Friday, September 16, 2011

WS consumer performance tips

WS call are always expensive with the overhead each call require. Caching is a way to avoid unneccesary WS calls and improve performance: 

The general rules for cacheing are:

Always cache WS data which is not very dynamic in nature, bu at the same time make sure you don't get functional error by caching data that needs to be fetched fresh.

Use the ASP.NET cache with a timeout instead of some custom cache like hash table

Invalidate cache based on business rules or time-out

Consumers of Web services have the option of calling web services asynchronously or synchronously. Your code should call a Web service asynchronously only when you want to avoid blocking the client while a web service call is in progress. If you are not careful, you can use a greater number of worker and I/O threads cause by asynchronous WS calls, which negatively affects performance. It is also slower to call a service asynchronously; therefore, you should avoid doing so unless your client application needs to do something else while the service is invoked.

© Copyright 2011, Tomas Elfving

0 kommentarer: