A, top command Detailed
- Current time 20:27:12
- The current system uptime 3:18 seconds
- A user
- The average length of the system load 0.00,0.00,0.00 (respectively 1 minute, 5 minutes, 15 minutes prior to the current average value)
- The second line summary R process state running state, S sleep state, T being followed or stopped, Z zombie state
Resolution:
0.0%us |
User space occupied by the percentage of CPU |
0.0% its |
Core CPU space occupancy Percentage |
0.0% ni |
Priority processes within the user process space occupied by the percentage of CPU changed |
100.0%id |
Currently the percentage of idle CPU system |
0.0% wa |
Waiting for input output I / O percentage of CPU time |
0.0%hi |
Hardware interrupt CPU occupancy percentage |
0.0% and |
Soft interrupt occupancy percentage of CPU |
- When id sustained too low, the system is an urgent need to address the problem of cpu resources
- cpu utilization = 1-% id
Resolution:
Men:1906556k total |
Total physical memory |
Men:695372k used |
Amount of physical memory used |
Men:1211184k free |
The total amount of free memory |
Men:86244k buffers |
The amount of memory used into the kernel |
Swap:2097144k total |
The total amount of swap |
Swap:0k used |
The total amount used swap |
Swap:2097144k free |
The amount of free swap |
Swap:175672 cached |
Total buffer swap |
- buffer and cache effect is to shorten the time I / O system calls (cache will occupy physical memory), if the cache is large value, indicating cache files inside a lot, or if you frequently accessed files can hit it, it is clear that this read call will be faster than disk, disk I / O must be reduced. However, if insufficient system memory, buffer / cache memory used can be released by a drop cache
- Total physical memory Mem_total = Men_used + Mem_free
- Physical memory actually used -buffers / cache = used - buffers - cache
- The actual number of available physical memory + buffers / cache = free + buffers + cache
- 交换分区对应的内存总数Swap_total = swap_used + swap_free
解析:
%CPU |
进程所占用的CPU的百分比 |
%MEM |
进程使用的物理内存百分比 |
二、性能分析过程
检查RT(响应时间) |
完成一笔业务的时间 2/5/8原则 |
检查TPS(吞吐量) |
TPS大时RT小,说明性能好 |
检查web服务器资源损耗 |
1.检查cpu使用率,确认用户cpu和系统cpu占用情况 2.检查内存使用情况 3.检查磁盘使用情况 4.检查占用的带宽 5.分析web页面确认是什么请求影响了性能 6.是否存在前端图片过多加载时间过长问题 |
是否有DB性能问题 |
1.数据库最大连接数 |
是否是SQL问题 |
1.不合理的查询SQL 2.索引是否正常使用 3.是否有做临时表缓存 |
三、性能指标参考值
1.cpu
注意 >=50%
告警 >=70%
严重 >=90%
2.内存
注意 >=50%
告警 >=70%
严重 >=80%
3.系统IO利用率(I/O(input/output)字面理解就是输入/输出,输入指的是对磁盘写入数据,输出指的是从磁盘读出数据。)
注意 >=40%
告警 >=60%
严重 >=80%