性能优化工具

CPU 优化的各类工具

在这里插入图片描述

network
netperf

服务端:

$ netserver
Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC
$ cat netperf.sh 
#!/bin/bash
count=$1
for ((i=1;i<=count;i++))
doecho "Instance:$i-------"# 下方命令可以替换为测试场景表格中的命令# -H 后填写服务器 IP 地址;# -l 后为测试时间,为了防止 netperf 提前结束,因此时间设为 10000;netperf -t TCP_STREAM -H 172.17.48.107 -l 10000 -- -m 1500 -R 1 &
done
$ bash netperf.sh 20
Instance:1-------
Instance:2-------
Instance:3-------
Instance:4-------
Instance:5-------
Instance:6-------
Instance:7-------
Instance:8-------
Instance:9-------
Instance:10-------
Instance:11-------
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
Instance:12-------
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
Instance:13-------
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
Instance:14-------
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
Instance:15-------
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
Instance:16-------
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
Instance:17-------
Instance:18-------
Instance:19-------
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
Instance:20-------
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
[root]$ MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.17.48.107 () port 0 AF_INET

在这里插入图片描述

iperf

基本使用用法

$ iperf -h
Usage: iperf [-s|-c host] [options]iperf [-h|--help] [-v|--version]Client/Server:-b, --bandwidth #[kmgKMG | pps]  bandwidth to send at in bits/sec or packets per second-e, --enhancedreports    use enhanced reporting giving more tcp/udp and traffic information-f, --format    [kmgKMG]   format to report: Kbits, Mbits, KBytes, MBytes-i, --interval  #        seconds between periodic bandwidth reports-l, --len       #[kmKM]    length of buffer in bytes to read or write (Defaults: TCP=128K, v4 UDP=1470, v6 UDP=1450)-m, --print_mss          print TCP maximum segment size (MTU - TCP/IP header)-o, --output    <filename> output the report or error message to this specified file-p, --port      #        server port to listen on/connect to-u, --udp                use UDP rather than TCP--udp-counters-64bit use 64 bit sequence numbers with UDP-w, --window    #[KM]    TCP window size (socket buffer size)-z, --realtime           request realtime scheduler-B, --bind <host>[:<port>][%<dev>] bind to <host>, ip addr (including multicast address) and optional port and device-C, --compatibility      for use with older versions does not sent extra msgs-M, --mss       #        set TCP maximum segment size (MTU - 40 bytes)-N, --nodelay            set TCP no delay, disabling Nagle's Algorithm-S, --tos       #        set the socket's IP_TOS (byte) fieldServer specific:-s, --server             run in server mode-t, --time      #        time in seconds to listen for new connections as well as to receive traffic (default not set)--udp-histogram #,#  enable UDP latency histogram(s) with bin width and count, e.g. 1,1000=1(ms),1000(bins)-B, --bind <ip>[%<dev>]  bind to multicast address and optional device-H, --ssm-host <ip>      set the SSM source, use with -B for (S,G) -U, --single_udp         run in single threaded UDP mode-D, --daemon             run the server as a daemon-V, --ipv6_domain        Enable IPv6 reception by setting the domain and socket to AF_INET6 (Can receive on both IPv4 and IPv6)Client specific:-c, --client    <host>   run in client mode, connecting to <host>-d, --dualtest           Do a bidirectional test simultaneously--ipg                set the the interpacket gap (milliseconds) for packets within an isochronous frame--isochronous <frames-per-second>:<mean>,<stddev> send traffic in bursts (frames - emulate video traffic)-n, --num       #[kmgKMG]    number of bytes to transmit (instead of -t)-r, --tradeoff           Do a bidirectional test individually-t, --time      #        time in seconds to transmit for (default 10 secs)-B, --bind [<ip> | <ip:port>] bind ip (and optional port) from which to source traffic-F, --fileinput <name>   input the data to be transmitted from a file-I, --stdin              input the data to be transmitted from stdin-L, --listenport #       port to receive bidirectional tests back on-P, --parallel  #        number of parallel client threads to run-R, --reverse            reverse the test (client receives, server sends)-T, --ttl       #        time-to-live, for multicast (default 1)-V, --ipv6_domain        Set the domain to IPv6 (send packets over IPv6)-X, --peer-detect        perform server version detection and version exchange-Z, --linux-congestion <algo>  set TCP congestion control algorithm (Linux only)Miscellaneous:-x, --reportexclude [CDMSV]   exclude C(connection) D(data) M(multicast) S(settings) V(server) reports-y, --reportstyle C      report as a Comma-Separated Values-h, --help               print this message and quit-v, --version            print version information and quit[kmgKMG] Indicates options that support a k,m,g,K,M or G suffix
Lowercase format characters are 10^3 based and uppercase are 2^n based
(e.g. 1k = 1000, 1K = 1024, 1m = 1,000,000 and 1M = 1,048,576)The TCP window size option can be set by the environment variable
TCP_WINDOW_SIZE. Most other options can be set by an environment variable
IPERF_<long option name>, such as IPERF_BANDWIDTH.

