alexedwards / scs

HTTP Session Management for Go
MIT License
2.12k stars 165 forks source link

NATS Jetstream and session replication might be of interest #200

Open gedw99 opened 6 months ago

gedw99 commented 6 months ago

When you have servers that are geophysically all over the world and using BGP / Anycast, NATS allows the users session to be replicated to all the Servers.

Its very easy because you can use the NATS KV Store to do this.

https://docs.nats.io/nats-concepts/jetstream/key-value-store/kv_walkthrough

locnguyen commented 6 months ago

I'm using NATS in a new project for pub/sub messaging. I saw that it also supports key/value storage which would allow me to remove my Redis dependency that I'm using for key/value as well as scs sessions. I wonder if anyone else is interested in a NATS custom session store :)

gedw99 commented 6 months ago

There are already GitHub projects that replace Redis with Nats. Just can’t remember the project right now.

I did find this though:

https://www.reddit.com/r/golang/comments/1b2dfm6/jetstream_kv_a_fascinating_gobased_alternative_to/

Also for Nats kv using fiber. https://docs.gofiber.io/storage/nats_v1.x.x/nats/

I tend to stick with golang std router to keep upgrades easy.

Hopefully something here helps.

tommyo commented 4 months ago

This would be trivial to implement. I'll submit a pull request after my next rainy-day hack session.