eugeneK
eugeneK

Reputation: 11126

How to avoid fast rate page refresh in ASP.NET?

I have a page that shows statistics for users, this cannot be cached because each user has different statistics and there are many thus the real time query must be made.

What the way to avoid database server overload when user will click F5's to refresh or to ask different queries in short time intervals ?

Upvotes: 4

Views: 258

Answers (2)

Murph
Murph

Reputation: 10190

I think @Jens A. is halfway there - this is a perfect case for caching, calculate the stats, stick them into the cache with a fixed expiry time and then only calculate them if they're not in the cache. By having the expiry time set to an appropriate value (5 minutes, less?) the stats will still be reasonably up to date and will change (update) at a reasonable without having to be calculated every time if the pages are being refreshed continuously.

Upvotes: 2

Jens
Jens

Reputation: 25573

You could store the generated statistics in your database for some time, and just show the old values if the statistics are requested again.

Upvotes: 2

Related Questions