This post discusses the stateless microservice design pattern; it is meant as support material for other posts of mine that discuss microservices, mainly michael.gr - The Stateful Microservice.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-BQohDWIfWLaJTf6hlVtC-SWW2OGnKtr0wi1HCwnUF4r9Pcjo0Jg0ilokn77UIbFU5qSoSsdTG3zpN3sLUekUdyOM8fyzGwUJJmgNjDvV7aoOUp82nzJrZabc4Q1cwk2uidwjSkC0Dx8X/w269-h400/8.png) |
Dory, the yellow-blue fish (a Royal Blue Tang) that suffered from amnesia in the 2003 movie Finding Nemo by Pixar.
|
Is statelessness a requirement for a microservice?
In another post of mine I discuss what a microservice really is, and I come to the conclusion that despite various attempts out there to define microservices using twenty-item-long lists of characteristics, a good working definition could be as simple as this:
A microservice is a scalable and resilient module.
Even if you disagree with the terseness of this definition, and you regard microservices as necessarily more than that, I hope you will at least agree that it is precisely scalability and resilience that the stateless microservice design pattern aims to address, so the definition serves its purpose at least in the context of this series of posts.
There are many who will try to convince you that in order to build a scalable and resilient system, you need statelessness; so much so, that microservices have almost come to be regarded as synonymous with statelessness. This post examines whether this is that in fact so, and what is the cost of doing things this way.