Replies: 3 comments
-
FYI @sgirones Ping you to see if you see NATS KC Clustering as a worthwhile addition to Surreal DB. I saw that TIKV bug about Surreal loosing connection to TIKV at #3570 NATS clients are not exposed to reconnect issues when NATS Servers change. For example NATS Server itself can be upgraded with no downtime for any clients. It's called Lame duck mode in NATS. https://docs.nats.io/running-a-nats-service/nats_admin/lame_duck_mode. I would need to review the latest on this however as those docs look a bit old. https://docs.nats.io/running-a-nats-service/nats_admin/upgrading_cluster is a decent playground to test upgrades and what happens with clients. You just need the NATS CLI and NATS Server to do this playground. |
Beta Was this translation helpful? Give feedback.
-
I also think this is a great idea for the same reasons. I'm sure NATS KV isn't quite as performant as TiKV (let alone Speedb, or the upcoming SurrealKV), but it comes with immense extra functionality - namely pubsub type stuff - and it all "just works", almost magically. So, if Surreal could be built on top of NATS, the two would enormously simplify the backend stack for a geodistributed event driven architecture. |
Beta Was this translation helpful? Give feedback.
-
Although I love NATS and what they are doing, we don't plan to officially support any other KV store for the time being 🙏 |
Beta Was this translation helpful? Give feedback.
-
NATS KV is a scalable cluster solution. See: https://docs.nats.io/nats-concepts/jetstream/key-value-store
Its very to setup a global cluster with NATS. Typically 3 servers per data centre that are then setup as a global gateway. See: https://docs.nats.io/nats-concepts/service_infrastructure/adaptive_edge_deployment
NATS rust package from https://github.com/nats-io/nats.rs is well maintained, and only a bit behind the nats golang package.
So al this makes me ponder if we would add a NATS Endpoint to https://github.com/surrealdb/surrealdb/tree/main/lib/src/api/opt/endpoint
I dont know the semantics of what a Surreal Cluster KV endpoint needs to support in terms of ACID, and other things though. Just because we can does not mean we should :)
But I am a bit of a fan of NATS and its lightness and flexibility, so I wanted to start up this discussion.
The TIKV setup was took only 1 minute. With NATS it's also a 1 minute setup I think..
Here is an example using GOLANG: https://natsbyexample.com/examples/kv/intro/go
Here is the same using RUST: https://natsbyexample.com/examples/kv/intro/rust, and so the Endpoint code in https://github.com/surrealdb/surrealdb/tree/main/lib/src/api/opt/endpoint would be a bit like this...
Beta Was this translation helpful? Give feedback.
All reactions