views:

92

answers:

3

I have a user control in my page which is inside a update panel.By using the user control i am displaying a message for the user.I need to change the message every 5 min.The message is stored in the data base and the user control will retrieve the message from the database every 5 min once automatically. My problem is when there are more than 50 users accessing the same page then for every 5 min the request is sent from each client automatically to the server which decreases the server performance. So can anybody help me to resolve this performance issue.

+4  A: 

Requests to server will always use up resources. It's a fact of life.

You don't say which server it is that has the performance problem, but if the message in the database is static, then why not load it into a cache on the application server so that each client doesn't make a request to the database?

starskythehutch
+1 for suggesting caching, so there went my 2 answers.
Chris Marisic
the message is not static it will change for every 5 min. is there any way i can use cache for the data which change dynamically????or else is there any other method i can move use????
A cache doesn't have to be permanent. You can have the cache invalidate its data every 5 minutes so that the next fetch refills the cache with the new data. I agree with what else that has been said as regards to profiling your application, as the scenario you describe is so trivial that you should be seeing virtually no impact on either server if coded correctly.
starskythehutch
Is the data the same for every user or is it different for all 50 users?
Greg
ya the data is same for all the users....but the data have to change in UI page for all the users,when ever i change the data in the data base.is there any way i can send request from the client only when the data is changed in the data base????
To add on to @starskythehutch, if you have 50 people hitting the server every 5 minutes, that's on average one hit per 6 seconds. A page request should not be taking 6 seconds...
Nelson
+3  A: 

You need to profile your application to find the performance bottleneck(s).

Seriously! Anything else is just guessing.

Even though it did not top the list, I recommend the EQATEC Profiler.


Update

Just thought I would point out that 50 concurrent users should be no problem for ASP.NET.

MySpace runs on ASP.NET with 2.3 million concurrent users and handles 1.5 billion page views every day.

Chris Shouts
Indeed, measuring the application with one the tools mentioned also aids in solving the performance problems.
XIII
I think there should be a feature of stack overflow to mark multiple answers correct! Maybe I'll go to meta :)
starskythehutch
Its a online live video streaming website.so when the live is going on i need to change the message every 5 min so it send a request to the sever which will increase the load while the video is streaming if more than 50 users is accessing the same page....so can u tell some options to reduce the server request????
...MySpace doesn't have one server.
Nelson
+5  A: 

Make use of the Cache object in the UI tier to load in the different texts. Only load it in on first request when needed.

have a user control in my page which is inside a update panel

Try to get rid of the updatepanel as it will always send back and forth the full viewstate of the page. Make use of ajax, script only instead in combination with a PageMethod or a service endpoint (.asmx or wcf).

Also measure where things are going slow. I like to use tools like YSlow and Sql Profiler to measure. ASP.NET also has the capability of tracing which you can turn on/off in the web.config.

XIII
+1 for suggesting lightweight ajax
Chris Marisic
Thanks for your idea...can u pls explain me how can i use ajax to increase the performance ...or can u pls provide a small sample using ajax method related to this issue??????
@user311077: http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/ shows a good introduction.
XIII
the data is same for all the users....but the data have to change in UI page for all the users,when ever i change the data in the data base.is there any way i can send request from the client only when the data is changed in the data base????
Note that PageMethod only works with ASMX-style services. WCF is the newer, usually recommended approach.
Nelson
@user311077: Http is stateless so once the original page got rendered to the browser it forgets about it. Updating something in that database can't be pushed to those browsers out there viewing your page. With ajax however and the use of __setTimeout__ (http://www.w3schools.com/js/js_timing.asp) for example you can have your browser poll every xx seconds or minutes to the server and look up the data from the database.
XIII