opensearch-project / opensearch-project/OpenSearch

Reduce created segments when there is low traffic on a shard

Open
#618 8 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

distributed framework enhancement Indexing:Performance lucene Priority-Low RFC
Dominant language
Java
Stars
13.7k
Forks
3k
Avg merge
2d 23h
Merged PRs (30d)
108

Description

Lucene creates 1 segment per active concurrent thread per shard. Number of active concurrent threads per shard is determined by bulk thread pool in ES, which is a worker on the queue holding sub bulk requests. Each sub-bulk request ends up being picked by a different thread, hence resulting in multiple segments during refresh, resulting in better performance during reads. When there is a low traffic on a particular shard on a node, we can potentially reduce the number of created segments by co-alescing bulk requests.

When there are lot of shards on a single node for different indices, this problem may aggravate further.

The proposal is to optimize this entire process is via the following tasks:

  • Pipeline the CPU work into different tasks further (parsing, translog, lucene add) per shard
  • Coalesce the lucene documents across different bulk requests by adding a separate queue for lucene adds.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by tracing the bulk thread pool and shard indexing path to understand where parsing, translog work, and Lucene adds are scheduled. Done would require implementing and validating the proposed task pipeline and coalescing Lucene documents across bulk requests, with evidence that low-traffic shards create fewer segments.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
performance, search
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.