Concern: Pressure load
Source: IBM
Pressure test and load test
The problem in the performance list is: "Is there a tool to help me test the J2EE application?" Before answering this question, let us ask yourself: what is the pressure test, why these developers Need it? (I believe that some people in you have encountered the case where you have stressful, but we are not this here yesterday, but we are not this here). The pressure test is to find out the performance of your application will be unacceptable under what conditions. This is achieved by changing the input of the application to impose a growing load on the application and measure changes in these different input time performance. This operation is also referred to as a load test, but load tests generally describe a specific type of pressure test - increasing the number of users to perform pressure testing applications.
The simplest method for the application is the simplest method to manually change the input (the number of clients, the demand size, the frequency of request, the mixing of the request, etc.) and describe performance changes. For some applications, you need to do it. But if there are many inputs, or if you need to change your input in a large range, you may need an automated tool. In addition, in manual testing, if you want to retest the application after some change, it is difficult to accurately repeat a group of tests. If you have multiple users to test your app, it is hardly running manual testing, unless you have a lot of unemployed friends, it is very difficult to expand the number of users who have expanded the test application.
2. No one knife
Unfortunately, there is no universal pressure test tool because the inputs accepted by each application are different. But for many J2EE applications, communication from the client arrives at the server is HTTP protocol. Fortunately, there are many load test tools to simulate user activity on HTTP in a controllable and repeatable manner. They include free tools such as Apache Jmeter, The Grinder, and Pushtotext, and quite expensive tools such as Mercury Astraload. Generally speaking, a penny - the more expensive tools, the more it can do. In order to understand their differences, we first see what the most basic load test tools do.
If you want to build your own load test tool, you will first write a program that runs a thread to each analog client. Each thread needs to communicate with the server and may use the java.net.url class. This approach allows you to get basic HTTP client simulation, which can perform GET and PUT. Each thread needs to be done is to send HTTP requests, collect reply, wait for some time (simulation "consideration time"), repeat. This set of action can be quite easily abstract into a separate profile. Soon, you get a basic load test tool. You may need to add some configuration options to determine how many threads (simulated clients) and they start simultaneously and slowly increase the load. Of course, you need to interact with the server, because this is the core content you want to test.
3. If it is simple ...
So, what is the result of processing an extended interaction (ie, a request depends on the result of the previous request)? What about processing cookies? Cookies is essential for many sessions-oriented J2EE systems. Change data input? What if the J2EE application client needs to process some JavaScript to enter the next communication? How to analyze it after collecting the response time data? Other types of monitoring, such as CPU time, network usage, heap size, paging activity, or database activity?
As such and other functions, such as tools used to record browser sessions and join them into the test script, is the difference between the high-end load test tool and the basic tool. How to choose the right tool for yourself? Of course, this depends on your needs, your plan and your budget. Most importantly, you need to use a tool that correctly simulates a customer browser feature requiring your application. After a basic function, you can consider the productivity of the tool. In general, the more analytical tools, the more performance data types can be recorded, the higher the productivity you can reach - the more money you wish to pay. Top load test programs can simulate multiple browsers, integrated with most application servers, collect performance data of multiple server hosts (including operating systems, JVM, and database statistics), generate analysis of analytical tools that can be used later data set. On the other hand, the low-end load test procedure is free. In the days of limited budgets, the meaning of "free" is not self-motivated. Figure 1-1 shows a free load test program Apache Jmeter, which shows an automatic recorded script.
Figure 1-1. Jmeter displays an automatic recorded script
We have seen the basic functions of the pressure test tool, it is also suitable for adding additional features? Where is the difference between different load test tools? Of course, your most important requirement is that this tool must simulate your application client. If your application uses some uncommon browser features or other non-standard client technology, it excludes a considerable number of candidates. In addition, other functions have higher productivity to the load test. The following list is a useful starting point for the load test tool that is suitable for its own project.
Simulate your client
The primary requirement must be that the load test program can handle the functions and protocols used by your application.
Run multiple simulated clients
This is the most basic feature of the load test program, which helps determine which is the load test program and which is not (some frameworks are trying to disguise the load test program).
Scriptization execution and edit the script
If you cannot write scripts interacting between clients and servers, you cannot handle things other than the simplest client. The ability to edit scripts is the most basic - small changes should not be required to regenerate scripts.
Support session
Load Tests If you do not support sessions or cookies, it is not an active load test program and cannot be loaded on most J2EE applications.
Configurable user quantity
Test programs should allow you to specify how many simulated users of each script, including allowing you to change the number of simulated users over time, because many load tests should start from a small user, and slowly add to more users. Number.
Report success, error and failure
Each script must define a method to identify successful interactions and fail and error mode (the error does not have a page return, and fail may get the wrong data on the page).
Page display
If the load test program allows you to check some pages sent to the analog user, this will be useful so you can ensure that the test work is correct.
Export result
You often want to analyze test results with different tools, including spreadsheets and custom scripts that can handle data. While many load test tools include a large number of analytical functions, the ability to export data makes you more flexibility in an arbitrary way to analyze and catalog data.
Consider time
Users in real world will not request another page immediately after receiving a page - generally delayed between view and next page. Considering that this standard term represents the addition of delays in the script to more realively simulate user behavior. Most load test procedures support consider time according to statistical distribution.
The client selects data from the list
Users generally do not use the same set of data, each user usually interact with the server. The simulation user should also do this. If the key points in the interaction, the script can select data from a set of data, and you can more easily let your analog users exhibit behavior using different data.
Session record script from manual execution
Compared to writing scripts, use browsers to run sessions and record this session and then edit more easily.
JavaScript
Some applications use JavaScript to use JavaScript and require analog client to support it. However, using client JavaScript may increase the need for system resources on the test system.
analyzing tool
Measurement performance is only half of success. The other half is analyzing performance data. Who can better develop this analytical tool than the person who write test tools? Yes, at least theory is this. Anyway, the more analytical tools provided by your toolbox, the better you can do.
Measuring server-side statistics
Basic load test program Measurement client / server interaction based on client-based response time. If other statistics are collected, such as CPU usage and page error rate are better. The more you get the statistics, the more you can do with your load test system. If you have this data, you can do some useful work, such as viewing the client response time and throughput statistics in the server load context.
4 Conclusion
Work that can be done with any tool is often limited by people's skills, knowledge and imagination. We also show all the possibilities of using this tool when describing what is used with load test tools. Now you can use your imagination to develop more possibilities.