iperf 服务端:

$ iperf -s -i 1 -p 3389
------------------------------------------------------------
Server listening on TCP port 3389
TCP window size:  128 KByte (default)
------------------------------------------------------------

客户端:

$ cat iperf.sh 
#!/bin/bash
count=$1
for ((i=1;i<=count;i++))
doecho "Instance:$i-------"iperf -c 172.17.48.107 -p 3389 -i 1 &
done

客户端执行:

$ bash  iperf.sh 10
Instance:1-------
Instance:2-------
Instance:3-------
Instance:4-------
Instance:5-------
Instance:6-------
Instance:7-------
Instance:8-------
Instance:9-------
Instance:10-------
[root@core_172.17.48.52 ~]$ ------------------------------------------------------------
Client connecting to 172.17.48.107, TCP port 3389
TCP window size:  198 KByte (default)
------------------------------------------------------------
[  3] local 172.17.48.52 port 52312 connected with 172.17.48.107 port 3389
------------------------------------------------------------
Client connecting to 172.17.48.107, TCP port 3389
------------------------------------------------------------
TCP window size:  194 KByte (default)
------------------------------------------------------------
Client connecting to 172.17.48.107, TCP port 3389
[  3] local 172.17.48.52 port 52316 connected with 172.17.48.107 port 3389
TCP window size:  400 KByte (default)

服务端反馈:

[ 10]  9.0-10.0 sec   377 MBytes  3.16 Gbits/sec
[ 10]  0.0-10.0 sec  2.36 GBytes  2.02 Gbits/sec
[  8]  9.0-10.0 sec   191 MBytes  1.60 Gbits/sec
[ 12]  9.0-10.0 sec   337 MBytes  2.83 Gbits/sec
[ 11]  9.0-10.0 sec   259 MBytes  2.17 Gbits/sec
[ 13]  9.0-10.0 sec   190 MBytes  1.60 Gbits/sec
[SUM]  9.0-10.0 sec  2.71 GBytes  23.3 Gbits/sec
[  7]  0.0-10.0 sec  2.41 GBytes  2.07 Gbits/sec
[  5]  0.0-10.0 sec  2.43 GBytes  2.08 Gbits/sec
[  4]  0.0-10.0 sec  1.81 GBytes  1.55 Gbits/sec
[  9]  0.0-10.0 sec  5.17 GBytes  4.44 Gbits/sec
[  6]  0.0-10.0 sec  2.70 GBytes  2.32 Gbits/sec
[  8]  0.0-10.0 sec  3.24 GBytes  2.78 Gbits/sec
[ 12]  0.0-10.0 sec  2.76 GBytes  2.37 Gbits/sec
[ 11]  0.0-10.0 sec  2.15 GBytes  1.85 Gbits/sec
[ 13]  0.0-10.0 sec  1.96 GBytes  1.68 Gbits/sec
[SUM]  0.0-10.0 sec  27.0 GBytes  23.1 Gbits/sec

或者客户端无需脚本, 直接使用 -P 并发参数

