Design for Performance: Implementing Web Services Better


Written on Sunday, December 30, 2007 by Edwin Sanchez

In a distributed environment where different servers contribute for the processing of a certain task, good design is essential. One point of consideration is your database. If you have a db4o database and you have designed it well, it will give you the expected results. However, something can still slow down your application even if you designed your database well. What else could go wrong? Your middle-tier is another point of consideration. Are you using web services? Is it waiting too long because of a large database query? Let’s consider some design guidelines that can take you to maximum warp.

  • Consider asynchronous calls.
    If you are doing large queries that can let your calling application wait for a long time, this is a must. I will explain this further on the next post.
  • Group different information into one when making web service calls
    You may have data that you need to display in one or more dropdown lists, an existing transaction that comprise several objects, and any other information that you need to query from the database. Depending on your needs, you can reduce the number of calls to a web service just to return all of the objects you need.
  • Cache the results of the web service call
    Output caching is one of the cool things in ASP.Net. How does it work for web services? Suppose you call a web service that returns true if a user is a valid user in your application. You can cache the result of the web service in a specified time and when the same web service call with the same parameters is invoked again, instead of executing it, ASP.Net will get the results from the cache. This improves performance. Implementation is simple:

[WebMethod(CacheDuration=60)] public bool IsUserAuthentic(string userId, string password)

You just need to add the CacheDuration web method attribute and give it a time period in seconds to remain in the cache. In our example, the result will remain in the cache for 60 seconds. Take note, however, not to abuse this feature. This is really cool, I agree. But using too much of this, specially caching large object sets for a long time can be trouble. When caching results, ASP.Net stores it in server memory. It remains in memory for the specified cache duration. If you also have service calls that vary most of the time, it is not a good candidate for caching.

The next time you find bottlenecks in your web services, assess the problem by considering the performance guidelines above.

If you enjoyed this post Subscribe to our feed

1 Comment

  1. Search Engine Optimization |

    This is Some few SEO interview Questions? I like to Answers On this,Let us Discuss On this question. web design company, web designer, web design india

    Give me a description of your general SEO(search engine optimization) experience.
    Do you currently do SEO on your own sites and give me some examples. Do you operate any blogs?
    Do you currently do any freelance work and do you plan on continuing it?
    Where do you think the SEO industry is headed?
    What industry sites, blogs, and forums do you regularly read?
    Have you attended any search related conferences?
    What SEO tools do you regularly use?
    What SEO areas are you weak and strong in, and give examples of both.
    What areas do you think are currently the most important in organically ranking a site?
    Do you have experience in copywriting and can you provide some writing samples?


Post a Comment