2

I'm working on an application with about 50 or so microservices that have separate multi-tenanted databases. The problem arose of taking a tenant's data offline meaning that any requests for a certain tenant's data should be denied regardless of what service the request is being made for.

Normally in a single tenant database, we might just have taken the database server offline, but obviously we cannot do that in the multi-tenanted scenario which is further complicated by having separate databases for each service.

So the question arose if this is a problem that each microservice should have to handle or if this should be solved at a higher layer, say some type of gateway that every request passes through and can be filtered out accordingly.

Each solution creates a single point of failure. If each microservice needs to know a status of a tenant, then they will need to query the same service for this information and if that service is down, then the request will fail. Similarly if the gateway goes down, all requests fail. So in terms of availability both solutions appear to have the same result.

Is there a more accepted approach in microservices design of pushing the problem to individual services or trying to create a single solution so that each individual service does not need to worry about certain problems?

  • 1
    It's unclear from your question whether the microservices are separate because they have individual tenants, or whether the individual tenants are spread out across all of the microservices. If it's the latter, and we're talking about a single database containing all of the tenants, then why not just remove permissions to the database for a particular tenant? Your services will all fall over for that particular tenant, but I think that's what you want to have happen. – Robert Harvey May 31 '16 at 23:26
  • The tenants are spread across all microservices. For example Tenant "100" might have data in Service A, Service B, Service C, etc. Each service has their own database with Tenant "100" data alongside Tenant "200" data etc. – Mike L. May 31 '16 at 23:36
  • 1
    You could require users to present their requests to a single gateway that forwards their requests to the appropriate microservice. There has to be some tenant identification on every request, which I assume you already have. You would have to add a service identifier to each request. – Robert Harvey Jun 1 '16 at 0:17
  • 1
    The other way to do it would be to create a broadcast program that automatically disables the microservices on a per-tenant basis. Every microservice would have to be modified to accept the new control signals. – Robert Harvey Jun 1 '16 at 0:20
  • 3
    I would only add that not every problem in computing has a pre-packaged, pre-approved solution with the Good Housekeeping seal slapped on it. Our worth as software developers is measured mostly by our ability to solve novel problems, not by following well-worn blueprints for already-solved problems. If that's all we did, we'd essentially be overpaid pattern-matchers. – Robert Harvey Jun 1 '16 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.