Hands On System Design - Distributed Systems Implementation

Hands On System Design - Distributed Systems Implementation

🔍 Day 27: Building a Distributed Log Query System Across Partitions

Week 4: Distributed Log Storage | 254-Day Hands-On System Design Series

Jun 07, 2025
∙ Paid

📋 Table of Contents

  1. The Detective's Challenge

  2. Core Architecture & Concepts

  3. Implementation Deep Dive

  4. Hands-On Project Implementation

  5. Build, Test & Verification Guide

  6. Performance Optimization

  7. Real-World Applications

  8. Assignment & Next Steps


🕵️ The Detective's Challenge

Imagine you're a detective trying to solve a case, but the evidence is scattered across 50 different filing cabinets in different buildings. You need to search all of them efficiently and piece together the results. That's exactly what we're building today - a system that can query logs distributed across multiple partitions and return coherent, ordered results.

Yesterday, we built a cluster membership system that knows which nodes are alive and healthy. Today, we're leveraging that foundation to build something even more powerful: a query system that can intelligently search across your entire distributed log cluster.

Why This Matters in Production Systems

When Netflix processes billions of log events per day across thousands of services, they can't afford to have engineers manually checking each partition when debugging an issue. Their query system needs to:

  • ✅ Search across hundreds of partitions simultaneously

  • ✅ Return results in seconds, not minutes

  • ✅ Handle partial failures gracefully

  • ✅ Maintain consistent ordering across time zones

The key insight that separates production systems from toy implementations is query planning. Just like a database query planner, our system needs to be smart about which partitions to query, how to parallelize the work, and how to merge results efficiently.


🏗️ Core Architecture & Concepts

The Scatter-Gather Pattern with Intelligence

Our distributed query system implements the scatter-gather pattern but with a critical enhancement: smart routing. Instead of blindly querying every partition, we use metadata to route queries only to relevant partitions.

Client Query → Query Coordinator → Smart Router → Relevant Partitions
                      ↓
            Result Merger ← Parallel Results ← Query Executors
                      ↓
                Final Response

Three Core Components

User's avatar

Continue reading this post for free, courtesy of System Design Course.

Or purchase a paid subscription.
© 2026 Systemdr, Inc. · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture