3 ms·
I can understand why they only allow one read/write transaction at a time. However, could they implement multiple concurrent read/write transactions by having
by herge 10y ago
I can understand why they only allow one read/write transaction at a time.
However, could they implement multiple concurrent read/write transactions by having the transaction fail if it writes to any key modified by any other concurrent transaction?
Like if writer X modifies a key at time t1, but writer Y opens a transaction at time t0 and tries to modify the same key at time t2, Y is told their transaction is invalid and should restart their operation from the beginning.
- jhugg 10y agoSometimes this is slower than serialization. In fact, when you’re doing KV-CRUD work on in-memory data, it’s often slower than serialization. Keeping RW-sets is non-trivial overhead compared to the hardest typical part of KV-CRUD, tree or hash lookups. Many many systems have more parallelism, but less throughput. Now, if you want to prevent one transaction with a bad-actor blocking the system, then RW-sets, timeouts and OCC/MVCC might be a good idea, it just won’t be faster.