Let you know about software development in advance (42): Performance Testing

Source: Internet
Author: User

Part 1 software R & D work summary

Performance testing

 

Abstr]

For some intermediate modules in the communication field, the main function is to process and send received messages, which serves as a "bridge" between the two modules. Because there are many and few messages, this puts forward requirements on its performance.

Based on the author's practical project experience, this article describes the entire process of the performance testing, and briefly introduces some common problems during the performance testing.

 

1. Preface

After coding for the new requirements of the project is completed, it is inevitable to self-validate the code to verify the correctness of the function. Generally, it takes a lot of other time to test the environment. By testing the code you have compiled, developers can discover the design and coding deficiencies and promptly modify the program, reducing the cost of adding the changes ?.

Some intermediate modules are located between two important modules and act as "bridges. It processes the received message and sends the processed message. The number of messages is small. When the number of messages is very large, the intermediate module is required to have higher performance than the limit. Therefore, it is necessary to test the performance of the intermediate module to verify its ability to process a large number of messages.

This article describes the entire process of performance retries and briefly introduces some precautions during the retries.

 

2. Build a performance testing environment

2.1 system structure

In general, performance testing is required for systems that want to process a large number of messages. The general system structure 1 shows.

Figure 1 structure of the performance testing system

1. The intermediate module C needs to interact with the module A and module B. First, module A sends A message to the intermediate module C. Module C assembles the good news according to the protocol and sends it to module B. Module B returns A response message to the intermediate module C after receiving the message, the intermediate module C then assembles the response message to module A according to the protocol.

It can be seen that the intermediate module C needs to process different messages. When the message volume is very large, it puts forward requirements on its processing performance.

 

2.2 compile a simulation program

As shown in Figure 1, to test the performance of the intermediate module C, you need to simulate the functions of module A and module B.

For ease of operation, you can write a simulation program on your work PC to complete a simple performance test. If you want to conduct a large-scale performance test, you need a dedicated trial staff and a trial environment.

Generally, you can write A visual operation interface to simulate modules A and B, which facilitates message tracking and debugging. See Figure 2 on the simulated interface.

Figure 2 simulation interface

2. As you can see, the entire operation interface is simpler, the options include "start trial" button, "exit system" button, message type button, "send count" control box, "send interval" control box, and display box.

The START trial button is used to control the start of the trial.

The "exit system" button is used to control the end of the trial.

The message category button is used to control the content of the sent message. After the system is set up, module A sends the message to the intermediate module C after A function is selected and the start trial button is clicked, and receive messages from intermediate module C. The sent and received messages are displayed in the display box in the middle.

The "Send count" control box is used to control the number of messages sent, which is the most important embodiment of performance testing. Can I add messages of a certain type gradually? The value of this item.

The send interval control box controls the message sending interval. This is to facilitate observation of the sending status of each message, and can be adjusted according to the actual situation.

The display box is used to display the message execution, facilitating tracking and debugging.

In the simulation module A and module B programs, the most important thing is to assemble the sent messages in strict accordance with the protocol, not only to ensure the correctness of the field content and order, but also to ensure the correctness of the format. To ensure that the sent message is accurate, can you add? A configuration file in which messages are configured.

 

3. Performance testing procedure

The performance test procedure is no different from the actual test procedure. Before the trial, ensure the normal execution of the system, ensure the correctness of the relevant configuration file content, and ensure the correctness of the software.

3.1 Start the simulation interface

The interface 3 after the simulation program is successfully started is displayed.

Figure 3 interface after the simulation program is successfully started

 

3.2 perform a retry on a single message

Select a message category and set "number of sent messages" to 1 to view the message sending and receiving status, as shown in figure 4.

Figure 4 1 message sent successfully

You can use the display box in figure 4 to verify that the functions of the program are correct.

 

3.3 conduct performance testing on intermediate module C

One of the main purposes of writing a simulation program is to conduct a performance test on the intermediate module C, that is, to continuously send multiple messages to the intermediate module C and check whether the function is normal.

For example, if you select a type of message and set "number of sent messages" to 10000, you can see the situation of sending and receiving messages, as shown in figure 5.

Figure 5 10000 messages sent successfully

In figure 5, the simulation program keeps sending messages to the intermediate module C until 10000 messages are sent. After the message is sent, you can check whether the intermediate module C processes the message normally, that is, whether the performance testing has achieved the expected purpose.

Generally, it is necessary to ensure that the intermediate module C can withstand 100000 or more performance tests. After the performance test of a function is passed, the system also tests the performance of other functions involved in the intermediate module C to ensure its performance stability.

 

4. FAQs about performance testing

During the performance testing, the following are common questions and answers:

1) why cannot a simulation program send messages?

A: In this case, the configuration is usually incorrect. Before performing a performance review, make sure that the configuration files are correct, the server and client configurations are correct, and the connection port is accurate. The connection fails. This is generally caused by incorrect port numbers.

2) Why is the message parsing incorrect?

A: This is usually because messages are not assembled as required by the protocol.

3) Why does the program crash when processing a few messages with some functions?

A: There must be a problem with the C program of the intermediate module. The purpose of the performance testing is to find such problems. Check the log files to see where the program crashes. Generally, you can find the problem by checking the corresponding code.

 

5. Summary

This article describes the entire process of performing a performance test on the intermediate module C, and describes common problems during the test.

The main purpose of the performance testing is to ensure the quality of the code and the quality of the product. After writing the code, developers must perform a thorough test on the code to reduce the trouble caused by the changes.


 

 

 

(My microblogging: http://weibo.com/zhouzxi? Topnav = 1 & wvr = 5, No.: 245924426, welcome !)

Let you know about software development in advance (42): Performance Testing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.