What is ledger sharding?
Ledger sharding
Ledger sharding splits one logical balance into many physical balances so concurrent posts stop locking the same row. Your app picks a shard, posts to it, and sums the shards when it reports the total. The customer still sees one pot. The book has several.
How does ledger sharding work?
One settlement or treasury balance sits on every transfer and becomes a bottleneck. You open N balances, such as @Settlement-0 through @Settlement-19. A hash of the other side of the transfer picks the shard. Each shard locks on its own. The reported total is the sum.
Ledger sharding vs queue sharding
Queue sharding spreads workers across lanes so unrelated sources do not wait on each other. The balance is still one row. Ledger sharding splits that row. Use the queue first. Shard the balance when one id is still the limit after the queue and coalescing are on.
When should you not shard?
A customer wallet that is not a funnel. You then have to explain twenty balances to one person, and you still serialize that person’s own traffic. Shard the hot company pot, not every wallet.
In Blnk you create the shard balances and route in your app. The ledger will not pick a shard for you. See handling hot balances.