-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdf899e
commit 0db8206
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,38 @@ | ||
# redb-backend | ||
# Batched Write | ||
|
||
In multi-raft, multiple shards process write requests. Conceptually, each shard maintains its own log for entry insertion. | ||
|
||
Having a physically independent log for each shard isn't efficient as each write requires a transaction to persist the data on the storage. | ||
|
||
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. | ||
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 | ||
``` |