A microservice means different things to different people. So when is a microservice not a microservice? Well, its when people with different viewpoints look at it!
Amongst the attributes that it may (or may not!) have, Martin Fowler’s site states:
Microservices prefer letting each service manage its own database
That seems to be a preference rather than a requirement though. Here, I’m not intending trying to define what a microservice is – I want to define some traits that microservices do not have. Here, I’m targeting a database, and the idea that microservices do not share a database, either between themselves or with a monolith.
This is backed up by microservices.io, where the idea is that each microservice has its own database (assuming it needs one):
Keep each microservice’s persistent data private to that service and accessible only via its API.
Anyway, the whole idea of being able to independently scale a microservice is counter to the idea of having a shared database: how can you possibly scale a database client independently of the database? I don’t think there will be too many people disagreeing here.
If we say that a service is not a microservice if uses a shared database, then what is it? A quick answer would be a “monolith”, however I’ve seen and written some small services that would otherwise be microservices if they didn’t have a shared database.
So, I think we need a new term for them. Miniliths.