How to write a server stress test program design

What should be done for server stress testing before the game goes live

For game backend performance, the evaluation standard is not only TPS (how many XX requests are processed per second) alone, because when your game server goes live, there is no stressful scenario in which a group of players only send XX requests. Therefore, the game background by the present network request pressure is always a mixture of multiple scenarios, under such pressure, the background can support how many people online at the same time, is a game pressure tester need to get valuable test conclusions.  

To get the “maximum number of people online at the same time” that can be supported, we need to do 2 things:

1, design your class of the existing network pressure model

In the real pressure of the existing network, no matter how the size of the pressure is changing, how the environment of the existing network is changing, after the design of a game type and gameplay is finalized, there are always 2 macro data of the pressure to keep unchanged: a. the proportion of the pressure of the interfaces remains unchanged, b. the average player’s pressure remains unchanged, b. the average player’s pressure remains unchanged. Unchanged, b. The average frequency of player operations per minute remains unchanged. Therefore, the goal of stress testing becomes how to simulate the stress that matches the ab data.  

For a, first of all, from the same type of game or the game of the internal test stage, the log plug pile, collect the proportion of each interface call; then, the interface proportion into the scene proportion, such as at the same time there will be a 2% finished landing, 15% of the players fighting, 20% of the players pulling the list of friends, 10% of the players gamble (a hand game scenario example).

For b, the same in the testing phase to collect the average frequency of player operations.

At this point, with a and b, it is possible to construct a model of the real pressure of players online at the same time in a minute.

2, using pressure measurement tools to construct a pressure model in line with the pressure

This can be written by yourself, you can also use ready-made pressure measurement tools. There are a lot of pressure measurement tools on the market now, but many of them are focused on the parameter TPS, which does not meet the concern of the pressure measurement of the game industry, the number of people online at the same time.

How do you do access stress testing on a web server?

Website server stress testing I think there are some major points.

1. The protocol side is basically http or https-based, if you use other protocols need to analyze the method of unpacking.

2. To generate a certain amount of pressure, the pressure source must be guaranteed. Generally use robots to simulate the pressure, the logic of the robot can be developed according to the specific business.

3. Need to observe in a certain pressure, the server’s performance indicators (cpu, memory, IO, network traffic) to observe, such as memory leaks, cpu utilization is too high.

4. Stress testing should be a continuous process, in the process need to count the server’s performance data, including tps, as well as the machine’s load and so on. Accordingly, you can analyze where the server bottleneck is, and then you can optimize for.

5. Currently most of the servers are deployed on the Linux system, the test students also need to master the relevant Linux commands in order to better test.

If you think the front is too much trouble, you can come to WeTest server stress test high concurrency, real-time performance reports, expert performance optimization recommendations, we are currently doing this piece of the site pressure test, you have to do is just fill in the URL to be tested, the pressure source, the statistics of these trivial work to us on the line.

How to test the server pressure

Take Weibo as an example, test the server pressure method is as follows:

1, first download and install WAST, and then open the software, set the number of parallel connections, set the duration, set the completion of the pressure test.

2, click on the toolbar “NewScript”, click “Manual” to create a new test project, fill in the IP address of the server you want to test in Server, select the test Web connection mode, in the “Settings” section, click “WAST”, and then click “WAST”. way, in the “Settings” feature settings will be StressLevel (Threads) threads set to 1000.

3, and then point to the tool in the gray triangle button to test can be.

The throughput of a server is the number of requests processed by the server per unit of time, which is usually expressed as “reqs per s” (the number of requests processed by the server per second). There are five types of server stress tests: peak test, same-screen stress test, behavioral stress test, data stress test, and device stress test.

Jmeter test map service performance (II) – stress test map service

Jmeter can be used to simulate multiple users to access the http(s) request and return the results of the access, and the map service is still ultimately a http(s) request. So we can use Jmeter to stress test the map service.

Of course, the map service also has its own peculiarities, for the general web service users are open, browse, jump, close these steps. But for a map service users will keep zooming in and out, dragging and dropping the map in addition to the above operations. Therefore, the data on the page will keep changing, so we have to take into account the specificity of the design of the stress test.

1. Create a test plan, customize its name and comments, and save the test plan file in the file directory.

2. Add threads (groups) and set the thread group parameters. Thread group templates are various and support plug-in expansion, this article selects the steppingthreadgroup as an example.

Name: the name of the thread group

