One Billion Spans, One System: Inside Amazon OpenSearch Service's New Engine Optimized for Log Analytics
OpenSearch Service's new log-optimized engine combines Parquet columnar storage with a Lucene inverted index, enabling a hybrid "grep + aggregate" query to finish in 65 ms across 1B spans. On a 3-node, $4,400/mo cluster, it delivered 77 ms trace lookups, sub-3s dashboards, and 75% compression, collapsing the two-system observability stack into one.
Observability teams have lived with an uncomfortable trade-off for years: columnar analytical databases are fast at dashboard aggregations but can't search text; search engines excel at investigation but pay a storage and aggregation penalty. Many platform teams ended up running both: two systems, two pipelines, two bills, two things to page you at 3 AM.
With OpenSearch 3.5, Amazon OpenSearch Service introduced an engine option that collapses that trade-off: Optimized for log analytics. It stores data in Apache Parquet, executes analytics through a vectorized engine (Apache DataFusion), and, this is the key part, retains the Lucene inverted index alongside, routing each part of a query to the engine best suited to run it.
We put a billion OpenTelemetry trace spans through it to see what that architecture delivers in practice.
TL;DR: At 1B spans on a modest 3-data-node domain (~$4,400/month), dashboard-style aggregations complete in 0.5–2.6 seconds, trace lookups in 77 ms. And the query that defines incident response, "find every span mentioning 'timeout', then give me p99 latency by service," completes in 65 milliseconds. One query, one system, both engines.
What the optimized engine actually is
This is not a tuning profile; it's a different storage and execution stack running inside the same managed service:
Component | Role |
|---|---|
Apache Parquet | Primary columnar storage; dictionary encoding and tight numeric packing deliver major compression |
Apache DataFusion | Rust-based vectorized execution for aggregations, filters, and scans |
Lucene inverted index | Retained for full-text predicates (match, phrase, wildcard) on searchable fields |
Apache Calcite | Plans each PPL/SQL query and routes operations to the right engine (they can hand off mid-query) |
Apache Arrow | Zero-copy in-memory format connecting the pieces |
Amazon S3 | Durable backing store for both Parquet files and index segments |
You ingest through the same Bulk API and client libraries you already use. No new agents, no pipeline changes. Queries run in PPL and SQL and execute natively through the vectorized engine.
The test
Deployment
A deliberately modest, realistic domain, not a hero benchmark cluster:
- 3 × or2.4xlarge.search data nodes (16 vCPU / 128 GiB each), 3 AZs
- 3 × m7g.large.search dedicated leader nodes
- 2,500 GB gp3 EBS per node
- ~$4,360/month on-demand in us-east-2
Dataset: 1B OTel trace spans
One billion synthetic OpenTelemetry spans simulating a 14-service microservice architecture: checkout, payment, cart, inventory, and 10 additional backend services. Each trace carries 2-8 parent-child spans with realistic latency distributions, HTTP status codes, and searchable error messages ("NullPointerException…", "TimeoutException…", "CircuitBreakerOpen…"). Roughly 430 GB of raw JSON spread across a 24-hour window: the shape of a real mid-size observability workload.
Ingest ran through the standard Bulk API from a single c7g.4xlarge client with 10 parallel workers, sustaining ~70,000 documents/second without a single write rejection, while the cluster operated well below capacity. (AWS's own multi-client benchmark pushed 9 larger nodes to 1.78M docs/sec; a single Python client is nowhere near the engine's ceiling.)
Queries
Eight patterns spanning the observability workload, executed as PPL with 10 warm-up runs discarded and 50 measured runs each, from a client in the same region.
Results
Fifty measured runs per query, ten warm-up runs discarded, executed from a client in the same region. All 400 runs completed error-free.
# | Query | p50 | p95 | p99 |
|---|---|---|---|---|
1 | Error count by service | 1,566 ms | 1,582 ms | 1,618 ms |
2 | Span volume by host | 1,872 ms | 1,885 ms | 1,892 ms |
3 | p99 latency by service (full scan, no time filter)† | 17,657 ms | 23,741 ms | 23,830 ms |
4 | Top 10 slowest endpoints | 2,645 ms | 2,660 ms | 2,670 ms |
5 | Single trace lookup by traceId | 77 ms | 84 ms | 88 ms |
6 | Full-text grep: "NullPointerException" | 506 ms | 521 ms | 521 ms |
7 | Grep "timeout" + p99 aggregate by service | 65 ms | 73 ms | 77 ms |
8 | Service dependency aggregation | 5,602 ms | 5,624 ms | 5,632 ms |
†Intentional worst case: no time filter forces a full-history scan across all 1B spans. With a realistic 15-minute window, this drops to 257 ms — see Row-group pruning below.
Latency distributions were remarkably tight: most queries show <2% spread between p50 and p99, a sign of consistent engine behavior with no GC spikes or cache cliffs.
The three results that matter
1. Trace lookup: 77 ms across a billion spans (Q5). Finding one trace among 1,000,000,000 by ID is the bread-and-butter debugging flow. The query planner recognizes the selective predicate and routes it to the Lucene inverted index rather than scanning columnar data. This is the routing architecture working exactly as designed.
2. Full-text search: 506 ms to grep a billion error messages (Q6). "Which services are throwing NullPointerExceptions, and how many?" Answered in half a second. There is no LIKE-scan, no brute force: the inverted index resolves the text predicate directly. This capability simply does not exist in pure columnar log stores without bolting on a second system.
3. The hybrid query: 65 ms (Q7). This is the headline. "Find all spans whose error message mentions 'timeout', then compute p99 latency and hit counts by service." It's the exact query an engineer runs mid-incident: text search feeding analytics. The optimized engine executes it as one statement: Lucene resolves "timeout" to a candidate set near-instantly, hands it off mid-query, and DataFusion aggregates just those rows. Faster than any pure-aggregation query in the suite because the index collapsed a billion-row problem into a few-million-row problem before the analytical engine ever ran.
Why is a hybrid query faster than a pure aggregation? It's not magic — it's search-space reduction. Queries 1–4 scan all 1B rows because their predicates don't narrow the dataset enough for index routing to help. Q7's text predicate ("timeout") matches roughly 0.1% of spans. The inverted index resolves that in microseconds, collapsing a billion-row aggregation into a few-million-row aggregation before the vectorized engine ever starts. The engine isn't slow at analytics; it's fast at not doing unnecessary work.
That mid-query handoff is the architectural bet of the optimized engine, and at 1B scale it pays off visibly.
The row-group pruning effect
Q3 (percentile aggregation with no time filter) took 17.7 seconds. That's the worst case: scanning every Parquet row group across a full 24-hour, 1B-span dataset for a percentile computation.
Add a 15-minute time window, the way a real dashboard query would run:
Q3 variant | p50 latency |
|---|---|
No time filter (full 1B scan) | 17,657 ms |
With @timestamp >= 15 min ago | 257 ms |
69× faster. The engine prunes Parquet row groups by the timestamp column, reading only the sliver of data that falls within the window. This is the architecture working as designed: columnar storage enables aggressive physical pruning that inverted indexes can't match on range predicates.
The lesson for practitioners: time-scope your analytical queries. Every observability dashboard already does this; the engine rewards the pattern.
What this means for your observability stack
The investigation workflow lives in one system now. The classic incident flow — dashboard shows error spike → grep logs for the exception → aggregate the matches → pull the offending trace — used to span two systems with two query languages. Here it's three PPL queries against one domain: Q1 (1.6s) → Q7 (65ms) → Q5 (77ms). The entire flow completes in under 2 seconds of query time, on a $4,400/month domain, over a billion spans.
No pipeline migration. The Bulk API is unchanged. Existing Fluent Bit / OTel Collector / Data Prepper pipelines point at a new domain endpoint and keep working. Our entire 1B-span ingest used stock client libraries.
Storage economics. Our 1B spans occupied 430 GB as raw JSON. The optimized engine stored them in 105 GB primary (75.6% compression): Parquet with dictionary encoding on repeated service names, hosts, and operations, plus tight numeric packing on timestamps and durations. With one replica the total is 213 GB — still half the raw source size. At S3-backed storage rates, that's a meaningful retention cost reduction at multi-TB scale.
The rest of the box. ISM-managed retention and rollover, alerting, anomaly detection, IAM-native security, OpenSearch Dashboards with PPL and natural-language query assistance. These are capabilities that would otherwise be assembled from three or four additional components around a bare analytical database.
Considerations before adopting
Consideration | Detail |
|---|---|
PPL and SQL only | The DSL query API is not supported on the optimized engine at launch. Dashboards and alerting monitors built on DSL need migration to PPL/SQL. |
Domain-level choice at creation | You cannot convert an existing domain. Create a new one (Console → use case: Observability) and repoint pipelines. |
Append-only log workloads | Relevance ranking, vector search, Painless scripting, nested queries, and in-place updates remain the general-purpose engine's territory. |
No write-time dedup | The engine is append-only with no native document-level deduplication on ingest. In at-least-once pipelines (network retries, pipeline restarts), duplicates will land. PPL's dedup command handles this at query time, but if your workflow requires write-time idempotency, add dedup logic upstream (Data Prepper, Flink, or collector-level) before ingest. |
Top-N approximation | Like any distributed engine, top N aggregations are computed per-shard and merged — results may be incomplete when cardinality is high relative to N and distribution is skewed across shards. This is not specific to the optimized engine (it exists in traditional OpenSearch/Elasticsearch too), but it's worth noting for real-time analytics use cases. For exact results, increase the shard-level sample size or use a two-pass approach. |
Time-scope your queries | Row-group pruning is the engine's superpower; unfiltered full-history scans (like Q3 without a filter) are its weak spot. |
Bottom line
At a billion spans, the optimized engine delivered sub-2-second dashboard aggregations, 77 ms trace lookups, and 65 ms search-plus-aggregate queries, on three mid-size nodes, ingesting through unchanged standard APIs. The two-system observability architecture existed because no single engine could do both jobs. That assumption is now worth re-testing against your own workload.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article