41 points · by lonjil · 5y ago · 18 comments
TigerBeetle is still alpha and we're moving to beta now with automated fault injection testing of our consensus and replication. The project has been a year since ProtoBeetle in July 2020. Regarding multiple regions, we have some novel Viewstamped Replication optimizations that we hope to write up soon and document in our repo.
At present, TigerBeetle can already be used to limit debits/credits against an account to not exceed the credits/debits of the account by setting
account.debits_must_not_exceed_credits = true
when creating the account. This will then become an immutable policy on the account and TigerBeetle will then cap transactions to never exceed the liquidity available.If you wanted to rate limit transactions, you could create something like a "prepaid" account where you periodically top up the account, and then let transfers drain it out.
Would these address something like what you were thinking?
TigerBeetle also has support for something called Linked Events where you can submit a batch of either accounts, transfers or commits and where you can then chain a subset of events within this batch together by toggling a "linked" flag on each, so that these subset chains succeed or fail atomically together, much like what you can do when submitting IO through io_uring: https://github.com/coilhq/tigerbeetle/blob/main/src/tigerbee...
We didn't go into our accounting features too much beyond the big idea because we wanted to focus more on the technical aspects for this talk.
However, our motivation for managing clock faults was not because we wanted to do leader leases. We don't risk stale reads so we don't do leader leases, i.e. where the leader can operate as a lone ranger without consensus from the cluster for a period of time. We're not comfortable with what could potentially go wrong when stale reads are allowed to become part of the fault model.
The motivation for having some kind of clock fault tolerance was rather so that TigerBeetle can clamp the system time to cluster time for reasonably accurate transaction timestamps for auditing purposes, and for reliable timeouts of our two-phase commit ledger transfers so that liquidity is not locked up forever.
In other words, the only reason we synchronize clocks across the cluster is so that a leader with a far-future clock can't push the cluster's monotonic clock out into the far future for unrealistic timestamps or to delay transaction timeouts (or expire them too early if a new leader's clock is stuck in the past).
Ahead of performance, we are especially excited about TigerBeetle's safety fault models, where we think there's an opportunity to break new ground, with all the new storage fault research that's been coming out the past two or three years, especially from UW-Madison.
Zig has been fantastic, in particular for Direct I/O alignment and static allocation, and it's only getting better with things like the self-hosted compiler. Having done a bit of security work in the past, I really like Zig's unique approach to safety, for example checked arithmetic enabled by default in safe builds, all the explicitness around return values and exhaustive syscall error handling, and of course comptime. The speed and ease of the compiler itself and cross-compilation tooling is excellent and the readability of Zig is also remarkable.
Huge props to the Zig Software Foundation for what they are achieving as a fully open source community funded project.
More performance allows you to trade expensive hardware for cheaper commodity hardware to gain lower operational cost (e.g. a cluster of three Raspberry Pi's) while still having more than enough headroom to handle volume spikes safely (e.g. Black Friday).
With digital payments, payments are also becoming more global, with higher volume and lower value, but existing infrastructure is not typically designed for this high volume low value performance profile (e.g. millions of payments at a fraction of a cent).
Finally, high throughput allows you to easily ingest huge amounts of historical data into TigerBeetle in a few seconds.
The design actually made this kind of throughput fairly easy to achieve, even for three small office laptops. The hard part is all the safety work that we're doing to make this hopefully many times safer than existing systems.
[1] "Coil’s Mojaloop Performance Work 2020" - https://docs.mojaloop.io/documentation/discussions/Mojaloop%...
Thanks also to Loris Cro for hosting us on Zig ShowTime. We had a blast! :)