Replies: 3 comments 7 replies
-
Hi @mumoshu, thanks for this idea and starting the discussion! We've definitely had an eye on FoundationDB for a long, long time now (since 2015 I believe)! I am open to having FoundationDB as a potential backing store, albeit the design limitations may result in a number of queries failing in SurrealDB. Is your PoC source code visible anywhere (I'd love to take a look)? The limitations which were a semi-deciding factor for us going with TiKV are: Large transactions
Long running transactions
The full page of design limitations can be found here. Having said that, FoundationDB does have a very nice key-watching feature, which I wish TiKV had too. |
Beta Was this translation helpful? Give feedback.
-
@tobiemh Hey! Thanks a lot for your response
Thanks! I'm aware of it and I'm still optimistic about it and that's why I'm going to benchmark the two. I would greatly appreciate it if you could review/validate my idea! You may already be aware of all these points but please let me explain them fully anyway. So, my understanding is that it's mainly due to that (1) FDB focuses more on higher throughput FDB queries and wants the FDB layer developer to use snapshot isolation to disable serializable transactions OR the layer to implement its own MVCC on top of FDB and (2)FDB's MVCC for 5 seconds is implemented with non-MVCC data on disk plus the MVCC layers maintained in-memory https://forums.foundationdb.org/t/large-range-scans-avoid-5s-limit/292/6. The main memory is relatively more constrained than the storage hence they heuristically decided to use lower limits. An example of (1) I know of is https://github.com/losfair/mvsqlite which had implemented its own MVCC backed by SQLite transactions and WAL. TiKV seems to do MVCC at the storage layer by prefixing RocksDB keys with the kv version https://tikv.org/docs/5.1/reference/architecture/storage/#mvcc. Theoretically, FDB could do the same and there might be pros/cons for doing so. If you weigh more on throughputs you'd better use FDB by compiling it with more generous limits(I thought they are just constants in their source code) and run it on the machines with more memory. If you weigh more on the economy you might better use TiKV. Considering all, I guess "I" am not yet at the stage where relying solely on TiKV for its potential to handle larger and log-running transactions, although I can't say FDB's better either 😁 That said, I'm still interested in what kind of SurrealDB queries you have in your mind that may fail and be non-functional when run on FDB? To my humble knowledge, I can imagine:
would have a hard life if they are supposed to be made "serializable" naively on FDB, without SurrealDB's own MVCC layer. I'm not yet sure if making a whole large KV-store transaction serializable is always practical, though. It needs to write transaction logs/WAL to the disk at least. Should I always let it additionally write versioned or layered KVs for MVCC? It might result in more write amplication in exchange for larger transactions. If we learned later that TiKV could actually make large transactions serializable without serious problems- it's totally awesome! I might happily use TiKV as the backing store for SurrealDB, or FDB could be updated to do a similar storage-level MVCC to catch up. // In other words, I do respect TiKV and its authors and maintainers a lot. However until I see real numbers, I can't justify me saying "no hard-coded limit = more scalability". At least from what their respective docs say, I can't stop thinking that they should have similar architectural limits although TiKV seems to have more generous hard-coded limits than FDB. Well, this turned out to be a very long read. It's my pleasure to discuss this kind of thing as I'm very much interested in this area so I couldn't stop writing this as detailed as I can think. Sorry about that! I hope it's readable. Thanks in advance for taking your time 🙏 |
Beta Was this translation helpful? Give feedback.
-
I'll publish it in a few days once I confirmed it works at least with my local installation of FDB 😄 |
Beta Was this translation helpful? Give feedback.
-
// I'm posting this feature request here by following https://github.com/surrealdb/surrealdb/blob/main/CONTRIBUTING.md#introducing-new-features but if you have another channel for that please let me know!
Would there be any chance that SurrealDB could add support for FoundationDB as a KV store?
My primary motivation is benchmarking at this point- For me, TiKV and FDB are the two biggest transactional KV stores(although they have several differences as explained in places like tikv/tikv#2986). I prefer FDB for its extensive test suite for ensuring correctness.
I'm not yet totally sold on either of those though- It would be great if I could write/run some benchmarks against SurrealDB on TiKV and FDB, compare, and decide which one to use as the backing store for awesome SurrealDB, and encourage other folks to do the same so that we can collaborate and I'm not alone in the Internet who might be using SurrealDB on FDB, hence this feature request 😄
If it happened I believe it might look very similar to one for TiKV. It would also require a new dependency to foundationdb-rs. (I actually have a PoC that compiles successfully
WDYT?
// P.S. Perhaps you've already tried FDB and opted to go with TiKV? Then I'd greatly appreciate it if you could share your experience. Thanks in advance for taking your time.
And lastly... Keep up the great work! I'm impressed to all your work on SurrealDB and looking forward to every "coming-soon" feature you mentioned in the documentation/site!
Beta Was this translation helpful? Give feedback.
All reactions