Pivot Tracing: Dynamic Causal Monitoring for Distributed Systems

第一个同时实现了dynamic instrumentation + cross-boundary propagation的工作。 提了一个happens-before关系,可以理解为属于一个request的path上(可以不相邻)的两个具有先后关系的事件。

主要解决两个问题

  • what gets recorded is defined a priori, at development or deployment time
  • the information is captured in a component- or machine-centric way, making it extremely difficult to correlate events that cross these boundaries

在Java基础上实现的。

Motivation

Pivot Tracing in Action

主要给了一个例子,HBase、Hadoop MapReduce和direct HDFS clients。 默认的HDFS只有dirct clients的信息,因此会将本来属于HBase和MapReduce clients的流量也都合并到一起去。

Pivot Tracing主要是在第一次被client protocol method处理的时候就记录下来到底是来自哪个客户端的。 然后将这个信息一起propagate。

利用Pivot Tracing能够将数据以不同的维度聚合起来。

Pivot Tracing Overview

图2给了Pivot Tracing的整体架构图。 Pivot Tracing主要提出了以下几个新的概念

  • tracepoints。instructions on where and how to change the system to obtain the exported identifiers。
  • queries。variables exposed by one or more tracepoints。
  • advices。intermediate representation。

Monitoring and Troubleshooting Challenges

  • Challenge 1: One size does not fit all,桩点的通用性问题。需要动态插桩来解决。
  • Challenge 2: Crossing boundaries,信息被局限在process/thread层面,没有办法实时cross boundaries。

实际上这边的单独拿出动态插桩来看、又或者是分布式追踪,其实都已经有相关的工作了。 但是在写这篇文章的时候,还没有同时有工作能够同时完成两个事情,这也是本篇文章的贡献。

Design

主要目标

  1. Dynamically configure and install monitoring at runtime
  2. Low system overhead to enable "always on" monitoring
  3. Capture causality between events from multiple processes and applications

一些主要设计(其实是提出的概念)

  • tracepoints
  • query language
  • happened before joins
    • 这个主要说一下,a->b表示a与b在处理同一个请求的时候(不一定相继)发生,且a的发生之后是b的发生。

Pivot Tracing Optimization

主要有以下优化

  • Baggage:evaluate happens-before关系需要全局视野,为了避免集中性能瓶颈,Pivot tracing利用baggage里面传递的一些信息,在原地进行了一些inline evaluation。
  • tuple aggregation:减少the number of tuples emitted for global aggregation。有Aggregation操作的queries就进行原地、周期性的聚合。
  • query optimization:减少the number of tuples packed。做法是pushes projection、selection和aggregation terms as close as possible to source tracepoints。
  • propagation overhead:为了避免baggage里面太多信息,可以revert to constant baggage size。所欲呕的tyuples是被emitted而不是packed。

Implementation

  • Agent:A Pivot Tracing agent thread runs in every Pivot Tracing-enabled process
  • Dynamic Instrumentation:Java的字节码增强,没什么好说的。
  • Baggage:thread-local variables。lazily serialized and deserialized using protocol buffers。
  • propagation:需要用户自己实现。
  • branches and versioning:a versioning scheme for baggage using interval tree clocks。
  • Materializing Advice:没什么好说的,一些实现。比如OBSERVE对应这个、UNPACK/PACK对应那个之类的。