[It168]With the popularity of the Internet and broadband, more and more individuals and organizations have set up their own websites. Most of the servers that act as websites are normal PCs or low-end servers. In this way, a large number of visitors or DDoS attacks can easily lead to paralysis. Therefore, we need the website to perform stress testing before it is actually released, that is, to simulate a large number of clients or computers to access the server at the same time to obtain the server's affordability. Here, we can use a web application stress tool (was) developed by Microsoft's website testers to complete the process.
I. Preparations
To test data preparation, you must first Delete temporary files such as cache and cookies. Start IE and open the "Internet" option command under the "Tools" menu. In the "General" tab of the "Internet Options" window that appears, click "delete cookies" and "Delete Files" in the "temporary files on the Internet" area to delete the temporary files.
Ii. Recording test scripts
Install and start was. When the program runs, the "cteate new script" dialog box is opened, that is, a new script window is created (1 ), if you do not open the window when running was, click the new script button on the toolbar of the was main program window.
Because it is the first time to use, in the new script window, click the "record" button to open the create wizard dialog box "browser recorder-step 1 of 2 ", three options are used to select the content to be recorded, including request, cookies, and host headers ), you can select as needed (figure 2). Then, click "Next" to open the "browser recorder-Step 2 of 2" window and click "finish. In this way, was is automatically enabled and a browser window is opened. You can enter the website to be tested in the address bar of the browser. As the content of the website to be tested is continuously displayed, the information in the "Recording" tab on the was main interface is updated in real time (3 ).
When the browser status bar is displayed as "complete", we can return to the was window and click "stop recording" to return to the script window.
Iii. Test settings
To make the test more accurate and more realistic, you need to set the recorded test script.
Remove static interference
Because a webpage consists of images, text, and other dynamic source code, the bandwidth consumed by static content is not very large, so we can exclude it. In the script, select the gray button that points to the image, text, and other static file items, and click the delete button on the toolbar to delete it (figure 4 ).
Set concurrency
Click the "Settings" tab under "New Recorded script", where "concurrent connections" sets the number of concurrent connections, and the "stress level (threads)" under it) "and" stress multiplier (Sockets perthread) "respectively set the pressure on the target server and the load level, where level is the number of threads produced by the client, A thread can generate multiple concurrent socket requests. Therefore, the two values are multiplied. The number obtained is the number of concurrent connections of the client at the same time (figure 5 ).
Time settings
The time settings include "test run time", "request delay", and "Suspend. The test run time is set by day, hour, minute, and second. It is recommended that the test run time not be too short. If the set concurrency is large, the time should increase by comparison, in order to generate enough requests, and the stop time means timeout processing when the connection exceeds this time. The suspension time is either warmup or cooldown, generally, it can be set to two or three minutes. The purpose is to avoid data deformation at the test start and end hours and affect the accuracy of the test.
Bandwidth bottleneck
"Bandwith" specifies the bandwidth bottleneck, that is, the bandwidth used by most users to access the website. For example, if the vast majority of users who access the website are dialing, you can select 56 K.
4. Start testing
After completing the basic settings, you can select the new script "New Recorded script" on the left and click the "run script" button on the toolbar, or open the "run" command under the "scripts" menu to start the test. During the test, the progress bar is displayed in real time. After the progress bar ends, we can analyze the test results.
V. Data Analysis
Now we can open the test report to view the test results. Click "View" and select "reports". All test reports are displayed on the left side of the window. Select this test report based on the time, and you can view the specific content on the right side of the window.
The most important part in the test report is the socket errors and result codes. Socket errors is divided into connect, send, Recv, and timeouts. Connect indicates the number of times that the client cannot connect to the server; send indicates the number of times that the client cannot correctly send data to the server; Recv indicates the number of times that the client cannot correctly connect to the server; timeouts indicates the number of timeout threads. Therefore, if these four values are relatively small or even 0, it means that our server is able to withstand the test. If the value remains high, or even close to the set concurrency, check your server (figure 6 ).
In the "result codes" section, if the value in the code list is 200, all requests are successfully returned by the server. If the value is 400 or greater than 400, for example, 404, in this case, you need to find the "page data" node on the left side, view the specific error items, and make corrections.
In fact, to fully reflect the running status of a website on the server, you must constantly increase or decrease the number of concurrent jobs and perform multiple tests to understand the limits that the server can withstand, then, you can set the maximum number of connections allowed in IIS to ensure the normal operation of the website.