3MileBeach: A Tracer with Teeth

3MileBeach通过在消息序列化库层插桩,透明地提供细粒度的跟踪和故障注入功能。

Motivation

主要是fault injection方面的motivation。

现有的框架没有考虑到时序的bug注入。 比如TOCTTOU Bugs,也就是Time Of Check To Time Of Use Bugs。一个service在check之后变得不可用了,导致引发一些错误。 解决方法是分成离散的时间段。

Temporal Fault Injection,TFI的关键见解如下

  • 搜索空间其实不大。 Injecting a given fault at every logical state of service’s implicit state machine就足够了。
  • 在基于微服务的架构中,有一个方便的choke point,就是序列化/反序列化的库
  • 基于上下文传播机制的介入使我们能够设计出第一个实用的故障注入器来实现TFI。可以根据context来决定故障的注入策略

Implementation

Architecture Abstraction

介绍context-propagation mechanism。

3MileBeach利用微服务架构的限制提供跟踪和故障注入。 微服务框架为每个微服务提供管道抽象,如service handlers,允许服务将逻辑(如处理程序功能)与inbound和outbound消息(即请求和响应)相关联。 因此inbound和outbound在序列化和反序列化的时候是插桩的好时机。

  • inbound component deserializes raw inbound messages extracted from the network, and invokes the service handler
  • outbound component processes outbound messages from the service handler, then sends the data as outgoing messages

Data structure

applied data structures to carry 3MileBeach’s payload。主要包括

  • 事件:记录了时间戳、行动(收到或发送)、类型(请求或响应)、名称
  • 故障注入配置

Algorithms

the algorithms to collect traces and to inject faults