当前位置:网站首页>Netperf and network performance measurement
Netperf and network performance measurement
2022-07-07 03:11:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack
This paper first introduces some basic concepts and methods of network performance measurement . Then combine netperf Tool use . Discuss in detail how to test the network performance in different situations .
2004 year 7 month 01 Japan
Content
When building or managing a network system . Many of us are concerned about the availability of the network . That is, whether the network is connected , But for its overall performance, there is often little consideration . Or even considering the problem of performance , But I found that there is no suitable means to test the performance of the network .
When a web application is developed , We will find that , In the actual network environment . The effect of network application is not very ideal , The problem may lie in the development of the program , It may also be because there are bottlenecks in the actual network environment . In the face of such a problem . Procedural apes usually have nothing to do , The reason lies in not mastering some network performance measurement tools .
In this paper , Firstly, some basic concepts and methods of network performance measurement are introduced , Then combine netperf Tool use . Discuss in detail how to test the network performance in different situations .
Overview of network performance testing
Five indicators of network performance measurement
The five indicators for measuring network performance are :
- Usability (availability)
- response time (response time)
- Network utilization (network utilization)
- Network throughput (network throughput)
- Network bandwidth capacity (network bandwidth capacity)
1. Usability
The first step in testing network performance is to determine whether the network is working properly , The easiest way is to use ping command . By sending icmp echo request. And wait to receive icmp echo reply To infer whether the remote machine is connected , Whether the network works normally .
Ping Commands have a wealth of command options , example -c Can specify sending echo request The number of ,-s Be able to specify each time you send ping Bag size .
There are usually multiple buffer pools inside the network device , Different buffer pools use different buffer sizes , It is used to deal with groups of different sizes (packet). For example, there are usually three types of packet buffers in switches : One is for small groups , One is for groups of medium size , The other is for large groups . To test this network device , The test tool must have the ability to send packets of different sizes .Ping Ordered -s Can be used in this situation .
2. response time
Ping Ordered echo request/reply The time taken for a round trip is the response time . There are many factors that affect the response time , Such as the load of the network segment , Load of network host , Broadcast storm , Network devices that are not working properly, etc .
When the network works normally , Record the normal response time . When users complain about the slow response time of the network , We can compare the current response time with the normal response time , Suppose the fluctuation of the difference between the two is very large . It can indicate that the network equipment is faulty .
3. Network utilization
Network utilization refers to the time that the network is used accounts for the total time ( That is, the time used + Free time ) The proportion of .
example ,Ethernet Although it is shared . But at the same time, only one message can be transmitted . So at any moment ,Ethernet Or is it 100% Utilization ratio , Or is it 0% Utilization ratio .
Calculating the network utilization of a network segment is relatively easy, But determining the utilization rate of a network is more complex .
therefore , Network testing tools generally use network throughput and network bandwidth capacity to determine the performance between two nodes in the network .
4. Network throughput
Network throughput refers to the time when , Between two nodes in a network , The remaining bandwidth provided to network applications .
Network throughput can help groups find bottlenecks in network paths . example . Even if client and server They're all connected to their own 100M Ethernet On , But suppose these two 100M Of Ethernet By 10M Of Ethernet Connect , that 10M Of Ethernet Is the bottleneck of the network .
Network throughput depends on the current network load . therefore . In order to get the correct network throughput , It's best to do it at different times ( At different times of the day , Or different days of the week ) Test separately . Only in this way can we get a comprehensive understanding of network throughput .
Some network applications can be executed normally in the test of the development process , But it can't work normally in the actual network environment ( Because there is not enough network throughput ). This is because the test is only in the leisure network environment , It is not considered that there are other kinds of network traffic in the actual network environment . therefore . It is meaningful to define network throughput as residual bandwidth .
5. Network bandwidth capacity
Different from network throughput , Network bandwidth capacity refers to the maximum available bandwidth between two nodes of the network .
This is determined by the capabilities of the devices that make up the network .
There are two difficulties in testing network bandwidth capacity : When there is other network traffic on the network , How to know the maximum available bandwidth of the network ; During the test , How to not affect the existing network traffic .
Network testing tools generally use packet pairs and packet trains Technology to overcome this difficulty .
How to collect network performance data
After determining the test index of network performance . You need to use network testing tools to collect the corresponding performance data , There are three ways to get data from the network :
1. adopt snmp The protocol is obtained directly from the network device . Such as net-snmp Tools
2. Listen for relevant network performance data , The typical tool is tcpdump
3. Generate corresponding test data by itself , As used in this article netperf Tools
Netperf
Netperf It is a measuring tool for network performance , Mainly based on TCP or UDP The transmission of .
Netperf Depending on the application , You can test the network performance in different modes . That is, batch transmission of data (bulk data transfer) Patterns and requests / The reply (request/reponse) Pattern .
Netperf The test results reflect how fast one system can send data to another system , And another system can receive data at the speed of multiple blocks .
Netperf Tools to client/server Way to work .server The end is netserver, For listening from client End connection .client The end is netperf, Used to direct to server Launch network test .
stay client And server Between , First set up a control connection , Pass information about the test configuration . And the test results ; After the control connection is established and the test configuration information is passed ,client And server A test connection will be established between , It is used to transmit special traffic patterns back and forth . To test the performance of the network .
TCP network performance
because TCP The protocol can provide reliable end-to-end transmission . Therefore, it is used by a large number of network applications .
But , The establishment of reliability comes at a price .TCP Measures to ensure reliability by agreement . Such as establishing and maintaining connections 、 The orderly transmission of control data will consume a certain amount of network bandwidth .
Netperf Can simulate three different TCP Flow mode :
1) Single TCP Connect , Batch (bulk) Transfer a lot of data
2) Single TCP Connect ,client request /server Transactions answered (transaction) The way
3) Multiple TCP Connect . A pair of requests in each connection / Transaction mode of response
UDP network performance
UDP There is no burden of establishing connections , But UDP The reliability of transmission cannot be guaranteed , So use UDP Your application needs to track each outgoing packet by itself . And resend the lost packet .
Netperf Can simulate two UDP Traffic mode of :
1) from client To server One way batch transmission
2) request / Transaction mode of response
because UDP Unreliability of transmission . In the use of netperf Make sure that the sending buffer size is not larger than the receiving buffer size , Otherwise, the data will be lost .netperf Will give wrong results . therefore , The statistics of received packets are not necessarily accurate , It is necessary to draw a conclusion in combination with the statistical synthesis of the transmitted packets .
Netperf Command line arguments for
stay unix In the system , Be able to directly execute executable programs to start netserver, Can also make inetd or xinetd Take the initiative to start netserver.
When netserver stay server After the end is started , Can be in client End execution netperf To test the performance of the network .netperf Control the type of test and detailed test options through command line parameters .
According to the different scope of action ,netperf The command line parameters of can be divided into two categories : Global command line parameters 、 Test relevant local parameters , In between – Separate :
netperf [global options]-- [test-specific options]
Here we only explain the command line parameters that are often used . Other parameters readers can query netperf Of man Manual .
-H host : Specify remote execution netserver Of server IP Address .
-l testlen: Specify the length of time for the test ( second )
-t testname: Specify the type of test to be performed , contain TCP_STREAM,UDP_STREAM.TCP_RR.TCP_CRR,UDP_RR. They are explained separately in the following .
In the later tests ,netserver Execute on 192.168.0.28,server And client Connect through LAN (100M Hub).
Netperf Test network performance
Test batch (bulk) Performance of network traffic
Typical examples of batch data transmission are ftp And other similar web applications ( That is, the entire file is transferred at one time ). Depending on the transmission protocol used , Batch transmission data is divided into TCP Batch transmission and UDP Bulk transfer .
1. TCP_STREAM
Netperf By default TCP Bulk transfer . namely -t TCP_STREAM. During the test ,netperf towards netserver Send bulk TCP The data packet , To determine the throughput during data transmission :
./netperf -H 192.168.0.28 -l 60
TCP STREAM TEST to 192.168.0.28
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
87380 16384 16384 60.00 88.00
from netperf The result output of , We can know the following information :
1) Remote system ( namely server) Use a size of 87380 Bytes of socket Receive buffer
2) The local system ( namely client) Use a size of 16384 Bytes of socket Send buffer
3) The size of the test packet sent to the remote system is 16384 byte
4) The test time is 60 second
5) The test result of throughput is 88Mbits/ second
By default .netperf The size of the test packet sent to is set to that used by the local system socket Send buffer size .
TCP_STREAM Local parameters related to the test under the mode, such as the following table :
Parameters | explain |
---|---|
-s size | Set up the local system socket Send and receive buffer size |
-S size | Set up the remote system socket Send and receive buffer size |
-m size | Set the size of test packets sent by the local system |
-M size | Set the size of the test packet received by the remote system |
-D | For local and remote systems socket Set up TCP_NODELAY Options |
By changing the above parameters , And observe the changes of the results , We can determine what factors affect the throughput of the connection . such as , Suppose you suspect that the router lacks sufficient buffer space . There are problems in forwarding large packets . You can add test groups (-m) Size , To observe the change of throughput :
./netperf -H 192.168.0.28 -l 60 -- -m 2048
TCP STREAM TEST to 192.168.0.28
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
87380 16384 2048 60.00 87.62
ad locum , The size of the test group is reduced to 2048 byte , The throughput has not changed much ( The size of the test group is 16K Bytes compared ). contrary . Suppose the throughput has been greatly improved , It shows that the router in the middle of the network does have a buffer problem .
2. UDP_STREAM
UDP_STREAM Used for testing UDP Network performance in batch transmission .
Special attention should be paid to , At this time, the size of the test group shall not be greater than socket Send and receive buffer size of . otherwise netperf There will be an error message :
./netperf -t UDP_STREAM -H 192.168.0.28 -l 60
UDP UNIDIRECTIONAL SEND TEST to 192.168.0.28
udp_send: data send error: Message too long
To avoid that , The size of the test group can be limited by command line parameters , Or add socket Sending of / Receive buffer size .UDP_STREAM Use in the same way as TCP_STREAM Local command line parameters in the same way . therefore , Here you can use -m To change the size of the group used in the test :
./netperf -t UDP_STREAM -H 192.168.0.28 -- -m 1024
UDP UNIDIRECTIONAL SEND TEST to 192.168.0.28
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec
65535 1024 9.99 114127 0 93.55
65535 9.99 114122 93.54
UDP_STREAM There are two lines of test data in the result of mode , The first line shows the sending statistics of the local system , The throughput here represents netperf To the local socket Ability to send packets . But , We know ,UDP It's an unreliable transport protocol , The number of packets sent is not necessarily equal to the number of packets received .
The second line shows the reception of the remote system . because client And server Directly connected together . And there is no other traffic in the network . So the packets sent by the local system were almost correctly received by the remote system , The throughput of the remote system is almost equal to the transmission throughput of the local system . But . In the real world , General remote system socket The buffer size is different from that of the local system socket Buffer size , And because UDP The unreliability of the protocol . The receiving throughput of the remote system is far less than the sending throughput .
Test request / The reply (request/response) Performance of network traffic
Another common type of network traffic is applied in client/server The structure of the request/response Pattern .
In every transaction (transaction) in ,client towards server Send out small query groups ,server Received request , Large result data is returned after processing .
1. TCP_RR TCP_RR The test object of the method is multiple TCP request and response The trading process of , But they happen in the same TCP Connecting , Such patterns often appear in database applications . Database client Procedure and server The program establishes a TCP After the connection . In this connection, multiple transactions of the database are transmitted . ./netperf -t TCP_RR -H 192.168.0.28 TCP REQUEST/RESPONSE TEST to 192.168.0.28 Local /Remote Socket Size Request Resp. Elapsed Trans. Send Recv Size Size Time Rate bytes Bytes bytes bytes secs. per sec 16384 87380 1 1 10.00 9502.73 16384 87380 Netperf The output result is also composed of two lines . The first line shows the local system , The second line shows the information of the remote system . Average trading rate (transaction rate) by 9502.73 Time / second . Notice the request and response The size of the group is 1 Bytes . Not of great practical significance . Users can change by testing related parameters request and response The size of the group ,TCP_RR For example, the parameters in the mode are shown in the following table : Parameters explain -r req,resp Set up request and reponse The size of the group -s size Set up the local system socket Send and receive buffer size -S size Set up the remote system socket Send and receive buffer size -D For local and remote systems socket Set up TCP_NODELAY Options By using -r Parameters . We can conduct more meaningful tests : ./netperf -t TCP_RR -H 192.168.0.28 -- -r 32,1024 TCP REQUEST/RESPONSE TEST to 192.168.0.28 Local /Remote Socket Size Request Resp. Elapsed Trans. Send Recv Size Size Time Rate bytes Bytes bytes bytes secs. per sec 16384 87380 32 1024 10.00 4945.97 16384 87380 From the results, we can see , because request/reponse The size of the group is added , Led to a significant decline in the trading rate . notes : Compared with the actual system , The calculation of transaction rate here does not fully consider the application processing delay in the transaction process , Therefore, the result is often higher than the actual situation . 2. TCP_CRR And TCP_RR Different .TCP_CRR Create a new... For each transaction TCP Connect . The most typical application is HTTP. Every time HTTP Trading is in a separate TCP In connection . therefore , Because we need to keep building new ones TCP Connect , And dismantle it after the transaction TCP Connect . The trading rate will be greatly affected . ./netperf -t TCP_CRR -H 192.168.0.28 TCP Connect/Request/Response TEST to 192.168.0.28 Local /Remote Socket Size Request Resp. Elapsed Trans. Send Recv Size Size Time Rate bytes Bytes bytes bytes secs. per sec 131070 131070 1 1 9.99 2662.20 16384 87380 Even one byte request/response grouping . The trading rate has also decreased significantly , Only 2662.20 Time / second .TCP_CRR Use with TCP_RR The same local parameters . 3. UDP_RR UDP_RR Way to use UDP In groups request/response The trading process of . Because no TCP The burden of connection , So we guess that the trading rate will increase correspondingly . ./netperf -t UDP_RR -H 192.168.0.28 UDP REQUEST/RESPONSE TEST to 192.168.0.28 Local /Remote Socket Size Request Resp. Elapsed Trans. Send Recv Size Size Time Rate bytes Bytes bytes bytes secs. per sec 65535 65535 1 1 9.99 10141.16 65535 65535 The results confirmed our conjecture , The trading rate is 10141.16 Time / second , Higher than TCP_RR The numerical . It's just , Suppose the opposite result occurs , That is, the trading rate has decreased , There is no need to worry . Because this shows that in the network , A router or other network device pair UDP And TCP Different buffer spaces and processing techniques . Back to the first page
Conclusion
except netperf outside , There are many other network performance testing tools . Such as dbs, iperf, pathrate, nettest, netlogger, tcptrace, ntop etc. .
These tools have their own characteristics and different focuses , We can base on the detailed application environment . Use them selectively . In this way, these tools can be used to the greatest effect . Although they are all open source software , However, these tools are as powerful as commercial network testing tools . And it has also been widely used , Being familiar with these tools will be of great help to our practical work .
Copyright notice : This article is the original article of the blogger , Blog , Do not reprint without permission .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/116785.html Link to the original text :https://javaforall.cn
边栏推荐
- OC, OD, push-pull explanation of hardware
- “零售为王”下的家电产业:什么是行业共识?
- Detailed explanation of 19 dimensional integrated navigation module sinsgps in psins (time synchronization part)
- 应用程序启动速度的优化
- CVPR 2022 最佳论文候选 | PIP: 6个惯性传感器实现全身动捕和受力估计
- 【基于 RT-Thread Studio的CPK-RA6M4 开发板环境搭建】
- Es6中Promise的使用
- 制作(转换)ico图标
- How-PIL-to-Tensor
- mos管實現主副電源自動切換電路,並且“零”壓降,靜態電流20uA
猜你喜欢
上个厕所的功夫,就把定时任务的三种调度策略说得明明白白
密码学系列之:在线证书状态协议OCSP详解
Redis入门完整教程:AOF持久化
ERROR: Could not find a version that satisfies the requirement xxxxx (from versions: none)解决办法
Make (convert) ICO Icon
首届“量子计算+金融科技应用”研讨会在京成功举办
「小样本深度学习图像识别」最新2022综述
Babbitt | metauniverse daily must read: is IP authorization the way to break the circle of NFT? What are the difficulties? How should holder choose the cooperation platform
Qt蓝牙:QBluetoothDeviceInfo
mos管實現主副電源自動切換電路,並且“零”壓降,靜態電流20uA
随机推荐
ERROR: Could not find a version that satisfies the requirement xxxxx (from versions: none)解决办法
Detailed explanation of 19 dimensional integrated navigation module sinsgps in psins (initial assignment part)
Redis入门完整教程:复制配置
Cglib agent in agent mode
巴比特 | 元宇宙每日必读:IP授权是NFT的破圈之路吗?它的难点在哪里?Holder该如何选择合作平台?...
Form validation of uniapp
【基于 RT-Thread Studio的CPK-RA6M4 开发板环境搭建】
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
PSINS中19维组合导航模块sinsgps详解(初始赋值部分)
Introduction to ins/gps integrated navigation type
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
How-PIL-to-Tensor
Use of tensorboard
新标杆!智慧化社会治理
杰理之FM 模式单声道或立体声选择设置【篇】
又一百万量子比特!以色列光量子初创公司完成1500万美元融资
密码学系列之:在线证书状态协议OCSP详解
杰理之开启经典蓝牙 HID 手机的显示图标为键盘设置【篇】
Dotconnect for DB2 Data Provider
你知道电子招标最突出的5大好处有哪些吗?