ChaosBlade可針對(duì)多達(dá)7個(gè)場(chǎng)景開展故障注入實(shí)驗(yàn),但網(wǎng)上官方的中英文文檔質(zhì)量欠佳,內(nèi)容缺失,真心沒(méi)有站在一般用戶的角度來(lái)寫,只能通過(guò)運(yùn)行blade命令的help了解究竟有什么功能。

官網(wǎng)
https://github.com/chaosblade-io/chaosblade
一句話介紹
ChaosBlade是阿里巴巴開源的針對(duì)7個(gè)檢驗(yàn)軟件系統(tǒng)穩(wěn)定性場(chǎng)景的混沌工程故障注入開源工具:主機(jī)基礎(chǔ)資源、CRI容器、K8S平臺(tái)、Java應(yīng)用、C++應(yīng)用、阿里云平臺(tái)、其他服務(wù)。
關(guān)鍵特性
以下關(guān)鍵特性,是我下載ChaosBlade v1.7.2,在運(yùn)行blade時(shí)帶上help參數(shù),一點(diǎn)點(diǎn)試出來(lái)的。官網(wǎng)github的readme文檔并沒(méi)有寫這么細(xì)。
場(chǎng)景1:主機(jī)基礎(chǔ)資源
可注入故障包括CPU負(fù)載爆滿,磁盤占用和讀寫爆滿,內(nèi)存爆滿,網(wǎng)絡(luò)延遲/丟包/壞包/亂序,端口被占用,DNS配置錯(cuò)誤,殺進(jìn)程。
場(chǎng)景2:CRI容器
可注入故障包括向容器內(nèi)的基礎(chǔ)資源注入故障,刪除容器,以及向容器內(nèi)各種服務(wù)注入故障。
場(chǎng)景3:K8S平臺(tái)
可注入故障包括向K8S平臺(tái)內(nèi)容器、node和pod注入故障。
場(chǎng)景4:Java應(yīng)用
可注入故障包括代碼緩存爆滿,內(nèi)存不足,增加延遲,返回特定值,動(dòng)態(tài)執(zhí)行腳本,拋異常等。
場(chǎng)景5:C++應(yīng)用
可注入故障包括增加延遲,運(yùn)行中修改變量值,返回錯(cuò)誤。
場(chǎng)景6:阿里云平臺(tái)
可注入故障包括卸載磁盤,掛載或卸載網(wǎng)絡(luò)接口等。
場(chǎng)景7:其他服務(wù)
可注入故障包括增加延遲和拋異常,可以針對(duì)如elastic search, hbase, http, mongodb, mysql等近30種服務(wù)注入故障。
具體特性,可以參考文后我根據(jù)命令行help輸出,整理的特性列表。需要對(duì)里面的英文語(yǔ)法錯(cuò)誤保持寬容態(tài)度。
適用平臺(tái)
主機(jī),CRI容器,K8S平臺(tái),Java應(yīng)用,C++應(yīng)用,阿里云平臺(tái),其他服務(wù)。
適用場(chǎng)景
需要向主機(jī)、CRI容器、K8S平臺(tái)、阿里云平臺(tái)、Java應(yīng)用和C++應(yīng)用注入故障的場(chǎng)景。
優(yōu)勢(shì)
支持多達(dá)7個(gè)故障注入場(chǎng)景。
劣勢(shì)
網(wǎng)上的中英文文檔描述過(guò)于簡(jiǎn)略。每個(gè)功能往往就一句話。只能把工具裝上,運(yùn)行起來(lái),通過(guò)help參數(shù),逆向工程來(lái)發(fā)現(xiàn)有什么功能。
案例
國(guó)內(nèi)有金融行業(yè)的用戶,已經(jīng)基于ChaosBlade開發(fā)了混沌工程工具平臺(tái),在測(cè)試環(huán)境注入故障,檢驗(yàn)基礎(chǔ)設(shè)施和容器平臺(tái)的穩(wěn)定性。
開源許可證
Apache-2.0 license
Github點(diǎn)贊數(shù)
5.4k
最近發(fā)布日期與版本
2023.05: v1.7.2
所屬項(xiàng)目
CNCF云原生計(jì)算基金會(huì)沙箱項(xiàng)目
參考資料
ChaosBlade文檔:https://chaosblade.io/docs/
ChaosBlade使用入門:https://developer.aliyun.com/article/1196882
ChaosBlade使用案例:https://juejin.cn/post/6996923672564858916?searchId=2023080922085236FCE1AB509C0489C977
混沌工程開源工具 Chaosblade 探究:https://juejin.cn/post/7037154744225234981?searchId=2023080922085236FCE1AB509C0489C977#heading-5
你還知道有什么好用的開源故障注入工具?你還希望我聊有關(guān)混沌工程的其他什么新話題?歡迎在評(píng)論區(qū)留言。我會(huì)仔細(xì)閱讀每一條留言。期待聽到你的聲音。
如果覺(jué)得本文對(duì)你有幫助,歡迎點(diǎn)贊,【點(diǎn)擊在讀,】并轉(zhuǎn)發(fā)給其他志同道合的小伙伴。
企業(yè)生意好,系統(tǒng)運(yùn)行穩(wěn)。你所閱讀的文章,來(lái)自“吾真本說(shuō)混沌工程”知乎專欄。
附錄:ChaosBlade支持7個(gè)故障注入場(chǎng)景
1 主機(jī)基礎(chǔ)資源
cpu Cpu experiment, for example full load
fullload cpu load
disk Disk experiment contains fill disk or burn io
burn Increase disk read and write io load
fill Fill the specified directory path
mem Mem experiment, for example load
load mem load
network Network experiment
corrupt Corrupt experiment
delay Delay experiment
dns Dns experiment
dns_down Make DNS is not accessible
drop Drop experiment
duplicate Duplicate experiment
loss Loss network package
occupy Occupy the specify port
reorder Reorder experiment
process Process experiment
kill Kill process
stop process fake death
file File experiment contains file content append, permission modification so on
add File or path add
append File content append
chmod File permission modification.
delete File delete
move File move
2 CRI容器
cri CRI experiment, for example remove container. If container-runtime is containerd, the container-id shoud be full id.
ck Clickhouse experiment
container Execute a container experiment
cpu Cpu experiment
disk Disk experiment
druid Experiment with the Druid
dubbo Experiment with the Dubbo
es ElasticSearch experiment!
feign feign experiment
file File experiment
gateway gateway experiment!
hbase hbase experiment!
http http experiment
jedis jedis experiment
jvm Experiment with the JVM
kafka kafka experiment
lettuce redis client lettuce experiment
log log experiment
mem Mem experiment
mongodb MongoDB experiment
mysql mysql experiment
network Network experiment
process Process experiment
psql Postgrelsql experiment
rabbitmq rabbitmq experiment
redisson redisson experiment
rocketmq Rocketmq experiment,can make message send or pull delay and exception
security SpringSecurity login experiment
servlet java servlet experiment
tars tars experiment
zk zk experiment
3 K8S平臺(tái)
k8s Kubernetes experiment, for example kill pod
container-ck Clickhouse experiment
container-container Execute a container experiment
container-cpu Cpu experiment
container-disk Disk experiment
container-druid Experiment with the Druid
container-dubbo Experiment with the Dubbo
container-es ElasticSearch experiment!
container-feign feign experiment
container-file File experiment
container-gateway gateway experiment!
container-hbase hbase experiment!
container-http http experiment
container-jedis jedis experiment
container-jvm Experiment with the JVM
container-kafka kafka experiment
container-lettuce redis client lettuce experiment
container-log log experiment
container-mem Mem experiment
container-mongodb MongoDB experiment
container-mysql mysql experiment
container-network Network experiment
container-process Process experiment
container-psql Postgrelsql experiment
container-rabbitmq rabbitmq experiment
container-redisson redisson experiment
container-rocketmq Rocketmq experiment,can make message send or pull delay and exception
container-script Script chaos experiment
container-security SpringSecurity login experiment
container-servlet java servlet experiment
container-tars tars experiment
container-zk zk experiment
node-cpu Cpu experiment
node-disk Disk experiment
node-file File experiment
node-mem Mem experiment
node-network Network experiment
node-process Process experiment
node-script Script chaos experiment
pod-cpu Cpu experiment
pod-disk Disk experiment
pod-file File experiment
pod-mem Mem experiment
pod-network Network experiment
pod-pod Pod experiments
pod-process Process experiment
pod-script Script chaos experiment
4 Java應(yīng)用
jvm Experiment with the JVM, and you can specify classes, method injection delays, return values, exception failure scenarios, or write Groovy and Java scripts to implement complex scenarios
CodeCacheFilling Fill up code cache.
OutOfMemoryError JVM out of memory
cpufullload Process occupied cpu full load
delay delay time
full-gc JVM full gc
return Return the specify value
script Dynamically execute custom scripts
threadfull Specifies that the application thread is soaring
throwCustomException throw custom exception
throwDeclaredException Throw the first declared exception of method
5 C++應(yīng)用
cplus C++ chaos experiments contain code line delayed, variable modified and err returned
delay Code line delayed
modify Modify value of the variable in source code when program running
return error returned
6 阿里云
aliyun Aliyun experiment contains ecs, public ip, private ip, networkInterface, securityGroup, VSwitch, disk
disk do some aliyun diskId Operations, like detach
ecs do some aliyun ecs Operations, like stop, start, reboot
networkInterface do some aliyun networkInterfaceId Operations, like detach, attach
privateIp do some aliyun private ip Operations, like unassign
publicIp do some aliyun publicIp Operations, like release, unassociate
securityGroup do some aliyun securityGroupId Operations, like join, remove
vSwitch do some aliyun vSwitchId Operations, like delete
7 其他服務(wù)
ck Clickhouse experiment contains delay and exception by table name and so on
delay delay time
throwCustomException throw custom exception
druid Experiment with the Druid database connection pool, For example `blade create druid connectionpoolfull
connectionpoolfull Connection pool full
dubbo Dubbo experiment for testing service delay and exception
delay delay time
threadpoolfull Thread pool full
throwCustomException throw custom exception
es ElasticSearch experiment contains delay and exception by table name and so on
delay delay time
throwCustomException throw custom exception
feign feign experiment for testing service api delay and exception
delay delay time
throwCustomException throw custom exception
gateway gateway experiment contains delay and exception
delay delay time
throwCustomException throw custom exception
hbase hbase experiment contains delay and exception by table name and so on
delay delay time
throwCustomException throw custom exception
http http experiment for testing service delay and exception
delay delay time
throwCustomException throw custom exception
jedis jedis experiment contains delay and exception by command and so on
delay delay time
throwCustomException throw custom exception
kafka kafka experiment for testing service delay and exception
delay delay time
throwCustomException throw custom exception
lettuce redis client lettuce experiment
delay delay time
throwCustomException throw custom exception
update update action spec
log log experiment for testing service delay
delay delay time
throwCustomException throw custom exception
mongodb MongoDB experiment contains delay and exception by Collection name and so on
delay delay time
throwCustomException throw custom exception
mysql Mysql experiment contains delay and exception by table name and so on
delay delay time
throwCustomException throw custom exception
nginx Nginx experiment
config Config experiment
crash Crash experiment
response Response experiment
restart Restart experiment
psql Postgrelsql experiment contains delay and exception by table name and so on
delay delay time
throwCustomException throw custom exception
rabbitmq rabbitmq experiment
delay delay time
throwCustomException throw custom exception
redis Redis experiment
cache-expire Cache Expire
cache-limit Cache Memory Limit
redisson redisson experiment
delay delay time
throwCustomException throw custom exception
rocketmq Rocketmq experiment,can make message send or pull delay and exception,default if you not set [producerGroup,consumerGroup],will effect both send and pull message,if you only set producerGroup for specific group,will only effect on sendMessage,if you only set consumerGroup,will only effect pullMessage for specific group
delay delay time
throwCustomException throw custom exception
script Script chaos experiment
delay Script executed delay
exit Exit script
security SpringSecurity login experiment contains delay and exception by command and so on
delay delay time
throwCustomException throw custom exception
servlet Java servlet experiment, support path, query string, request method matcher
delay delay time
modifyCode update action spec
throwCustomException throw custom exception
strace strace experiment contains syscall delay or syscall error
delay Delay the syscall of the target pid
error change the syscall's return value of the target pid
systemd Systemd experiment
stop Stop systemd
tars tars experiment
delay delay time
throwCustomException throw custom exception
time Time experiment
travel Time Travel
zk zk experiment
delay delay time
throwCustomException throw custom exception