Elasticsearch Sharding Deep Dive: Primary vs Replica, Custom Routing, Hot Shards
Автор: DevXOps Tech
Загружено: 2026-03-02
Просмотров: 11
Описание:
🔶 Brought to you by DevXOps — https://devxops.tech
Your go-to resource for animated deep dives into DevOps, distributed systems, and platform engineering.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Why does one Elasticsearch cluster feel lightning fast while another struggles with high CPU, slow searches, and unstable heap — even when they store the same data? The answer lies in two deceptively simple ideas: shards and routing.
In this animated explainer, we go from your application request all the way down to the kernel and hardware. You'll see how documents are routed to shards, why primary and replica shards play different roles, how adaptive replica selection picks the fastest copy, and when custom routing becomes a superpower or a footgun. Every concept has clear diagrams, step-by-step animations, and real-world analogies.
Whether you're sizing shards for a new index, debugging hot shards, or prepping for system design interviews — this video gives you the mental model to design shards for workload reality, not defaults.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 Timeline — What you'll learn:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⏱️ 0:00 — Hook: Why shards and routing decide your cluster fate
⏱️ 1:00 — First principles: What is a shard? (Lucene index under the hood)
⏱️ 2:20 — Primary vs replica shards (write path, read path, resilience)
⏱️ 3:50 — Indexing routing: How documents find their shard (hash formula)
⏱️ 5:20 — Indexing path: App → coordinator → primary → replicas → disk
⏱️ 6:50 — Search path: Query phase, fetch phase, fan-out trade-offs
⏱️ 8:10 — Adaptive replica selection and search routing
⏱️ 9:30 — Custom routing: Superpower or footgun? (multi-tenant, hot shards)
⏱️ 11:00 — Shard count: Too few vs too many (Goldilocks principle)
⏱️ 12:20 — System internals: JVM heap vs page cache, shard impact
⏱️ 13:40 — Network costs of shards and routing
⏱️ 14:40 — Hidden optimization tricks and caveats
⏱️ 16:00 — Recent version notes and migration caveats
⏱️ 16:50 — Practical examples (multi-tenant, time-series, oversharding)
⏱️ 18:00 — Recap: Mental model from app to hardware
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔑 Key concepts:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
• Shard — unit of storage and search, one Lucene index
• Primary shard — handles writes, authoritative copy
• Replica shard — copy for resilience and read throughput
• Routing — hash(_id) or hash(_routing) maps document to shard
• num_routing_shards, routing_factor — routing formula
• Query phase — fan-out to shards, merge results
• Fetch phase — retrieve full _source for top hits
• Adaptive Replica Selection (ARS) — picks fastest shard copy
• Custom routing — route by tenant_id, reduce fan-out
• Hot shard — skewed routing key, one shard overloaded
• Oversharding — too many shards, coordination storm
• JVM heap vs OS page cache — distinct memory areas
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
👥 Who is this for?
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Software engineers, DevOps/SRE, backend engineers, platform engineers, and system design interview prep. Whether designing shard strategy, debugging slow searches, or explaining Elasticsearch architecture in an interview — this video has you covered.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📺 More from DevXOps:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔹 Elasticsearch Inverted Index — From App to Hardware
🔹 Elasticsearch Text vs Keyword Fields — Mapping Deep Dive
🔹 Elasticsearch Refresh vs Flush vs Commit — Durability
🔹 Elasticsearch Translog and Durability — Crash Recovery
🔹 Why Kafka Is So Fast — Zero Copy & DMA
🔹 Kafka Data Plane Replication — Leaders, ISR & High Watermark
🔹 Kafka Consumer Groups — Rebalancing & Partition Assignment
🔹 Kafka Control Plane — ZooKeeper vs KRaft
🔹 More coming soon — subscribe!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🌐 Resources:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔗 https://devxops.tech
🔗 Elasticsearch Shards: https://www.elastic.co/guide/en/elast...
🔗 Routing: https://www.elastic.co/guide/en/elast...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Like 👍 and Subscribe 🔔 for more animated deep dives on Elasticsearch, Kafka, Kubernetes, and distributed systems!
#elasticsearch #shards #routing #elasticsearchshards #elasticsearchrouting #primaryshard #replicashard #adaptivereplicaselection #customrouting #hotshard #oversharding #elasticsearchtutorial #elasticsearchdeepdive #elasticsearcharchitecture #elasticsearchperformance #lucene #distributedsystems #devops #systemdesign #backend #platformengineering #SRE #elasticsearchinternals #elasticsearchcluster #elasticsearchindex #elasticsearchinterview #animatedexplainer #devxops #elastic #elasticsearchbestpractices #elasticsearchtuning #shardcount #routingformula #queryphase #fetchphase #elasticsearchfanout
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: