My question is similar to this and this, but neither actually answer my question. The former is about data consistency between different services, and the latter is about receiving a message exactly once.
When designing a microservice architecture, it's important that each service manages its own data and that each service is independently scalable of every over service.
However, how should we approach handling the scaling of the data persistence that goes with each instance of this service? The way I see it, there are two options:
Option A:
You scale the data persistence layer independently of the service, using sharding or something.
This seems sensible at first blow... But a lot of databases can't (to my knowledge at least) be effectively scaled horizontally at runtime without at least a significant degradation to performance while it's happening.
Option B:
Each instance of the service gets its own copy of the persistence DB.
If we ignore the increased data replication (since storage is cheap now) the primary issue I see with this is ensuring that the data is consistent between the different instances of the service.
How do people generally approach this problem?