ChaosBlade多种特殊测试场景构造

场景

命令

服务延时

./blade create jvm delay --time 3000 --classname *** --methodname *** --process $PID

抛出异常

./blade create jvm throwCustomException --process $PID --classname *** --methodname *** --exception java.lang.Exception

数据库连接池打满

./blade c druid connectionpoolfull 

 

数据库查询慢

 ./blade c mysql delay --time 3000 --sqltype select --port $port --database ss_stl --table stl_cost_config_ratio_seg --effect-percent 50

 

CPU打满

 ./blade create cpu fullloadbin/chaos_burncpu --start --cpu-count 4(指定CPU打满的核数)

 

模拟磁盘占用100%(先在/opt/chaosblade创建目录bladedisk)

 ./blade create disk fill -d --mount-point bladedisk --size 40960//将模拟 40G大小的文件在目录bladedisk下

 

网卡出口流量随机延时1秒-1.5秒随机

 tc qdisc add dev eth0 root netem delay 1000ms 1500ms

 

网络丢包

 ./blade create network loss --interface eth0 --percent 10

 

模拟I/O读写满负荷

 bin/chaos_burnio --file-system /dev/sda1 --size 1 --count 1024 --read=true --write=false --nohup=truebin/chaos_burnio --file-system /dev/sda1 --size 1 --count 1024 --read=false --write=true --nohup=true

脚本

./blade c jvm script --classname *** -methodname *** --script-file /opt/app/ChaosController.java --process  $PID

原文地址:https://www.cnblogs.com/emars/p/12154849.html