$ iperf  -c 172.17.48.107 -p 3389 -i 1  -t 1200 -P 10
------------------------------------------------------------
Client connecting to 172.17.48.107, TCP port 3389
TCP window size:  234 KByte (default)
------------------------------------------------------------
[ 13] local 172.17.48.52 port 35696 connected with 172.17.48.107 port 3389
[  3] local 172.17.48.52 port 35678 connected with 172.17.48.107 port 3389
[  4] local 172.17.48.52 port 35680 connected with 172.17.48.107 port 3389
[  5] local 172.17.48.52 port 35682 connected with 172.17.48.107 port 3389
[  6] local 172.17.48.52 port 35684 connected with 172.17.48.107 port 3389
[  7] local 172.17.48.52 port 35686 connected with 172.17.48.107 port 3389
[  8] local 172.17.48.52 port 35688 connected with 172.17.48.107 port 3389
[ 11] local 172.17.48.52 port 35690 connected with 172.17.48.107 port 3389
[  9] local 172.17.48.52 port 35692 connected with 172.17.48.107 port 3389
[ 12] local 172.17.48.52 port 35694 connected with 172.17.48.107 port 3389
[ ID] Interval       Transfer     Bandwidth
[ 13]  0.0- 1.0 sec   184 MBytes  1.54 Gbits/sec
[  3]  0.0- 1.0 sec   177 MBytes  1.48 Gbits/sec
[  4]  0.0- 1.0 sec   175 MBytes  1.47 Gbits/sec
[  5]  0.0- 1.0 sec   383 MBytes  3.21 Gbits/sec
[  6]  0.0- 1.0 sec   255 MBytes  2.14 Gbits/sec
[  7]  0.0- 1.0 sec   233 MBytes  1.95 Gbits/sec
[  8]  0.0- 1.0 sec   714 MBytes  5.99 Gbits/sec
[ 11]  0.0- 1.0 sec   229 MBytes  1.92 Gbits/sec
[  9]  0.0- 1.0 sec   224 MBytes  1.88 Gbits/sec
[ 12]  0.0- 1.0 sec   161 MBytes  1.35 Gbits/sec
[SUM]  0.0- 1.0 sec  2.67 GBytes  22.9 Gbits/sec
[ 13]  1.0- 2.0 sec   145 MBytes  1.22 Gbits/sec
[  3]  1.0- 2.0 sec   176 MBytes  1.48 Gbits/sec
[  4]  1.0- 2.0 sec   225 MBytes  1.89 Gbits/sec
[  5]  1.0- 2.0 sec   425 MBytes  3.56 Gbits/sec
[  6]  1.0- 2.0 sec   287 MBytes  2.41 Gbits/sec
[  7]  1.0- 2.0 sec   237 MBytes  1.99 Gbits/sec
[  8]  1.0- 2.0 sec   577 MBytes  4.84 Gbits/sec
[ 11]  1.0- 2.0 sec   249 MBytes  2.09 Gbits/sec
[  9]  1.0- 2.0 sec   247 MBytes  2.07 Gbits/sec
[ 12]  1.0- 2.0 sec   206 MBytes  1.73 Gbits/sec
[SUM]  1.0- 2.0 sec  2.71 GBytes  23.3 Gbits/se
iperf3

服务端

$ cat server.sh 
for x in `seq 3400 3419`;do  iperf3 -s -i 1 -p $x &  done
$ bash server.sh 
-----------------------------------------------------------
Server listening on 3400
-----------------------------------------------------------
-----------------------------------------------------------
Server listening on 3401
-----------------------------------------------------------
-----------------------------------------------------------
Server listening on 3402
-----------------------------------------------------------
-----------------------------------------------------------
Server listening on 3403
-----------------------------------------------------------
-----------------------------------------------------------
Server listening on 3404
-----------------------------------------------------------
-----------------------------------------------------------
Server listening on 3405
-----------------------------------------------------------
-----------------------------------------------------------
Server listening on 3406
-----------------------------------------------------------

客户端

$ cat iperf3client.sh for x in `seq 3400 3409`;do iperf3   -c 172.17.48.107 -p $x -i 1  -t 1200 -P 10  &  done
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 12] 120.00-121.00 sec  31.1 MBytes   261 Mbits/sec   45   41.7 KBytes       
[ ID] Interval           Transfer     Bandwidth       Retr
[  8] 120.00-121.00 sec  25.0 MBytes   210 Mbits/sec   22   61.2 KBytes       
[ 10] 120.00-121.00 sec  27.7 MBytes   233 Mbits/sec   69   79.3 KBytes       
[ 10] 120.00-121.00 sec  28.1 MBytes   235 Mbits/sec   73   77.9 KBytes       
[  6] 120.00-121.00 sec  29.4 MBytes   247 Mbits/sec   96   65.4 KBytes       
[  8] 120.00-121.00 sec  19.8 MBytes   166 Mbits/sec   40    106 KBytes       
[ 12] 120.00-121.00 sec  35.4 MBytes   297 Mbits/sec   15    154 KBytes       
[ 12] 120.00-121.00 sec  24.7 MBytes   207 Mbits/sec   58   55.6 KBytes       
[ 12] 120.00-121.00 sec  31.8 MBytes   267 Mbits/sec   73   82.0 KBytes       
[ 14] 120.00-121.00 sec  27.0 MBytes   227 Mbits/sec   19   93.2 KBytes       
[ 14] 120.00-121.00 sec  23.6 MBytes   198 Mbits/sec   31   89.0 KBytes       

sar 检测

$ sar -n DEV 1
Linux 5.4.119-19.0009.40 (172.17.48.107)        04/16/2024      _x86_64_        (64 CPU)11:54:47 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
11:54:48 AM        lo      2.00      2.00      0.08      0.08      0.00      0.00      0.00
11:54:48 AM      eth0 2043634.00 158143.00 2949569.21   8463.96      0.00      0.00      0.0011:54:48 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
11:54:49 AM        lo   3708.00   3708.00   1232.12   1232.12      0.00      0.00      0.00
11:54:49 AM      eth0 2042823.00 159044.00 2948059.12   8619.72      0.00      0.00      0.00

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/623452.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

AI大模型日报#0416:李飞飞《2024年人工智能指数报告》、Sora加入Adobe、李彦宏聊百度大模型之路

​导读&#xff1a; 欢迎阅读《AI大模型日报》&#xff0c;内容基于Python爬虫和LLM自动生成。目前采用“文心一言”生成了每条资讯的摘要。标题: 刚刚&#xff0c;李飞飞团队发布《2024年人工智能指数报告》&#xff1a;10大趋势&#xff0c;揭示AI大模型的“喜”与“忧” 摘…

nginx 前后的分离 负载均衡

首先前端随便访问后端的一个端口,后端监听这个端口进行服务转发。 比如:8888 VITE_APP_API_BASEURL = http://192.168.10.111:8888 然后nginx在我们的服务器上部署两个后端 这里我用docker部署了两个 当然你也可以在两个服务器上面部署两个后端,只要在nginx配置代理的时…

OpenCV轻松入门(八)——图片卷积

对图像和滤波矩阵进行逐个元素相乘再求和的操作就相当于将一个二维的函数移动到另一个二维函数的所有位置&#xff0c;这个操作就叫卷积 卷积需要4个嵌套循环&#xff0c;所以它并不快&#xff0c;除非我们使用很小的卷积核。这里一般使用3x3或者5x5 图像滤波 图像滤波是尽量…

Clob数据类型解析及读取转换

1.简介 CLOB&#xff08;Character Large Object&#xff09; 是指用于存储大型文本数据的数据类型。与之对应的另一个数据类型是 BLOB&#xff0c;指的是二进制大型对象。CLOB 类型在实际应用中非常广泛&#xff0c;尤其是在存储长篇文字、图书、电子邮件以及其他类似数据时&…

JPA (Java Persistence API)

一、Jpa的介绍 JPA &#xff0c;是一套Sun公司Java官方制定的ORM 规范。 ORM&#xff0c;即 对象关系映射 &#xff08;Object Relational Mapping&#xff09;&#xff0c;是一种程序技术&#xff0c;用于 在关系数据库和业务实体对象之间做映射 。ORM 框架的存在&#xff0c;…

007 springboot整合mybatis-plus 增删改查 ModelAndView jsp 分页

文章目录 MybatisplusConfig.javaReceiveAddressController.javaReceiveAddress.javaReceiveAddressMapper.javaReceiveAddressServiceImpl.javaIReceiveAddressService.javaServerResult.javaServletInitializer.javaSpringbootDemoApplication.javareceive_address.sqlReceiv…

python接口自动化测试 —— unittest框架suite、runner详细使用

test suite 测试套件&#xff0c;理解成测试用例集一系列的测试用例&#xff0c;或测试套件&#xff0c;理解成测试用例的集合和测试套件的集合当运行测试套件时&#xff0c;则运行里面添加的所有测试用例 test runner 测试运行器用于执行和输出结果的组件 test suite、tes…

DBUtils工具类的使用

1、DBUtils是什么 为了更加简单地使用JDBC&#xff0c;Apache组织提供了一个DBUtils工具&#xff0c;它是操作数据库的一个组件&#xff0c;实现了对JDBC的简单封装&#xff0c;可以在不影响数据库访问性能的情况下简化JDBC的编码工作量。DBUtils工具要有2个作用。 写数据&am…

Upload-labs(Pass-14 - Pass-16)

Pass-14 &#xff08;图片马&#xff0c;判断文件类型&#xff09; 图片的格式在防护中通常是不会使用后缀进行判断的依据&#xff0c;文件头是文件开头的一段二进制码&#xff0c;不同类型的图片也就会有不同的二进制头。   JPEG (jpg)&#xff0c;文件头&#xff1a;FF D…

C++从入门到精通——类的6个默认成员函数之赋值运算符重载

赋值运算符重载 前言一、运算符重载定义实例注意要点 二、赋值运算符重载赋值运算符重载格式赋值运算符重载要点重载要点传值返回和传址返回要点 三、前置和后置重载 前言 类的6个默认成员函数&#xff1a;如果一个类中什么成员都没有&#xff0c;简称为空类。 空类中真的什么…

ESP32S3在wsl环境的JTAG、openocd仿真调试

文章目录 一、准备工作二、添加 ESP-IDF 环境变量三、添加 udev 规则文件四、vscode 配置 一、准备工作 安装配置好 WSL、ubuntu, 参考连接&#xff1a; WSL2安装Ubuntu迁移到其他盘或者其他电脑_wsl ubuntu迁移-CSDN博客 WSL2 设置桥接模式_wsl2 桥接-CSDN博客 下载好 WSL-US…

Python 物联网入门指南(八)

原文&#xff1a;zh.annas-archive.org/md5/4fe4273add75ed738e70f3d05e428b06 译者&#xff1a;飞龙 协议&#xff1a;CC BY-NC-SA 4.0 第三十章&#xff1a;制作机械臂 最后&#xff0c;我们终于到达了大多数人自本书开始以来就想要到达的地方。制作一个机械臂&#xff01;在…