I servizi stateless non memorizzano lo stato del client tra le richieste (ogni richiesta è indipendente), mentre i servizi stateful mantengono lo stato. L'assenza di stato è importante per la scalabilità — i servizi stateless sono molto più facili da scalare orizzontalmente.
Stateless vs stateful
STATELESS → the service keeps NO client state between requests:
→ each request contains all needed info; any server can handle any request
→ state lives ELSEWHERE (database, cache, client, token) if needed
STATEFUL → the service MAINTAINS state across requests:
→ a specific server holds a client's state (session in memory, etc.)
→ requests must go to the SAME server (or state must be shared/synchronized)
