
Ask HN: How are you solving the microservices data problem? - johnnycarcin
I&#x27;ve seen suggestions to use a database&#x2F;datasource per microservice, even if data is duplicated in those various locations. I&#x27;m interested in hearing what people who use many microservices in production are doing to solve this problem. MDM? A database microservice? Cron?
======
usgroup
Well the dream is orthogonality. It's not uncommon to have a data store like
Cassandra setup with each data access micro service having its own key space.
Other micro services then use the data access micro services in order to
retain the single point of responsibility.

So what used to be 4 lines of code with a shared SQL db now requires at least
2 services which have to have corellation Id based logging to give you a
fighting chance of working out what goes wrong, centralised log store,
separate containers, monitoring, configured orchestration for the containers
and some sort of communication between them ... what's not to love?

------
sprobertson
I don't use a database per service, rather a single database service which
others can query. Sometimes there might be some caching layer in another
service, or if the data source is unique enough (eg elasticsearch) it gets its
own service.

PS I'm apparently a buffoon and use microservices for even the most trivial
side project

~~~
johnnycarcin
I was talking with a group yesterday and that idea came up (or something
similar). The idea was to have a data microservice for writes and then let the
various microservices do reads from their specific db. This data microservice
would handle writing data out across the various data sources so nobody else
had to know about it, they just knew to send writes to that service. Is that
sort of what you are doing?

~~~
sprobertson
Even simpler, just one service for both reads and writes. It acts as a CRUD
API for the whole system. Other services are for more distinct functions like
sending notifications, interacting with an API, or running some specific
process.

------
itamarst
If you're a single developer you shouldn't be using microservices, which is an
easy way to solve the problem: microservices are only useful for large
organizations.

What specifically is the problem you're trying to solve?

~~~
johnnycarcin
No specific problem, I just run into a lot of customers who are trying to
solve the problem. I can parrot back everything from the books and the Netflix
tech blog but I'm interested to hear what non-Netflix people are actually
doing. Really more of just a learning question versus "I have an immediate
problem to solve".

