From 0db82064575f2757cef64d7a641825ff494ec0eb Mon Sep 17 00:00:00 2001 From: Akira Hayakawa Date: Sat, 8 Jun 2024 09:56:36 +0900 Subject: [PATCH] doc: batched write --- doc/src/SUMMARY.md | 1 + .../README.md => doc/src/batched-write.md | 33 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) rename redb-backend/README.md => doc/src/batched-write.md (64%) diff --git a/doc/src/SUMMARY.md b/doc/src/SUMMARY.md index c32b509c..6dc9af31 100644 --- a/doc/src/SUMMARY.md +++ b/doc/src/SUMMARY.md @@ -2,6 +2,7 @@ - [Multi-Raft](multi-raft.md) - [Heartbeat Multiplexing](heartbeat-multiplexing.md) + - [Batched Write](batched-write.md) - [Raft Process](raft-process.md) - [Multi Threading](multi-threading.md) - [Application State](application-state.md) diff --git a/redb-backend/README.md b/doc/src/batched-write.md similarity index 64% rename from redb-backend/README.md rename to doc/src/batched-write.md index e2516c74..df8eac66 100644 --- a/redb-backend/README.md +++ b/doc/src/batched-write.md @@ -1,4 +1,4 @@ -# redb-backend +# Batched Write In multi-raft, multiple shards process write requests. Conceptually, each shard maintains its own log for entry insertion. @@ -6,4 +6,33 @@ Having a physically independent log for each shard isn't efficient as each write However, an optimization technique called "batching" can be used. Here, each shard maintains a virtual log, and the entries are temporarily queued in a shared queue. These queued entries are then processed in a single transaction, reducing the number of transactions. -This approach often presents a throughput versus latency dilemma. However, this implementation increases throughput without sacrificing latency. \ No newline at end of file +This approach often presents a throughput versus latency dilemma. However, this implementation increases throughput without sacrificing latency. + +```mermaid +graph LR + CLI(Client) + + subgraph P1 + T1(redb::Table) + end + subgraph P2 + T2(redb::Table) + end + subgraph P3 + T3(redb::Table) + end + + subgraph Reaper + Q(Queue) + end + DB[(redb::Database)] + + CLI -->|entry| T1 + CLI --> T2 + CLI --> T3 + T1 -->|lazy entry| Q + T2 --> Q + T3 --> Q + Q -->|transaction| DB + +``` \ No newline at end of file