简体   繁体   中英

asp timer and update panel

I have a small web application I am working on that is basically a radio player that plays live radio. On the player we have the schedule and what's playing now etc. I used a asp timer and update panel to update various content on the player mainly the 'what's playing now' bit.

Last time we tried to use the asp timer and update panel on our website it crashed the webserver in minutes because the cpu went to 100% and it could not handle that many postbacks. I am wondering what the best way of optimizing this radio player is so that it does not crash?

I have thought I could load all the content in on page load in hidden fields then use jquery? Sounds a bit messy but open to ideas?

check view state is not enabled - this will quickly eat up memory. You could use JQuery to fill in a portion of your page (or several portions) after the initial PageLoad. I have learnt how to do this recently and it feels better than the timer and update panels. See this post for how I achieved it - the answer from jwiscarson has the detail.

Creating some Javascript that updates the update panel on certain timestamps isn't that much work. Send the expected end-time to the browser and let it update once the song ends.

You can even send a list of queued songs to the browser so it only has to update the data once in a while. (depending on play list style)

Make sure the update panel server side uses as much as possible cached output so it does not have to find the currently playing song. IIRC an update panel has quite some overhead, calling a clean JSON request to only retrieve the currently playing song might be much cleaner.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM