Linux常用性能分析命令有哪些

发布时间:2021-10-21 14:32:32 作者:小新
来源:亿速云 阅读:133

这篇文章主要介绍了Linux常用性能分析命令有哪些,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

性能分析

vmstat

虚拟内存统计

用法

Usage:  vmstat [options] [delay [count]]  Options:  -a, --active active/inactive memory  -f, --forks number of forks since boot  -m, --slabs slabinfo  -n, --one-header do not redisplay header  -s, --stats event counter statistics  -d, --disk disk statistics  -D, --disk-sum summarize disk statistics  -p, --partition <dev> partition specific statistics  -S, --unit <char> define display unit  -w, --wide wide output  -t, --timestamp show timestamp  -h, --help display this help and exit  -V, --version output version information and exit

示例

[root@localhost ~]# vmstat  procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----   r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st   0  0  71256  92720      0 565120    0    0     1   115   22   36  1  0 99  0  0

其中

free

内存使用状况

[root@localhost ~]# free                total        used        free      shared  buff/cache   available  Mem:        1849336     1193336       90344        1752      565656      460000  Swap:       2097148       71248     2025900  [root@localhost ~]# free -h                total        used        free      shared  buff/cache   available  Mem:           1.8G        1.1G         88M        1.7M        552M        449M  Swap:          2.0G         69M        1.9G  [root@localhost ~]# free -m                total        used        free      shared  buff/cache   available  Mem:           1805        1165          88           1         552         449  Swap:          2047          69        1978  [root@localhost ~]# free -h 2                total        used        free      shared  buff/cache   available  Mem:           1.8G        1.1G         88M        1.7M        552M        449M  Swap:          2.0G         69M        1.9G  [root@localhost ~]# free -h -s 2                total        used        free      shared  buff/cache   available  Mem:           1.8G        1.1G         88M        1.7M        552M        449M  Swap:          2.0G         69M        1.9G                   total        used        free      shared  buff/cache   available  Mem:           1.8G        1.1G         88M        1.7M        552M        449M  Swap:          2.0G         69M        1.9G                   total        used        free      shared  buff/cache   available  Mem:           1.8G        1.1G         88M        1.7M        552M        449M  Swap:          2.0G         69M        1.9G

uptime

统计当前系统的运行情况

[root@localhost ~]# uptime   09:59:55 up 2 days, 7 min,  1 user,  load average: 0.00, 0.01, 0.05  load average: 系统 1分钟,5分钟,15分钟的平均负荷

netstat

当前网络信息

用法

usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}         netstat [-vWnNcaeol] [<Socket> ...]         netstat { [-vWeenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]             -r, --route              display routing table          -I, --interfaces=<Iface> display interface table for <Iface>          -i, --interfaces         display interface table          -g, --groups             display multicast group memberships          -s, --statistics         display networking statistics (like SNMP)          -M, --masquerade         display masqueraded connections             -v, --verbose            be verbose          -W, --wide               don't truncate IP addresses          -n, --numeric            don't resolve names          --numeric-hosts          don't resolve host names          --numeric-ports          don't resolve port names          --numeric-users          don't resolve user names          -N, --symbolic           resolve hardware names          -e, --extend             display other/more information          -p, --programs           display PID/Program name for sockets          -o, --timers             display timers          -c, --continuous         continuous listing             -l, --listening          display listening server sockets          -a, --all                display all sockets (default: connected)          -F, --fib                display Forwarding Information Base (default)          -C, --cache              display routing cache instead of FIB          -Z, --context            display SELinux security context for sockets       <Socket>={-t|--tcp} {-u|--udp} {-U|--udplite} {-w|--raw} {-x|--unix}             --ax25 --ipx --netrom    <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: inet    List of possible address families (which support routing):      inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)      netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)      x25 (CCITT X.25)

其中

提示:LISTEN和LISTENING的状态只有用-a或者-l才能看到

top

[root@localhost java_demos]# top  top - 14:36:14 up 2 days,  4:43,  1 user,  load average: 0.00, 0.01, 0.05  Tasks: 110 total,   2 running, 108 sleeping,   0 stopped,   0 zombie  %Cpu(s):  0.3 us,  0.2 sy,  0.0 ni, 99.3 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st  KiB Mem :  1849336 total,   963348 free,   542372 used,   343616 buff/cache  KiB Swap:  2097148 total,  2011496 free,    85652 used.  1126908 avail Mem       PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND   1858 mysql     20   0 1465504 200800   6212 S   1.0 10.9  34:56.46 mysqld      1 root      20   0   56636   4308   2808 S   0.0  0.2   0:02.05 systemd      2 root      20   0       0      0      0 S   0.0  0.0   0:00.04 kthreadd      3 root      20   0       0      0      0 S   0.0  0.0   0:01.53 ksoftirqd/0      5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H      7 root      rt   0       0      0      0 S   0.0  0.0   0:00.07 migration/0      8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh      9 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuob/0     10 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuob/1     11 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuob/2     12 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuob/3     13 root      20   0       0      0      0 S   0.0  0.0   0:14.63 rcu_sched     14 root      20   0       0      0      0 S   0.0  0.0   0:10.43 rcuos/0     15 root      20   0       0      0      0 S   0.0  0.0   0:04.67 rcuos/1

其中

***行:

第二行:Tasks 任务(进程),

第三行:cpu状态

第四行:内存状态

第五行:swap交换分区

第六行:各进程(任务)的状态监控

监控java线程数:

ps -eLf grep java wc -l

监控网络客户连接数:

netstat -n grep tcp grep 侦听端口 wc -l

感谢你能够认真阅读完这篇文章,希望小编分享的“Linux常用性能分析命令有哪些”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

推荐阅读:
  1. Linux常用查找命令
  2. hashlinux常用命令有哪些

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux

上一篇:linux的vi命令怎么用

下一篇:有效的预防软件开发中出现臭虫的方法是什么

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》