Handling Concurrency

A frequently asked question is “How do you scale microservices?” We have these single-threaded, stateful Components—what happens if they don’t keep up? Are there other reasons to run concurrent instances? We have completely ignored dealing with concurrency in this project.

You’re right to think it isn’t as simple as just running more instances. That works very well for applications because they are inherently stateless. Autonomous components, on the other hand, are very much stateful.

And it isn’t just intentional scaling that would lead us to multiple instances. We might accidentally cause two instances to be running at the same time through our own error with our deployment system. Or perhaps we want to have two going ...

Get Practical Microservices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.