Course contentsShow
← System Design
Lesson 1245 of 1,91931. Observability: TracingFree lesson

Trace Storage Backends

Compare Cassandra, Elasticsearch, and other storage options for trace data with their tradeoffs in cost and query speed.

Trace Storage Backends

You'll learn: How to choose between Cassandra, Elasticsearch, and other storage systems for trace data based on cost and query performance tradeoffs.

Why Storage Matters for Traces

Distributed traces generate massive volumes of data—every request creates multiple spans across services. You need a storage backend that can handle high write throughput, support complex queries (like finding all traces with latency >500ms), and remain cost-effective at scale.

Popular Storage Options

Cassandra

Best for: High write throughput and horizontal scalability. Cassandra excels at ingesting millions of spans per second across multiple nodes. It's optimized for time-series data with excellent compression.

Tradeoff: Query flexibility is limited. Searching by arbitrary tags or performing ad-hoc analysis requires careful schema design upfront. Complex queries can be slow or impossible without pre-defined indexes.

Elasticsearch

Best for: Flexible querying and full-text search. You can filter traces by any span attribute, search error messages, or build complex aggregations without pre-planning indexes.

Tradeoff: Higher resource consumption (CPU, RAM, storage) means increased costs. Write-heavy workloads require more tuning and cluster capacity than Cassandra.

Other Options

  • ClickHouse: Columnar database offering excellent compression and fast analytical queries at lower cost than Elasticsearch
  • Object Storage (S3/GCS): Cheapest for long-term retention but slow query performance; good for compliance archives
  • BadgerDB/LevelDB: Embedded databases for small-scale or single-node deployments

The Decision Matrix

Think of it like choosing transportation: Cassandra is a cargo train—handles huge volumes efficiently but follows fixed routes. Elasticsearch is a helicopter—goes anywhere you need but burns more fuel.

Key Takeaway: Choose Cassandra for write-heavy workloads with predictable query patterns; choose Elasticsearch when query flexibility justifies higher costs; consider ClickHouse or hybrid approaches for balanced needs.