Comments: thread group comments

Sampler error after the implementation of the action: is divided into continue, start the next process cycle, stop the thread, stop the test, stop the test immediately five. Commonly used for continue and stop test two.

In StepingThreadGroup thread group the following parameters need to be set:

This groupwillstart: the maximum number of threads that will be started in this test.

Firstwaitfor:Time to wait before starting the first thread.

Thenstart:The number of threads to start for the first time.

Nextadd:Number of threads added each time after start.

Threadsevery:The time interval between two threadsevery increases.

Using ramp-up:Time to increase the number of threads.

Thenholdloadfor:Time that lasts after increasing to the maximum number of threads.

Finallystop:Number of threads to reduce each time during stop.

Threadsevery:The time interval between two reductions in the number of threads.

3. Add a test request with parameters.

Protocol: http(s)

Server name or IP: Fill in the name or IP address of the server corresponding to the ArcGISserver, make sure that the network of the test client and server is smooth.

Port: the port number of the http(s) request under test. In ArcGISServer http corresponds to 6080 and https corresponds to 6443.

Path: Fill in the part after the port number of the http(s) service being tested.

4. Set ArcGIS custom parameters

Parameters sent with the request:

F: return type, supports html|json|image|kmz four formats, we request a picture, select f=image can be;

< /p>

Bbox: the coordinates of the lower-left corner of the map and the upper-right corner of the map, the order is <xmin>,<ymin>,<xmax>,<ymax>. For example bbox=-104,35.6,-94.32,41;

Size: Returns the size, width and length of the image, for example: size=600,550;

imageSR: The coordinate system of the requested image;

format: The format of the requested image, there are the following: png|png8|png24|jpg|pdf|bmp|gif|svg|png32

layers: the layers of the requested image, there are four keywords: show (show) hide (hide) include (include) exclude (exclude); For example: show:1 (that shows the first layer of data), the same hide:1 (that hides the first layer of data);

layerDefinitions: said to get the data that meets the current conditions, equivalent to the where condition or Filter; for example: layerdefs = 0:COM1 = ‘ COPPER’ (indicates layer 0, the value in field COM1 is equal to all elements of “COPPER”);

transparent: transparency, only valid for png format;

5. Through the Bbox parameter. Simulate the user to move, zoom in and out the map.

The Bbox parameter sends a rectangular range with the http request to allow the server to return data within the corresponding rectangular range. Through the Bbox parameter to pass a different size of the rectangle range and not use the position of the rectangle range to simulate the user constantly zoom in and out and drag and drop the map.Bbox parameter for the map of the lower left corner coordinates and the upper right corner coordinates, the order of <xmin>,<ymin>,<xmax>,<ymax>. First need a generated random rectangular range of data, either txt or csv.

Fill in the random grid data configuration parameters

Variable name: the name of the table header in the CSV file, separated by English commas

Ignore the first row: select true

Add the Bbox parameter to the setup request, referencing the four coordinate parameters using ${}, filling in the format ${XMin},${YMin},${XMax},${YMax}. Check the encoding option

6, add a listener to collect test results.

Add a listener and configure the file path of the listener output.

Start jmeter and view the test results.

Request:ntp test program (including functional testing, stress testing, performance testing, stability testing)

Stress testing: there are two programs, are using the idea of synchronization, one is to open a multi-process and multi-threaded, at the same time to the server to send NTP packets, if the machine is good, it will be an average of the machine will be back to you to NTP packets, you can use the capture tool to view the packet, pay attention to the packets sent here is not to add the time delay of the packets sent here is not delayed, just the time that the program runs, if the algorithm is good, you can shrink the time to a small, this method I call trigger.

Program two, in the program on the basis of a delay, 200ums to send a packet is quite fast, but NTP can be received inside the immediate response, the time interval is quite small, only 100ums or so. Programs you can and find on the Internet. In fact, it is a socket to send a NTP packet, but if you want to do a good job, or to some of the basics. You need to use multi-process and multi-threading, socket programming, NTP protocol.

I think the performance and stability can be seen from the stress test, but stability also requires the length of the boot time, you can try, the test end and the test machine at the same time, constantly to the test machine to send packets, send him a few days and nights, while opening the packet capturing tool to monitor, this kind of test, you can consider using the time-delayed, every few ms to send an individual to set their own.

For the client, the main time synchronization, right? There is also the ability to receive packet processing, personally, this is not much different from the server test.