From 079c057137fa1c20b4800e0f34bad613d36af851 Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Tue, 7 Jul 2026 22:26:51 +0530 Subject: [PATCH 1/8] docs(kafka): IMDEEPMIND-34: added kafka introduction note --- .../kafka/_category_.json | 4 + .../kafka/introduction.md | 307 ++++++++++++++++++ .../rabbit-mq.md | 2 +- .../distributed-system-communication/sns.md | 4 +- .../distributed-system-communication/sqs.md | 4 +- 5 files changed, 316 insertions(+), 5 deletions(-) create mode 100644 docs/system-design/distributed-system-communication/kafka/_category_.json create mode 100644 docs/system-design/distributed-system-communication/kafka/introduction.md diff --git a/docs/system-design/distributed-system-communication/kafka/_category_.json b/docs/system-design/distributed-system-communication/kafka/_category_.json new file mode 100644 index 000000000..51ff9e11f --- /dev/null +++ b/docs/system-design/distributed-system-communication/kafka/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Kafka", + "position": 2 +} diff --git a/docs/system-design/distributed-system-communication/kafka/introduction.md b/docs/system-design/distributed-system-communication/kafka/introduction.md new file mode 100644 index 000000000..75fa1c9be --- /dev/null +++ b/docs/system-design/distributed-system-communication/kafka/introduction.md @@ -0,0 +1,307 @@ +--- +sidebar_position: 1 +--- + +# Introduction + +**Apache Kafka** is a distributed event streaming platform designed to handle large volumes of data in real time. It allows applications, services, and systems to continuously exchange data through streams of events while providing high throughput, fault tolerance, scalability, and durability. + +Kafka was originally developed at LinkedIn to solve challenges related to processing massive amounts of real-time data and was later open-sourced through the Apache Software Foundation. + +At its core, Kafka acts as a highly scalable, distributed commit log where data is written, stored, replicated, and consumed by multiple applications independently. + +
+ +```mermaid +graph LR + + Producer1[Order Service] + Producer2[Payment Service] + Producer3[User Service] + + Kafka[(Kafka Cluster)] + + Consumer1[Analytics Service] + Consumer2[Notification Service] + Consumer3[Fraud Detection Service] + + Producer1 --> Kafka + Producer2 --> Kafka + Producer3 --> Kafka + + Kafka --> Consumer1 + Kafka --> Consumer2 + Kafka --> Consumer3 +``` + +
+ +In the above example: + +* Multiple applications produce data into Kafka. +* Kafka stores the data reliably. +* Multiple consumers can independently read the same data. +* Producers and consumers remain loosely coupled. + +## Why Kafka Was Created + +Before Kafka, many organizations relied on traditional messaging systems, databases, or custom integrations for exchanging data between services. + +As systems grew larger, several challenges emerged: + +### Tight Coupling + +Applications often communicated directly with one another. + +```text +Order Service → Payment Service +Order Service → Email Service +Order Service → Analytics Service +Order Service → Inventory Service +``` + +As the number of services increased, managing these connections became increasingly complex. + +### Scalability Problems + +Traditional systems struggled to handle: + +* Millions of messages per second +* Thousands of concurrent consumers +* Continuous streams of real-time data + +### Data Replay Difficulties + +In many messaging systems, once a message was consumed, it disappeared permanently. + +If: + +* A consumer crashed +* A bug corrupted data +* A new service needed historical data + +Recovering the original messages became difficult or impossible. + +### Reliability Concerns + +Organizations needed guarantees that: + +* Messages would not be lost +* Systems could survive failures +* Data remained available during outages + +Kafka was designed specifically to address these challenges. + +## Core Goals of Kafka + +Kafka was built around several key objectives. + +### High Throughput + +Kafka is capable of handling millions of messages per second by: + +* Sequential disk writes +* Efficient batching +* Network optimization +* Distributed architecture + +### Fault Tolerance + +Failures are expected in distributed systems. + +Kafka protects against failures by: + +* Replicating data across multiple servers +* Automatically electing new leaders during failures +* Preserving data durability + +### Scalability + +Kafka clusters can scale horizontally. + +
+ +```mermaid +graph LR + + B1[Broker 1] + + B2[Broker 2] + + B3[Broker 3] + + B4[Broker 4] + + B5[Broker 5] + + B1 --- B2 + B2 --- B3 + B3 --- B4 + B4 --- B5 +``` + +
+ +As workload increases, additional brokers can be added to the cluster. + +### Durability + +Kafka stores data on disk and replicates it across brokers. + +This ensures data remains available even if servers fail. + +### Decoupling + +Kafka separates producers from consumers. + +Producers do not need to know: + +* Who consumes the data +* How many consumers exist +* Whether consumers are currently online + +Consumers can independently read data whenever needed. + +## Kafka as a Distributed Commit Log + +One of the most important ways to understand Kafka is to think of it as a **distributed commit log**. + +A commit log is an append-only data structure where new records are continuously added to the end. + +```text ++---------------------------------------------------+ +| Record 0 | Record 1 | Record 2 | Record 3 | ... | ++---------------------------------------------------+ +``` + +Existing records are not modified. + +New records are simply appended. + +This design provides several benefits: + +* Fast writes +* Predictable performance +* Ordered storage +* Efficient replication + +Kafka extends this concept across multiple machines, making it a distributed commit log. + +
+ +```mermaid +graph LR + + P[Producer] + + B1[(Broker 1)] + B2[(Broker 2)] + B3[(Broker 3)] + + P --> B1 + + B1 --> B2 + B1 --> B3 +``` + +
+ +Data written by producers can be replicated across multiple brokers, providing durability and fault tolerance. + +## Kafka as an Event Streaming Platform + +Kafka is often described as an **event streaming platform** rather than simply a message broker. + +A message broker primarily focuses on delivering messages between applications. + +Kafka goes further by providing: + +* Persistent storage +* Stream processing capabilities +* Replayability +* Large-scale event distribution +* Long-term event retention + +
+ +```mermaid +graph LR + + A[Application] + + K[(Kafka)] + + S1[Analytics] + S2[Monitoring] + S3[Search] + S4[Data Lake] + + A --> K + + K --> S1 + K --> S2 + K --> S3 + K --> S4 +``` + +
+ +A single event written to Kafka can be consumed by many independent systems without affecting other consumers. + +## Common Use Cases of Kafka + +Kafka is widely used across modern distributed systems. + +### Microservices Communication + +Services exchange events without direct dependencies. + +```text +Order Created +Payment Completed +Inventory Updated +Shipment Delivered +``` + +### Log Aggregation + +Application logs from many servers are collected into Kafka and processed centrally. + +### Real-Time Analytics + +Business metrics can be calculated as events occur. + +Examples: + +* User activity +* Purchases +* Clickstreams +* Application metrics + +### Event Sourcing + +Kafka can serve as the central event store for applications that store state changes as events. + +### Data Integration + +Kafka acts as a data backbone connecting: + +* Databases +* Applications +* Data warehouses +* Analytics systems + +## Why Kafka Became Popular + +Kafka became one of the most widely adopted data platforms because it combines several capabilities into a single system: + +* Message distribution +* Persistent storage +* Horizontal scalability +* Fault tolerance +* Event replay +* Stream processing support + +Instead of building separate systems for messaging, storage, replication, and event distribution, organizations can use Kafka as a unified event streaming platform. + +This makes Kafka a foundational component in modern data platforms, microservice architectures, real-time analytics systems, and event-driven applications. diff --git a/docs/system-design/distributed-system-communication/rabbit-mq.md b/docs/system-design/distributed-system-communication/rabbit-mq.md index 516646e0e..52ca5c79a 100644 --- a/docs/system-design/distributed-system-communication/rabbit-mq.md +++ b/docs/system-design/distributed-system-communication/rabbit-mq.md @@ -1,5 +1,5 @@ --- -sidebar_position: 4 +sidebar_position: 5 --- # RabbitMQ diff --git a/docs/system-design/distributed-system-communication/sns.md b/docs/system-design/distributed-system-communication/sns.md index 6175c58a3..e20d82c71 100644 --- a/docs/system-design/distributed-system-communication/sns.md +++ b/docs/system-design/distributed-system-communication/sns.md @@ -1,8 +1,8 @@ --- -sidebar_position: 3 +sidebar_position: 4 --- -# AWS SNS +# SNS Amazon Simple Notification Service (SNS) is a fully managed messaging service provided by AWS that enables the decoupling of microservices, distributed systems, and serverless applications through a **publish-subscribe (pub/sub)** messaging pattern. It is primarily used for sending notifications in real-time to multiple subscribers over different protocols. diff --git a/docs/system-design/distributed-system-communication/sqs.md b/docs/system-design/distributed-system-communication/sqs.md index 92aa93158..c4e1248c8 100644 --- a/docs/system-design/distributed-system-communication/sqs.md +++ b/docs/system-design/distributed-system-communication/sqs.md @@ -1,8 +1,8 @@ --- -sidebar_position: 2 +sidebar_position: 3 --- -# AWS SQS +# SQS Amazon SQS (Simple Queue Service) is a fully managed message queuing service that enables decoupling and scalability in distributed systems. It is highly reliable, secure, and scalable, making it a popular choice for applications requiring asynchronous communication. From 4947b099eddb99dbab18b711dd9dd45607b86be7 Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Tue, 7 Jul 2026 22:27:08 +0530 Subject: [PATCH 2/8] docs(kafka): IMDEEPMIND-34: added architecture note --- .../kafka/kafka-architecture.md | 627 ++++++++++++++++++ 1 file changed, 627 insertions(+) create mode 100644 docs/system-design/distributed-system-communication/kafka/kafka-architecture.md diff --git a/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md b/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md new file mode 100644 index 000000000..e1a420692 --- /dev/null +++ b/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md @@ -0,0 +1,627 @@ +--- +sidebar_position: 2 +--- + +# Kafka Architecture + +Before learning Producers, Consumers, Replication, or Fault Tolerance, it is important to understand the core building blocks that make up a Kafka cluster. + +At its heart, Kafka is a **distributed append-only log system**. Every message produced to Kafka is stored in logs, organized into topics and partitions, and managed by brokers. + +The primary building blocks are: + +- Kafka Cluster +- Brokers +- Topics +- Partitions +- Records (Messages) +- Offsets + +Understanding these concepts is essential because nearly every advanced Kafka feature is built on top of them. + +## What is a Kafka Cluster? + +A Kafka Cluster is a collection of one or more Kafka brokers working together to store and serve data. + +A single broker can run Kafka, but production environments almost always use multiple brokers. + +
+ +```mermaid +graph TD + + Producer1[Producer] + Producer2[Producer] + + Broker1[Broker 1] + Broker2[Broker 2] + Broker3[Broker 3] + + Consumer1[Consumer] + Consumer2[Consumer] + + Producer1 --> Broker1 + Producer2 --> Broker2 + + Broker1 <--> Broker2 + Broker2 <--> Broker3 + Broker3 <--> Broker1 + + Broker1 --> Consumer1 + Broker3 --> Consumer2 +``` + +
+ +A cluster provides: + +- Scalability +- High Availability +- Fault Tolerance +- Load Distribution + +## Why Not Use a Single Server? + +Imagine an application generating millions of events every second. + +A single machine would eventually face: + +- CPU limitations +- Memory limitations +- Disk limitations +- Network limitations + +Kafka solves this by distributing data across multiple brokers. + +
+ +```mermaid +graph LR + + Topic[Topic Orders] + + Topic --> P0[Partition 0] + Topic --> P1[Partition 1] + Topic --> P2[Partition 2] + + P0 --> B1[Broker 1] + P1 --> B2[Broker 2] + P2 --> B3[Broker 3] +``` + +
+ +Data is spread across machines, allowing Kafka to scale horizontally. + +## High-Level Data Flow + +A typical Kafka workflow looks like: + +
+ +```mermaid +graph LR + + Producer --> Topic + Topic --> Partition + Partition --> Broker + Broker --> Consumer +``` + +
+ +Step-by-step: + +1. Producer sends data. +2. Data is written into a topic. +3. Topic is divided into partitions. +4. Partitions are stored on brokers. +5. Consumers read data. + +## Kafka Brokers + +A Broker is a Kafka server responsible for storing and serving data. + +Every Kafka cluster consists of one or more brokers. + +
+ +```mermaid +graph TD + + Cluster((Kafka Cluster)) + + Cluster --> B1[Broker 1] + Cluster --> B2[Broker 2] + Cluster --> B3[Broker 3] +``` + +
+ +Think of a broker as a specialized database server that stores Kafka partitions. + +> One Kafka broker can store multiple partitions/topics. + +### Responsibilities of a Broker + +A broker performs several tasks: + +- **Store Messages**: Messages are persisted to disk. +- **Serve Consumer Requests**: Consumers fetch messages from brokers. +- **Handle Producer Requests**: Producers send messages to brokers. +- **Replicate Data**: Brokers replicate partitions to other brokers. +- **Participate in Cluster Coordination**: Brokers exchange metadata and coordinate cluster operations. + +### Broker Identification + +Each broker has a unique identifier. + +Example: + +```text +Broker 1 +Broker 2 +Broker 3 +``` + +Kafka uses broker IDs to identify nodes in the cluster. + + +### Broker Storage + +Each broker stores partition data locally. + +
+ +```mermaid +graph TD + + Broker[Broker] + + Broker --> TopicA[Orders-0] + Broker --> TopicB[Orders-1] + Broker --> TopicC[Payments-0] +``` + +
+ +A broker may host partitions from many topics. + +## Topics + +A Topic is a logical category used to organize messages. + +Examples: + +```text +orders +payments +users +notifications +logs +``` + +A topic acts like a stream of events. + +### Real-World Example + +Suppose an e-commerce application exists. + +Different events may be stored in different topics: + +```text +orders +payments +inventory +shipments +``` + +This separation improves organization and scalability. + +### Topic as a Stream + +Think of a topic as an endless stream. + +
+ +```mermaid +graph LR + + M1[Order 1] + M2[Order 2] + M3[Order 3] + M4[Order 4] + + M1 --> M2 --> M3 --> M4 +``` + +
+ +New messages continue to arrive. + +The stream never truly ends. + +### Topics are Logical + +A common misconception is: + +> A topic physically stores data. + +This is incorrect. + +A topic is a logical abstraction. + +Actual data is stored inside partitions. + + +
+ +```mermaid +graph TD + + Topic[Orders Topic] + + Topic --> P0[Partition 0] + Topic --> P1[Partition 1] + Topic --> P2[Partition 2] +``` + +
+ +## Partitions + +Without partitions, a topic would become a bottleneck. + +Consider: + +
+ +```mermaid +graph TD + + Topic[Orders Topic] + + Topic --> SinglePartition[Single Partition] +``` + +
+ +All traffic would hit one machine. This limits throughput. + +### Partitioning for Scalability + +Kafka divides topics into partitions. + +
+ +```mermaid +graph TD + + Topic[Orders Topic] + + Topic --> P0[Partition 0] + Topic --> P1[Partition 1] + Topic --> P2[Partition 2] +``` + +
+ +Each partition can live on a different broker. + +
+ +```mermaid +graph TD + + P0[Partition 0] --> B1[Broker 1] + P1[Partition 1] --> B2[Broker 2] + P2[Partition 2] --> B3[Broker 3] +``` + +
+ +This allows parallel processing. + +### Partition Structure + +A partition is an append-only log. + +
+ +```mermaid +graph LR + + M1[Message] + M2[Message] + M3[Message] + M4[Message] + + M1 --> M2 --> M3 --> M4 +``` + +
+ +Messages are always appended to the end. + +Existing messages are never modified. + +### Ordering Guarantee + +Kafka guarantees ordering only within a partition. + +Example: + +Partition 0 + +```text +Order Created +Order Paid +Order Shipped +Order Delivered +``` + +Order is preserved. + +Across multiple partitions: + +```text +Partition 0 -> Order A +Partition 1 -> Order B +Partition 2 -> Order C +``` + +Global ordering is not guaranteed. + +### Parallel Processing + +Partitions enable parallelism. + +
+ +```mermaid +graph TD + + P0[Partition 0] + P1[Partition 1] + P2[Partition 2] + + P0 --> C1[Consumer] + P1 --> C2[Consumer] + P2 --> C3[Consumer] +``` + +
+ +Multiple consumers can process data simultaneously. + +### Partition Keying + +Messages may include keys. + +Example: + +```text +User ID = 101 +User ID = 101 +User ID = 101 +``` + +Kafka hashes the key. + +All messages with the same key go to the same partition. + +
+ +```mermaid +graph TD + + Key[User 101] + + Key --> Partition[Partition 1] +``` + +
+ +This preserves ordering for that user. + +## Records (Messages) + +The smallest unit stored in Kafka is called a Record. + +A record contains: + +- Key +- Value +- Timestamp +- Headers +- Offset + +### Record Structure + +```text +Record +├── Key +├── Value +├── Timestamp +├── Headers +└── Offset +``` + +### Key + +The key determines partition placement. + +Example: + +```text +Key: User-101 +``` + +Messages with identical keys usually land in the same partition. + +### Value + +The value is the actual payload. + +Example: + +```json +{ + "orderId": 1001, + "amount": 500 +} +``` + +### Timestamp + +Kafka stores timestamps for records. + +Example: + +```text +2026-01-10T10:15:00Z +``` + +Used for: + +- Retention +- Monitoring +- Event processing + +### Headers + +Headers contain metadata. + +Example: + +```text +source=payment-service +version=v1 +``` + +## Offsets + +Every record inside a partition receives a unique sequential number. + +This number is called an Offset. + + +### Example + +```text +Partition 0 + +Offset 0 -> Order Created +Offset 1 -> Order Paid +Offset 2 -> Order Shipped +Offset 3 -> Order Delivered +``` + +### Visual Representation + +
+ +```mermaid +graph LR + + O0["Offset 0"] + O1["Offset 1"] + O2["Offset 2"] + O3["Offset 3"] + + O0 --> O1 --> O2 --> O3 +``` + +
+ +Offsets always increase. + +### Important Rule + +Offsets are unique only within a partition. + +Example: + +```text +Partition 0 +Offset 0 +Offset 1 +Offset 2 + +Partition 1 +Offset 0 +Offset 1 +Offset 2 +``` + +The same offset value may exist in multiple partitions. + +### Why Offsets Matter + +Offsets allow consumers to track progress. + +Example: + +```text +Current Offset = 150 +``` + +Consumer knows: + +- Messages before 150 were processed. +- Messages after 150 remain unread. + +### Reading from Offsets + +Consumers can start reading from: + +#### Beginning + +```text +Offset 0 +``` + +#### Latest + +```text +Most Recent Offset +``` + +#### Specific Offset + +```text +Offset 500 +``` + +This makes replaying historical events possible. + +## Relationship Between All Components + +The entire hierarchy looks like: + +
+ +```mermaid +graph TD + + Cluster((Kafka Cluster)) + + Cluster --> Broker1[Broker 1] + Cluster --> Broker2[Broker 2] + Cluster --> Broker3[Broker 3] + + Broker1 --> P0[Orders Partition 0] + Broker2 --> P1[Orders Partition 1] + Broker3 --> P2[Orders Partition 2] + + P0 --> R1[Offset 0] + P0 --> R2[Offset 1] + + P1 --> R3[Offset 0] + P1 --> R4[Offset 1] + + P2 --> R5[Offset 0] + P2 --> R6[Offset 1] +``` + +
From 759621bb488f3bd33f6cd150e2e4cd91712cfd63 Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Tue, 7 Jul 2026 23:17:23 +0530 Subject: [PATCH 3/8] docs(kafka): IMDEEPMIND-34: added notes on producer and consumer --- .../kafka/introduction.md | 92 +- .../kafka/kafka-architecture.md | 3 - .../kafka/producer-consumer.md | 937 ++++++++++++++++++ 3 files changed, 983 insertions(+), 49 deletions(-) create mode 100644 docs/system-design/distributed-system-communication/kafka/producer-consumer.md diff --git a/docs/system-design/distributed-system-communication/kafka/introduction.md b/docs/system-design/distributed-system-communication/kafka/introduction.md index 75fa1c9be..1b4a8e81b 100644 --- a/docs/system-design/distributed-system-communication/kafka/introduction.md +++ b/docs/system-design/distributed-system-communication/kafka/introduction.md @@ -38,10 +38,10 @@ graph LR In the above example: -* Multiple applications produce data into Kafka. -* Kafka stores the data reliably. -* Multiple consumers can independently read the same data. -* Producers and consumers remain loosely coupled. +- Multiple applications produce data into Kafka. +- Kafka stores the data reliably. +- Multiple consumers can independently read the same data. +- Producers and consumers remain loosely coupled. ## Why Kafka Was Created @@ -66,9 +66,9 @@ As the number of services increased, managing these connections became increasin Traditional systems struggled to handle: -* Millions of messages per second -* Thousands of concurrent consumers -* Continuous streams of real-time data +- Millions of messages per second +- Thousands of concurrent consumers +- Continuous streams of real-time data ### Data Replay Difficulties @@ -76,9 +76,9 @@ In many messaging systems, once a message was consumed, it disappeared permanent If: -* A consumer crashed -* A bug corrupted data -* A new service needed historical data +- A consumer crashed +- A bug corrupted data +- A new service needed historical data Recovering the original messages became difficult or impossible. @@ -86,9 +86,9 @@ Recovering the original messages became difficult or impossible. Organizations needed guarantees that: -* Messages would not be lost -* Systems could survive failures -* Data remained available during outages +- Messages would not be lost +- Systems could survive failures +- Data remained available during outages Kafka was designed specifically to address these challenges. @@ -100,10 +100,10 @@ Kafka was built around several key objectives. Kafka is capable of handling millions of messages per second by: -* Sequential disk writes -* Efficient batching -* Network optimization -* Distributed architecture +- Sequential disk writes +- Efficient batching +- Network optimization +- Distributed architecture ### Fault Tolerance @@ -111,9 +111,9 @@ Failures are expected in distributed systems. Kafka protects against failures by: -* Replicating data across multiple servers -* Automatically electing new leaders during failures -* Preserving data durability +- Replicating data across multiple servers +- Automatically electing new leaders during failures +- Preserving data durability ### Scalability @@ -156,9 +156,9 @@ Kafka separates producers from consumers. Producers do not need to know: -* Who consumes the data -* How many consumers exist -* Whether consumers are currently online +- Who consumes the data +- How many consumers exist +- Whether consumers are currently online Consumers can independently read data whenever needed. @@ -180,10 +180,10 @@ New records are simply appended. This design provides several benefits: -* Fast writes -* Predictable performance -* Ordered storage -* Efficient replication +- Fast writes +- Predictable performance +- Ordered storage +- Efficient replication Kafka extends this concept across multiple machines, making it a distributed commit log. @@ -216,11 +216,11 @@ A message broker primarily focuses on delivering messages between applications. Kafka goes further by providing: -* Persistent storage -* Stream processing capabilities -* Replayability -* Large-scale event distribution -* Long-term event retention +- Persistent storage +- Stream processing capabilities +- Replayability +- Large-scale event distribution +- Long-term event retention
@@ -273,10 +273,10 @@ Business metrics can be calculated as events occur. Examples: -* User activity -* Purchases -* Clickstreams -* Application metrics +- User activity +- Purchases +- Clickstreams +- Application metrics ### Event Sourcing @@ -286,21 +286,21 @@ Kafka can serve as the central event store for applications that store state cha Kafka acts as a data backbone connecting: -* Databases -* Applications -* Data warehouses -* Analytics systems +- Databases +- Applications +- Data warehouses +- Analytics systems ## Why Kafka Became Popular Kafka became one of the most widely adopted data platforms because it combines several capabilities into a single system: -* Message distribution -* Persistent storage -* Horizontal scalability -* Fault tolerance -* Event replay -* Stream processing support +- Message distribution +- Persistent storage +- Horizontal scalability +- Fault tolerance +- Event replay +- Stream processing support Instead of building separate systems for messaging, storage, replication, and event distribution, organizations can use Kafka as a unified event streaming platform. diff --git a/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md b/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md index e1a420692..ddcc4640f 100644 --- a/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md +++ b/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md @@ -166,7 +166,6 @@ Broker 3 Kafka uses broker IDs to identify nodes in the cluster. - ### Broker Storage Each broker stores partition data locally. @@ -253,7 +252,6 @@ A topic is a logical abstraction. Actual data is stored inside partitions. -
```mermaid @@ -505,7 +503,6 @@ Every record inside a partition receives a unique sequential number. This number is called an Offset. - ### Example ```text diff --git a/docs/system-design/distributed-system-communication/kafka/producer-consumer.md b/docs/system-design/distributed-system-communication/kafka/producer-consumer.md new file mode 100644 index 000000000..ac1bf1f01 --- /dev/null +++ b/docs/system-design/distributed-system-communication/kafka/producer-consumer.md @@ -0,0 +1,937 @@ +--- +sidebar_position: 3 +--- + +# Producers and Consumers + +Kafka is fundamentally a data streaming platform that enables applications to exchange events at scale. + +At a high level: + +- Producers write data into Kafka. +- Kafka stores the data. +- Consumers read the data from Kafka. + +
+ +```mermaid +graph LR + + Producer --> Kafka[Kafka Cluster] + Kafka --> Consumer +``` + +
+ +Everything that happens in Kafka revolves around this simple flow. + +Understanding Producers and Consumers is essential because they are the primary interfaces through which applications interact with Kafka. + +## The Producer Side + +A Producer is an application that publishes records to Kafka. + +Examples: + +- E-commerce application sending order events +- Payment service sending payment events +- Mobile application sending analytics events +- Web server sending logs + +Example event: + +```json +{ + "orderId": 1001, + "customerId": 500, + "amount": 1500 +} +``` + +The application generating this event is acting as a producer. + +### Producer Responsibilities + +A Kafka Producer is responsible for: + +- Creating records +- Determining the target topic +- Determining the target partition +- Sending records to brokers +- Retrying failed requests +- Handling acknowledgements +- Ensuring delivery guarantees + +### Producer Architecture + +A producer is not just a simple network client. + +Internally it contains several components. + +
+ +```mermaid +graph LR + + App[Application] + + App --> Serializer + Serializer --> Partitioner + Partitioner --> Buffer + Buffer --> Sender + Sender --> Broker +``` + +
+ +#### Serializer + +Kafka transmits bytes across the network. + +Before sending data, Kafka converts objects into byte arrays. + +Example: + +```json +{ + "orderId": 1001 +} +``` + +may become: + +```text +7B226F726465724964223A313030317D +``` + +Common serializers: + +- String Serializer +- JSON Serializer +- Avro Serializer +- Protobuf Serializer + +#### Partitioner + +The partitioner decides where a record should be stored. + +Example: + +```text +Topic: orders +Partitions: 3 +``` + +The partitioner chooses: + +```text +Partition 0 +Partition 1 +Partition 2 +``` + +for each record. + +#### Buffer Memory + +Producers do not immediately send every message. + +Instead, records are temporarily stored in memory. + +
+ +```mermaid +graph LR + + Record1 --> Buffer + Record2 --> Buffer + Record3 --> Buffer +``` + +
+ +This allows batching. + +#### Sender Thread + +A background thread continuously sends accumulated batches to Kafka brokers. + +
+ +```mermaid +graph LR + + Buffer --> Sender + Sender --> Broker +``` + +
+ +The application thread remains free to continue processing. + +### Producer Workflow + +The lifecycle of a record looks like: + +
+ +```mermaid +graph TD + + A[Application Creates Record] + B[Serialize Record] + C[Select Partition] + D[Store In Buffer] + E[Create Batch] + F[Send To Broker] + G[Acknowledgement Received] + + A --> B + B --> C + C --> D + D --> E + E --> F + F --> G +``` + +
+ +#### Step 1: Create Record + +Application generates an event. + +```json +{ + "userId": 101, + "action": "LOGIN" +} +``` + +#### Step 2: Serialization + +Record converted into bytes. + +#### Step 3: Partition Selection + +Producer determines target partition. + +#### Step 4: Buffering + +Record stored in memory. + +#### Step 5: Batching + +Multiple records combined together. + +
+ +```mermaid +graph LR + + M1 --> Batch + M2 --> Batch + M3 --> Batch + M4 --> Batch +``` + +
+ +Batching significantly improves throughput. + +#### Step 6: Network Transmission + +Batch sent to broker. + +#### Step 7: Acknowledgement + +Broker confirms successful write. + +### Producer Partitioning Strategies + +Partitioning is one of Kafka's most important concepts. + +It determines: + +- Scalability +- Ordering +- Load Distribution + +#### Round Robin Partitioning + +Messages distributed evenly. + +
+ +```mermaid +graph TD + + Producer + + Producer --> P0[Partition 0] + Producer --> P1[Partition 1] + Producer --> P2[Partition 2] +``` + +
+ +Example: + +```text +Message 1 → Partition 0 +Message 2 → Partition 1 +Message 3 → Partition 2 +Message 4 → Partition 0 +``` + +Advantages: + +- Even distribution +- Excellent load balancing + +Disadvantages: + +- Ordering across related records lost + +#### Key-Based Partitioning + +Kafka hashes the key. + +```text +Partition = hash(key) % totalPartitions +``` + +Example: + +```text +User 101 +``` + +always maps to the same partition. + +
+ +```mermaid +graph LR + + User101 --> Partition1 +``` + +
+ +Advantages: + +- Ordering preserved for a given key + +Disadvantages: + +- Poor key distribution may create hot partitions + +#### Sticky Partitioning + +When records have no key, Kafka attempts to keep sending records to the same partition temporarily. + +
+ +```mermaid +graph TD + + Producer --> P1 + Producer --> P1 + Producer --> P1 + Producer --> P2 +``` + +
+ +Benefits: + +- Larger batches +- Better throughput + +#### Custom Partitioners + +Applications may implement custom logic. + +Example: + +```text +Premium Users → Partition 0 +Regular Users → Partition 1 +``` + +Useful for specialized workloads. + +### Producer Acknowledgements + +After writing data, brokers send acknowledgements. + +The producer controls how much confirmation it requires. + +#### acks = 0 + +Producer does not wait. + +
+ +```mermaid +graph LR + + Producer --> Broker +``` + +
+ +No confirmation returned. + +Advantages: + +- Lowest latency + +Disadvantages: + +- Possible message loss + +#### acks = 1 + +Producer waits for leader acknowledgement. + +
+ +```mermaid +graph LR + + Producer --> Leader + Leader --> Producer +``` + +
+ +Advantages: + +- Good balance + +Disadvantages: + +- Data may still be lost if leader crashes before replication + +#### acks = all + +Producer waits for all in-sync replicas. + +
+ +```mermaid +graph LR + + Producer --> Leader + Leader --> Replica1 + Leader --> Replica2 + + Replica1 --> Leader + Replica2 --> Leader + + Leader --> Producer +``` + +
+ +Advantages: + +- Maximum durability + +Disadvantages: + +- Higher latency + +### Producer Delivery Guarantees + +Kafka supports three delivery models. + +#### At Most Once + +Message may be lost. + +Message never duplicated. + +```text +0 or 1 delivery +``` + +#### At Least Once + +Message never lost. + +Duplicate delivery possible. + +```text +1 or more deliveries +``` + +Most common production setup. + +#### Exactly Once + +Message delivered exactly one time. + +```text +Exactly 1 delivery +``` + +Requires: + +- Idempotent Producer +- Transactions + +## The Consumer Side + +A Consumer reads records from Kafka. + +Examples: + +- Order Processing Service +- Notification Service +- Analytics Service +- Fraud Detection Service + +
+ +```mermaid +graph LR + + Kafka --> Consumer +``` + +
+ +### Consumer Responsibilities + +Consumers: + +- Subscribe to topics +- Fetch records +- Process records +- Track offsets +- Handle failures + +### Consumer Architecture + +Internally, consumers are simpler than producers. + +
+ +```mermaid +graph LR + + Broker --> Fetcher + Fetcher --> PollLoop + PollLoop --> Application +``` + +
+ +#### Fetcher + +Fetches records from brokers. + +#### Poll Loop + +Applications continuously call: + +```java +consumer.poll(...) +``` + +to retrieve records. + +Kafka uses a pull-based model. + +### Why Pull Instead of Push? + +Push Model: + +
+ +```mermaid +graph LR + + Broker --> Consumer +``` + +
+ +Potential issue: + +Consumer overwhelmed. + +Pull Model: + +
+ +```mermaid +graph LR + + Consumer --> Broker + Broker --> Consumer +``` + +
+ +Consumer controls consumption speed. + +This improves scalability. + +### Consumer Workflow + +
+ +```mermaid +graph TD + + A[Subscribe Topic] + B[Poll Records] + C[Process Records] + D[Commit Offset] + E[Poll Again] + + A --> B + B --> C + C --> D + D --> E +``` + +
+ +#### Step 1: Subscribe + +Consumer subscribes to topic. + +```java +consumer.subscribe(...) +``` + +#### Step 2: Poll + +Fetch records from broker. + +#### Step 3: Process + +Business logic executes. + +Example: + +```text +Send Email +Update Database +Generate Invoice +``` + +#### Step 4: Commit Offset + +Consumer stores progress. + +#### Step 5: Continue + +Process repeats forever. + +### Consumer Groups + +Consumer Groups are one of Kafka's most powerful features. + +#### Why Consumer Groups Exist + +Without groups: + +
+ +```mermaid +graph LR + + Topic --> Consumer1 +``` + +
+ +Only one consumer processes everything. + +Scaling becomes difficult. + +### Consumer Group Concept + +
+ +```mermaid +graph TD + + Topic + + Topic --> Consumer1 + Topic --> Consumer2 + Topic --> Consumer3 +``` + +
+ +Kafka distributes partitions among consumers. + +#### Partition Assignment + +Suppose: + +```text +Topic Partitions = 3 +Consumers = 3 +``` + +Assignment: + +
+ +```mermaid +graph TD + + P0[Partition 0] --> C1[Consumer 1] + P1[Partition 1] --> C2[Consumer 2] + P2[Partition 2] --> C3[Consumer 3] +``` + +
+ +Each partition belongs to only one consumer within the group. + +#### More Consumers Than Partitions + +Example: + +```text +Partitions = 3 +Consumers = 5 +``` + +
+ +```mermaid +graph TD + + P0 --> C1 + P1 --> C2 + P2 --> C3 + + C4[Consumer 4 Idle] + C5[Consumer 5 Idle] +``` + +
+ +Extra consumers remain idle. + +#### More Partitions Than Consumers + +Example: + +```text +Partitions = 6 +Consumers = 3 +``` + +
+ +```mermaid +graph TD + + P0 --> C1 + P1 --> C1 + + P2 --> C2 + P3 --> C2 + + P4 --> C3 + P5 --> C3 +``` + +
+ +Consumers process multiple partitions. + +### Consumer Rebalancing + +A rebalance occurs whenever partition ownership changes. + +#### Common Triggers + +##### New Consumer Joins + +```text +Consumer 4 Added +``` + +Partitions reassigned. + +##### Consumer Leaves + +```text +Consumer 2 Crashed +``` + +Remaining consumers receive its partitions. + +##### Partition Count Changes + +Topic partitions increased. + +Reassignment required. + +#### Rebalance Example + +Before: + +
+ +```mermaid +graph TD + + P0 --> C1 + P1 --> C2 +``` + +
+ +After Consumer 3 Joins: + +
+ +```mermaid +graph TD + + P0 --> C1 + P1 --> C2 + P2 --> C3 +``` + +
+ +### Rebalance Cost + +During rebalancing: + +- Consumption pauses +- Ownership changes +- Offset synchronization occurs + +Frequent rebalances reduce throughput. + +#### Consumer Offset Management + +Offsets represent consumer progress. + +### Automatic Commit + +Kafka periodically commits offsets. + +```text +enable.auto.commit=true +``` + +Advantages: + +- Simple + +Disadvantages: + +- Potential message loss + +### Manual Commit + +Application controls commits. + +
+ +```mermaid +graph TD + + ProcessRecord --> CommitOffset +``` + +
+ +Advantages: + +- Greater reliability + +Disadvantages: + +- More complexity + +### Commit After Processing + +Preferred pattern: + +
+ +```mermaid +graph TD + + Read --> Process --> Commit +``` + +
+ +If processing succeeds: + +Commit. + +If processing fails: + +Do not commit. + +Record can be retried. + +## End-to-End Producer to Consumer Flow + +The complete flow looks like: + +
+ +```mermaid +graph TD + + Producer + + Producer --> Topic + + Topic --> Partition0 + Topic --> Partition1 + Topic --> Partition2 + + Partition0 --> Broker1 + Partition1 --> Broker2 + Partition2 --> Broker3 + + Broker1 --> Consumer1 + Broker2 --> Consumer2 + Broker3 --> Consumer3 +``` + +
+ +Detailed sequence: + +
+ +```mermaid +sequenceDiagram + + participant P as Producer + participant B as Broker + participant C as Consumer + + P->>B: Send Record + B-->>P: Acknowledgement + + C->>B: Poll Records + B-->>C: Return Records + + C->>C: Process Records + C->>B: Commit Offset +``` + +
From 7fe083e4eeceb0c9ce668bf4f12ae1814a6e41e3 Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Wed, 8 Jul 2026 20:27:13 +0530 Subject: [PATCH 4/8] docs(kafka): IMDEEPMIND-34: added notes on replication --- .../kafka/kafka-architecture.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md b/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md index ddcc4640f..422899c88 100644 --- a/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md +++ b/docs/system-design/distributed-system-communication/kafka/kafka-architecture.md @@ -2,7 +2,7 @@ sidebar_position: 2 --- -# Kafka Architecture +# Architecture Before learning Producers, Consumers, Replication, or Fault Tolerance, it is important to understand the core building blocks that make up a Kafka cluster. From 09952d857e0146e47e0e490beaed2cbd75d72d42 Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Tue, 14 Jul 2026 20:47:20 +0530 Subject: [PATCH 5/8] docs(kafka): IMDEEPMIND-34: added notes on replication --- .../kafka/replication.md | 899 ++++++++++++++++++ 1 file changed, 899 insertions(+) create mode 100644 docs/system-design/distributed-system-communication/kafka/replication.md diff --git a/docs/system-design/distributed-system-communication/kafka/replication.md b/docs/system-design/distributed-system-communication/kafka/replication.md new file mode 100644 index 000000000..0755d1fa7 --- /dev/null +++ b/docs/system-design/distributed-system-communication/kafka/replication.md @@ -0,0 +1,899 @@ +--- +sidebar_position: 4 +--- + +# Replication and Fault Tolerance + +One of Kafka's most important features is its ability to continue operating even when machines fail. In a distributed system, failures are not exceptional events, they are expected events. + +- Machines crash. +- Disks fail. +- Networks become unavailable. +- Processes stop unexpectedly. + +If Kafka stored every partition on only one broker, the failure of that broker would result in data loss and service unavailability. To solve this problem, Kafka uses: + +- Replication +- Leader-Follower Architecture +- In-Sync Replicas (ISR) +- Automatic Failover +- Durable Storage + +These mechanisms allow Kafka to provide high availability and strong durability guarantees. + +## Why Replication Exists + +Consider a Kafka cluster with three brokers. + +
+ +```mermaid +graph TD + + B1[Broker 1] + B2[Broker 2] + B3[Broker 3] +``` + +
+ +Suppose a partition exists only on Broker 1. + +
+ +```mermaid +graph TD + + B1[Broker 1] + + B1 --> P0[Orders Partition 0] +``` + +
+ +Everything works normally. + +Now Broker 1 crashes. + +
+ +```mermaid +graph TD + + B1[Broker 1 - DOWN] + + B1 --> P0[Orders Partition 0] +``` + +
+ +The partition becomes unavailable. Consumers cannot read. Producers cannot write. If the disk is permanently lost, all data is lost. + +This is known as a **Single Point of Failure (SPOF)**. Replication eliminates this problem. + +## Kafka Replication + +Replication means maintaining multiple copies of the same partition across different brokers. + +Instead of storing a partition on a single machine: + +
+ +```mermaid +graph TD + + B1[Broker 1] + + B1 --> P0[Partition 0] +``` + +
+ +Kafka stores multiple copies. + +
+ +```mermaid +graph TD + + B1[Broker 1] + B2[Broker 2] + B3[Broker 3] + + B1 --> P0A[Partition 0] + B2 --> P0B[Partition 0 Replica] + B3 --> P0C[Partition 0 Replica] +``` + +
+ +Now the failure of one broker does not result in partition loss. + +### Replication Factor + +The number of copies maintained by Kafka is called the **Replication Factor (RF)**. + +Example: + +```text +Replication Factor = 1 +``` + +One copy exists. + +
+ +```mermaid +graph TD + + B1 --> P0[Partition 0] +``` + +
+ +No fault tolerance. + +Example: + +```text +Replication Factor = 2 +``` + +Two copies exist. + +
+ +```mermaid +graph TD + + B1 --> P0A[Partition 0] + B2 --> P0B[Partition 0 Replica] +``` + +
+ +One broker can fail safely. + +Example: + +```text +Replication Factor = 3 +``` + +Three copies exist. + +
+ +```mermaid +graph TD + + B1 --> P0A[Partition 0] + B2 --> P0B[Partition 0 Replica] + B3 --> P0C[Partition 0 Replica] +``` + +
+ +Two failures can potentially be tolerated depending on ISR state. + +### Replication Factor vs Number of Brokers + +Replication factor cannot exceed available brokers. + +Example: + +```text +Brokers = 3 +Replication Factor = 5 +``` + +Impossible. + +Kafka cannot place five replicas on only three brokers. + +Rule: + +```text +Replication Factor <= Number of Brokers +``` + +## Leaders and Followers + +Replication alone is not enough. Kafka also needs a mechanism for coordinating reads and writes. This is where Leaders and Followers come in. + +### Leader Replica + +Every partition has exactly one Leader. + +Example: + +
+ +```mermaid +graph TD + + Leader[Partition 0 Leader] +``` + +
+ +The leader handles: + +- Producer writes +- Consumer reads +- Replica synchronization + +All client traffic flows through the leader. + +### Follower Replicas + +The remaining replicas are Followers. + +
+ +```mermaid +graph TD + + L[Leader] + + F1[Follower] + F2[Follower] + + L --> F1 + L --> F2 +``` + +
+ +Followers do not serve normal client requests. + +Their primary responsibility is to copy data from the leader. + +### Leader-Follower Architecture + +Consider: + +```text +Partition 0 +Replication Factor = 3 +``` + +
+ +```mermaid +graph TD + + B1[Broker 1 Leader] + B2[Broker 2 Follower] + B3[Broker 3 Follower] + + B1 --> B2 + B1 --> B3 +``` + +
+ +Producer writes: + +
+ +```mermaid +graph LR + + Producer --> Leader +``` + +
+ +Consumer reads: + +
+ +```mermaid +graph LR + + Leader --> Consumer +``` + +
+ +Replication: + +
+ +```mermaid +graph LR + + Leader --> Follower1 + Leader --> Follower2 +``` + +
+ +This architecture simplifies consistency management. + +### Why Not Allow Writes to Followers? + +Imagine allowing writes to all replicas. + +
+ +```mermaid +graph TD + + Producer --> B1 + Producer --> B2 + Producer --> B3 +``` + +
+ +Potential problems: + +- Conflicting writes +- Ordering issues +- Complex synchronization + +Kafka avoids these problems by making the leader the single source of truth. + +## Replication Workflow + +Consider a producer sending a record. + +```json +{ + "orderId": 1001 +} +``` + +### Step 1: Producer Sends Record + +
+ +```mermaid +graph LR + + Producer --> Leader +``` + +
+ +### Step 2: Leader Appends Record + +
+ +```mermaid +graph LR + + Offset0 --> Offset1 --> Offset2 +``` + +
+ +New record appended. + +
+ +```mermaid +graph LR + + Offset0 --> Offset1 --> Offset2 --> Offset3 +``` + +
+ +### Step 3: Followers Fetch Data + +Followers continuously pull updates from leader. + +
+ +```mermaid +graph LR + + Leader --> Follower1 + Leader --> Follower2 +``` + +
+ +### Step 4: Followers Append Record + +Followers write the same record. + +
+ +```mermaid +graph TD + + Leader + F1[Follower 1] + F2[Follower 2] + + Leader --> F1 + Leader --> F2 +``` + +
+ +### Step 5: Acknowledgement + +Depending on producer configuration: + +```text +acks=0 +acks=1 +acks=all +``` + +Kafka may acknowledge immediately or wait for replica synchronization. + +## In-Sync Replicas (ISR) + +Not every replica is always healthy. + +Some replicas may: + +- Fall behind +- Experience network issues +- Become overloaded + +Kafka therefore maintains a special set called the **In-Sync Replica Set (ISR)**. + +ISR contains replicas that are sufficiently caught up with the leader. + +### Example ISR + +
+ +```mermaid +graph TD + + L[Leader] + F1[Follower 1] + F2[Follower 2] + + L --> F1 + L --> F2 +``` + +
+ +All replicas synchronized. + +ISR: + +```text +ISR = {Leader, Follower1, Follower2} +``` + +### Lagging Replica + +Suppose Follower 2 falls behind. + +
+ +```mermaid +graph TD + + L[Leader] + F1[Follower 1] + F2[Follower 2 Lagging] +``` + +
+ +Kafka removes it from ISR. + +```text +ISR = {Leader, Follower1} +``` + +Follower 2 still exists. + +It simply is not considered fully synchronized. + +### Why ISR Matters + +Kafka uses ISR for: + +- Durability decisions +- Acknowledgements +- Leader elections +- Failure recovery + +ISR is one of the most important concepts in Kafka. + +## Producer Acknowledgements and ISR + +Recall: + +```text +acks=all +``` + +This means: + +> Do not acknowledge until all ISR replicas have stored the record. + +Example: + +
+ +```mermaid +graph TD + + Producer --> Leader + + Leader --> F1 + Leader --> F2 + + F1 --> Leader + F2 --> Leader + + Leader --> Producer +``` + +
+ +Only after ISR confirmation does producer receive success. + +This provides maximum durability. + +## Leader Failure + +Now consider the leader crashing. + +Initial state: + +
+ +```mermaid +graph TD + + L[Leader] + F1[Follower 1] + F2[Follower 2] +``` + +
+ +Producer writes normally. + +Suddenly: + +
+ +```mermaid +graph TD + + L[Leader DOWN] + F1[Follower 1] + F2[Follower 2] +``` + +
+ +Without failover: + +- Partition unavailable +- Consumers blocked +- Producers blocked + +Kafka solves this using leader election. + +## Leader Election + +When a leader fails: Kafka selects a new leader from ISR. + +Example: + +Before failure: + +```text +ISR = {Leader, Follower1, Follower2} +``` + +Leader crashes. + +```text +ISR = {Follower1, Follower2} +``` + +Kafka elects: + +
+ +```mermaid +graph TD + + F1[New Leader] + F2[Follower] +``` + +
+ +Clients continue operating. + +The partition remains available. + +## Why Only ISR Members Become Leaders? + +Suppose a lagging replica becomes leader. + +
+ +```mermaid +graph TD + + OldLeader[Leader] + LaggingReplica[Lagging Replica] +``` + +
+ +Some records may never have reached the lagging replica. Promoting it could cause data loss. Therefore Kafka elects leaders from ISR. + +## Fault Tolerance in Kafka + +Fault tolerance is the ability of a system to continue operating despite failures. + +Kafka is designed with failure as a normal operating condition. + +### Scenario 1: Broker Failure + +Initial cluster: + +
+ +```mermaid +graph TD + + B1[Broker 1] + B2[Broker 2] + B3[Broker 3] +``` + +
+ +Broker 1 crashes. + +
+ +```mermaid +graph TD + + B1[Broker 1 DOWN] + B2[Broker 2] + B3[Broker 3] +``` + +
+Replicas on Brokers 2 and 3 continue serving traffic. System remains operational. + +### Scenario 2: Disk Failure + +If one broker loses storage: + +
+ +```mermaid +graph TD + + B1[Disk Failure] + B2[Replica] + B3[Replica] +``` + +
+ +Replica copies still exist. + +Partition survives. + +### Scenario 3: Network Partition + +A broker may become temporarily unreachable. +
+ +```mermaid +graph TD + + Cluster[Kafka Cluster] + + Cluster --> B1 + Cluster --> B2 + Cluster --> B3 + + B3 -. Network Issue .- Cluster +``` + +
+ +Kafka removes unhealthy replicas from ISR. + +Cluster continues operating. + +### Scenario 4: Consumer Failure + +Consumer crashes. + +
+ +```mermaid +graph TD + + Consumer[Consumer DOWN] +``` + +
+ +Data remains safely stored in Kafka. + +Another consumer can resume processing using offsets. + +## Data Durability + +Durability means: + +> Once Kafka acknowledges a record, the record should survive failures. + +Durability is one of Kafka's most important guarantees. + +### How Kafka Achieves Durability + +Kafka combines: + +- Disk Storage +- Replication +- ISR +- Acknowledgements +- Leader Election + +to provide durability. + +### Persistent Storage + +Kafka stores records on disk. + +
+ +```mermaid +graph TD + + Memory --> Disk +``` + +
+ +Unlike in-memory systems, data survives process restarts. + +### Append-Only Log + +Records are appended sequentially. +
+ +```mermaid +graph LR + + O0 --> O1 --> O2 --> O3 --> O4 +``` + +
+ +Sequential writes are: + +- Fast +- Reliable +- Durable + +### Durability Levels + +#### Lowest Durability + +```text +Replication Factor = 1 +acks = 0 +``` + +Fastest. Highest risk of loss. + +#### Medium Durability + +```text +Replication Factor = 3 +acks = 1 +``` + +Good balance. Most common for non-critical workloads. + +#### Highest Durability + +```text +Replication Factor = 3 +acks = all +min.insync.replicas = 2 +``` + +Strong durability guarantees. Widely used in production systems. + +## Understanding min.insync.replicas + +This configuration defines the minimum number of ISR replicas required for writes. + +Example: + +```text +Replication Factor = 3 +min.insync.replicas = 2 +``` + +Valid: + +```text +ISR = {Leader, Follower1} +``` + +Writes continue. + +Invalid: + +```text +ISR = {Leader} +``` + +Writes rejected. + +Kafka prioritizes durability over availability. + +## High Availability vs Durability + +Distributed systems always involve trade-offs. + +### Favor Availability + +```text +acks=1 +``` + +System continues serving writes more easily. + +Potentially less durable. + +### Favor Durability + +```text +acks=all +min.insync.replicas=2 +``` + +Stronger guarantees. + +May reject writes under severe failures. + +## Complete Replication Flow + +
+ +```mermaid +sequenceDiagram + + participant P as Producer + participant L as Leader + participant F1 as Follower 1 + participant F2 as Follower 2 + + P->>L: Produce Record + + L->>L: Append Record + + L->>F1: Replicate Record + L->>F2: Replicate Record + + F1-->>L: Acknowledgement + F2-->>L: Acknowledgement + + L-->>P: Success +``` + +
From b74e9c793240cb9b8ad7cac2201112176060b7be Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Mon, 20 Jul 2026 21:15:14 +0530 Subject: [PATCH 6/8] chore(packages): IMDEEPMIND-34: updated the package json --- package-lock.json | 833 ++++++++++++++++++++++------------------------ package.json | 12 +- 2 files changed, 398 insertions(+), 447 deletions(-) diff --git a/package-lock.json b/package-lock.json index 11c2a60d7..c993e77ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,9 +8,9 @@ "name": "imdeepmind", "version": "0.0.0", "dependencies": { - "@docusaurus/core": "^3.10.1", - "@docusaurus/preset-classic": "^3.10.1", - "@docusaurus/theme-mermaid": "^3.10.1", + "@docusaurus/core": "^3.10.2", + "@docusaurus/preset-classic": "^3.10.2", + "@docusaurus/theme-mermaid": "^3.10.2", "@easyops-cn/docusaurus-search-local": "^0.46.1", "@mdx-js/react": "^3.0.0", "clsx": "^2.0.0", @@ -22,9 +22,9 @@ "remark-math": "^6.0.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "^3.10.1", - "@docusaurus/tsconfig": "^3.10.1", - "@docusaurus/types": "^3.10.1", + "@docusaurus/module-type-aliases": "^3.10.2", + "@docusaurus/tsconfig": "^3.10.2", + "@docusaurus/types": "^3.10.2", "baseline-browser-mapping": "^2.9.15", "gh-pages": "^6.2.0", "markdownlint-cli": "^0.45.0", @@ -34,16 +34,31 @@ "node": ">=18.0" } }, + "node_modules/@11ty/gray-matter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@11ty/gray-matter/-/gray-matter-1.0.0.tgz", + "integrity": "sha512-7mJJl+wf1AByoT0PknQiQfOPnVNT4fevGrUBVWO4HXsnYn1aQPyRyrELYrNUFleUBM++KzMKN6QaxHPk0t/6/g==", + "license": "MIT", + "dependencies": { + "js-yaml": "^4.1.0", + "kind-of": "^6.0.3", + "section-matter": "^1.0.0", + "strip-bom-string": "^1.0.0" + }, + "engines": { + "node": ">=11" + } + }, "node_modules/@algolia/abtesting": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@algolia/abtesting/-/abtesting-1.21.1.tgz", - "integrity": "sha512-Wia5/mNTfiU0PIUN25UMfAGGdASkkwuCS9nBAdmhqrNPY/ff7U/6MgBVdwFDPsa3sA1msutPtO50gvOzx6MOXA==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@algolia/abtesting/-/abtesting-1.22.0.tgz", + "integrity": "sha512-BFR6zNowNKcY7Ou7TaJc9QWexES4YKPbmf/OTFofpdsdhz4x6q0lbxp3duO0EHnyrN7rE4ba/TSXuY+BDGu4+g==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" @@ -82,100 +97,100 @@ } }, "node_modules/@algolia/client-abtesting": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/client-abtesting/-/client-abtesting-5.55.1.tgz", - "integrity": "sha512-miW8RzAtBgNiEJ9fGEhsOPgWUpekAe64YcVufqXrlykj0Jjmo5nj0a5f/HAzRVX5ZuU1GAVd7BkzFDx7q50P3A==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/client-abtesting/-/client-abtesting-5.56.0.tgz", + "integrity": "sha512-7r4Z3NC7yU1oAQVWJNA2HX7tX481F3pJvCGyLIXiTdBcthz4Q/o21jwcMYDFkuI92UWTNBQQmHYgwHo1zS5dzg==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/client-analytics": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-5.55.1.tgz", - "integrity": "sha512-eR3J3kB9JX6DdCvDRi3I4KPfwO6fR9HWYRXhVke2TXIoOQafMKCRAneg33JRmIrb+DnnJ/eWApJLF1O1CLPERg==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-5.56.0.tgz", + "integrity": "sha512-avmjXQSq+jadFO8Xl2em05/uQdQnEmHsJyOAdVbZkmVgpMfxL12aJwVVfGNwYr9nulcpuJN1X0lTaQ5wxuNGcA==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/client-common": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.55.1.tgz", - "integrity": "sha512-P5ak7EurwYqgAiDyb95mgA3WRR/Zu8CPMv36lWTISvL2AmlPyqQPy2nX/KEJRTcwaeTWwrk6wJV4/M93GfjOWw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.56.0.tgz", + "integrity": "sha512-v2TPStUhY//ripPjIVclZ8AWc7DEGooXULZGFlFu37zNatgHjw34oZZ+OSbbc/YHO+xZwPl62I1k8xH1m4S2eg==", "license": "MIT", "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/client-insights": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/client-insights/-/client-insights-5.55.1.tgz", - "integrity": "sha512-OVtj9uA//+pjvKQI5INnzbyLrf3ClNv3XRbWswwJ2kHIStQNHtBfHo+LofNB/WhM9xjuXlW5ANn2aMj65UGx7w==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/client-insights/-/client-insights-5.56.0.tgz", + "integrity": "sha512-P0ehROpM4Sem3Sqo5x2cKPgj67D3G3jy0rh1Amwkcvsfr6tkvIcdCmerieanqTF7NxUMPNFLkpIFeMO8Rpa50w==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/client-personalization": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-5.55.1.tgz", - "integrity": "sha512-oKlVFlp+qbIEe4p7E54zSiP2gEV/vDu972Ykv8VDMFwEvreS7m0YKA3a8hGGHwc7yiBUGGiR3LlwzMLfnJmy6Q==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-5.56.0.tgz", + "integrity": "sha512-SXK3Vn3WVxyzbm31oePZBJkp1wpOyuWdd4B/Pv7n0aXDxmeSWhC1R1FC1517mMrFAIaPH4Rt0x6RUe7ZNjz8FA==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/client-query-suggestions": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/client-query-suggestions/-/client-query-suggestions-5.55.1.tgz", - "integrity": "sha512-BOVrld6vdtsFmotVDMTVQfYXwrVplJ+DUvy60JFi+tkWV698q2J9NNPKEO3dr5qxtSLKQP4vHF8n+3U5PDWhOQ==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/client-query-suggestions/-/client-query-suggestions-5.56.0.tgz", + "integrity": "sha512-5+ZdX8garFnmycnZgKhtXHePEaLj5zqDxI/0lkhhluzCcvTn0/PvvTirTg8hHYetQHvn7GDyeAiqTAieMvMW4A==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/client-search": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.55.1.tgz", - "integrity": "sha512-GAqHl9zERhC3bbBfubwUu07G3UXO06gORvOcsiTBZB3et0s3auNUbHlYdYNp4VKa3sUZqH5AcD3OKzU/KDGXjQ==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.56.0.tgz", + "integrity": "sha512-+mKUdYvqOi0BcvpAEyCEw49vSBptufIcfibtHz2bdr1pI789M46Yt0uQEk/sxtK3teh71OQvVFHaTDzShUWewQ==", "license": "MIT", "peer": true, "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" @@ -188,81 +203,81 @@ "license": "MIT" }, "node_modules/@algolia/ingestion": { - "version": "1.55.1", - "resolved": "https://registry.npmjs.org/@algolia/ingestion/-/ingestion-1.55.1.tgz", - "integrity": "sha512-BXZw+C+gsWL7pZvbnhJUnCXASiDLGcQxVV7h55Pyh2DmSzwdZIVccE5xc9RVD2trtrhIqk5smuODTxtaZqd0IA==", + "version": "1.56.0", + "resolved": "https://registry.npmjs.org/@algolia/ingestion/-/ingestion-1.56.0.tgz", + "integrity": "sha512-9g/zj+AZx5moFcdFIrYQoVrueXivjUcc3MQHtCYT8WhIuk1lUh1AyEhvJCS0XBZld09cLvd1AZ3BvDBpVpX2UA==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/monitoring": { - "version": "1.55.1", - "resolved": "https://registry.npmjs.org/@algolia/monitoring/-/monitoring-1.55.1.tgz", - "integrity": "sha512-9g/ceZrZTqA62FA3588Xj0onRPjDNfu0pVQqefK0rrHp9H6Wblph/YmzGjZ2g8uqbTh0ZGIvAGCzErU8f7MHpA==", + "version": "1.56.0", + "resolved": "https://registry.npmjs.org/@algolia/monitoring/-/monitoring-1.56.0.tgz", + "integrity": "sha512-Qf3Sr6f9A9uxCZUf3MXS0d2b877uYzEB5yxqpVGXAhcJnBCQjrRRon0KvefpGkxy+BshrIJs96OUoMtGqXTFDA==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/recommend": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-5.55.1.tgz", - "integrity": "sha512-cZTIrGyAP+W4A6jDVwvWM/JOaoJKQkD/2a5eLUEeNdKAD45jN7BCpsMDONyhZlosLa4UwL8uiINQzj4iFy9nqg==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-5.56.0.tgz", + "integrity": "sha512-GXWG1rWc5wu8hY4N33Y3b6ernY6sAdAvmKWN/zHAiACOx40WnpG0TVX5YazCAr/9gOYGInSiM2A0y2jy2xbiDA==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/client-common": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/requester-browser-xhr": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.55.1.tgz", - "integrity": "sha512-N6I3leW0UO8Y9Zv90yo2UHgYGuxZO0mjbvzNxDIJDjO0qECEF7Z9XMvSNeUWXQh/iNDA9lr8MfEy3rmZGIcclw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.56.0.tgz", + "integrity": "sha512-7t24cBxaInS3mZb7ddEaZT/tp6q+/aR4YttsQVyP1/i+LmwPR34atO35KjaLFCcRVrlP7sYOAqkCfg6lIRB+ew==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1" + "@algolia/client-common": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/requester-fetch": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/requester-fetch/-/requester-fetch-5.55.1.tgz", - "integrity": "sha512-ukU5zeeFs44rQkzv+TRdYard+d+3lmPGs8lPZhHtWE8rfz+LlBSF6s9kP3VQ7LeOYL8Dz0u6tZfnyTrqrumbHQ==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-fetch/-/requester-fetch-5.56.0.tgz", + "integrity": "sha512-R7ePHgVYmDFjZpvrsVAfbDz/d4RxKAYZ5/vgLfIsCVRZRryjWl/3INOxpOICzitehQ5FjNtNjcLQTrmHPTcHBQ==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1" + "@algolia/client-common": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/requester-node-http": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.55.1.tgz", - "integrity": "sha512-lCwXyijwPm3vbYHpBXPRomMcD6mgiptmps27gnMCf4HK+u/AOeFPBnIFh4V3l4A5SnP9VRiKBZqwGBpUH0vaTg==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.56.0.tgz", + "integrity": "sha512-PIOUXlSnrqM0S+WOgDRb4RzotydJH7ZoT6tOyL7tAO7qJOfvX5wsEW8Pe+PMKMwvuI4/gIyK9cg2H7lJXqnc4Q==", "license": "MIT", "dependencies": { - "@algolia/client-common": "5.55.1" + "@algolia/client-common": "5.56.0" }, "engines": { "node": ">= 14.0.0" @@ -3443,9 +3458,9 @@ } }, "node_modules/@docusaurus/babel": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/babel/-/babel-3.10.1.tgz", - "integrity": "sha512-DZzFO1K3v/GoEt1fx1DiYHF4en+PuhtQf1AkQJa5zu3CoeKSpr5cpQRUlz3jr0m44wyzmSXu9bVpfir+N4+8bg==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/babel/-/babel-3.10.2.tgz", + "integrity": "sha512-aJ1hpGyvfkte3dDAfNbWM4biW4yWZBVz7TIGLZP+v+tWOBgxX3e0N5ZIXHIvmfNNXTI77pcHUx3KmtOk05Ze3Q==", "license": "MIT", "dependencies": { "@babel/core": "^7.25.9", @@ -3457,8 +3472,8 @@ "@babel/preset-typescript": "^7.25.9", "@babel/runtime": "^7.25.9", "@babel/traverse": "^7.25.9", - "@docusaurus/logger": "3.10.1", - "@docusaurus/utils": "3.10.1", + "@docusaurus/logger": "3.10.2", + "@docusaurus/utils": "3.10.2", "babel-plugin-dynamic-import-node": "^2.3.3", "fs-extra": "^11.1.1", "tslib": "^2.6.0" @@ -3468,17 +3483,17 @@ } }, "node_modules/@docusaurus/bundler": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/bundler/-/bundler-3.10.1.tgz", - "integrity": "sha512-HIqQPvbqnnQRe4NsBd1774KRarjXqS6wHsWELtyuSs1gCfvixJO2jUGH/OEBtr1Gvzpw+ze5CjGMvSJ8UE1KUw==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/bundler/-/bundler-3.10.2.tgz", + "integrity": "sha512-i0ZNcy0f0WhaOlYVgzLsWhIoEXO9kS3HRoKPtgE6vQtZUq7arKZaYdNBudr3mqCmd+TyOkwtwfHgs1ENj07r5g==", "license": "MIT", "dependencies": { "@babel/core": "^7.25.9", - "@docusaurus/babel": "3.10.1", - "@docusaurus/cssnano-preset": "3.10.1", - "@docusaurus/logger": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils": "3.10.1", + "@docusaurus/babel": "3.10.2", + "@docusaurus/cssnano-preset": "3.10.2", + "@docusaurus/logger": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils": "3.10.2", "babel-loader": "^9.2.1", "clean-css": "^5.3.3", "copy-webpack-plugin": "^11.0.0", @@ -3511,18 +3526,18 @@ } }, "node_modules/@docusaurus/core": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/core/-/core-3.10.1.tgz", - "integrity": "sha512-3pf2fXXw0eVk8WnC3T4LIigRDupcpvngpKo9Vy7mYyBhuddc0klDUuZAIfzMoK6z05pdlk6EFC/vBSX43+1O5w==", - "license": "MIT", - "dependencies": { - "@docusaurus/babel": "3.10.1", - "@docusaurus/bundler": "3.10.1", - "@docusaurus/logger": "3.10.1", - "@docusaurus/mdx-loader": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-common": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/core/-/core-3.10.2.tgz", + "integrity": "sha512-EYByj6nk+aD9KeVxV6Hmo2/nAAT79P21Y82ycTBOBtrmqilloIbIEhgL2/8Xpt2Jz/pgNqHAwyusOGwmbKeJmA==", + "license": "MIT", + "dependencies": { + "@docusaurus/babel": "3.10.2", + "@docusaurus/bundler": "3.10.2", + "@docusaurus/logger": "3.10.2", + "@docusaurus/mdx-loader": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-common": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "boxen": "^6.2.1", "chalk": "^4.1.2", "chokidar": "^3.5.3", @@ -3530,7 +3545,7 @@ "combine-promises": "^1.1.0", "commander": "^5.1.0", "core-js": "^3.31.1", - "detect-port": "^1.5.1", + "detect-port": "^2.1.0", "escape-html": "^1.0.3", "eta": "^2.2.0", "eval": "^0.1.8", @@ -3578,9 +3593,9 @@ } }, "node_modules/@docusaurus/cssnano-preset": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/cssnano-preset/-/cssnano-preset-3.10.1.tgz", - "integrity": "sha512-eNfHGcTKCSq6xmcavAkX3RRclHaE2xRCMParlDXLdXVP01/a2e/jKXMj/0ULnLFQSNwwuI62L0Ge8J+nZsR7UQ==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/cssnano-preset/-/cssnano-preset-3.10.2.tgz", + "integrity": "sha512-4gCnHRbJLTloiwfvFAa92tgb2gI4KYhvjfQVYnEaiMO/EgvWfCo1LwytHXen+1oZAN0VAlS0JAPxp3MsvKDa3A==", "license": "MIT", "dependencies": { "cssnano-preset-advanced": "^6.1.2", @@ -3593,9 +3608,9 @@ } }, "node_modules/@docusaurus/logger": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/logger/-/logger-3.10.1.tgz", - "integrity": "sha512-oPjNFnfJsRCkePVjkGrxWGq4MvJKRQT0r9jOP0eRBTZ7Wr9FAbzdP/Gjs0I2Ss6YRkPoEgygKG112OkE6skvJw==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/logger/-/logger-3.10.2.tgz", + "integrity": "sha512-gSEwqtPfCAnC3ZSJY6xL7tcIfgg0vFD39jbv93eakuweyvO2864xR0K+kmKwBhkTCtWRNjuGGnb5rdmkD/ndqw==", "license": "MIT", "dependencies": { "chalk": "^4.1.2", @@ -3606,14 +3621,14 @@ } }, "node_modules/@docusaurus/mdx-loader": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/mdx-loader/-/mdx-loader-3.10.1.tgz", - "integrity": "sha512-GRmeb/wQ+iXRrFwcHBfgQhrJxGElgCsoTWZYDhccjsZVne1p8MK/EpQVIloXttz76TCe78kKD5AEG9n1xc1oxQ==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/mdx-loader/-/mdx-loader-3.10.2.tgz", + "integrity": "sha512-9Fd4V/SFjfrVQ0JH5EN0+iPWyFunvTeQE3gfyFeetqPaXMP0OylIjOw16dCuXG4NZJrYdBqwzjh18/h3gRi47w==", "license": "MIT", "dependencies": { - "@docusaurus/logger": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/logger": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "@mdx-js/mdx": "^3.0.0", "@slorber/remark-comment": "^1.0.0", "escape-html": "^1.0.3", @@ -3645,12 +3660,12 @@ } }, "node_modules/@docusaurus/module-type-aliases": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-3.10.1.tgz", - "integrity": "sha512-YoOZKUdGlp8xSYhuAkGdSo5Ydkbq4V4eK3sD8v0a2hloxCWdQbNBhkc+Ko9QyjpESc0BYcIGM5iHVAy5hdFV6w==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-3.10.2.tgz", + "integrity": "sha512-h/I5e4jaAhDHW4vaLENi1i2hnOEnXY1t9R+nnRTbgUl7ymVRzN/HF7dDfj8rKYGj8gfIge+Ef+iYRAMtbGvsrQ==", "license": "MIT", "dependencies": { - "@docusaurus/types": "3.10.1", + "@docusaurus/types": "3.10.2", "@types/history": "^4.7.11", "@types/react": "*", "@types/react-router-config": "*", @@ -3664,19 +3679,19 @@ } }, "node_modules/@docusaurus/plugin-content-blog": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.10.1.tgz", - "integrity": "sha512-mmkgE6Q2+K74tnkou7tXlpDLvoCU/qkSa2GSQ3XUiHWvcebCoDQzS670RR3tO8PmaWlIyWWISYWzZLuMfxunRA==", - "license": "MIT", - "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/logger": "3.10.1", - "@docusaurus/mdx-loader": "3.10.1", - "@docusaurus/theme-common": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-common": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.10.2.tgz", + "integrity": "sha512-0cbEnNKf0InmLkhj/+nVRmqEnWEoOE8Mh+2x1qOXI0qYpCnphq4RXknVJ8BvybKRXqYVvbmdMfiJSup+k4tm5w==", + "license": "MIT", + "dependencies": { + "@docusaurus/core": "3.10.2", + "@docusaurus/logger": "3.10.2", + "@docusaurus/mdx-loader": "3.10.2", + "@docusaurus/theme-common": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-common": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "cheerio": "1.0.0-rc.12", "combine-promises": "^1.1.0", "feed": "^4.2.2", @@ -3699,21 +3714,21 @@ } }, "node_modules/@docusaurus/plugin-content-docs": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.10.1.tgz", - "integrity": "sha512-2jRVrtzjf8LClGTHQlwlwuD3wQXRx3WEoF7XUarJ8Ou+0onV+SLtejsyfY9JLpfUh9hPhXM4pbBGkyAY4Bi3HQ==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.10.2.tgz", + "integrity": "sha512-Sqwl4FPoZBDrlY8I2VU2H8O0M91CHp9T8ToMSkTZmjvHCif+1laqfXi6sTk8IfyVS/trN5yNjcWd1bFsGB6W5Q==", "license": "MIT", "peer": true, "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/logger": "3.10.1", - "@docusaurus/mdx-loader": "3.10.1", - "@docusaurus/module-type-aliases": "3.10.1", - "@docusaurus/theme-common": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-common": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/logger": "3.10.2", + "@docusaurus/mdx-loader": "3.10.2", + "@docusaurus/module-type-aliases": "3.10.2", + "@docusaurus/theme-common": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-common": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "@types/react-router-config": "^5.0.7", "combine-promises": "^1.1.0", "fs-extra": "^11.1.1", @@ -3733,16 +3748,16 @@ } }, "node_modules/@docusaurus/plugin-content-pages": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-pages/-/plugin-content-pages-3.10.1.tgz", - "integrity": "sha512-huJpaRPMl42nsFwuCXvV8bVDj2MazuwRJIUylI/RSlmZeJssVoZXeCjVf1y+1Drtpa9SKcdGn8yoJ76IRJijtw==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-pages/-/plugin-content-pages-3.10.2.tgz", + "integrity": "sha512-h5R12sZ/vV9EPiVjvIl9YFCOwkpwXes7dQMYt3EvP6Pphu4amHxxTqWxf08Fl5DR8h+oZMbWpFTNw5vKEYfvzQ==", "license": "MIT", "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/mdx-loader": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/mdx-loader": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "fs-extra": "^11.1.1", "tslib": "^2.6.0", "webpack": "^5.88.1" @@ -3756,15 +3771,15 @@ } }, "node_modules/@docusaurus/plugin-css-cascade-layers": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-css-cascade-layers/-/plugin-css-cascade-layers-3.10.1.tgz", - "integrity": "sha512-r//fn+MNHkE1wCof8T29VAQezt1enGCpsFxoziBbvLgBM4JfXN2P3rxrBaavHmvLvm7lYkpJeitcDthwnmWCTw==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-css-cascade-layers/-/plugin-css-cascade-layers-3.10.2.tgz", + "integrity": "sha512-UkdvQby5OQUKWrw3lLnSTJXQ6VETaUVTuPQX9AABtmFm5h+ifEBx1OQ+LN726Q4byuwBf2ElHkf4qU4hTxdvRg==", "license": "MIT", "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "tslib": "^2.6.0" }, "engines": { @@ -3772,14 +3787,14 @@ } }, "node_modules/@docusaurus/plugin-debug": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-debug/-/plugin-debug-3.10.1.tgz", - "integrity": "sha512-9KqOpKNfAyqGZykRb9LhIT/vyRF6sm/ykhjj/39JvaJahDS+jZJE0Z1Wfz9q3DUNDTMNN0Q7u/kk4rKKU+IJuA==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-debug/-/plugin-debug-3.10.2.tgz", + "integrity": "sha512-8vbZNOSCpnsT57EY6CgN7sgRVmx3KTYwO8Uvo2pbxOyb8tbqAwtT9SslqaQ41HbA1v1hpn5RP7u5s2KvRwAFpQ==", "license": "MIT", "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils": "3.10.2", "fs-extra": "^11.1.1", "react-json-view-lite": "^2.3.0", "tslib": "^2.6.0" @@ -3793,14 +3808,14 @@ } }, "node_modules/@docusaurus/plugin-google-analytics": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-3.10.1.tgz", - "integrity": "sha512-8o0P1KtmgdYQHH+oInitPpRWI0Of5XednAX4+DMhQNSmGSRNrsEEHg1ebv35m9AgRClfAytCJ5jA9KvcASTyuA==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-3.10.2.tgz", + "integrity": "sha512-kMHMBK9j4VAtgd5owwrRLRIi0EjkrpXlX7ePj1+y68XfVZV9I1T4S+koPDm+Hfw2TtnyHvh0uNrDvjz+DjQGVA==", "license": "MIT", "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "tslib": "^2.6.0" }, "engines": { @@ -3812,15 +3827,14 @@ } }, "node_modules/@docusaurus/plugin-google-gtag": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-3.10.1.tgz", - "integrity": "sha512-pu3xIUo5o/zCMLfUY9BO5KOwSH0zIsAGyFRPvXHayFSA5XIhCU/SFuB0g0ZNjFn9niZLCaNvoeAuOGFJZq0fdw==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-3.10.2.tgz", + "integrity": "sha512-Vt90nNFhtAChRe9+it1hcHFgFvETdSnOkL5Bma+p6E/yU2tAYrvvyk+gv+LJGM2ZUkyKuKXLRsZ2Lb0bO7+Vog==", "license": "MIT", "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", - "@types/gtag.js": "^0.0.20", + "@docusaurus/core": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "tslib": "^2.6.0" }, "engines": { @@ -3832,14 +3846,14 @@ } }, "node_modules/@docusaurus/plugin-google-tag-manager": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-tag-manager/-/plugin-google-tag-manager-3.10.1.tgz", - "integrity": "sha512-f6fyGHiCm7kJHBtAisGQS5oNBnpnMTYQZxDXeVrnw/3zWU+LMA22pr6UHGYkBKDbN+qPC5QHG3NuOfzQLq3+Lw==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-google-tag-manager/-/plugin-google-tag-manager-3.10.2.tgz", + "integrity": "sha512-MLCffCldysi/R0nzJQP7ZWd0xAoGNnSTiVOo6TTR6mKVGFhE+/XArGe67ZcaZv1uytgQXoXs92VJrgVDrz80rQ==", "license": "MIT", "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "tslib": "^2.6.0" }, "engines": { @@ -3851,17 +3865,17 @@ } }, "node_modules/@docusaurus/plugin-sitemap": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-sitemap/-/plugin-sitemap-3.10.1.tgz", - "integrity": "sha512-C26MbmmqgdjkDq1htaZ3aD7LzEDKFWXfpyQpt0EOUThuq5nV77zDaedV20yHcVo9p+3ey9aZ4pbHA0D3QcZTzg==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-sitemap/-/plugin-sitemap-3.10.2.tgz", + "integrity": "sha512-PODkwg5XetLML3hU/3xpCKJUZ9cqExLaBnD/Fzzwj2VHogLeqnDisLIujae87zuze7T4mCm2A6KEqZkyiz07EQ==", "license": "MIT", "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/logger": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-common": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/logger": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-common": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "fs-extra": "^11.1.1", "sitemap": "^7.1.1", "tslib": "^2.6.0" @@ -3875,15 +3889,15 @@ } }, "node_modules/@docusaurus/plugin-svgr": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/plugin-svgr/-/plugin-svgr-3.10.1.tgz", - "integrity": "sha512-6SFxsmjWFkVLDmBUvFK6i72QjUwqyQFe4Ovz+SUJophJjOyVG3ZZG5IQpBC/kX/Gfv1yWeU9nWauH6F6Q7QX/Q==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-svgr/-/plugin-svgr-3.10.2.tgz", + "integrity": "sha512-JgfT3jWM0TJ8Uw0cEcqxHpybngQY1vlBYpuuNO+gEh5iPh5Ar+vxq/u9CFrYsWeXy48BN7Db76Pzp2edNXUQ8A==", "license": "MIT", "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "@svgr/core": "8.1.0", "@svgr/webpack": "^8.1.0", "tslib": "^2.6.0", @@ -3898,26 +3912,26 @@ } }, "node_modules/@docusaurus/preset-classic": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/preset-classic/-/preset-classic-3.10.1.tgz", - "integrity": "sha512-YO/FL8v1zmbxoTso6mjMz/RDjhaTJxb1UpFFTDdY5847LLDCeyYiYlrhyTbgN1RIN3xnkLKZ9Lj1x8hUzI4JOg==", - "license": "MIT", - "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/plugin-content-blog": "3.10.1", - "@docusaurus/plugin-content-docs": "3.10.1", - "@docusaurus/plugin-content-pages": "3.10.1", - "@docusaurus/plugin-css-cascade-layers": "3.10.1", - "@docusaurus/plugin-debug": "3.10.1", - "@docusaurus/plugin-google-analytics": "3.10.1", - "@docusaurus/plugin-google-gtag": "3.10.1", - "@docusaurus/plugin-google-tag-manager": "3.10.1", - "@docusaurus/plugin-sitemap": "3.10.1", - "@docusaurus/plugin-svgr": "3.10.1", - "@docusaurus/theme-classic": "3.10.1", - "@docusaurus/theme-common": "3.10.1", - "@docusaurus/theme-search-algolia": "3.10.1", - "@docusaurus/types": "3.10.1" + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/preset-classic/-/preset-classic-3.10.2.tgz", + "integrity": "sha512-a4B3VczmDl99zK0EufDQYomdJ186WDingjmDXxhN2PNPS9Ty/Y2M5CLFX1KQMRKqRTLiRDKfutzG5IY1FC/ceg==", + "license": "MIT", + "dependencies": { + "@docusaurus/core": "3.10.2", + "@docusaurus/plugin-content-blog": "3.10.2", + "@docusaurus/plugin-content-docs": "3.10.2", + "@docusaurus/plugin-content-pages": "3.10.2", + "@docusaurus/plugin-css-cascade-layers": "3.10.2", + "@docusaurus/plugin-debug": "3.10.2", + "@docusaurus/plugin-google-analytics": "3.10.2", + "@docusaurus/plugin-google-gtag": "3.10.2", + "@docusaurus/plugin-google-tag-manager": "3.10.2", + "@docusaurus/plugin-sitemap": "3.10.2", + "@docusaurus/plugin-svgr": "3.10.2", + "@docusaurus/theme-classic": "3.10.2", + "@docusaurus/theme-common": "3.10.2", + "@docusaurus/theme-search-algolia": "3.10.2", + "@docusaurus/types": "3.10.2" }, "engines": { "node": ">=20.0" @@ -3928,24 +3942,24 @@ } }, "node_modules/@docusaurus/theme-classic": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/theme-classic/-/theme-classic-3.10.1.tgz", - "integrity": "sha512-VU1RK0qb2pab0si4r7HFK37cYco8VzqLj3u1PspVipSr/z/GPVKHO4/HXbnePqHoWDk8urjyGSeatH0NIMBM1A==", - "license": "MIT", - "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/logger": "3.10.1", - "@docusaurus/mdx-loader": "3.10.1", - "@docusaurus/module-type-aliases": "3.10.1", - "@docusaurus/plugin-content-blog": "3.10.1", - "@docusaurus/plugin-content-docs": "3.10.1", - "@docusaurus/plugin-content-pages": "3.10.1", - "@docusaurus/theme-common": "3.10.1", - "@docusaurus/theme-translations": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-common": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-classic/-/theme-classic-3.10.2.tgz", + "integrity": "sha512-JqTSLQmqmA9uKWZsD5iwBGJ4JyKB4/yTw6PsSXVPRJG/6GAm/u+add9Iip+hvwP12/AnPNztrdxsI14NJW4KeA==", + "license": "MIT", + "dependencies": { + "@docusaurus/core": "3.10.2", + "@docusaurus/logger": "3.10.2", + "@docusaurus/mdx-loader": "3.10.2", + "@docusaurus/module-type-aliases": "3.10.2", + "@docusaurus/plugin-content-blog": "3.10.2", + "@docusaurus/plugin-content-docs": "3.10.2", + "@docusaurus/plugin-content-pages": "3.10.2", + "@docusaurus/theme-common": "3.10.2", + "@docusaurus/theme-translations": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-common": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "@mdx-js/react": "^3.0.0", "clsx": "^2.0.0", "copy-text-to-clipboard": "^3.2.0", @@ -3969,16 +3983,16 @@ } }, "node_modules/@docusaurus/theme-common": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/theme-common/-/theme-common-3.10.1.tgz", - "integrity": "sha512-0YtmIeoNo1fIw65LO8+/1dPgmDV86UmhMkow37gzjytuiCSQm9xob6PJy0L4kuQEMTLfUOGvkXvZr7GPrHquMA==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-common/-/theme-common-3.10.2.tgz", + "integrity": "sha512-R9b/vMpK1yye6hNZTA6x/ivRv+at6GhxnXcxkpzCGzO1R1RwiquqiFg2wMFh6aqlJTpWRFKpFD2TzCDQcyOU0A==", "license": "MIT", "peer": true, "dependencies": { - "@docusaurus/mdx-loader": "3.10.1", - "@docusaurus/module-type-aliases": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-common": "3.10.1", + "@docusaurus/mdx-loader": "3.10.2", + "@docusaurus/module-type-aliases": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-common": "3.10.2", "@types/history": "^4.7.11", "@types/react": "*", "@types/react-router-config": "*", @@ -3998,16 +4012,16 @@ } }, "node_modules/@docusaurus/theme-mermaid": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/theme-mermaid/-/theme-mermaid-3.10.1.tgz", - "integrity": "sha512-2gxpmln8Pc4EN1oWzshQEx2HTs67jk14v7MmgqGs8ZU7Nm8oihg+fTouof2u4vN8DtB3Fln4cDJu4UprSX1S3Q==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-mermaid/-/theme-mermaid-3.10.2.tgz", + "integrity": "sha512-Stssh5MYQJ+EdYugUXf+ZcpeJFQPKXf0KCd/SWp10o3CmXNaOoh5IEgVjVqY1e1XhQf3on4+Y4BnrMiD95E2SQ==", "license": "MIT", "dependencies": { - "@docusaurus/core": "3.10.1", - "@docusaurus/module-type-aliases": "3.10.1", - "@docusaurus/theme-common": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/module-type-aliases": "3.10.2", + "@docusaurus/theme-common": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "mermaid": ">=11.6.0", "tslib": "^2.6.0" }, @@ -4026,20 +4040,20 @@ } }, "node_modules/@docusaurus/theme-search-algolia": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/theme-search-algolia/-/theme-search-algolia-3.10.1.tgz", - "integrity": "sha512-OTaARARVZj2GvkJQjB+1jOIxntRaXea+G+fMsNqrZBAU1O1vJKDW22R7kECOHW27oJCLFN9HKaZeRrfAUyviug==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-search-algolia/-/theme-search-algolia-3.10.2.tgz", + "integrity": "sha512-1msxllyhi/5m77JukXtp5UFnUAriwZIC1oJ7MTnpQpCwLTbclJi5BK5n28CTZuSXpQN2ewbbnqRgAhMM6c6ihg==", "license": "MIT", "dependencies": { "@algolia/autocomplete-core": "^1.19.2", "@docsearch/react": "^3.9.0 || ^4.3.2", - "@docusaurus/core": "3.10.1", - "@docusaurus/logger": "3.10.1", - "@docusaurus/plugin-content-docs": "3.10.1", - "@docusaurus/theme-common": "3.10.1", - "@docusaurus/theme-translations": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-validation": "3.10.1", + "@docusaurus/core": "3.10.2", + "@docusaurus/logger": "3.10.2", + "@docusaurus/plugin-content-docs": "3.10.2", + "@docusaurus/theme-common": "3.10.2", + "@docusaurus/theme-translations": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-validation": "3.10.2", "algoliasearch": "^5.37.0", "algoliasearch-helper": "^3.26.0", "clsx": "^2.0.0", @@ -4058,9 +4072,9 @@ } }, "node_modules/@docusaurus/theme-translations": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/theme-translations/-/theme-translations-3.10.1.tgz", - "integrity": "sha512-cLMyaKivjBVWKMJuWqyFVVgtqe8DPJNPkog0bn8W1MDVAKcPdxRFycBfC1We1RaNp7Rdk513bmtW78RR6OBxBw==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-translations/-/theme-translations-3.10.2.tgz", + "integrity": "sha512-iv20wrxnyXkY89LM3TzRlzGlt5fIGO5UnaR6UL1ZVfB9RRFjxQFQ6awDrwAc6Km8Y5gD8pInuwYPF+6/TiCxXA==", "license": "MIT", "dependencies": { "fs-extra": "^11.1.1", @@ -4071,16 +4085,16 @@ } }, "node_modules/@docusaurus/tsconfig": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/tsconfig/-/tsconfig-3.10.1.tgz", - "integrity": "sha512-rYvB7yqkdqWIpAbDzQljGfM4cDBkLTbhmagZBEcsyj6oPUsz47lmW2pYdN1j+7sGFgltbAmQH62xfbrij4Eh6Q==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/tsconfig/-/tsconfig-3.10.2.tgz", + "integrity": "sha512-5GiB7h/nFsMFPO9mCqcRNE1yA5TSXXNCshNIgHPL6fCPOjcTDixs6qjQBu8ddkgPcicwCvOA7n3jeK2rGdJk6g==", "dev": true, "license": "MIT" }, "node_modules/@docusaurus/types": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/types/-/types-3.10.1.tgz", - "integrity": "sha512-XYMK8k1szDCFMw2V+Xyen0g7Kee1sP3dtFnl7vkGkZOkeAJ/oPDQPL8iz4HBKOo/cwU8QeV6onVjMqtP+tFzsw==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/types/-/types-3.10.2.tgz", + "integrity": "sha512-B6rvfwIFSapUqUJjMriZswX13K8l5Z7AcmVE6uTEJpYddQieSTR12DsGaFtcZAIDsQd4p+0WTl0Vc6jmZK0Trw==", "license": "MIT", "dependencies": { "@mdx-js/mdx": "^3.0.0", @@ -4114,21 +4128,21 @@ } }, "node_modules/@docusaurus/utils": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/utils/-/utils-3.10.1.tgz", - "integrity": "sha512-3ojeJry9xBYdJO6qoyyzqeJFSJBVx2mXhyDzSdjwL2+URFQMf+h25gG38iswGImicK0ELjTd1EL2xzk8hf3QPw==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/utils/-/utils-3.10.2.tgz", + "integrity": "sha512-xx0W3eav2uW1NRIpuHJWNwLTC15xPNjU4Uxi9NSnd3swYC96BE3vFiT93SD8s24kmAAWNwgZwfZ2fghGZ01Lcw==", "license": "MIT", "dependencies": { - "@docusaurus/logger": "3.10.1", - "@docusaurus/types": "3.10.1", - "@docusaurus/utils-common": "3.10.1", + "@11ty/gray-matter": "^1.0.0", + "@docusaurus/logger": "3.10.2", + "@docusaurus/types": "3.10.2", + "@docusaurus/utils-common": "3.10.2", "escape-string-regexp": "^4.0.0", "execa": "^5.1.1", "file-loader": "^6.2.0", "fs-extra": "^11.1.1", "github-slugger": "^1.5.0", "globby": "^11.1.0", - "gray-matter": "^4.0.3", "jiti": "^1.20.0", "js-yaml": "^4.1.0", "lodash": "^4.17.21", @@ -4146,12 +4160,12 @@ } }, "node_modules/@docusaurus/utils-common": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/utils-common/-/utils-common-3.10.1.tgz", - "integrity": "sha512-5mFSgEADtnFxFH7RLw02QA5MpU5JVUCj0MPeIvi/aF4Fi45tQRIuTwXoXDqJ+1VfQJuYJGz3SI63wmGz4HvXzA==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/utils-common/-/utils-common-3.10.2.tgz", + "integrity": "sha512-x3Dz6jv6iQKBNjBmVTu8p57abMp/VNTUgKBMgRVXJc5444orBTsArv0+cdfrXTiz/VMmHfDRVkPbL7GH2B7T7w==", "license": "MIT", "dependencies": { - "@docusaurus/types": "3.10.1", + "@docusaurus/types": "3.10.2", "tslib": "^2.6.0" }, "engines": { @@ -4159,14 +4173,14 @@ } }, "node_modules/@docusaurus/utils-validation": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@docusaurus/utils-validation/-/utils-validation-3.10.1.tgz", - "integrity": "sha512-cRv1X69jwaWv47waglllgZVWzeBFLhl53XT/XED/83BerVBTC5FTP8WTcVl8Z6sZOegDSwitu/wpCSPCDOT6lg==", + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/@docusaurus/utils-validation/-/utils-validation-3.10.2.tgz", + "integrity": "sha512-sn8unbDfUL585NtR3cwHefPicOyaHvPaX7VD0aOg/siIxUBoKyKKaGEqzJZDS64mM43TnxurkYDtmB1wsJlZsw==", "license": "MIT", "dependencies": { - "@docusaurus/logger": "3.10.1", - "@docusaurus/utils": "3.10.1", - "@docusaurus/utils-common": "3.10.1", + "@docusaurus/logger": "3.10.2", + "@docusaurus/utils": "3.10.2", + "@docusaurus/utils-common": "3.10.2", "fs-extra": "^11.2.0", "joi": "^17.9.2", "js-yaml": "^4.1.0", @@ -5225,9 +5239,9 @@ "license": "BSD-3-Clause" }, "node_modules/@sinclair/typebox": { - "version": "0.27.10", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz", - "integrity": "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==", + "version": "0.27.12", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.12.tgz", + "integrity": "sha512-hhyNJ+nbR6ZR7pToHvllEFun9TL0sbL+tk/ON75lo+Xas054uez98qRbsuNt7MBCyZKK4+8Yli/OAGZhmfBZ/g==", "license": "MIT" }, "node_modules/@sindresorhus/is": { @@ -5887,12 +5901,6 @@ "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", "license": "MIT" }, - "node_modules/@types/gtag.js": { - "version": "0.0.20", - "resolved": "https://registry.npmjs.org/@types/gtag.js/-/gtag.js-0.0.20.tgz", - "integrity": "sha512-wwAbk3SA2QeU67unN7zPxjEHmPmlXwZXZvQEpbEUQuMCRGgKyE1m6XDuTUA9b6pCGb/GqJmdfMOY5LuDjJSbbg==", - "license": "MIT" - }, "node_modules/@types/hast": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", @@ -6438,12 +6446,12 @@ } }, "node_modules/address": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/address/-/address-1.2.2.tgz", - "integrity": "sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/address/-/address-2.0.3.tgz", + "integrity": "sha512-XNAb/a6TCqou+TufU8/u11HCu9x1gYvOoxLwtlXgIqmkrYQADVv6ljyW2zwiPhHz9R1gItAWpuDrdJMmrOBFEA==", "license": "MIT", "engines": { - "node": ">= 10.0.0" + "node": ">= 16.0.0" } }, "node_modules/aggregate-error": { @@ -6506,35 +6514,35 @@ } }, "node_modules/algoliasearch": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-5.55.1.tgz", - "integrity": "sha512-FyaFnnsbVPtevQwqSj/SdxE3jAsSsY0BEH8IVLf9rXxEBdAhAmT6VKCVSMWoaPIHVN1Eufh/1w8q6k8URpIkWw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-5.56.0.tgz", + "integrity": "sha512-PrqppUmhT4ENdas2pH9caE7efUcxy6EcSFhWzosiVuQBzu2tQ5yLTI6jwomT/1cuBnivzGfxiJCqDNN9FRRh+Q==", "license": "MIT", "peer": true, "dependencies": { - "@algolia/abtesting": "1.21.1", - "@algolia/client-abtesting": "5.55.1", - "@algolia/client-analytics": "5.55.1", - "@algolia/client-common": "5.55.1", - "@algolia/client-insights": "5.55.1", - "@algolia/client-personalization": "5.55.1", - "@algolia/client-query-suggestions": "5.55.1", - "@algolia/client-search": "5.55.1", - "@algolia/ingestion": "1.55.1", - "@algolia/monitoring": "1.55.1", - "@algolia/recommend": "5.55.1", - "@algolia/requester-browser-xhr": "5.55.1", - "@algolia/requester-fetch": "5.55.1", - "@algolia/requester-node-http": "5.55.1" + "@algolia/abtesting": "1.22.0", + "@algolia/client-abtesting": "5.56.0", + "@algolia/client-analytics": "5.56.0", + "@algolia/client-common": "5.56.0", + "@algolia/client-insights": "5.56.0", + "@algolia/client-personalization": "5.56.0", + "@algolia/client-query-suggestions": "5.56.0", + "@algolia/client-search": "5.56.0", + "@algolia/ingestion": "1.56.0", + "@algolia/monitoring": "1.56.0", + "@algolia/recommend": "5.56.0", + "@algolia/requester-browser-xhr": "5.56.0", + "@algolia/requester-fetch": "5.56.0", + "@algolia/requester-node-http": "5.56.0" }, "engines": { "node": ">= 14.0.0" } }, "node_modules/algoliasearch-helper": { - "version": "3.29.1", - "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-3.29.1.tgz", - "integrity": "sha512-6ck2YFudF2Pje7szQoPBiRFTGfd+1I+0I/WfLPGn0bj1kvrFoOQmNyedNiDxTk3/r4IfSLDYk+RA4G7u8H6+yA==", + "version": "3.29.2", + "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-3.29.2.tgz", + "integrity": "sha512-SaV+rZM3drExb0punEYYjT+sNcH74YFwN8ocjya7IDOyQvKWeQpEaSMVG3+IGTVos+feuatj7ljQ4BXlXdUp3w==", "license": "MIT", "dependencies": { "@algolia/events": "^4.0.1" @@ -6688,9 +6696,9 @@ "license": "MIT" }, "node_modules/autoprefixer": { - "version": "10.5.2", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.5.2.tgz", - "integrity": "sha512-rD5t5DwOjJdmSORcTq64j8MawTC+tbQ+HHqjR4NDumamy/ambn1UJrlKL+KdwujWxMkFjPM3pPHOEA9tl4767Q==", + "version": "10.5.4", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.5.4.tgz", + "integrity": "sha512-MaU0U/za7N3r6brxD4YB/l4NSrFzLPlANv6wEuQVaIPlD3L4W9rFcQPbL/EilY9BHhHvhfcz3gInDLrEtWT4EA==", "funding": [ { "type": "opencollective", @@ -6707,8 +6715,8 @@ ], "license": "MIT", "dependencies": { - "browserslist": "^4.28.4", - "caniuse-lite": "^1.0.30001799", + "browserslist": "^4.28.6", + "caniuse-lite": "^1.0.30001806", "fraction.js": "^5.3.4", "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" @@ -6814,9 +6822,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.10.40", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.40.tgz", - "integrity": "sha512-BSSLZ9/Cjjv7Gtj5B68ZzXcXUg8iOf3fme+FCuh8rC/Go+Kmh8cox7M3A8dolou16s64QjLPOSdngh7GxXvkSw==", + "version": "2.10.43", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.43.tgz", + "integrity": "sha512-AjYpR78kDWAY3Efj+cDTFH9t9SCoL7OoTp1BOb0mQV7S+6CiLwnWM3FyxhJtdPufDFKzmCSFoUncKjWgJEZTCQ==", "license": "Apache-2.0", "bin": { "baseline-browser-mapping": "dist/cli.cjs" @@ -6973,9 +6981,9 @@ } }, "node_modules/browserslist": { - "version": "4.28.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.4.tgz", - "integrity": "sha512-MTc8i/x9jBQd1iMw2CFGS+rwMa07eYjLR0CCTLDACl9xhxy+nIs3KeML/biicXtk9JrZ6dnnTatmc7ErPXIxqw==", + "version": "4.28.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.6.tgz", + "integrity": "sha512-FQBYNK15VMslhLHpA7+n+n1GOlF1kId2xcCg7/j95f24AOF6VDYMNH4mFxF7KuaTdv627faazpOAjFzMrfJOUw==", "funding": [ { "type": "opencollective", @@ -6993,10 +7001,10 @@ "license": "MIT", "peer": true, "dependencies": { - "baseline-browser-mapping": "^2.10.38", - "caniuse-lite": "^1.0.30001799", - "electron-to-chromium": "^1.5.376", - "node-releases": "^2.0.48", + "baseline-browser-mapping": "^2.10.42", + "caniuse-lite": "^1.0.30001803", + "electron-to-chromium": "^1.5.389", + "node-releases": "^2.0.51", "update-browserslist-db": "^1.2.3" }, "bin": { @@ -7163,9 +7171,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001799", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz", - "integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==", + "version": "1.0.30001806", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001806.tgz", + "integrity": "sha512-72Cuvd95zbSYPKq6Fhg8eDJRlzgWDf7/mtoZv6Qe/DYNCEBdNxoA3+rZAU2ZhGCpZlns3EssFavaZomckT5Uuw==", "funding": [ { "type": "opencollective", @@ -9016,20 +9024,19 @@ "license": "MIT" }, "node_modules/detect-port": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/detect-port/-/detect-port-1.6.1.tgz", - "integrity": "sha512-CmnVc+Hek2egPx1PeTFVta2W78xy2K/9Rkf6cC4T59S50tVnzKj+tnx5mmx5lwvCkujZ4uRrpRSuV+IVs3f90Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-port/-/detect-port-2.1.0.tgz", + "integrity": "sha512-epZuWb/6Q62L+nDHJc/hQAqf8pylsqgk3BpZXVBx1CDnr3nkrVNn73Uu1rXcFzkNcc+hkP3whuOg7JZYaQB65Q==", "license": "MIT", "dependencies": { - "address": "^1.0.1", - "debug": "4" + "address": "^2.0.1" }, "bin": { - "detect": "bin/detect-port.js", - "detect-port": "bin/detect-port.js" + "detect": "dist/commonjs/bin/detect-port.js", + "detect-port": "dist/commonjs/bin/detect-port.js" }, "engines": { - "node": ">= 4.0.0" + "node": ">= 16.0.0" } }, "node_modules/devlop": { @@ -9209,9 +9216,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.380", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.380.tgz", - "integrity": "sha512-W6d5AbuEoRayO447cqrg6lKJIlscgRnnxOZl/08kfV71BQDoEBC7Wwis68z87LjyK6f4kWyTaubuDbhHKrZkbA==", + "version": "1.5.393", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.393.tgz", + "integrity": "sha512-kiDJdIUawuEIcp9XoICKp1iTYDEbgguIPq526N1Q7jIQDeQ3CqoMx71025PI/7E48Ddtw2HuWsVjY7afEgNxmg==", "license": "ISC" }, "node_modules/email-addresses": { @@ -9438,19 +9445,6 @@ "node": ">=8.0.0" } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/esrecurse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", @@ -10569,43 +10563,6 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "license": "ISC" }, - "node_modules/gray-matter": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", - "integrity": "sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==", - "license": "MIT", - "dependencies": { - "js-yaml": "^3.13.1", - "kind-of": "^6.0.2", - "section-matter": "^1.0.0", - "strip-bom-string": "^1.0.0" - }, - "engines": { - "node": ">=6.0" - } - }, - "node_modules/gray-matter/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/gray-matter/node_modules/js-yaml": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.0.tgz", - "integrity": "sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog==", - "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/gzip-size": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz", @@ -15128,9 +15085,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.15", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz", - "integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==", + "version": "3.3.16", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", + "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", "funding": [ { "type": "github", @@ -15186,9 +15143,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.50", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.50.tgz", - "integrity": "sha512-J6l92tKHX6w8Jy5nO1Vuc01NoIiRGi/d6qBKVxh+IQ8Cr3b6HbVNfKiF8ZpFKufTwpwxMmce2W3iQZ861ZRyTg==", + "version": "2.0.51", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.51.tgz", + "integrity": "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==", "license": "MIT", "engines": { "node": ">=18" @@ -15875,9 +15832,9 @@ } }, "node_modules/postcss": { - "version": "8.5.15", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", - "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", + "version": "8.5.20", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.20.tgz", + "integrity": "sha512-lW616l85ucIQL+FocMmL7pQFPqBmwejrCMg+iPxyImlrANNJG9NHq/RkyCZopDhd8C3LA03PHRJDjkbGu8vvug==", "funding": [ { "type": "opencollective", @@ -15895,7 +15852,7 @@ "license": "MIT", "peer": true, "dependencies": { - "nanoid": "^3.3.12", + "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -19100,12 +19057,6 @@ "wbuf": "^1.7.3" } }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "license": "BSD-3-Clause" - }, "node_modules/srcset": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/srcset/-/srcset-4.0.0.tgz", @@ -19378,9 +19329,9 @@ "license": "MIT" }, "node_modules/svgo": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.3.3.tgz", - "integrity": "sha512-+wn7I4p7YgJhHs38k2TNjy1vCfPIfLIJWR5MnCStsN8WuuTcBnRKcMHQLMM2ijxGZmDoZwNv8ipl5aTTen62ng==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.3.4.tgz", + "integrity": "sha512-GsNRis4e8jxn2Y9ENz/8lbJ93CstG8svtMnuRaHbiF2LTJ5tK0/q3t/URPq9Zc7zVWBJnNnJMIp6bevK7bSmNg==", "license": "MIT", "dependencies": { "commander": "^7.2.0", @@ -20499,9 +20450,9 @@ } }, "node_modules/webpack-dev-server": { - "version": "5.2.5", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.2.5.tgz", - "integrity": "sha512-4wZtCquSuv9CKX8oybo+mqxtxZqWz47uM1Ch94lxowBztOhWCbhqvRbfC/mODOwxgV2brY+JGZpHq58/SuVFYg==", + "version": "5.2.6", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.2.6.tgz", + "integrity": "sha512-HNLRmamRvVavZQ+avceZifmv8hmdUjg43t6MI4SqJDwFdW7RPQwH5vzGhDRZSX59SgfbeHhLnq3g+uooWo7pVw==", "license": "MIT", "dependencies": { "@types/bonjour": "^3.5.13", @@ -20522,7 +20473,7 @@ "graceful-fs": "^4.2.6", "http-proxy-middleware": "^2.0.9", "ipaddr.js": "^2.1.0", - "launch-editor": "^2.6.1", + "launch-editor": "^2.14.1", "open": "^10.0.3", "p-retry": "^6.2.0", "schema-utils": "^4.2.0", @@ -20666,9 +20617,9 @@ } }, "node_modules/websocket-driver": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", - "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.5.tgz", + "integrity": "sha512-ZL2+3c7kMBdIRCMz6l8jQMHyGVxj+UL+xVk74Ombiciboca8rHa15L86B19E5oh1pL9Ii/uj54gtsIrZGMo6zA==", "license": "Apache-2.0", "dependencies": { "http-parser-js": ">=0.5.1", diff --git a/package.json b/package.json index d5c7cec02..81a856978 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,9 @@ "lint:md": "markdownlint 'docs/**/*.md'" }, "dependencies": { - "@docusaurus/core": "^3.10.1", - "@docusaurus/preset-classic": "^3.10.1", - "@docusaurus/theme-mermaid": "^3.10.1", + "@docusaurus/core": "^3.10.2", + "@docusaurus/preset-classic": "^3.10.2", + "@docusaurus/theme-mermaid": "^3.10.2", "@easyops-cn/docusaurus-search-local": "^0.46.1", "@mdx-js/react": "^3.0.0", "clsx": "^2.0.0", @@ -35,9 +35,9 @@ "remark-math": "^6.0.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "^3.10.1", - "@docusaurus/tsconfig": "^3.10.1", - "@docusaurus/types": "^3.10.1", + "@docusaurus/module-type-aliases": "^3.10.2", + "@docusaurus/tsconfig": "^3.10.2", + "@docusaurus/types": "^3.10.2", "baseline-browser-mapping": "^2.9.15", "gh-pages": "^6.2.0", "markdownlint-cli": "^0.45.0", From 87bdc6a07c7dfb289fba6772080b44d21c6a4f60 Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Mon, 20 Jul 2026 22:11:50 +0530 Subject: [PATCH 7/8] docs(kafka): IMDEEPMIND-34: added storage internals note --- .../kafka/storage-internals.md | 929 ++++++++++++++++++ 1 file changed, 929 insertions(+) create mode 100644 docs/system-design/distributed-system-communication/kafka/storage-internals.md diff --git a/docs/system-design/distributed-system-communication/kafka/storage-internals.md b/docs/system-design/distributed-system-communication/kafka/storage-internals.md new file mode 100644 index 000000000..5e54a267f --- /dev/null +++ b/docs/system-design/distributed-system-communication/kafka/storage-internals.md @@ -0,0 +1,929 @@ +--- +sidebar_position: 5 +--- + +# Storage Internals + +Most messaging systems are thought of as network-based systems: + +```text +Producer → Broker → Consumer +``` + +However, one of Kafka's greatest innovations is not networking, it is the persistent storage. Many engineers assume Kafka is fast because it keeps data in memory. Kafka is fast because it is designed around efficient disk access patterns. + +In fact, Kafka was specifically built with the assumption that: + +> Disk is cheap, memory is limited, and sequential disk operations are extremely fast. + +To understand Kafka's performance, durability, scalability, and retention behavior, we must understand how Kafka stores data internally. + +This note covers: + +- Kafka's Log-Based Storage Model +- Partition Storage Structure +- Segment Files +- Index Files +- Active and Closed Segments +- Log Compaction +- Tombstones +- Retention Policies +- Data Lifecycle + +## Why Kafka Uses a Log-Based Storage Model + +Traditional databases support operations such as: + +```sql +INSERT +UPDATE +DELETE +SELECT +``` + +Records can be modified at any time. + +For example: + +```text +User 101 → Premium +``` + +Later: + +```text +User 101 → Basic +``` + +The original value is overwritten here. Kafka on the other hand very works differently. Kafka treats data as a stream of events. Instead of updating existing data: + +```text +User 101 → Premium +User 101 → Basic +User 101 → Premium +``` + +Every change becomes a new event. Nothing is modified. Nothing is overwritten. Events are simply appended. This design is called an **Append-Only Log**. + +### What is a Log? + +A log is an ordered sequence of records. + +
+ +```mermaid +graph LR + + O0["Offset 0"] + O1["Offset 1"] + O2["Offset 2"] + O3["Offset 3"] + + O0 --> O1 --> O2 --> O3 +``` + +
+ +New records are always added at the end. + +
+ +```mermaid +graph LR + + O0["Offset 0"] + O1["Offset 1"] + O2["Offset 2"] + O3["Offset 3"] + O4["Offset 4"] + + O0 --> O1 --> O2 --> O3 --> O4 +``` + +
+ +Existing records remain unchanged. + +## Kafka Storage Hierarchy + +Kafka organizes storage in several layers. + +
+ +```mermaid +graph TD + + Cluster[Kafka Cluster] + + Cluster --> Topic + + Topic --> Partition0 + Topic --> Partition1 + + Partition0 --> SegmentA + Partition0 --> SegmentB + + Partition1 --> SegmentC + Partition1 --> SegmentD +``` + +
+ +Hierarchy: + +```text +Cluster + └── Topic + └── Partition + └── Segment + └── Records +``` + +This hierarchy is fundamental to Kafka's storage engine. + +### Topics Do Not Store Data + +One common misconception is: + +> Topics contain messages. + +Not exactly. Topics are logical constructs. Actual storage happens inside partitions. + +
+ +```mermaid +graph TD + + Topic[Orders Topic] + + Topic --> P0[Partition 0] + Topic --> P1[Partition 1] + Topic --> P2[Partition 2] +``` + +
+ +Each partition is stored independently. + +### Partitions Are Logs + +Internally, every partition is an append-only log. + +Example: + +```text +Orders Topic + +Partition 0 +``` + +
+ +```mermaid +graph LR + + O0["Offset 0"] + O1["Offset 1"] + O2["Offset 2"] + O3["Offset 3"] + + O0 --> O1 --> O2 --> O3 +``` + +
+ +Every new message is appended at the end. Kafka never inserts records in the middle or never reorders records or never updates records in place. This simplicity is one of Kafka's biggest performance advantages. + +### Why Append-Only Storage is Fast + +In traditional random writes, disk head needs constantly move. Becuase of this performance decreses significantly. + +```text +Write Block 10 +Write Block 500 +Write Block 1000 +Write Block 25 +``` + +Kafka on the other hand writes sequentially: + +```text +Offset 0 +Offset 1 +Offset 2 +Offset 3 +Offset 4 +``` + +The disk writes continuously. + +
+ +```mermaid +graph LR + + O0 --> O1 --> O2 --> O3 --> O4 --> O5 +``` + +
+ +Sequential I/O is significantly faster than random I/O. This is one reasons why Kafka achieves extremely high throughput. + +### Partition Storage on Disk + +Each partition corresponds to a directory on disk. + +Example: + +```text +orders-0 +orders-1 +orders-2 +``` + +Directory structure: + +```text +kafka-logs/ + +├── orders-0/ +├── orders-1/ +├── orders-2/ +``` + +Each partition maintains its own storage files. + +### Segment Files + +A partition does not store everything in one giant file. Instead, Kafka divides partitions into smaller pieces called **Segments**. + +#### Why Segments Exist + +Imagine a partition storing: + +```text +500 GB +``` + +Single file: + +```text +orders.log +``` + +Problems: + +- Hard to manage +- Hard to delete old data +- Recovery becomes expensive + +Kafka solves this using segment files. + +#### Partition Segmentation + +Instead of: + +```text +Partition + └── 500 GB Log +``` + +Kafka creates: + +```text +Partition + ├── Segment 1 + ├── Segment 2 + ├── Segment 3 + ├── Segment 4 +``` + +
+ +```mermaid +graph LR + + Segment1 --> Segment2 --> Segment3 --> Segment4 +``` + +
+ +Each segment contains a portion of the partition. + +#### Segment Naming + +Example: + +```text +00000000000000000000.log +00000000000000050000.log +00000000000000100000.log +``` + +The filename represents the base offset. + +Example: + +```text +00000000000000100000.log +``` + +Means: + +```text +First Offset = 100000 +``` + +Records: + +```text +100000 +100001 +100002 +100003 +``` + +#### Active Segment + +Only one segment accepts writes. This is called the **Active Segment**. + +
+ +```mermaid +graph LR + + Closed1[Closed] + Closed2[Closed] + Active[Active Segment] + + Closed1 --> Closed2 --> Active +``` + +
+ +All new records go into the active segment. + +#### Segment Rolling + +Eventually the active segment becomes too large. Kafka closes it and creats a new active one. + +
+ +```mermaid +graph LR + + Active1[Active] +``` + +
+ +Becomes: + +
+ +```mermaid +graph LR + + Closed1[Closed] + Active2[New Active] +``` + +
+ +This process is called **Segment Rolling**. + +#### Why Roll Segments? + +Because Kafka must efficiently: + +- Delete old data +- Compact logs +- Recover partitions +- Manage storage + +Working with smaller files is significantly easier. + +### Index Files + +Suppose a consumer wants: + +```text +Offset 800000 +``` + +Without indexing: + +```text +Read Offset 0 +Read Offset 1 +Read Offset 2 +... +Read Offset 800000 +``` + +Kafka has to read entire sigment which is extremely inefficient. To solve this Kafka maintains indexes. + +
+ +```mermaid +graph TD + + Index --> LogSegment +``` + +
+ +The index maps: + +```text +Offset → File Position +``` + +Example: + +```text +Offset 1000 → Byte Position 20480 +Offset 2000 → Byte Position 40560 +Offset 3000 → Byte Position 60120 +``` + +Using the index, Kafka can jump directly to the desired location. + +#### Offset Index + +The Offset Index allows Kafka to quickly locate records within a segment file. + +Without an index, Kafka would need to scan the segment from the beginning to find a requested offset. + +Conceptually, the index stores mappings like: + +```text +Offset → File Position +``` + +Example: + +```text +Offset 50000 → Byte Position 1,048,576 +``` + +When a consumer requests a specific offset, Kafka first consults the Offset Index, jumps close to the record's location in the segment, and then performs a small sequential scan to find the exact record. + +This approach keeps index files small while allowing efficient reads from very large partitions. + +### Time Index + +The Offset Index helps Kafka answer: + +> "I know the offset. Where is the record on disk?" + +The Time Index solves a different problem: + +> "I know the timestamp. Which offset should I start reading from?" + +Imagine a partition containing hundreds of millions of records. A consumer wants all events that occurred after: + +```text +2026-01-01 10:00:00 +``` + +Without a Time Index, Kafka would need to scan a huge portion of the log looking for the first record with a matching timestamp. + +Instead, Kafka maintains a Time Index that maps timestamps to offsets. + +This allows Kafka to efficiently support time-based replay without scanning the entire log. + +## Reading Data + +Now that we understand segments and indexes, let's see what actually happens when a consumer requests a record. + +Suppose a consumer asks for: + +```text +Partition 0 +Offset 100000 +``` + +Kafka does not start reading from Offset 0 and scan forward until it reaches Offset 100000. That would be far too expensive for large partitions. + +Instead, Kafka uses its index structures to jump almost directly to the requested record. + +Kafka process: + +
+ +```mermaid +graph TD + + Request --> IndexLookup + IndexLookup --> SegmentLookup + SegmentLookup --> RecordFetch +``` + +
+ +Steps: + +1. Locate segment. +2. Consult index. +3. Seek file position. +4. Read records. + +Very efficient even for large partitions. + +## Storage Lifecycle of a Record + +Understanding the complete lifecycle of a record helps connect all the storage concepts together. + +Consider a producer sending: + +```json +{ + "orderId": 1001 +} +``` + +The record goes through several stages before it is eventually deleted or compacted. + +Step 1: + +Producer sends record. + +
+ +```mermaid +graph LR + + Producer --> Broker +``` + +
+ +Step 2: + +Broker appends record. + +
+ +```mermaid +graph LR + + O0 --> O1 --> O2 --> O3 +``` + +
+ +Step 3: + +Record stored in active segment. + +Step 4: + +Segment eventually closes. + +Step 5: + +Retention or compaction determines future lifetime. + +## Log Compaction + +### Why Log Compaction Exists + +Many systems care only about the latest state. + +Example: + +```text +User 101 → Basic +User 101 → Premium +User 101 → Gold +``` + +Current state: + +```text +User 101 → Gold +``` + +Earlier values may no longer matter. + +Without compaction: + +```text +Basic +Premium +Gold +``` + +All versions stored forever. + +Storage grows indefinitely. + +### What is Log Compaction? + +Log compaction removes obsolete records while preserving the latest value for each key. + +Example Before Compaction + +```text +Offset 0 → User101 = Basic +Offset 1 → User102 = Free +Offset 2 → User101 = Premium +Offset 3 → User101 = Gold +``` + +After Compaction + +```text +Offset 1 → User102 = Free +Offset 3 → User101 = Gold +``` + +Older versions removed. + +Latest state preserved. + +### Compaction Visualization + +Before: + +
+ +```mermaid +graph LR + + A["101=Basic"] + B["102=Free"] + C["101=Premium"] + D["101=Gold"] + + A --> B --> C --> D +``` + +
+ +After: + +
+ +```mermaid +graph LR + + B["102=Free"] + D["101=Gold"] + + B --> D +``` + +
+ +### Important Property + +Compaction does NOT guarantee immediate removal. Kafka compacts in the background. Old records may exist temporarily. + +### Tombstones + +Kafka uses Tombstones to delete a record. Basically Kafka marks a record to indicate that this record will be deleted. + +Example: + +```text +User101 = null +``` + +This special record indicates deletion. + +Before: + +```text +User101 = Gold +``` + +Tombstone: + +```text +User101 = null +``` + +After compaction: + +```text +User101 removed +``` + +After the compaction, the key disappears entirely from the segment. + +### Retention Policies + +Kafka cannot store data forever. Over time, partitions continue to grow as new records are appended. + +To prevent unlimited storage growth, Kafka uses **Retention Policies**, which define when old data should be removed from a topic. + +Unlike Log Compaction, which keeps the latest value for each key, retention is primarily concerned with **how long data should be kept**. + +Most Kafka topics use retention because event streams often have a limited useful lifetime, such as a few days, weeks, or months. + +#### What is Retention? + +As producers continue writing data, Kafka partitions grow indefinitely. + +To prevent disks from eventually filling up, Kafka uses **Retention Policies**, which determine when old data should be removed. + +Unlike traditional message queues, Kafka does not delete messages after consumers read them. Records remain in the log until they are removed by the configured retention policy. + +Eventually, Kafka deletes old **segments**, freeing disk space. + +#### Time-Based Retention + +Time-based retention removes data that is older than a configured age. + +Example: + +```text +retention.ms = 604800000 +``` + +Equivalent to: + +```text +7 days +``` + +Once a segment contains only records older than seven days, Kafka can delete that segment. + +
+ +```mermaid +graph LR + + Day1 --> Day2 --> Day3 --> Day4 --> Day5 --> Day6 --> Day7 --> Delete +``` + +
+ +It is important to note that Kafka deletes data at the **segment level**, not the individual record level. As a result, data may remain slightly longer than the configured retention period until the entire segment becomes eligible for deletion. + +#### Size-Based Retention + +Retention can also be based on total storage usage. + +Example: + +```text +retention.bytes = 100 GB +``` + +Kafka attempts to keep the total size of a partition below the configured limit. + +When the limit is exceeded, Kafka removes the oldest segments first. + +
+ +```mermaid +graph LR + + Segment1 --> Segment2 --> Segment3 --> Segment4 +``` + +
+ +Storage exceeds the configured limit. + +Kafka removes the oldest segment: + +
+ +```mermaid +graph LR + + Segment2 --> Segment3 --> Segment4 +``` + +
+ +This process continues until storage falls below the configured threshold. + +## Cleanup Policies + +A cleanup policy determines **how Kafka removes old data**. + +Kafka supports two primary cleanup strategies: + +- Delete +- Compact + +### Delete Policy + +```text +cleanup.policy=delete +``` + +This is the default and most commonly used cleanup policy. + +Kafka removes old segments when they exceed the configured retention period or storage limit. + +
+ +```mermaid +graph LR + + Old --> New +``` + +
+ +As data ages out, older segments are deleted. + +This policy is commonly used for event streams, logs, metrics, and analytics pipelines where historical data only needs to be retained for a limited period. + +### Compact Policy + +```text +cleanup.policy=compact +``` + +Log Compaction preserves the latest value for each key instead of deleting data based on age. + +This is commonly used for: + +- User profiles +- Application configuration +- Kafka Streams state stores +- Reference data + +The goal is not to keep historical changes forever, but to ensure the latest state of each key can always be reconstructed. + +## Compact + Delete + +Kafka supports both cleanup strategies simultaneously. + +```text +cleanup.policy=compact,delete +``` + +This configuration preserves the latest value for each key while still allowing very old data to be removed. + +It combines: + +- State preservation through compaction +- Storage management through retention + +### Retention vs Compaction + +Retention and Compaction solve different problems and are often confused. + +| Retention | Compaction | +| ------------------------------ | ---------------------------------------- | +| Controls how long data is kept | Controls which versions of data are kept | +| Based on age or storage size | Based on record keys | +| Deletes old segments | Removes obsolete versions of records | +| Common for event streams | Common for state-oriented topics | + +Retention asks: + +```text +How long should data exist? +``` + +Compaction asks: + +```text +Which versions of data should exist? +``` + +Example: + +```text +Retention: +Delete data older than 30 days +``` + +```text +Compaction: +Keep only the latest value per key +``` + +## Complete Storage Architecture + +
+ +```mermaid +graph TD + + Topic + + Topic --> Partition0 + Topic --> Partition1 + + Partition0 --> SegmentA + Partition0 --> SegmentB + Partition0 --> SegmentC + + SegmentA --> IndexA + SegmentB --> IndexB + SegmentC --> IndexC + + SegmentC --> ActiveSegment +``` + +
From 450d4f35b2943344d8495c73e5722bafab53e2eb Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Fri, 31 Jul 2026 23:33:09 +0530 Subject: [PATCH 8/8] docs(kafka): IMDEEPMIND-34: added networking note --- .../kafka/networking.md | 970 ++++++++++++++++++ 1 file changed, 970 insertions(+) create mode 100644 docs/system-design/distributed-system-communication/kafka/networking.md diff --git a/docs/system-design/distributed-system-communication/kafka/networking.md b/docs/system-design/distributed-system-communication/kafka/networking.md new file mode 100644 index 000000000..e1cd55266 --- /dev/null +++ b/docs/system-design/distributed-system-communication/kafka/networking.md @@ -0,0 +1,970 @@ +--- +sidebar_position: 6 +--- + +# Networking and Cluster Coordination + +Kafka is fundamentally a distributed system. A Kafka cluster may consist of multiple brokers running across multiple machines, racks, availability zones, or even data centers. For such a distributed system to work correctly, Kafka must solve two major problems: + +1. **Networking** + + - How do producers, consumers, and brokers communicate? + - How does data move across the cluster? + - How do brokers discover each other? + - How are connections maintained efficiently? + +2. **Cluster Coordination** + + - Who is responsible for managing cluster metadata? + - How are leaders elected? + - How do brokers agree on the current cluster state? + - How are failures detected and handled? + +Without these mechanisms, Kafka would simply be a collection of independent servers rather than a fault-tolerant distributed messaging platform. + +## Kafka Networking + +### Why Networking Matters + +Every Kafka operation involves network communication. + +Examples: + +- Producer sending messages to a broker +- Consumer fetching records +- Broker replicating data to followers +- Controller managing metadata +- Clients requesting cluster information + +A single message may traverse multiple network paths before it is finally stored and consumed. + +
+ +```mermaid +flowchart LR + + P((Producer)) + B1((Broker 1)) + B2((Broker 2)) + B3((Broker 3)) + C((Consumer)) + + P --> B1 + B1 --> B2 + B1 --> B3 + C --> B1 +``` + +
+ +The producer communicates with the leader broker. + +The leader then replicates data to follower brokers. + +Consumers fetch records from the leader. + +### Kafka Network Architecture + +Kafka follows a client-server architecture. + +
+ +```mermaid +flowchart TB + + P1((Producer)) + P2((Producer)) + + C1((Consumer)) + C2((Consumer)) + + B1((Broker 1)) + B2((Broker 2)) + B3((Broker 3)) + + P1 --> B1 + P2 --> B2 + + C1 --> B1 + C2 --> B3 + + B1 <--> B2 + B2 <--> B3 + B3 <--> B1 +``` + +
+ +Each broker is both: + +- A server for producers and consumers +- A client when communicating with other brokers + +This peer-to-peer communication between brokers is essential for replication and cluster coordination. + +### Kafka Network Components + +#### Producers + +Producers establish TCP connections with brokers. + +Their responsibilities include: + +- Fetching metadata +- Determining partition leaders +- Sending records +- Retrying failed requests + +
+ +```mermaid +sequenceDiagram + + participant Producer + participant Broker + + Producer->>Broker: Metadata Request + Broker-->>Producer: Topic Metadata + + Producer->>Broker: Produce Request + Broker-->>Producer: Acknowledgement +``` + +
+ +The producer never broadcasts messages to all brokers. + +It sends data directly to the leader of the target partition. + +#### Consumers + +Consumers also communicate directly with partition leaders. + +
+ +```mermaid +sequenceDiagram + + participant Consumer + participant Broker + + Consumer->>Broker: Fetch Request + Broker-->>Consumer: Records +``` + +
+ +Consumers periodically: + +- Fetch data +- Commit offsets +- Request metadata + +#### Brokers + +Brokers communicate with: + +- Producers +- Consumers +- Other brokers +- Controller + +
+ +```mermaid +flowchart LR + + P((Producer)) + C((Consumer)) + B1((Broker)) + B2((Broker)) + CTRL((Controller)) + + P --> B1 + C --> B1 + + B1 <--> B2 + CTRL --> B1 +``` + +
+ +### Kafka Uses TCP + +Kafka uses TCP rather than UDP. + +Reasons: + +- Reliable delivery +- Ordered packets +- Congestion control +- Error detection + +Kafka depends heavily on TCP guarantees because message ordering is critical. + +
+ +```mermaid +flowchart LR + + App[Kafka Application] + TCP[TCP Layer] + IP[IP Layer] + Network[Network] + + App --> TCP + TCP --> IP + IP --> Network +``` + +
+ +### Kafka Binary Protocol + +Kafka does not use: + +- HTTP +- REST +- SOAP + +Internally, Kafka uses a custom binary protocol. + +Advantages: + +- Smaller payload size +- Faster serialization +- Lower CPU overhead +- Higher throughput + +Every request contains: + +- API key +- API version +- Correlation ID +- Client ID +- Request body + +
+ +```mermaid +flowchart TB + + Req[Request] + + Req --> Header + Req --> Body + + Header --> ApiKey + Header --> Version + Header --> CorrelationId + Header --> ClientId +``` + +
+ +### Metadata Discovery + +One of the first things every client does is fetch metadata. + +The client only needs the address of one broker. + +
+ +```mermaid +sequenceDiagram + + participant Producer + participant Broker1 + + Producer->>Broker1: Metadata Request + Broker1-->>Producer: Cluster Metadata +``` + +
+ +Returned metadata includes: + +- Brokers +- Topics +- Partitions +- Leaders +- Replicas + +Example: + +```text +Topic: Orders + +Partition 0 -> Broker 2 +Partition 1 -> Broker 1 +Partition 2 -> Broker 3 +``` + +After receiving metadata, the producer can communicate directly with the correct broker. + +### Connection Management + +Creating TCP connections is expensive. + +Kafka therefore keeps connections open. + +
+ +```mermaid +flowchart LR + + Producer -->|Persistent TCP| Broker +``` + +
+ +Benefits: + +- Reduced latency +- Lower CPU cost +- Better throughput + +Kafka clients maintain connection pools and reuse existing connections whenever possible. + +### Network Threads + +Every broker contains network threads. + +Their job is to: + +- Accept connections +- Read requests +- Write responses + +
+ +```mermaid +flowchart TB + + Connections --> NetworkThreads + NetworkThreads --> RequestQueue + RequestQueue --> IOThreads +``` + +
+ +The broker separates: + +- Network handling +- Request processing + +This prevents slow processing from blocking incoming connections. + +### Request Processing Pipeline + +When a producer sends data: + +
+ +```mermaid +flowchart LR + + Producer + --> NetworkThread + + NetworkThread + --> RequestQueue + + RequestQueue + --> IOThread + + IOThread + --> Log + + Log + --> Response +``` + +
+ +Steps: + +1. Network thread receives request. +2. Request enters queue. +3. I/O thread processes it. +4. Data written to log. +5. Response sent back. + +This architecture allows Kafka to process massive request volumes. + +### Replication Traffic + +Replication also consumes network bandwidth. + +
+ +```mermaid +flowchart LR + + Leader((Leader)) + F1((Follower 1)) + F2((Follower 2)) + + Leader --> F1 + Leader --> F2 +``` + +
+ +Follower brokers continuously fetch data from the leader. + +This means Kafka networking is not only client traffic. + +Broker-to-broker traffic can be extremely large. + +### Rack Awareness + +Large deployments often span multiple racks. + +
+ +```mermaid +flowchart TB + + subgraph RackA + B1((Broker 1)) + end + + subgraph RackB + B2((Broker 2)) + end + + subgraph RackC + B3((Broker 3)) + end +``` + +
+ +Kafka can place replicas across racks. + +Benefits: + +- Improved fault tolerance +- Better availability +- Reduced risk of rack-level failures + +### Inter-Broker Communication + +Brokers communicate constantly. + +Common reasons: + +- Replication +- Metadata updates +- Leader elections +- Heartbeats + +
+ +```mermaid +flowchart LR + + B1((Broker1)) + B2((Broker2)) + B3((Broker3)) + + B1 <--> B2 + B2 <--> B3 + B3 <--> B1 +``` + +
+ +Without inter-broker networking, replication would not exist. + +### Network Failures + +Kafka must tolerate: + +- Packet loss +- High latency +- Broker crashes +- Network partitions + +Example: + +
+ +```mermaid +flowchart LR + + B1((Broker1)) + X((Network Failure)) + B2((Broker2)) + + B1 -.-> X -.-> B2 +``` + +
+ +Kafka uses: + +- Timeouts +- Retries +- Leader election +- Replication + +to maintain availability during failures. + +## Kafka Cluster Coordination + +### What is Cluster Coordination? + +A distributed system needs agreement. + +Questions Kafka must answer: + +- Which brokers are alive? +- Which broker is controller? +- Which replica is leader? +- Which replicas are in-sync? +- What topics exist? + +Cluster coordination is the mechanism that maintains this shared state. + +### Cluster Metadata + +Metadata is information about the cluster. + +
+ +```mermaid +flowchart TB + + Metadata + + Metadata --> Brokers + Metadata --> Topics + Metadata --> Partitions + Metadata --> Leaders + Metadata --> Replicas + Metadata --> Configurations +``` + +
+ +Every broker must agree on this information. + +Otherwise the cluster becomes inconsistent. + +### Controller + +Kafka elects one broker as the Controller. + +
+ +```mermaid +flowchart LR + + C((Controller)) + + B1((Broker1)) + B2((Broker2)) + B3((Broker3)) + + C --> B1 + C --> B2 + C --> B3 +``` + +
+ +The Controller is responsible for: + +- Broker registration +- Broker failure handling +- Leader election +- Metadata updates +- Partition reassignment + +Only one active controller exists at a time. + +### ZooKeeper Era + +Historically Kafka used ZooKeeper. + +
+ +```mermaid +flowchart LR + + ZK((ZooKeeper)) + + B1((Broker1)) + B2((Broker2)) + B3((Broker3)) + + B1 --> ZK + B2 --> ZK + B3 --> ZK +``` + +
+ +ZooKeeper stored: + +- Metadata +- Controller information +- Broker registrations + +Problems: + +- Operational complexity +- Additional cluster +- Scalability limitations + +Because of these issues Kafka moved toward KRaft. + +### KRaft Architecture + +Modern Kafka uses KRaft (Kafka Raft). + +ZooKeeper is no longer required. + +
+ +```mermaid +flowchart TB + + subgraph KRaft Cluster + + C1((Controller)) + C2((Controller)) + C3((Controller)) + + end + + B1((Broker1)) + B2((Broker2)) + B3((Broker3)) + + C1 --> B1 + C1 --> B2 + C1 --> B3 +``` + +
+ +Metadata is stored inside Kafka itself. + +Benefits: + +- Simpler deployment +- Better scalability +- Faster failover +- Fewer moving parts + +### Metadata Log + +KRaft stores metadata in a replicated log. + +Think of it as a special Kafka log dedicated to cluster metadata. + +
+ +```mermaid +flowchart LR + + ControllerLeader + --> MetadataLog + + MetadataLog + --> ControllerFollower1 + + MetadataLog + --> ControllerFollower2 +``` + +
+ +Examples of metadata records: + +- Topic creation +- Topic deletion +- Broker registration +- Configuration changes +- Partition leader changes + +### Raft Consensus + +KRaft uses the Raft consensus algorithm. + +Goal: + +All controllers agree on metadata state. + +
+ +```mermaid +flowchart LR + + Leader((Raft Leader)) + + F1((Follower)) + F2((Follower)) + + Leader --> F1 + Leader --> F2 +``` + +
+ +Only the leader can commit metadata changes. + +Followers replicate the metadata log. + +### Controller Quorum + +KRaft controllers form a quorum. + +Example: + +
+ +```mermaid +flowchart LR + + C1((Controller)) + C2((Controller)) + C3((Controller)) +``` + +
+ +With three controllers: + +- Majority = 2 + +As long as two controllers remain available, the cluster continues functioning. + +### Leader Election + +Every partition has one leader. + +
+ +```mermaid +flowchart LR + + L((Leader)) + + F1((Follower)) + F2((Follower)) + + L --> F1 + L --> F2 +``` + +
+ +Producers and consumers interact with the leader only. + +If the leader fails: + +
+ +```mermaid +flowchart LR + + OldLeader((Failed Leader)) + + F1((Follower)) + F2((Follower)) + + F1 --> NewLeader((New Leader)) +``` + +
+ +The controller promotes an eligible follower. + +### In-Sync Replicas (ISR) + +Not all replicas are equal. + +Kafka tracks replicas that are fully caught up. + +These replicas form the ISR. + +
+ +```mermaid +flowchart LR + + Leader((Leader)) + + ISR1((ISR)) + ISR2((ISR)) + + SlowReplica((Lagging Replica)) + + Leader --> ISR1 + Leader --> ISR2 + Leader --> SlowReplica +``` + +
+ +Only ISR members are considered safe candidates for leader election. + +### Broker Registration + +When a broker starts: + +
+ +```mermaid +sequenceDiagram + + participant Broker + participant Controller + + Broker->>Controller: Register + Controller-->>Broker: Accepted +``` + +
+ +The controller updates metadata. + +Other brokers learn about the new broker through metadata propagation. + +### Failure Detection + +Controllers monitor brokers through heartbeats. + +
+ +```mermaid +sequenceDiagram + + participant Broker + participant Controller + + loop Heartbeats + Broker->>Controller: Alive + end +``` + +
+ +If heartbeats stop: + +
+ +```mermaid +flowchart LR + + Broker((Broker)) + Controller((Controller)) + + Broker -. heartbeat lost .-> Controller +``` + +
+ +The controller marks the broker as failed. + +### Broker Failure Recovery + +Suppose Broker 2 fails. + +
+ +```mermaid +flowchart LR + + B1((Broker1)) + B2((Failed)) + B3((Broker3)) +``` + +
+ +The controller performs: + +1. Failure detection +2. Leader election +3. Metadata update +4. Cluster notification + +
+ +```mermaid +flowchart TB + + Failure + --> Detection + --> Election + --> MetadataUpdate + --> Recovery +``` + +
+ +This process is automatic. + +### End-to-End Example + +Consider a topic with replication factor 3. + + +
+ +```mermaid +flowchart LR + + P((Producer)) + + B1((Leader)) + B2((Follower)) + B3((Follower)) + + P --> B1 + + B1 --> B2 + B1 --> B3 +``` + +
+ +Normal operation: + +1. Producer sends records to B1. +2. B1 writes data locally. +3. B1 replicates data to B2 and B3. +4. Replicas acknowledge. +5. Producer receives acknowledgement. + +If B1 crashes: + +
+ +```mermaid +flowchart LR + + B1((Failed)) + + B2((New Leader)) + B3((Follower)) + + B2 --> B3 +``` + +
+ +Controller actions: + +1. Detect failure. +2. Elect B2. +3. Update metadata. +4. Notify clients. +5. Producers reconnect to B2. + +The application continues running with minimal disruption.