.NET WebServices are always more an important part of my every day work: they permit you to build distributed infrastructure and are a good way to permit different systems to talk together.
One of the useful tricks to increase WebService's performances is to use some sort of caching. Lots of times a WebService will return always the same results over multiple calls, so in this scenario it's recommended to cache the data retrieved to speed up the communication.
When developing .NET XML Web services you can take advantage of the ASP.NET output cache by adding the CacheDuration attribute to your WebMethod declaration.
The CacheDuration parameter indicates the number of seconds to hold the response in the ASP.NET output cache. You can simply write a method like this:
<WebMethod(CacheDuration:=60)> _
Public Function SayMeSomething() As String
Return "Hello Stefano, I'm your WebService!"
End Function
and the WebMethod response will be hold in the output cache for 60 seconds. The default value is 0, which means that no caching is enabled.
This tricks can help you to increase performances and decrease the delay for data retrieval, but there's a thing to remember however: when caching is enabled, all requests and responses are held in memory on the server for all the cache duration. If these requests or responses are very large, you could have problems on memory usage on the server.