TL;DR
Distributed tracing generates massive amounts of data, forcing systems to rely on lossy sampling techniques that often miss critical edge-case bugs. This paper introduces Tracezip, an online trace compression system that uses a novel Span Retrieval Tree (SRT) to eliminate redundant data at the source. By compressing traces before transmission, Tracezip drastically reduces network and storage overhead—boosting throughput by 8x—without sacrificing the completeness of the trace data.
What Problem Does This Paper Address?
In modern cloud and microservice architectures, a single user request might touch dozens of different services. Distributed tracing tracks these requests, providing a granular view of system health and bottlenecks. However, tracing every request generates an enormous volume of data (e.g., Google generates around 1,000 TB of raw traces daily).
To manage this overhead, the industry standard is sampling:
- Head-based sampling: Randomly decides to trace a tiny fraction (e.g., 1%) of requests at the start. This is cheap but often misses rare, critical edge cases (like tail latency spikes).
- Tail-based sampling: Traces everything, but only saves the traces that exhibit errors or high latency. This captures the edge cases but still incurs massive network and compute overhead because all the raw data must be collected and ingested by the backend first.
The authors tackle this dilemma by asking: Can we reduce the overhead of tracing without throwing away data?
Methods
The authors observed that trace data is highly redundant. Up to 70% of the key-value pairs in trace spans (e.g., hostnames, standard HTTP tags, repetitive structural schemas) are identical across multiple requests. Standard compression tools like gzip struggle here because they only look for redundancy within a small, localized sliding window.
To exploit this global redundancy, the authors developed Tracezip, which sits directly inside the tracing agent at the service side:
- Span Retrieval Tree (SRT): Tracezip builds a prefix-tree-like data structure in memory. When a trace span is generated, its common, repetitive fields (universal fields) are mapped to a path in the SRT.
- Path Identifiers: Instead of sending the full JSON span, Tracezip sends a tiny "path identifier" representing the shared fields, plus only the unique "local fields" (like specific timestamps or span IDs).
- Tree Restructuring & Mapping: To keep the SRT small, Tracezip dynamically reorders the tree and uses a dictionary to map common string tokens to short alphanumeric hashes.
- Differential Synchronization: The service only sends incremental updates of the SRT to the backend. The backend uses its synced copy of the tree to perfectly reconstruct the original spans.
Datasets
The authors evaluated Tracezip on a mix of open-source benchmarks and real-world production data:
- Train Ticket: A popular open-source railway ticketing benchmark comprising 41 microservices.
- Cloud Application Components: Standard infrastructure services including gRPC, Apache Kafka, Servlet, MySQL, Redis, and MongoDB.
- Alibaba Production Traces: A massive dataset collected from a deployment of over 20,000 microservices, totaling 26.15GB of raw trace data.
Key Insights and Ideas
- Global vs. Local Redundancy: General-purpose compressors are blind to the long-term structural repetition of telemetry data. By maintaining a continuous, global state (the SRT), Tracezip achieves much deeper compression.
- Pre-Serialization Compression: Tracezip compresses data before it is serialized into JSON. This avoids the CPU-intensive process of serializing the same strings repeatedly, massively speeding up the pipeline.
- Orthogonal to Sampling: Tracezip doesn't replace sampling; it complements it. By making trace transmission vastly cheaper, operators can afford to increase their sampling rates.
Key Results
- Compression Ratio (CR): Tracezip reduces data size by a factor of ~4x to 6.5x. When paired with standard compressors like
lzma, it boosts their compression ratios by 10% to 45%. - Production Scale: On the Alibaba dataset, combining Tracezip with
lzmaachieved a CR of 13.69, shrinking 26.15GB to just 1.91GB. - Throughput & Speed: Tracezip accelerated trace collection throughput by nearly 8x (from 13.78 MB/s to 109.68 MB/s) compared to standard JSON transmission.
- Low Overhead: The memory footprint is negligible—typically around 2.5 MB—and CPU utilization is only 20%–40% of what
gziprequires.
Limitations and Future Work
- Highly Random Data: Tracezip relies on structural repetition. For systems like Apache Kafka with highly variable payloads, the improvement was less than 10%.
- Memory Trade-offs: The system relies on a threshold parameter ($\psi$) to manage tree size. While the authors cap the structure at 5MB, some tuning is required for optimal efficiency.
- Future Directions: Future work could explore native integration with binary formats like Protocol Buffers to push throughput even higher.
Summary updated