Stateless vs stateful
A stateless system keeps no trace of what came before: every request starts from scratch. A stateful system remembers (login session, cart, conversation history). The distinction drives six architecture pairs every AI builder ends up having to call: Lambda versus ECS (one-off task triggered on demand versus a service that keeps running), database versus cache (durable storage versus a fast temporary copy), queue versus stream (a list you clear once handled versus an event timeline you can replay), retrieval versus reranking (finding a batch of documents versus pushing the best ones to the top), monitoring versus tracing (knowing something is wrong versus following one request to find where). A few concrete markers make each pair readable. Lambda suits a short task fired by an event, such as processing a file the moment it is uploaded; ECS runs a service that has to stay up, such as an API, and can carry stateless and stateful work alike. A queue works like the order tickets in a kitchen: a cook takes a ticket, prepares it, and the ticket leaves the rail. A stream is closer to a ledger of everything that happened: the event stays, and several systems can each read it on their own without stepping on one another. A cache is a copy of the most requested data held in fast memory, never the original.
Strengths
- A single reading axis that orders six architecture decisions instead of handling them one by one
- The stateless-by-default reflex avoids the most common scalability debt
Limitations
- The distinction is binary in theory but blurry in practice: many systems are stateful only in places
Best for
- A dev or tech lead laying the foundations of an AI backend who wants to avoid paying for a naive architecture later