Reputation: 4797
I have a large C# .net project that I recently optimized and it's working great. It's a pretty big code library though so I am not familiar with it in great detail.
That said, everything works very well until once in a while a user will get frustrated that a page takes a few seconds to load and starts refreshing a page over and over. Looking at my active processes in IIS, one user had refreshed the same page 300 times in about as many seconds (so non stop refreshing for 5 minutes)
Since this page was already somewhat slower this brought the server to its knees. 100% CPU for about an hour until I recycled the process and then killed the old w3wp. Immediately everything came back to life and everything is fast again.
Is there any way to detect this behavior (ie, page is already being loaded by this user/session) and instead of a full refresh just piggy-back on the already running thread, or canceling the first thread, or really any sort of mitigation to catch this?
Upvotes: 0
Views: 113
Reputation: 10929
The very simple solution would be to set a session variable (for instance the time the page is requested). Then on every request to that page, you know both that the page has been requested before and when, so you can choose to break.
Upvotes: 1