Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第 42 期 failpoint 设计与实现 #372

Closed
lonng opened this issue May 8, 2019 · 0 comments
Closed

第 42 期 failpoint 设计与实现 #372

lonng opened this issue May 8, 2019 · 0 comments
Labels
Go 夜读 Go 夜读:主题分享 已分享 ✅ Go 夜读的分享状态:分享已完成。

Comments

@lonng
Copy link

lonng commented May 8, 2019

Failpoint 介绍

Failpoint 是 FreeBSD failpoints 的 Golang 实现,允许在代码中注入错误或异常行为, 并由环境变量或代码动态激活来触发这些异常行为。对于一个大型复杂的系统来说,通常包含多个模块或多个组件构成,模拟各个子系统的故障是测试中必不可少的环节, 并且这些故障模拟必须做到无侵入地集成到自动化测试系统中,通过在自动化测试中自动激活这些 failpoint 来模拟故障,并观测最终结果否符合预期结果来判断系统的正确性和稳定性。 etcd 团队在 2016 年实现了 gofail 极大地简化了错误注入,为 Golang 生态做出了巨大贡献。
如果在一个分布式系统中需要专门请一位同事来插拔网线来模拟网络异常,一个存储系统中需要通过破坏硬盘来模拟磁盘损坏,昂贵的测试成本会让测试成为一场灾难, 并且难以模拟一些需要精细化控制的的测试。Failpoint 能用于各种复杂系统中模拟错误处理来提高系统的容错性、正确性和稳定性,比如:

  • 微服务中某个服务出现随机延迟、某个服务不可用
  • 存储系统磁盘 IO 延迟增加、IO 吞吐量过低、落盘时间长
  • 调度系统中出现热点,某个调度指令失败
  • 充值系统中模拟第三方重复请求充值成功回调接口
  • 游戏开发中模拟玩家网络不稳定、掉帧、延迟过大等,以及各种异常输入(外挂请求)情况下系统是否正确工作
  • 等等

本次主要分享 failpoint 设计与实现,以及如何将 failpoint 应用到项目中来提高程序的健壮性。

预备知识

  • Golang 基本语法
  • AST 基本概念
  • fault injection 基本概念

参考资料

讨论

讨论的朋友可以进 Slack channel

分享时间

2019 年 5 月 16 日 21 点

@yangwenmai yangwenmai added Go 夜读 Go 夜读:主题分享 分享话题 labels May 8, 2019
@yangwenmai yangwenmai pinned this issue May 8, 2019
@yangwenmai yangwenmai changed the title 【分享】failpoint 设计与实现 第 42 期 Go 夜读之 failpoint 设计与实现 May 13, 2019
@yangwenmai yangwenmai unpinned this issue May 16, 2019
@yangwenmai yangwenmai changed the title 第 42 期 Go 夜读之 failpoint 设计与实现 第 42 期 failpoint 设计与实现 Feb 2, 2020
@yangwenmai yangwenmai added the 已分享 ✅ Go 夜读的分享状态:分享已完成。 label Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Go 夜读 Go 夜读:主题分享 已分享 ✅ Go 夜读的分享状态:分享已完成。
Projects
Development

No branches or pull requests

2 participants