
CCO at @tigerbeetledb | 1000x faster and 10x safer OLTP | 🇰🇷🇺🇸 Sales Coach | Author, "Unlocking Authentic Sales"
San Diego, CA
Joined April 2009
- Tweets1.3K
- Following456
- Followers850
- Likes1.8K
Peter Ahn retweeted
There’s no excuse for new software not to be logical, not to be deterministic.
Investing in owning your testing, to be DST-first, and to accelerate the local development velocity of your team, is probably the best technical decision you can make.
Peter Ahn retweeted
Just use TigerBeetle.
System design prompt: design Stripe payments ledger.
Start with requirements:
1) Immutable, auditable history. No UPDATE in place. Every balance change is an event.
2) Correctness over latency. Strong consistency per account. Idempotent writes.
3) Queries: current balance, balance at time T, list transactions, reconciliation/export.
4) Multi-currency, fees, refunds, disputes, chargebacks, holds.
APIs + data model:
- POST /entries (idempotency_key, account_id, currency, amount, type, external_ref)
- POST /transfers (from_account, to_account, amount, currency, ref)
- GET /balance?account_id=&as_of=
Tables:
- accounts
- journal_entries(id, ts, currency, metadata, external_ref)
- entry_lines(entry_id, account_id, amount, direction, available_vs_pending)
Balance is sum(lines) grouped by account+currency. Keep derived balance snapshots for speed, but treat them as cache.
Architecture:
- Write path: API -> validator -> append-only store (SQL with constraints) -> async projector builds balance snapshots and search indexes.
- Partition by account_id so all mutations for an account serialize on one shard.
- Use unique(idempotency_key, account_id) to make retries safe.
- Every transfer is double-entry: two lines, same entry_id, commit atomically.
Scaling + tradeoffs:
- Hot accounts: shard within account by sub-ledger (available/pending) or by currency, but keep a single ordering key.
- Read performance: periodic snapshots (eg every 1k entries) + replay tail.
- Exactly-once is a trap. Build at-least-once with idempotency + reconciliation jobs.
Failure cases to discuss:
- Partial writes: enforce DB transaction for entry + lines, or nothing.
- Duplicate requests: idempotency keys must survive deploys and cache evictions.
- Clock skew: ordering is DB sequence, not client timestamps.
- Backfills and reversals: never delete. Post compensating entries.
- Projector lag: balance endpoint can serve strongly consistent (compute from source) vs fast (snapshot) with clear staleness bounds.
Peter Ahn retweeted
Replying to @loadingalias
I really appreciate your kind words!
But I wouldn’t take a small view of Zig (or judge a technology on the number of people writing it).
And, in fact, there are hundreds of companies writing and running Zig across the world (literally, from busses and supermarkets to factories).
They may not be as visible as Ghostty, Egres, River, Cloudflare, Uber, ZML (or even TB) but I see Zig’s growth tracking closely with Rust’s, relative to age.
I find in technology, you want to paddle out to the wave before it breaks, to surf the swell, not to the wave that already has a thousand surfers on it.
Peter Ahn retweeted
Replying to @loadingalias
Ah, but my friend (!), you forgot the biggest reason:
C) It’s truly the language that is the best expression of TigerStyle.dev
(and why I picked Zig for TB in 2020)
It’s hard to understand TB’s engineering without realizing that Zig is really the only way we could have written TB the way it is.
Peter Ahn retweeted
October in TigerLand is out!
- Official Rust client published!
- State Machine Fuzzer rewritten
- The Tale of TigerStyle x Object Storage
tigerbeetle.com/newsletters/…
Peter Ahn retweeted
Imagine you have 128 TB of data on a machine. Machines fail, and at some point mean time to recovery (MTTR) surpasses mean time between failures (MTBR).
While one machine is recovering, another is already failing. Hello, death spiral.
For terabyte scale: Diagonal scaling.
Peter Ahn retweeted
We built the fastest object storage client (that we know of) from scratch in Zig, and TigerStyle'd it.
For the curious, the story! By @georg_kreuzmayr.
youtu.be/NJrqmoNpVGg
Peter Ahn retweeted
Correctness is a design problem, not a language problem.
If a system is incorrect by design, it’s incorrect by design.
This is another way, of course, of saying that safety is an emergent property of “the system as a whole”.
Cf. Fallacy of composition
tigerbeetle.com/blog/2025-10…
Peter Ahn retweeted
Replying to @patrickgwsmith
The memory hierarchy is extending over object storage:
- durability, and
- interface, but especially
- recovery time, to scale anything beyond 16 TiB, to preserve (MTTR < MTBF), and crucially
- cost, as it’s cost-prohibitive to store petabytes on 3x replicated NVMe.
The world is becoming more transactional.
It’s simply impossible for the memory hierarchy not to be extending over erasure-coded object storage.
youtu.be/y2_BqkKTbD8?si=fsEO…
Peter Ahn retweeted
Be radical.
When you’re building mission-critical software you can’t be thinking in terms of tradeoffs.
It’s inspiring to see our engineers craft @TigerBeetleDB every day for 10X safety AND 1000X performance.
We’ve redesigned the interface for OLTP starting from first principles.
To be on a new hill, away from the defaults of the past and into the future 🚀
🙏 @jorandirkgreef
#thebeetlesofdatabases
Peter Ahn retweeted
It’s memory hierarchy all the way down.
S3 is the future, the world’s disk. It’s not the only storage medium, nor should it be (again, memory hierarchy).
But there’s hot and cold data, and the well-designed architectures will respect this.
Whether it be L1/L2/L3 and main memory, or NVMe and HDD, or pure replication and erasure coding.
The best designs exploit the memory hierarchy.
S3-based database architectures don’t read from S3 all the time, though.
Instead, they amortize the cost by caching in memory and on local disk (which can be NVMe). As a result, read performance is more or less the same as in local-disk architectures, though the tail latency is heavier; NVMe’s tail is much flatter.
Writes are slower, but not by as much as people often think. You almost never want a write acknowledged by a single local disk, so a local-disk database pays a network round trip for replication anyway. That makes S3-based architectures competitive, especially with S3 Express.
Peter Ahn retweeted
Amdahl’s law is one of the most powerful mental models to make a dent in everything you do…
Whether it be designing transaction processing…
Or engineering your engineering with DST…
Or thinking about thinking (vs typing).
If AI makes you 10x faster at coding, why is your team not shipping 10x faster? Amdahl's law has the answer...
The law says the overall speedup is capped by the part you did not speed up. With `p` as the fraction of the work you accelerate and `s` as the speedup on that fraction, speedup is computed as attached.
Now plug in some numbers. Say writing code is 30% of the time from idea to production, and AI makes that part 10x faster. The overall speedup is 1 / (0.7 + 0.03), which is about 1.37x. Even if coding is half of the cycle, you get about 1.8x.
These numbers are illustrative, so use your own, but the shape stays the same. The rest of the cycle is still there:
- Figuring out what to build
- Aligning product, design, and other teams.
- Code reviews, which are now more than ever
- CI and CD takes the same wall time as before.
- Debugging and incidents, where code that nobody on the team wrote line by line takes longer to understand.
In fact, it can get worse than Amdahl predicts.
Faster code generation increases the load on every stage after it, so the review queue grows and the bottleneck shifts. A team that writes 10x more code with the same review capacity is just building a bigger queue, unfortunately
So if you want the team to actually ship faster, measure the whole path from idea to production and find where work waits. Then apply AI there too: review, test generation, flaky test triage, deploy safety checks. Otherwise, you have optimized the part of the system that was never the constraint.
Speeding up the typing was always the easy part :)
Peter Ahn retweeted
“Correct and Fast.” — Jim Gray
Replying to @salesoptecs @MansiCodez
this answer is correct but it's slow. the correct and fast answer is tigerbeetle
Peter Ahn retweeted
Just use TigerBeetle…
Recently I interviewed a Senior Engineer.
Strong candidate.
Kafka? ✅
Redis? ✅
Microservices? ✅
Distributed systems? ✅
Then I asked:
"You're building the inventory service for a flash sale.
Only 1 item left in stock."
Two users hit “Buy Now” at the exact same millisecond.
Both requests pass the “is available?” check.
Both create an order.
Both deduct stock.
Now you’ve sold 2 items when only 1 existed.
How do you guarantee you never oversell — even with concurrent requests, client retries, and partial failures?
"Just use a database transaction."
Doesn’t fully solve it if both requests read `stock = 1` before either writes, or if the response is lost and the client retries.
"Check stock before deducting."
What happens when both checks happen at the same time?
"Use Redis DECR and reject if it goes negative."
What happens if Redis is down, or the decrement succeeds but the order is never persisted?
Your turn:
How would you design this inventory reservation API so concurrent buyers and retries never oversell the last item?
There’s a specific distributed-systems concept behind this.
And you’ll encounter it everywhere inventory, tickets, seats, coupons, and limited resources are involved.
Peter Ahn retweeted
Yeah this only just clicked for me yesterday. It is beautlful once you see it, very elegant!
Peter Ahn retweeted
Replying to @infogulch
The key/value string workload of a general purpose (OLGP) “system of reference” like Postgres is easy to scale…
…once you offload the read-modify-write hot integer workload to a transaction processing (OLTP) “system of record” like TigerBeetle.
But you also get good architectural principles like “separation of concerns”.
Peter Ahn retweeted
🔥
"Those who would trade essential safety for a little performance, deserve neither safety nor performance" - Ben Franklin.
"Give me strict serializability or give me death" - @jorandirkgreef @TigerBeetleDB
Peter Ahn retweeted
I got into database design thanks to systems like ZFS and Redis.
And I remember when Antirez was “staring down the barrel” of building a storage engine for Redis, and then walked away (wisely I believe) from that at the time.
But for transacting processing (and for TigerBeetle), I would say “safety is never a tradeoff, but rather a move from local maximum to global maximum”.
It’s not XOR (as humans we tend to think too much in terms of XOR instead of OR).
If you can apply first principles, to move from local maximum (how things have always been done) to global maximum (the physics optimal way that things should be done) then you get both safety and performance, as was our experience in TigerBeetle.
As Jim Gray would say: “correct AND fast”.














