So... what is Stateless Architecture in Software Engineering[System Design Sundays]
Understanding the Stateless vs Stateful architecture debate and why Stateless is taking over.
Hey, it’s your favorite cult leader here 🐱👤
On Sundays, I will go over various Systems Design topics⚙⚙. These can be mock interviews, writeups by various organizations, or overviews of topics that you need to design better systems. 📝📝
To get access to all the articles, support my crippling chocolate milk addiction, and become a premium member of this cult, use the button below-
p.s. you can learn more about the paid plan here.
If you have any interest in Cloud Computing, you’ve probably come across stateless architectures. There has been a large push towards Stateless architecture setups. Take this passage from Google’s recommendations on designing safer and more scalable architecture-
A stateless architecture enables your applications to scale up quickly with minimum boot dependencies. The applications can withstand hard restarts, have lower downtime, and provide better performance for end users.
The system design category describes recommendations to make your applications stateless or to utilize cloud-native features to improve capturing machine state for your stateful applications.
But what exactly is stateless architecture? And how does it operate? How do engineers navigate the storage requirement without storing the state? In this article, we will be going over stateless architecture in more detail, to help you understand why so many people are pushing for this new design.
Understanding Stateless architecture
Background, the traditional way: To truly understand stateless architecture and its benefits we must first understand the context around it. Traditionally, cloud software followed the client-server pattern (read more here), where lightweight client machines used big-boi servers for the computations. This was good when personal computers were wimpy and it made sense to centralize the costs. So, what does this have to do with State and Stateless architecture?
Understanding State- The state of an application at a point of time can be understood as the values of the app’s parameters at that snapshot in time (think variables on the stack frame etc). In the traditional way, the state is stored server-side for computations leading to stateful architecture. This can lead to problems in stability and scale. If I refresh something client-side, this can disrupt operations and make me restart the whole thing. Stateful architectures are also not horizontally scalable since I can’t distribute the state across multiple servers safely and easily. This was the motivation behind going Stateless.
How Stateless Architecture Helps- Stateless architecture is a bit of a misnomer. It’s not that your app doesn’t track state (this is needed) but this tracking is outsourced to systems that can do it better. By using tools like cookies, sharing Redis instances for storing state b/w servers, etc. handling states becomes much easier. Stateless architecture is well-suited to a world where PCs have been sipping on that jungle juice and advanced hardware is cheap. This enables Client side computers to step in and take some of the computational load. This is a win for all- Client experience is smoother since storing state client side is more robust and server-side computations and scaling become easier.
Learn more- Two great resources that will allow you study this concept in more detail are- Stateful vs stateless by Red Hat, and the aforementioned Stateful vs Stateless Architecture: Why Stateless Won. Both are great resources to jump into the topic.
I really like this quote from the Why Stateless Won writeup-
Stateful architecture made sense in a server-focused world where clients were merely thin interfaces to more powerful servers. When services only needed to scale to hundreds or thousands of users, having a strong coupling between users and servers wasn’t an issue.
Now that we have powerful client machines and web services are often required to scale to millions or even billions of users, we’ve needed to evolve not only hardware and software, but also design patterns and concepts.
What do you think will be the next innovation in software design patterns? I’d love to hear what you think. To those of you that prefer videos, this one by Codedamn is a good one-
That is it for this piece. I appreciate your time. As always, if you’re interested in working with me or checking out my other work, my links will be at the end of this email/post. If you like my writing, I would really appreciate an anonymous testimonial. You can drop it here. And if you found value in this write-up, I would appreciate you sharing it with more people. It is word-of-mouth referrals like yours that help me grow.
Save the time, energy, and money you would burn by going through all those videos, courses, products, and ‘coaches’ and easily find all your needs met in one place at ‘Tech Made Simple’! Stay ahead of the curve in AI, software engineering, and the tech industry with expert insights, tips, and resources. 20% off for new subscribers by clicking this link. Subscribe now and simplify your tech journey!
Using this discount will drop the prices-
800 INR (10 USD) → 640 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year (533 INR /month)
Reach out to me
Use the links below to check out my other content, learn more about tutoring, reach out to me about projects, or just to say hi.
Small Snippets about Tech, AI and Machine Learning over here
AI Newsletter- https://artificialintelligencemadesimple.substack.com/
My grandma’s favorite Tech Newsletter- https://codinginterviewsmadesimple.substack.com/
Check out my other articles on Medium. : https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd
Reach out to me on LinkedIn. Let’s connect: https://rb.gy/m5ok2y
My Instagram: https://rb.gy/gmvuy9
My Twitter: https://twitter.com/Machine01776819