SKILLS & TRICKS
On and off you come across the battle of performance for your application and most of us don't take load testing seriously until it has raised some red flags. Yeah, that's when we all start to talk about performance and testing applications, monitoring all the shit which is happening, looking at the speed at which data is loaded and RPS of API is critically looked to make judgement. We all know about Load testing but yet very few of us really invest in it and mostly just live on the unit tests.
I am also sure that most of us would have come across a group which believes in testing things only once and then forgetting about it has really damaged our reputation and invited you to a meeting with the CTO or CEO of the company. I mean as a dev we change so much on a monthly basis in any application and its UX for users that at times we don't seem to remember all of it and the business reasons behind it. This blog post is not out of frustration but more about understanding the importance of Load Testing and why its done, the basics, what you need measure and do's / don'ts, etc. What is Load Testing: Load testing is the process of putting simulated demand on software, an application, or website in a way that demonstrates its behavior under various conditions. It used to be a simple pre deployment exercise to ensure a web application could handle the load of multiple users and is slowly becoming an integral part of software development and continuous performance improvement. As websites and web applications become more innovative and complex, load testing poses a significant challenge for teams to 1. Execute properly and 2. Cover all the bases. As a result, load testing needs to be done more frequently, more effectively, and more efficiently. Itâs also created a need to simply train more people in the basics of load testing. Given that our lives increasingly rest on apps functioning properly -- whether itâs in medical devices, transportation, communications, defense, or entertainment â app performance has never been more important. Weâll cover:
Basic of Load Testing
Load testing is a type of performance testing. Performance testing is a series of testing methods employed to understand how a system performs in terms of responsiveness and stability under a specific set of strains. Oftentimes, teams begin performance testing in conjunction with or after functional testing within the test phase of the software development lifecycle. Each type of performance testing method helps answer a specific question about your applicationâs behavior that helps carve a path for issue identification & iterative performance improvement.
For instance, load testing helps you answer, how will my application behave in production with the typical traffic that we see? Load testing is used to verify your applicationâs behavior under normal and peak load conditions. This allows you to verify that your application can meet the desired performance objectives; which are often specified in a service level agreement (SLA). Load testing also enables you to measure response times, throughput rates, resource utilization levels, and to identify your applicationâs breaking point, assuming that breaking point occurs below the peak load condition. Load testing helps you check your web serverâs perfor- mance under a massive load, determine its robustness, and estimate its scalability.
Stress Testing enables you to evaluate your applicationâs behavior when it is pushed beyond the normal or peak load conditions, and helps you understand âwhat is my applicationâs breaking point?â The purpose of web server stress testing is to find the target applicationâs crash point. The crash point is not always an error message or access violation. It can be a perceptible slowdown in the request processing. The goal of stress testing is to unearth application bugs that surface only under high load conditions. Stress testing helps you find your applicationâs weak points, and how it behaves under extreme load conditions.
Capacity Testing is complementary to load testing and determines your serverâs ultimate failure point, whereas load testing monitors results at various levels of load and traffic patterns. For example, letâs say youâre developing a new online voting platform, and youâd like it to be able to handle potentially up to 10,000 user submissions per minute during peak load times. While developing the software, you may have performed unit tests as the code was being written, plus periodic regression tests to make sure you didnât break existing functionality with each new modification as development progressed, but at what point did you begin testing for multiple users?
At what point did you begin testing the program to accept hundreds or even thousands of overlapping field entries, form submissions, and other commands? This is when load testing comes into the picture. â Goals of Load Testing
1. Identify bottlenecks and their causes
2. Optimize the application configuration (both the hardware and software) for maximum performance. â 3. Verify the reliability of your application under stress Load/stress testing helps in identifying the following characteristics:
Weâll approach load testing with a four-step process:
Preparing your Load Test
With DevOps, development teams are pressured to test more and test often. Testing should be performed at each step in the development cycle and should continue after the application is live. While it can be frustrating that a testerâs job is never done, itâs important to take into consideration that with each testing and remediation cycle, the application improves. Applications go down under load for two reasons:
-- either developers didnât load test or, -- worse, they took the time to load test but didnât prepare properly. Without adequate prep work, a load test canât find all the issues that it should. So, how do you best prepare for a load test? 1. What do you really need to know? Determine what you want to learn about your application or system. Each type of test is run differently, and looks at your application in a different light. So, youâll need to run different types of tests based on what you hope to find out. For example:
2. Decide on a number of users If you are going to load test, how many virtual users do you want to simulate? In order to answer this, you will want to approximate how many concurrent users may visit your site, depending on the time of day. Donât guess. Instead, leverage some of the data you already have. Talk to your marketing team and take real traffic patterns from tools like Google Analytics, or engage your Operations team and use data from their Real User Monitoring (RUM) tools, which can provide insight into realistic scenarios to test. If you want to know some concrete statistics from a historical perspective, go directly to your analytics reports. You may even want to ask your engineers how many concurrent users they designed the application for, and your product owner for projected numbers, based on promotional activities. Plan to test that number and some percentage above it. There are numerous ways you can find the number of virtual users needed to run a load test. We recommend the following formula to find the number of virtual users needed to run a load test. Concurrent users = (peak hourly visits * visit duration in seconds) 3600 You can find peak hourly visits and visit duration from an analytics tool, such as Google Analytics. Note that this formula should be used to estimate the number of concurrent users required to achieve a specific page-view rate at fully ramped load. It should not be used to estimate the number of pages that will load within a specific time interval. 3. Study your analytics Donât pretend to know how your customers use your application. The only way to truly understand your users is to study history (i..e. analytics). By studying your analytics, you will be able to create tests that are representative of your actual users, as opposed to tests that you think are representative of your users. In this regard, analytics are a testerâs best friend. 4. Performance is a team goal Gather your team You need to involve a number of people in the testing effort, including: developer, network engineer, DBA, and business owner. All of these individuals have a vested interest in making the application successful, and each will approach the problem from a different angle. The correct solution will not fall directly into one of these buckets, but will be a combination of two or more. Make sure each is aligned with the performance expectations and is available during testing to:
5. Prepare your browsers Use testing software that brings you as close to your actual usersâ experience as possible. You should be able to record your scenario in the browsers of your choice, but you also need to anticipate the browsers your users will most likely use. Consider the countries and regions where you anticipate high usage, and research the most used browsers. Youâll need to have these installed on your machine to begin testing. Then you need to make sure your load testing software emulates as closely as possible actual user behavior. This includes:
6. Be prepared to test your production application While it is valuable to test your application when it is in a staging environment, this can leave some holes in your testing. There are a few reasons for this, including:
7. Set aside time to analyze results You should be prepared to spend some time analyzing test results as a group (remember all of those people that were present during testing?). Results need to be looked at to ensure bottlenecks/ errors/weaknesses are understood and remediation is effective. Reach out to everyone involved and schedule adequate time. 8. Set aside time to make changes Different remediation will have differing costs in terms of time. Remediation such as implementing a caching strategy, refactoring code, database optimization and hardware upgrades have a wide range of costs to implement in terms of both time and money. As an example, adding more hardware will require time to order the hardware, receive the shipment, test the new hardware, install software and data, test, install into the network, and test some more. This can be weeks or months of work. This is less of a problem if you are in the cloud. In which case, it takes less than a day. Many companies are opting to move to cloud infrastructures, offering an unlimited number of environments without the need for additional hardware costs and time constraints. However, itâs always advisable to load test applications that are accessible within your firewall as well. 9. Plan an Agile testing methodology Once you remediate, it is time to test again. The saying, âtesting is a process, not a destinationâ is very true. Each time a bottleneck is uncovered and corrected, another one rises to take its place. It is important to plan an Agile testing methodology, whereby performance testing is baked into each step of the development cycle. Additional testing should be performed:
10. How to record scenarios The first thing to do is to determine the roles you will define for use in your test. A role is equivalent to a certain type of user that will visit the tested web- site, and the steps they will take while visiting. If the tested site is a retail site, for example, you might have the following roles:
⢠Look at hours of operation and make a reservation Itâs best to choose at least three of the most common pathways through your site, and add a few uncommon routes as well. Next, you need to break these roles down by percentage of traffic. A typical retail site may have 95% of users browsing and leaving, and 5% (or less!) actually making a purchase. The combination of these two roles, or scenarios, will represent actual site traffic. After each scenario is recorded, you need to verify it individually. This involves running a single virtual user for a single pass through the scenario. This step should never be forgotten. Now youâre ready to start testing. By recording scenarios that imitate actual user traffic, youâre setting the stage to greatly improve customer experience and, if youâre into e-commerce, get that percentage of purchases above 5%.
Making it Real
Development teamâs load test should be able to emulate real-life conditions. Otherwise, whatâs the point of testing?
More often than not, developers and QA managers come away from a trial of load testing software with little more than the number of users that will crash their system. Unless they have a professional load tester on staff, most development teams donât have the resources, or knowledge to garner all they could from their load tests. That data is wasted because the person running the tests is unable to apply it to an applicationâs performance. Luckily, improvements in graphics and UIs have made interpreting data much easier â if you know what to look for. Hereâs a list of the most important results in load testing and how you should be working with them
Page Load Time
You need to know the average page load time for each page in your scenario. You might have a strict Service Level Agreement (SLA) that mandates how quickly pages must load, or may just want to know what this number is. It is also important to know if one page takes longer than others to loadâ this indicates a bottleneck in your application. Response Load Time Just knowing page load time is not enough. If a page is slow, you need to know why. Being able to look at average response times for each response gives you a detailed look into where the time is being spent. Errors and Warnings You need to know which errors and warnings were generated and at what level of load. This is especially important information to see in chart format. It is important to see which errors and warnings are generated and be able to see how that changes as load increases. A common error at high levels of load is âServer Error 500s.â Navigation Timings Understanding what your end user experience and why is it key in identifying performance issues. Some of these metrics include redirect time, connect time, first byte time, response time, DOM load time, and event time. Itâs important to understand what your performance benchmarks (or competitive benchmarks are) for these metrics to make sure that the experience youâre delivering through the browser meets your standards. Request and Response Throughput Itâs important to see the amount of data going to and coming from the tested system. This is especially important in a case where load is increasing, but bandwidth reaches and maintains a plateau. In this case, it becomes apparent that bandwidth is being throttled at some point in the process, possibly at the firewall. Hosts Because so many of todayâs websites call out to a plethora of additional hosts for things like content delivery networks, ad servers, analytics servers, social media and syndicated content, it is important for these sites to be enumerated in your reports. Itâs equally important to be able to view all of the calls to a particular host. If a host is called from your pages, the response time for those requests will add to the time it takes your pages to render. The Dos & Donâts of Load Testing
âAs you get ready to implement load testing to your performance strategy, there are a few dos and donâts youâll want to keep in mind.
Dos: Record Tests with an end-user in mind. Map out user journeys that are realistic, comprehensive, and critical to business functions. Understanding that your application can handle what a user would realistically do is key in ensuring it will stand up in production. Generate Load from different servers than those that host your application. Serve them from different environments so you can get the best view of performance without accidentally altering results. Start Recording a new scenario from the web browserâs start. If you start recording a scenario after you connect to the tested web server and open a few web pages, the playback of the scenario will fail. This will happen because the recorded traffic will not reproduce the authentication procedure, and the tested web server will ignore the simulated requests. Parameterize Scenarios to simulate more realistic load on the server. Parameterizing scenarios involves replacing recorded parameters in the requests with variable values. This way you can make virtual users send user-specific data to the server. These data-driven tests will give you a more realistic view of how your application will perform when a unique group of users interact with it. Verify User Scenarios. Before creating tests on the basis of a recorded scenario, make sure that the scenario is executed successfully for one virtual user. This can help you identify bottlenecks of the scenario and eliminate problems which are not related to the number of virtual users and additional testing conditions. Arrange User Scenarios in your tests so that critical functionality is tested first. Don'ts âDo not run tests in real environments. A real environment can have other network traffic, and this may affect test results. To avoid excess data transfer, use a test environment that behaves in the same way as the real environment except that there is no other traffic usage. Do not try to crash the tested server. The goal of web server performance testing is not to break the server, but to identify web application performance bottlenecks under various loads. Do not overly stress the client test systems. Do not use zero think time. Make sure that think time in your test is based on real-life conditions. Using zero think time does not provide realistic user simulation and puts an abnormal load on the tested server. However, omitting think time can help you determine bottleneck issues.
I hope the above helps in planning, implementing and running your Load Testing Strategy and also maintain it for future releases.
0 Comments
Leave a Reply. |
Archives
February 2020
Categories
All
|