Self-Hosted Open Source Infrastructure
OpenSearch Shard Optimization: Managing Petabyte-Scale Log Indexes Without Cluster Performance Degradation
OpenSearch clusters degrade when shard count grows unchecked. Too many small shards waste memory and CPU; too few large shards create hotspots. At petabyte scale, shard strategy determines whether the cluster survives. This guide optimizes shards for log workloads.
Príomhphointí
- Size shards deliberately. Target 10-50 GB per shard; smaller shards waste overhead, larger ones slow recovery.
- Use time-based indices. Daily or weekly indices match log ingestion patterns and simplify retention.
- Limit shard count. Keep total shards under a few thousand per node to avoid memory pressure.
- Configure ILM policies. Automate rollover, shrink, and delete to control shard growth.
- Use forcemerge on old indices. Merging segments reduces memory and improves query speed.
- Monitor shard allocation. Uneven distribution creates hot nodes; use allocation awareness.
- Tune refresh intervals. Longer intervals reduce indexing overhead for high-throughput logs.
- Plan capacity. Calculate shard count from data volume and retention before deploying.
Architecture
Logs flow into time-based indices, each with a configured number of primary shards. ILM policies rollover when size or age thresholds are met, shrink old indices, and delete expired data. Shard allocation balances across nodes, and forcemerge compacts segments.
Production configuration
Edge cases from production
- Rollover requires an alias; ensure the write alias points to the current index.
- Shrinking changes shard count; queries must handle the new topology.
- Forcemerge on large indices is I/O intensive; schedule during low traffic.
- Replica shards double storage; balance cost against availability needs.
Ceisteanna coitianta
How many shards per node?
Keep total shards under a few thousand per node; memory is the limiting factor.
Should I use daily or weekly indices?
Daily for high-volume logs, weekly for lower volume; match to your data rate.
What happens if I have too many shards?
Memory pressure, slow queries, and cluster instability.
Can I change shard count after creation?
No, you must reindex; plan shard count before going live.
How do I reduce shard count?
Use shrink or reindex to consolidate into fewer shards.
Conas a chabhraíonn Kinetikatech le self-hosted open source infrastructure
Tá an tairiscint simplí: Running sovereign collaboration, storage, and identity stacks on hardware you control. Cuir ar iontaoibh dár seirbhís Bainistíocht Freastalaithe agus Cothabháil Suíomh Gréasáin é agus beidh clúdach iomlán agat: measúnú dáiríre, cur i bhfeidhm glan, faireachán gan stad.