All articles

What Lucene Got Right, and What the Cloud Changed

Lucene got immutable segments and concurrent reads right. JVM overhead, stateful shards and idle capacity make its traditional server architectures a poor default for agent workloads.

An intact blue segmented core emerges from a much larger open housing while continuous ribbons pass through it, suggesting useful search foundations freed from cumbersome operating machinery.

Lucene earned its place at the foundation of search. Its immutable segments, consistent readers and incremental indexing solved difficult performance problems. Elasticsearch, OpenSearch and Solr brought that foundation into services that teams could deploy and operate at scale.

Those achievements also made an operating model familiar: provision a cluster, size its heaps, arrange shards and replicas, and keep enough capacity warm for the next peak. We think that model has aged badly. Agent workloads expose its costs, and renting the machines from a cloud provider does little to change them.

Lucene is a library; Elasticsearch, OpenSearch and Solr make their own server and deployment decisions around it. The distinction matters when assigning responsibility. Together, however, Lucene's managed runtime and the traditional stateful architectures built around it leave customers carrying too much memory overhead, capacity planning and background work. They are aging foundations for a workload that increasingly needs cheap requests, predictable tail latency and rapid changes in serving capacity.

The foundations Lucene got right

A segment is a searchable index over a subset of documents. Buffered additions become new segments when flushed. Each segment has an immutable core, with deletion state and doc-values updates handled separately. Readers keep a consistent view while indexing continues. Lucene's index documentation describes these boundaries.

That separation makes concurrent reads tractable. A merge produces new files while an existing query finishes against its original view. Immutable files are also straightforward to copy and cache because their contents do not change underneath a reader. These properties remain valuable when durable files live in object storage.

Lucene also separates search visibility from durable commits. Near-real-time readers can observe uncommitted changes, allowing applications to control freshness without paying for a durable commit on every write. DirectoryReader exposes that explicitly.

These are ideas worth carrying forward. They explain why a new engine can share some of Lucene's design principles while making very different choices about memory, storage and scheduling.

Agents make the overhead harder to afford

An agent can search, inspect the result, reformulate and search again before its user sees an answer. It can also launch several searches together. That makes retrieval part of the reasoning loop, with costs and delays accumulating across the task.

Consider a task with ten sequential retrieval steps. An extra delay on each step accumulates ten times. When a step waits for a batch of parallel searches, the slowest required response sets its completion time. A good median can hide a poor experience under bursts.

This is the operational argument behind rebuilding search for the agentic era: measure cost per successful task and latency under concurrent requests. The engine also has to accommodate quiet customer collections without keeping all their serving resources allocated. The combination demands efficiency during a burst and low cost between bursts.

Garbage collection becomes a scaling concern

Lucene and its Java server ecosystem bring a managed heap and garbage collector into that critical path. Garbage collection consumes CPU, and its pauses can delay requests. Allocation pressure from concurrent work can turn available compute into memory-reclamation work precisely when demand is rising. Elastic documents that high JVM memory pressure can degrade performance and trigger circuit breakers, and that collection becomes more frequent and takes longer as pressure increases. Elasticsearch memory-pressure guidance.

This gives operators another workload to provision for. They need enough memory headroom for the collector and enough CPU to reclaim memory while queries and indexing continue. A pause can also affect several requests sharing a JVM, making it especially relevant when agents fan out across a service.

Scaling up therefore requires more than choosing a larger instance. A larger heap can relieve pressure, but its collection behavior must be tested against the latency target. Solr's own guidance recommends examining GC logs, leaving headroom, keeping heaps as small as good performance allows and testing larger heaps extensively. Solr JVM settings.

The JVM can execute fast code, and Lucene already uses SIMD acceleration. The operational disadvantage is the additional reclamation work and latency variability a service must budget for. Those costs matter even when the query loop itself is efficient.

Memory management is still the operator's job

Automatic reclamation does not eliminate memory management at the system level. Someone still has to balance heap, native allocations and filesystem cache, monitor GC behavior, investigate retained objects and decide how much concurrent work a node can admit.

Elasticsearch recommends keeping heap at or below 50% of available memory and below the compressed-object-pointer threshold, leaving room for other allocations and caching. It also warns that larger heaps can cause longer GC pauses. The remaining RAM is useful; the problem is that more installed memory does not translate directly into an equally larger efficient heap. Elasticsearch JVM guidance.

OpenSearch likewise documents explicit heap sizing, native-memory requirements and host settings as part of production setup. Managed services can take over those decisions, but their resource costs still exist. OpenSearch installation guidance.

Scaling out introduces another set of costs. New JVM processes initialize and build up optimized code through profiling and compilation, while the service loads its working data. JIT warm-up applies to a new process; reopening a collection inside an already-warm process need not repeat it. HotSpot compilation.

For an elastic service, time until new capacity is useful matters as much as the time it takes to launch a machine. Heap sizing, GC diagnosis and runtime warm-up make that path harder to operate predictably.

Stateful shards make elasticity expensive

Traditional search clusters use replicas for several purposes: retaining another copy of data, taking over after failure and adding query capacity. When these responsibilities share the same serving nodes, scaling decisions inherit storage and recovery obligations.

Elastic's shard-sizing guidance illustrates the balancing act. Small shards multiply overhead; large shards can slow recovery. Its suggested 10–50 GB range is a starting point that still requires workload-specific testing. Splitting, shrinking, reindexing and rollover provide ways to change the layout, with operational work attached.

For an application with many customer collections, that is a poor abstraction to expose. Customers need isolation and capacity when traffic arrives. They should not have to forecast physical partitions or fund idle serving copies simply to retain their data.

A service designed around remote durable state can schedule serving capacity independently and load the data it needs. It still has to manage placement, availability and cold starts. The opportunity is to make those responsibilities part of the service rather than recurring customer infrastructure projects.

Updates and merges consume the same budget

Immutability has a price. Lucene's ordinary document replacement deletes and re-adds the document, and merges eventually reclaim the old data. Selected doc-values updates have a separate path. IndexWriter documents these behaviors.

Repeated updates therefore create work beyond the incoming document bytes. Merges consume CPU and I/O, and a backlog can affect ingestion: Lucene's ConcurrentMergeScheduler can throttle indexing threads when too many merges accumulate.

Object storage changes the bill again. Merged files must be published, and obsolete files must remain available until readers and retained snapshots no longer need them. Freshness, upload batching, reclamation and query latency become connected decisions. These costs belong in a capacity model alongside foreground queries.

Any engine adopting immutable segments inherits versions of this trade-off. A modern implementation needs to design and measure background work as carefully as its fastest query path.

Moving files to the cloud is only the beginning

The Lucene ecosystem is responding with substantial redesigns. Elastic's Serverless architecture separates indexing and search compute, with durable index data, translogs and cluster state in object storage. Its hollow shards release idle indexing writers and readers from memory. OpenSearch's remote-backed storage moves transaction logs and segments into remote storage and supports segment replication.

These are meaningful changes. They demonstrate how much of the traditional architecture must be reconsidered, and why Lucene-based deployments should be judged individually. They also leave a demanding engine problem: how much useful work can each byte of memory and each CPU second support?

Remote reads make that question concrete. Several dependent reads that are cheap against local storage can become several network round trips. File layout, metadata prefetching and request coalescing determine how much a cold query waits. Lucene provides an optional prefetch API; the storage implementation and execution path must make effective use of it.

Elastic's refresh-cost work shows the additional engineering: batch uploads and let search nodes fetch recent segments from indexing nodes before those segments reach object storage. A filesystem adapter alone cannot deliver the same result.

A different default for the next generation

Our view is that the traditional Lucene, Elasticsearch, OpenSearch and Solr operating model is no longer a good default for new agent applications. A stack that needs persistent capacity, careful heap management and customer-led shard planning is poorly prepared for their economics. Adding an agent API leaves those costs intact.

As we argued in AI-Ready Search Starts With a More Efficient Engine, the opportunity is to redesign execution and infrastructure together. WarpSearch uses a C++ core to control data layout, buffer reuse and memory reclamation directly. That removes JVM heap collection from our core execution path; it also makes memory safety and allocator behavior our responsibility. Performance still has to be demonstrated under comparable workloads.

WarpSearch keeps collection data in object storage with local caching and can release serving compute for idle collections. Our collection lifecycle documents the resulting warm-up behavior. Our durability contract distinguishes local persistence from durability=strong, which waits for object-store persistence on managed collections.

The test for any replacement is concrete: cost per successful agent task, p99 during concurrent bursts, time to add useful capacity, memory per active and idle collection, and performance while updates and merges run. Cold requests belong in that test too.

Lucene deserves credit for the foundations it established. Today's workloads deserve an engine and operating model designed around today's constraints. We think rebuilding that machinery is overdue.

Cookie settings

Optional tracking stays off until you choose it. Your choice applies to this browser for 180 days. Read the details.

Essential storage keeps you signed in, protects forms, and remembers this choice. It is always available.