Hey everyone! I'm working on a demo application meant for Kubernetes, possibly OpenShift, and I've been exploring some cloud-native architecture principles. I get that stateless services are key, but I'm concerned about user sessions since they do have some state and are usually stored during runtime. Here's my question: what's the best way to manage this state? Should I use a shared cache, and if so, which one would you recommend?
2 Answers
The article you linked has some great high-level insights, but it doesn't dive deep into practical implementation. A major part of your challenge will be in setting up your Kubernetes cluster and figuring out how to deploy your application effectively. Beyond deployment, managing state becomes crucial. Cloud-native solutions can be a bit flexible in their definitions, so having real-world examples can be quite helpful.
When it comes to handling state in Kubernetes, a popular choice is using in-memory stores like Redis. While session stickiness is uncommon in Kubernetes environments, you might also consider using shared file systems, though that’s less common. Essentially, Redis can offer a solid solution for managing user sessions efficiently.
I have to say, your advice feels somewhat off. We've handled a software product with over 50,000 users and terabytes of data, making state management our top priority. We’re planning to test with Redis, but I’m concerned about handling concurrent requests since we have trading partners sending multiple transactions at once for the same entity. We've dealt with this with pessimistic DB row locking in our previous systems.