© Thomas Hunter II 2017

Thomas Hunter II, Advanced Microservices , 10.1007/978-1-4842-2887-6_5

5. Service State

Thomas Hunter II

(1)San Francisco, California, USA

Many services will need to retain state in some form or another. Making your services as “stateless” as possible is something you should strive for. That said, you do need to keep state somewhere, ideally outside of your service instances. This is where databases come into play.

An important rule with databases in relation to microservices is that you don’t want to allow any other teams to directly connect to your database. The database should be so far out of reach from your consumers that they shouldn’t even know what kind of databases you are using. If a consumer ever does happen upon ...

Get Advanced Microservices: A Hands-on Approach to Microservice Infrastructure and Tooling now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.