stability-check环境稳定性检查命令
命令功能
执行环境稳定性检查,根据变异系数(以下简称为CV)判断环境负载是否稳定。

CV:反映了数据的波动程度,CV定义为标准差σ与均值μ的比值,即CV = σ/μ。当CV值大0.15时,被认为具有一定程度的波动,数据越大,波动程度越高。
命令格式
1 | ksys stability-check [-h] [-d <sec>] [-i <sec>] [-o OUTPUT] [-l {0,1,2,3}] |
参数说明
参数 |
参数选项 |
参数说明 |
---|---|---|
-h/--help |
- |
可选参数,获取帮助信息。 |
-d/--duration |
- |
可选参数,指定采集时间(以秒为单位),最小值为10秒,最大值120秒,默认值为30秒。 |
-i/--interval |
- |
可选参数,指定采样间隔(以秒为单位),最小值为1秒,默认值为1秒。 |
-o/--output |
- |
可选参数,指定结果文件存放目录,不指定则在当前目录下生成格式为“Y_M_D_H_M_S_stability”的log文件。 |
-l/--log-level |
0/1/2/3 |
可选参数,设置日志级别,默认为1。
|
使用示例
- 执行以下命令,查看stability-check命令支持的功能信息:
1
ksys stability-check -h
返回信息如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
USAGE ksys stability-check [-h] [-d <sec>] [-i <sec>] [-o OUTPUT] [-l {0,1,2,3}] DESCRIPTION Create a environment stability check command line task. options: -h, --help show this help message and exit -d <sec>, --duration <sec> Duration in seconds for the task collect. The minimum value is 10s. The maximum value is 120s. The default value is 30s. The user can use Ctrl+ \ to cancel the task or Ctrl+ C to stop the task. -i <sec>, --interval <sec> Interval in seconds for sampling. The minimum value is 1s, and the default value is 1s. The maximum value is recommand not to be greater than duration / 10 -o OUTPUT, --output OUTPUT Output the full path. -l {0,1,2,3}, --log-level {0,1,2,3} Set the log level (0=DEBUG, 1=INFO, 2=WARNING, 3=ERROR), which defaults to 1(INFO).
- 执行环境稳定性检查命令,分析当前环境是否稳定。
ksys stability-check -d 30 -i 1 -o /home/test/
采集时间指定为30秒,采样间隔指定为1秒,指定在“/home/test/”目录下生成JSON文件。
返回信息片段如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
[INFO] The coefficient of variation (CV) reflects the degree of data fluctuation. CV is defined as the ratio of the standard deviation σ to the mean μ, CV = σ / μ. A value greater than 0.15 is considered to have a certain degree of fluctuation. The larger the data, the greater the degree of fluctuation CPUFreq +--------+-------------+---------+---------+ | metric | current_mhz | min_mhz | max_mhz | +--------+-------------+---------+---------+ | cv | 0.0 | 0.0 | 0.0 | +--------+-------------+---------+---------+ CPUUtilization +--------+--------+------+--------+------+--------+--------+---------+-------+-------+------------+ | metric | user | nice | system | idle | iowait | irq | softirq | steal | guest | guest_nice | +--------+--------+------+--------+------+--------+--------+---------+-------+-------+------------+ | cv | 0.0074 | 0.0 | 0.0041 | 0.0 | 0.0 | 0.0003 | 0.0007 | 0.0 | 0.0 | 0.0 | +--------+--------+------+--------+------+--------+--------+---------+-------+-------+------------+ CPUStat +--------+--------+--------+------------+ | metric | cswch | intrs | soft_intrs | +--------+--------+--------+------------+ | cv | 0.0327 | 0.0527 | 0.3125 | +--------+--------+--------+------------+ CPULoad +--------+--------+--------+--------+ | metric | load1 | load5 | load15 | +--------+--------+--------+--------+ | cv | 0.1823 | 0.0352 | 0.0147 | +--------+--------+--------+--------+ MemInfo +--------+-------+-----------+---------+--------+--------+--------+----------+---------+--------+--------+------+ | metric | total | available | percent | used | free | active | inactive | buffers | cached | shared | slab | +--------+-------+-----------+---------+--------+--------+--------+----------+---------+--------+--------+------+ | cv | 0.0 | 0.0001 | 0.0 | 0.0003 | 0.0001 | 0.0024 | 0.0002 | 0.0 | 0.0 | 0.0 | 0.0 | +--------+-------+-----------+---------+--------+--------+--------+----------+---------+--------+--------+------+ SwapMem +--------+-------+------+------+---------+-----+------+ | metric | total | used | free | percent | sin | sout | +--------+-------+------+------+---------+-----+------+ | cv | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | +--------+-------+------+------+---------+-----+------+ IO +--------+--------+-----------+-----------+--------------+---------+--------+------------+--------+--------+ | metric | tps | kb_read_s | kb_wrtn_s | kb_discard_s | areq_sz | aqu_sz | await_time | util | DEVICE | +--------+--------+-----------+-----------+--------------+---------+--------+------------+--------+--------+ | cv | 1.1388 | 0.8485 | 1.3792 | 0.0 | 0.0994 | 0.0085 | 0.0061 | 0.0237 | sda | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | sda1 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | sda2 | | | 0.7529 | 0.6408 | 1.3792 | 0.0 | 0.1249 | 0.0 | 0.0219 | 0.0259 | sda3 | | | 0.071 | 0.0 | 1.7111 | 0.0 | 1.8673 | 0.0035 | 0.1098 | 0.0178 | sdb | | | 0.0232 | 0.0 | 1.7111 | 0.0 | 1.3751 | 0.0033 | 0.0824 | 0.0027 | sdb1 | | | 1.2243 | 0.0 | 1.3083 | 0.0 | 0.0103 | 0.0167 | 0.0025 | 0.0304 | dm-0 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | dm-1 | | | 1.2467 | 0.2065 | 2.1096 | 0.0 | 3.1948 | 0.0094 | 0.0569 | 0.0073 | dm-2 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | sdc | +--------+--------+-----------+-----------+--------------+---------+--------+------------+--------+--------+ Network +--------+----------+----------+---------+---------+-----------------+-----------------+----------------+--------+-------------+ | metric | rx_pck_s | tx_pck_s | rx_kb_s | tx_kb_s | rx_compressed_s | tx_compressed_s | rx_multicast_s | util | DEVICE | +--------+----------+----------+---------+---------+-----------------+-----------------+----------------+--------+-------------+ | cv | 0.0636 | 0.0534 | 0.0099 | 0.5153 | 0.0 | 0.0 | 0.0 | 0.0124 | eno1 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | eno2 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | eno3 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | eno4 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | docker0 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | veth1cb3bd9 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | vethf6352c1 | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | vethabea97c | | | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | veth | +--------+----------+----------+---------+---------+-----------------+-----------------+----------------+--------+-------------+ [INFO] Data saved successfully at /home/test/2025_08_14_16_17_04_stability.log
采集的数据显示在回显信息中,详细原始数据会保存到“/home/test/2025_08_14_16_17_04_stability.log”文件中。
环境稳定性检查会采集一段时间内的性能指标,并分析性能指标的波动情况,提供CV用于判断环境是否稳定。通过报告可以看到CPU利用率的CV较低,说明这段时间内CPU利用率比较稳定,但是I/O下sda设备的tps指标>0.15为1.1388,说明当前环境存在涉及sda的内存密集型业务,并且在sda设备的使用上存在波动。
父主题: 鲲鹏系统性能方法论分析工具