Situation: The web application hosted on a server in India is performing well for end users in India. But the users in Europe are having a tough time accessing the web pages due to extremely slow response times. How would you reduce the risk considering you don’t have enough budgets to have a geographically distributed network to support your end users and keep them happy? J
Solution: Two most important things to note that helps improve perf over WAN is:
ü Minimize the overall data transfer between web server and the client.
ü Minimize the number of HTTP requests for each user action.
Here are some of my favourite tips and tricks to enable your app perform in the above mentioned manner.
ü HTTP Compression: Reduces the overall data transferred between web server and the client by compressing static/dynamic pages.
The link below shows how to enable static and dynamic compression.
Note: Enabling Compression for dynamic pages slightly increases the overall CPU utilization on the web server and this depends from app to app. Hence the application has to be thoroughly tested in order to maintain a right balance.
ü Use Pagination: Consider displaying data records on a page by page basis to reduce the data transferred for a single user action. For example, get only 10 records at a time instead of fetching everything. Also, consider fetching only the required columns for each record from the database.
ü Enable Content Expiration: This helps in reducing the unnecessary 304 round trips from client to the web server. This might be only useful for sites where static content do not change too frequently(at least a day)
So how does this work? Consider a page whose static content is already cached on the client. Whenever the browser requests that page, it checks to see if there is any change in static content on the server. If there is no change then the request returns with HTTP status code 304 and the browser takes the content directly from the cache. Hence, in order to reduce these unnecessary 304 round trips and to prevent the browser from checking for any change on the server we set content expiration on static content for a particular duration depending on the type of web application.
See the following on how to enable content expiration.
ü Image Clustering: Consider combining smaller images into one image wherever feasible to reduce the number of HTTP request made to the server. Also several java scripts can be combined together instead of fetching them separately from the web server.
ü Enable Connection Keep-Alive: This allows the web server to keep the connection open to the client. Hence the client can download multiple files without any hassles of opening and closing the connections each time. Although this option is enabled by default in IIS 6.0 it is always better to check for it.
Hope you like this post 🙂
Hope you like this post 🙂