Increase Web Service Performance
Speed up your Web Services by using an ASP.NET Application object as a data cache.
by Tim Chester
|
Technology Toolbox
C#, ASP.NET, XML
Other: Microsoft Access 2000
|
It's simple to program a Web Service that supports 10 users; it's a challenge to build one that supports 10,000. When faced with performance issues, most developers opt for additional hardware capacity. This choice ignores an important premise: Performance has more to do with software code than hardware capacity. In this column, I'll show you how to improve performance by building a Web Service that uses the ASP.NET Application object as a data cache.
You'll build a C# Web Service that converses with a database, then caches the results in memory. You can then handle subsequent client requests using the cached results from the Application object. The sample code includes a C# project and a Microsoft Access database—everything you need to deploy this solution (download the code). In fact, the principles covered in this column apply to Web Services written in all the Visual Studio .NET languages, and even to software written with VS6. In addition, this solution works with any OLE DB data source, including SQL Server.
Here's a brief overview of how this works. Typically, a client initiates a request against a middle-tier application server in a Web Service that returns information from a database (see Figure 1). The Web Service processes the request, executes a database query, and returns the results in XML format. Each client request requires a round-trip conversation with the database, and these database queries reduce an application's performance substantially. If your Web Service requires only one database call and serves no more than 10 users at a time, performance probably isn't an issue. But it's an entirely different scenario if your Web Service requires five database calls and must service requests from 500 users concurrently.
Back to top
|