Latency can be the hardest to fix. There is a certain amount of time it takes messages to get from the user’s computer to the website. The general advice here is to minimize the amount of communication the site needs to do. Don’t send messages back and forth one at a time. Send all the information at once if possible so the user only needs to wait on one reply.
Performance testing is a broad and deep area of software development. Most developers are familiar with load and stress testing. However, there are other types of tests that can be used to identify problems in websites and web applications. Each test is used for a different purpose or in a specific stage of the software development lifecycle.
A performance test is a broad category that includes all tests that measure the capabilities of a web application such as throughput and scalability. Load tests are the most common type of performance tests. Load tests measure and record application performance under normal and peak conditions. Load tests usually measure metrics such as response times, resource utilization and throughput rates. If load tests are carried out constantly, they help determine whether changes made to an application have degraded or improved performance.
The second most popular type of performance test is the stress test. During a stress test a website or web application is pushed beyond the peak load it was designed for to see how it fails. Stress tests usually help to identify which components will fail first. Increasing the efficiency and robustness of these components helps make the website more resilient. Bugs such as race conditions, memory leaks and synchronization bugs usually appear during stress tests. A common subset of stress testing is spike testing. A spike test will subject the system to load that exceeds peak workload for a short period of time. Developers should be careful when running stress tests as they may cause system failure if the test environment is not separated from the production environment.
An important type of test that is often overlooked is the soak test. Soak tests will test system stability over a long period of time. These tests are very useful as they usually revel bugs such as data corruption that only occur when a system has been operating for some time. Soak tests are also used to obtain important metrics such as Mean Time Between Failure and Mean Time To Failure.
The main purpose of load testing is to determine which parts of a website or system are causing performance issues and then fixing them. Most of the time these issues are remedied by changing the websites code and optimizing it. You can also fix performance issues using HTTP’s features. HTTP has many performance testing features that can boost the performance of your code. These feature do not require changes to your code, you only need to reconfigure your web server. Popular webservers such as Apache and Ngix support these features.
The HTTP feature with the greatest impact on performance is caching. However, caching is complex and there are many pitfalls that should be avoided. The major principle behind caching is that servers should not send data that the client already has. The challenge becomes determining which data the client has downloaded and whether it has changed on the server. HTTP provides various response headers that tell clients how to cache data. One of them is the cache-control header. Cache-control specifies the time that a client should cache data (it also helps when load testing API endpoints too). It also informs intermediaries such as CDNs and proxies whether they should cache the data or not. Cache-control on its own is limited as it cannot inform the client when to download new data. The etag header fixes the limitations of cache-control. Dotcom-Monitor actually covers a variety of this information on their website, if you're intersted in reading more.
Etag gives each resource being requested a unique id. The id is usually computed as a hash of the resource or timestamp. Etag will therefore prevent the client from downloading unchanged data. The server will always include the etag value of a resource in the etag header.
HTTP provides a more complex header known as vary. The vary header informs intermediaries such as CDNs, cache engines and proxies which types of clients get what data. This allows clients which request compressed data to get different data from those who request raw data. Vary is also used with User-Agents to show users different data based on their browsers. Apart from caching, there are many other HTTP features that one can use to increase the performance of a website.
Many web developers work for companies that sell goods via an e-commerce site. An e-commerce site provides unique challenges when it comes to load testing. Most sites will experience a large spike in traffic during specific times such as Black Friday and the holiday season. Downtime for an e-commerce site should be avoided at all costs since it usually causes a loss of revenue. Downtime during peak traffic would be a disaster for any B2C company. The best way to avoid downtime is to load and stress test your website to ensure that it performs as expected during peak traffic.Load tests for an e-commerce website should mirror the checkout process that customers will follow when purchasing goods.
The first step is to create data stores that contain realistic data. These data stores will be used in specific user scenarios to test various functionalities on the website. Data stores are made by creating parameterized CSV files. The most important part of the checkout process that should be tested is the payments process. However, one should contact their payments provider to ensure that they do not violate the terms of service of their contract. The best way to approach this is to create a test and QA environment that allows developers to test different payment methods.
Web hosting is also an important considering in the performance of an ecommerce website. If you've got poor quality hosting, it's very possible that your web hosting could be affecting the results of your load test. For example, when comparing bluehost against hostgator, you might find that you'll get better results from hostgator as their servers seem to be a bit more responsive overall. That said, Wordpress is an entirely different thing to consider when load testing if you're using that. Determining what is the best wordpress hosting isn't always easy to do just from running a load test, but it can help you to determine the quality of the host overall.
Another crucial part to be tested is the communication channel. You should load test your emails and chat systems. If customers receive an email after purchase, load test that too. You should be careful when load testing email as you may be blacklisted by your email provider as spam. However, most load testing tools can load test SMTP servers. Finally if your system sends an SMS for confirming purchases, consider disabling this feature so as to save money.
There are other important things that a developer should look out for. Most e-commerce systems have automated inventory that automatically orders for products when an item is low. If you are testing using real items in the load tests, be sure to disable such parts of your system. Most of these issues mentioned can be avoided by setting up a test environment that has all the features of the production system.