Performance Tuning

This post was moved to


Performance tuning is one of the important aspects that needs to be considered while designing the web application. Although performance can be improved in many different ways and with different permutations, the decision for the best combination can only be decided according to the nature of the application,performance requirement and the hardware infrastructure. In this article i am going to discuss few ways to improve performance and different use cases and the ways the combinations can be used.

Performance Tuning techniques:
Performance tuning can be done be achieved by taking measures while coding and by proper design.

  • Minimum Logging
  • Avoiding fancy coding
  • Caching
  • Minimum Synchronizing
  • Database connections

Minimum Logging: Logging is eyes of a developer on the application, but if you are doing ‘out of bounds logging’ then it will effect the response time of the application. Many might argue that there are frameworks which work efficiently which i will not debate it, but irrespective its still an Input/Output which is not needed. This will make a difference in an application where response time is very very important.

Avoiding fancy coding: Using all the latest api while coding doesn’t always need to work in your favour. You will have to choose the api we are using according to the requirement. Some apis like Reflection and regular expressions should be used only if the requirement asks for it because internally it takes more time to deliver the goods when the same result can be expected from code using simple api.

Caching: Dynamic pages are normally created using server side programming languages. There are different sources of data that is used in dynamic pages, caching can be used for the all the sources that doesn’t change much. The best examples are xml files, data from database etc. I wouldn’t recommend using this technique if the data to be displayed changes very often. For example if the dynamic pages are generated from xml files according to the request one gets in web server, these xml files can be cached so that when the request comes in, code can get the xml from cache instead from disk from saving the time for IO. I wouldn’t recommend doing this if the dynamic data to be displayed for stocks trading application.

Minimum Synchronizing: Software developers should make sure that code should be synchornized only when it is required. Synchoronizing the code would restrict multiple threads to access the part of the code simultaneously thus making a queue of all the requests inturn following a FIFO (First In First Out) policy to attend the request.

Database connections: A database call would involve making a database connection, execute the procedure/query, get the result and close the connection which in turn makes the database connection one of the costly affair in terms of performance. With this in mind i would recommend designing the application up front with minimum number of database connections. One should always think of scenarios where data need not be fed into database in real time which in turn can be done through batch feed.