One user chatting with your agent is easy. Ten concurrent users is fine. A hundred concurrent users exposes every assumption you made when building for one.
The agent code itself rarely needs to change. What breaks is everything around it β conversation memory tied to a single instance, no limits on how much work one request can do, API connections opened and closed on every call, and identical questions hitting the model repeatedly when a cached answer would do.
This article covers how to design your Spring AI agent to scale horizontally: stateless services, persistent memory, connection pooling, response caching, and async request handling.
The stateless rule
The single most important principle for scaling: your application instances must be stateless.
Stateless means: any instance can handle any request.β¦