Performance of Web-Application
What do you mean by Performance of the web-application ? In layman's term, It can be explained as follows:
- System availability - This is the ratio of application's available time to end-user v/s down time when nobody can use it.
- Loading time of the page, can be termed as response time. This is a measure of how long it takes to load a page.
I have explained about the availability of the web-application in other article.
I am going to cover the other point of performance of web-application in this article. Let us see first as how the sluggish performance of an application is not good.
A little extra time in page load for the user will make the user go away to other sites where the performance is better, and this results in revenue loss. Companies hosting the websites, specially E-Commerce sites, cannot afford the delay in loading the content to its users. Stats says - just a second delay in loading the web pages results in 11% drop in an e-commerce site’s page views and a 7% drop in the conversion rate.
OMG! This is something really serious and to be looked at if planning to host a website. The performance or any end-user application greatly impacts the business.
Causes of Poor Performance of Web-Applications
There are various factors which comes into picture when we talk about web-application's performance for end users. Though for end-users, everything results in sluggish and slow response and more page load time, but actually this can be the result from one or more of the following factors:
- Throughput: For web applications, a count of requests per second is often used as a measure of throughput.
- Requests Rate: This is how much traffic your application receives to understand the dynamics of how your application scales. The more number of requests from end-users, the higher the load. As load increases, performance decreases.
- Resources Consumption: Measuring the usage of resources, like CPU, Memory, and disk space. This is also very important in resource planning for scalability.
- Efficiency of system: This can be explained as how many transactions a system is consuming with clustered servers or CPUs. Example of 100 transactions per second (TPS) on 2 CPUs have better efficiency than a system with 200 TPS on 5 CPUs.
- Latency: It is a time interval between the stimulation and response, or, from a more general point of view, a time delay between the cause and the effect of some change. Nothing happens in this period of time, but this may be the cause of remote requests. Latency is also the reason why you should minimise remote calls.
- Server response time: This is the measures of time a system takes to load the necessary HTML to begin rendering the page from your server, subtracting out the network latency between the browser and your server.
- DNS issues and network connectivity: Faulty DNS queries can prevent users from accessing the application, while also causing errors, 404s, and other errors. In a similar vein, network connectivity and an efficient firewall are key parts to access the application.
- Lack of load balancing: Slow response times can also be caused by poor load distribution. When new users are assigned incorrectly, it can drown out the system even if it is under capacity. Such an issue can cause a slow response time, especially if the system is receiving too many requests.
- Traffic spikes: Spikes happens, especially during a marketing promotion or holidays time, and a company may not be prepared for the extra traffic. This issue can also cause the system to slow down, hindering the performance of the application and harming the brand image.
How to find the Issues causing poor performance of Web-Application
To make sure that the system or application is performing as per the expectation of the design and requirement, there are various types of testing required to be done on the application, once it is ready to face the end-users.
Performance testing and types of performance testing such as Load Testing, Volume Testing, Stress Testing, Capacity Testing, Soak/Endurance Testing and Spike Testing come under Non-functional Testing, commonly termed as NFR Testing (Non-Functional Requirement Testing).
These testing helps in identifying the issues in various aspects and the team will have to address the issues to make the system really ready to face the real public.
How to Improve the Application's Performance
There are following ways the performance can be improved for any application for the end-user.
Reducing the server processing time while loading the page:
- Fine tune the code to see where the processing time is more and optimise the code.
- All the integration logic should be well designed and architected to not have wait time.
- Make the processing asynchronous wherever it is possible
- Follow the coding practices, as most of the common issues will be gone by best coding practices
Using caching mechanism:
- Caching the data at the server level: This will reduce the server processing time which requires the data to be fetched from database. Every time if there is any add/update to data, the cache should be invalidated and created again.
- Caching the static pages and web-resources: Using third party systems is very common which supports CDN (Content Delivery Network) and are cloud service providers. The request to the web-pages will directly be served from the CDN and cloud instead of hitting the servers. Akamai is the best example in this scenario.
- Having a dedicated server to host the cache of the data from database also helps in lot of functionalities of the website. Think of searching some content in website, which will be really fast if the application is having the enterprise search platform. Example can be Apache Solr.
Adding more resources: If the performance of the application can be improved by adding more resources to share the load, think of adding then. Example of more resources can be: adding load balancer and adding extra servers to share the load.
HTTP pipelining: HTTP pipelining is a technique in which multiple HTTP requests are sent on a single TCP connection without waiting for the corresponding responses. The technique was superseded by multiplexing via HTTP/2, which is supported by most modern browsers.
Decreasing the number of requests while loading a particular page: While loading a page, browser might requests various resources on the page, required to build it. These requests should be as minimal, and this can be done by reducing the number of resources by using sprites and combining JavaScript.
Optimising the rendering speed: This can be done, for example, by using more efficient CSS selectors, a better page layout, and optimising the JavaScript code.
Making the loading time appear shorter: How about showing the loading icon or bar or progress while rendering the page, which will say the page in getting rendered. It can be something catchy where end-user will not feel irritated with the delay (the famous AJAX paradigm).
Keep Performance in mind during all phases of application development
- Performance of application should be considered while designing the system / application and the architecture diagram.
- Developers and testers should raise the concerns in early stage of implementation to avoid changes in later part of development.
- Always vouch for various types of performance testing during the development phase itself. This will help to find the major changes required in early stages.
- If the application is to serve the global customers across multiple countries, make sure the performance testing is done to cover from various locations around the world. There are tools available to do the same.
- If the application supports different OS, devices and browsers, then the testing should be planned accordingly. Lot of applications and tools available in the market to cover the varied range of OS, devices and browsers.
- At the end, "it is working for me" is not what is required. The application is for end-users and thinking like a end-user is really required to architect, design and build the application.