Stateful
A stateful app is one that stores information about what has happened or changed since it started running
Stateless
Stateless apps don't expose any information about what has happened or changed since it started running
Knowledge session engine
Example |
---|
"For certain kinds of transactions a stateless session may perform slightly faster than a stateful session" from question Difference between sessionfactory.openSession() and sessionfactory.openStatelessSession()? |
"Service to build drools knowledge and get session i prepared a stateless engine lighter than the stateful one" from question How to use drools in grails3 without any plugin? |
"In ejb3 there is no such thing as stateless is better than stateful session beans" from question Stateful Session Bean and HTTP Session |
Service harder scale
Example |
---|
"A stateful service can not be scaled as easily;if you want to deploy more units on peek times a stateless service is way easier to handle" from question Why Microservices better to be stateless in cloud applications? |
"A stateful service is typically harder to develop and scale than stateless services" from question Meaning of the term "Stateful" in programming |
Others
Example |
---|
An architecture that makes sense in flutter is as follows a top-level stateful widget stateful works better for hot reload a stateless one can cause issues something like myapp but change my to the name of the actual app from question Navigation Drawer does not work for Screen within Screen |
Dealing with a stateless cluster is often simpler then dealing with a stateful cluster from question App Server Clustering vs Terracotta |
Or in short stateless is better than stateful from question A circular dependency involving comparison functors |
But keep in mind that in many cases being stateful or not stateless is no problem and not all stateless applications are by definition better than stateful ones from question What is the criteria for a web framework to be stateful |
Do you have any situation where stateful is more appropriate than stateless from question In what scenario is stateful better than stateless for the web? |
This post will also guide which one to choose between stateful component and stateless component from question Direct call of a functional component |
And that i should use stateless in simple things because props are imutable and also use more than stateful from question When to use stateless and statefull components in ReactJS after Hooks changes? |
While a lot of development has been done with stateless connections to solve most problems sometimes it s just simpler with stateful connections from question What are the pitfalls of using Websockets in place of RESTful HTTP? |
A stateless deleter cannot remember to delete something else;you can add a stateful deleter to unique_ptr that supports aliasing but then you ll have to alias manually from question Why doesn't std::unique_ptr have an aliasing constructor like std::shared_ptr has? |
Also soap is stateful and http is stateless;an stateful approach is worse for scalability from question Can I use TCP in a RESTful service? |