Tuning refresh interval vs. search after for high-concurrency latency
0 reputation · 06 Jul 2025, 19:57 UTC
Managing P99 latency in Elasticsearch under heavy concurrent load involves a trade-off between segment management and query efficiency. Increasing the index.refresh_interval mitigates CPU and I/O spikes caused by frequent segment creation and subsequent merges, but it delays the visibility of new documents to search queries.
Conversely, while utilizing the search_after API provides a performant method for deep pagination without the overhead of large offsets, it requires the client to track unique sort values. When the system faces simultaneous high-write and read pressure, the overhead of the refresh process can lead to thread pool exhaustion, further exacerbating tail latency.
How does a high refresh interval impact the stability of search-after cursors when documents are being indexed rapidly?
What is the documented threshold for refresh interval tuning where the gain in segment merge performance outweighs the cost of data staleness?