微前端架构如何改变企业的开发模式与效率提升
1307
2022-09-03
Linux sar命令查看系统资源使用情况
1.使用C语言分配足够的可以测试的内存
[root@node01:/var/log/sa]$ cat /home/sa.haibo.he/memory.c #include
2.编译可执行文件
[root@node01:/]$ gcc -o memory memory.c[root@node01:/]$ ./memory
3.使用sar命令
3.1 查看内存使用情况
每秒1次,共5次。
[root@node01:/var/log/sa]$ sar -r 1 5Linux 3.10.0-1160.el7.x86_64 (node01) 09/22/2021 _x86_64_ (4 CPU)10:25:00 AM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty10:25:01 AM 144668 7864308 98.19 0 4174484 9607004 58.60 5162884 1966344 010:25:02 AM 144668 7864308 98.19 0 4174484 9607004 58.60 5162900 1966344 010:25:03 AM 144668 7864308 98.19 0 4174484 9607004 58.60 5162912 1966344 010:25:04 AM 144668 7864308 98.19 0 4174484 9607004 58.60 5162912 1966344 010:25:05 AM 144668 7864308 98.19 0 4174488 9607004 58.60 5162916 1966344 32Average: 144668 7864308 98.19 0 4174485 9607004 58.60 5162905 1966344 6
查看22号内存使用情况
[root@node01:/var/log/sa]$ sar -r -f /var/log/sa/sa22Linux 3.10.0-1160.el7.x86_64 (node01) 09/22/2021 _x86_64_ (4 CPU)12:00:01 AM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty12:10:01 AM 148016 7860960 98.15 0 6224336 7512448 45.83 4021888 3061428 2412:20:01 AM 148576 7860400 98.14 0 6224352 7512164 45.82 4022120 3061216 4012:30:01 AM 148036 7860940 98.15 0 6224364 7521640 45.88 4023080 3061156 2412:40:01 AM 149892 7859084 98.13 0 6224388 7510960 45.82 4021780 3061124 1612:50:01 AM 162972 7846004 97.97 0 6224404 7497012 45.73 4015204 3056840 4001:00:01 AM 162588 7846388 97.97 0 6224436 7497448 45.73 4015736 3056700 1601:10:01 AM 160776 7848200 97.99 0 6224484 7496868 45.73 4020144 3053580 3201:20:01 AM 160712 7848264 97.99 0 6224504 7505956 45.79 4020564 3053552 3601:30:01 AM 159744 7849232 98.01 0 6224524 7497904 45.74 4020544 3053548 001:40:01 AM 155704 7853272 98.06 0 6224548 7504464 45.78 4023876 3053552 1201:50:01 AM 155800 7853176 98.05 0 6224572 7503940 45.77 4023820 3053508 002:00:01 AM 155564 7853412 98.06 0 6224592 7503940 45.77 4023860 3053508 2402:10:01 AM 154056 7854920 98.08 0 6224672 7506672 45.79 4030056 3049676 802:20:01 AM 151892 7857084 98.10 0 6224696 7517520 45.86 4031944 3049440 802:30:01 AM 150104 7858872 98.13 0 6224680 7517840 45.86 4032964 3049392 802:40:01 AM 150468 7858508 98.12 0 6224732 7517840 45.86 4032920 3049396 802:50:01 AM 150164 7858812 98.13 0 6224748 7508752 45.80 4032500 3049340 803:00:01 AM 149892 7859084 98.13 0 6224772 7509468 45.81 4032948 3049076 1203:10:01 AM 144452 7864524 98.20 0 6224836 7513428 45.83 4040668 3046208 803:20:01 AM 160928 7848048 97.99 0 6224832 7496652 45.73 4032448 3041880 803:30:01 AM 160392 7848584 98.00 0 6224788 7566896 46.16 4032444 3041856 3203:40:01 AM 160752 7848224 97.99 0 6224812 7497032 45.73 4032900 3041724 3603:50:01 AM 160864 7848112 97.99 0 6224792 7496484 45.73 4032412 3041724 3204:00:01 AM 160696 7848280 97.99 0 6224848 7496900 45.73 4032836 3041688 3204:10:01 AM 153284 7855692 98.09 0 6224884 7508652 45.80 4042292 3037744 3204:20:01 AM 154668 7854308 98.07 0 6224900 7504788 45.78 4041232 3037612 3204:30:01 AM 153660 7855316 98.08 0 6224912 7514216 45.84 4042252 3037564 2404:40:01 AM 154088 7854888 98.08 0 6224948 7505908 45.79 4042376 3037560 2404:50:01 AM 154252 7854724 98.07 0 6224984 7514280 45.84 4042508 3037524 3605:00:01 AM 152604 7856372 98.09 0 6225004 7515432 45.84 4043256 3037464 3205:10:01 AM 147848 7861128 98.15 0 6225040 7521320 45.88 4052036 3032708 3605:10:01 AM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty05:20:01 AM 147380 7861596 98.16 0 6225056 7583756 46.26 4051524 3032552 3205:30:01 AM 147920 7861056 98.15 0 6225068 7512548 45.83 4052080 3032416 3205:40:01 AM 163192 7845784 97.96 0 6225088 7503316 45.77 4042264 3029976 805:50:01 AM 163596 7845380 97.96 0 6225108 7494772 45.72 4042140 3029944 806:00:01 AM 164296 7844680 97.95 0 6225128 7494636 45.72 4041692 3029884 1206:10:01 AM 162428 7846548 97.97 0 6225168 7495992 45.73 4044876 3028388 806:20:01 AM 162192 7846784 97.97 0 6225188 7495448 45.72 4045176 3028260 806:30:01 AM 157340 7851636 98.04 0 6225212 7574044 46.20 4048932 3028220 806:40:01 AM 164116 7844860 97.95 0 6225220 7493944 45.71 4044168 3028184 806:50:01 AM 163672 7845304 97.96 0 6225248 7564224 46.14 4044328 3028156 807:00:01 AM 162764 7846212 97.97 0 6225272 7495348 45.72 4045112 3028056 807:10:01 AM 141868 7867108 98.23 0 6235540 7504920 45.78 4059672 3032828 3207:20:01 AM 142276 7866700 98.22 0 6235528 7575524 46.21 4059324 3032684 3207:30:01 AM 141704 7867272 98.23 0 6235568 7505064 45.78 4059924 3032668 4007:40:01 AM 140960 7868016 98.24 0 6235592 7504892 45.78 4059420 3032644 2407:50:01 AM 145576 7863400 98.18 0 6235616 7499744 45.75 4055592 3032616 3208:00:01 AM 145904 7863072 98.18 0 6235628 7500024 45.75 4055424 3032484 3208:10:01 AM 145088 7863888 98.19 0 6235660 7509024 45.80 4058316 3030264 3208:20:01 AM 145376 7863600 98.18 0 6235684 7500348 45.75 4058292 3030244 2408:30:01 AM 145424 7863552 98.18 0 6235692 7500668 45.75 4058616 3030236 2408:40:01 AM 145252 7863724 98.19 0 6235720 7509344 45.81 4059184 3030236 3608:50:01 AM 124744 7884232 98.44 0 4198212 9609716 58.62 5150956 1998288 3609:00:01 AM 141172 7867804 98.24 0 4181996 9609716 58.62 5153980 1979432 3209:10:02 AM 126268 7882708 98.42 0 4196624 9601100 58.57 5160748 1987192 3209:20:01 AM 154672 7854304 98.07 0 4168992 9600952 58.57 5151024 1968924 3609:30:01 AM 154084 7854892 98.08 0 4169160 9610484 58.62 5152612 1968940 3209:40:01 AM 159396 7849580 98.01 0 4169152 9667992 58.97 5147316 1968808 3209:50:01 AM 158708 7850268 98.02 0 4169204 9596596 58.54 5148444 1967752 3610:00:01 AM 154276 7854700 98.07 0 4169240 9612304 58.63 5152620 1967660 810:10:01 AM 141828 7867148 98.23 0 4174280 9611828 58.63 5164256 1966300 810:20:01 AM 143100 7865876 98.21 0 4174512 9617720 58.67 5163600 1966360 20Average: kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirtyAverage: 152420 7856556 98.10 0 5896286 7850820 47.89 4219149 2868869 23
3.2 sar命令的其他用法
sar 的常用参数说明: -r 查看系统内存资源 -n 查看系统网络资源 -u 查看系统CPU资源 -d 查看系统磁盘资源 -b 查看系统的IO速率 -f 从历史数据文件中获取数据,与上面的参数连用
3.3 sar命令举例说明
sar 应用举例:# sar -r 10 5 查看系统当前内存使用情况,每隔10秒报告一次,连续报告5次# sar -n DEV 1 5 查看系统当前网络资源使用情况,每个一秒报告一次,连续报告5次# sar -d -f /var/log/sa/sa22 查看系统历史(22号)磁盘资源使用情况# sar -u -f /var/log/sa/sa22 查看系统历史(22号)CPU资源使用情况# sar -h 查看sar命令的用法注意:其它的参数可以套用上面的例子
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~