1

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Pranesh Nair
  • 313
  • 4
  • 11
  • 27

3 Answers3

5

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.

Kris van der Mast
  • 16,343
  • 8
  • 39
  • 61
  • 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?????? – Pranesh Nair Jul 01 '10 at 14:13
  • 1
    @user311077: http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/ shows a good introduction. – Kris van der Mast Jul 01 '10 at 14:38
  • 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???? – Pranesh Nair Jul 01 '10 at 15:13
  • Note that PageMethod only works with ASMX-style services. WCF is the newer, usually recommended approach. – Nelson Rothermel Jul 01 '10 at 15:23
  • @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. – Kris van der Mast Jul 01 '10 at 15:50
4

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
  • 3,328
  • 1
  • 25
  • 35
  • 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???? – Pranesh Nair Jul 01 '10 at 14:06
  • 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 Jul 01 '10 at 14:14
  • Is the data the same for every user or is it different for all 50 users? – Greg Jul 01 '10 at 14:31
  • 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???? – Pranesh Nair Jul 01 '10 at 15:13
  • 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 Rothermel Jul 01 '10 at 15:25
3

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.

Community
  • 1
  • 1
Chris Shouts
  • 5,377
  • 2
  • 29
  • 40
  • Indeed, measuring the application with one the tools mentioned also aids in solving the performance problems. – Kris van der Mast Jul 01 '10 at 14:41
  • I think there should be a feature of stack overflow to mark multiple answers correct! Maybe I'll go to meta :) – starskythehutch Jul 01 '10 at 14:57
  • 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???? – Pranesh Nair Jul 01 '10 at 15:06
  • ...MySpace doesn't have one server. – Nelson Rothermel Jul 01 '10 at 15:28