Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 02, 2012 01:45 AM by Steven Cheng - MSFT
Feb 27, 2012 01:20 PM|LINK
Hello every ine. I am developing my WCF service and using it through MVC3. I am using SQL SERVER 2008. My problem is that,whenever I am calling my WCF Service to fetch data from db,it takes long time to execute.
Can anyone help me to boost its performance.
Thanx in advance.
Feb 27, 2012 01:40 PM|LINK
Firts of all ...to have a "realistic" idea o f possible performance problem start your project in not debugging mode, by selecting "start without debug" from the debug menu of Visual Studio....Maybe this is enough to make performance improve...because VS
2010 debugging its self add a BIG SUPPLEMENTARY work, and because when in debugging mode a lot of optimization are not done.
Then try your project on IIS...this will improve also performance....If the performance proble continue...after that, then you may start ana analysis to improve it.
Feb 27, 2012 01:44 PM|LINK
I am calling my WCF Service to fetch data from db,it takes long time to execute.
How many records do you fetch? Are you using SSL ? How big is the web connection ( MB / sec)? and so on...
In my local machine its running fine on debugging mode. Even I have published the webservice over ny IIS and then using it,it all goes fine.
but when I am uploading my project to my FTP,it performance is reduced alot,as its now taking 3 to 4 minutes to load a page,even if I am binding only two drop down lists in my code.
Any other solution????
Feb 27, 2012 02:22 PM|LINK
if the project works well on your local IIS....for sure the problem is your hosting, either because there are too many web sites hosted on the same server or because of the too limited banwidth. Try changing hosting.
Mar 02, 2012 01:45 AM|LINK
Generally, for such multi-tier web application(front web page--> middle service-->backend db), if there is no obvious coding or configuration issues, the performance will not have problem on local test environment. However, when you publish to the production
envir onment, especially to public internet service host, there are many things might make the performance behavior different.
I guess the web appplications in your case will have the following processing stages(let me know if that's not the case):
1) page be requested by client
2) page's code-behind code(such as page_load or button_click postback event) invoke a certain WCF service operation to fetch data from the database
3) data returned from the service operation and you use databind to display them on page controls
So in the above stages, it is likely that the WCF service call (from your web application host to the database host) might take most time(the time at database side for query data, the time the data is serialized to network layer and get transferred to the web
application side). Since your web application is published to public host, the network connection status between the web app host and database host is quite different from the environment when you testing them locally.
if you want to figure out the exact stage which took the most time, you can add some trace/logging statement in your page and wcf service's code so as to check the time spent on each stage.
If you find that the time does be mostly spent on the data fetching from web application's WCF service call to the database side(and there is no obvious programming or design problem), then you might need to consider if you need to add some caching or preloading
like code logic to boost the performance. For example, if the certain data do not need to be fetched from database every frequently, you can consider using ASP.NET cache to store the result from WCF service for a certain period of time. And you only reload
them from DB after the cached data expired.
#ASP.NET Caching: Techniques and Best Practices