I work in a company that uses microservices. We have one particular service (let's call it Cart Service for example purposes) that manages some logic (storing carts, allowing other services to add and remove items from a given user's cart, etc). My team owns this service and multiple other critical paths (like Item Search) talk to it routinely at 1000+ QPS.
Now, we need to add a web frontend that allows customer support people to remove/add items to the cart manually. This frontend basically needs to do all the stuff our service exposes currently, plus some more specific things (changing the owner of a cart, say). We have two choices:
- Make Cart Service serve the frontend. The frontend can talk to Cart Service to change the owners of the cart.
- Make a new Cart Admin Service that only serves the frontend and which talks to the Cart Service to perform the cart actions. This service wouldn't store any new data (probably) but would have to talk to other services (like customer support auth, etc).
I think that we should go with option 2 to avoid bloat of the Cart Service (which does a lot of stuff already) and that way we can scale the new service independently. It also separates the customer support concern from the core business concerns - Cart Admin Service and Cart Service have different uptime requirements, and we might bring down Cart Service inadvertently if we introduce a bug trying to change the frontend.
However, my coworker thinks that we should go with option 1 because writing the new APIs that the Cart Service would need to expose would be time better spent doing other things, and since the load of Cart Admin would be so insignificant compared to the current load of the Cart Service, load concerns don't really matter.
What are the pros and cons of each method beyond what I've described? Is there a reason one method is clearly better than the other?
-
To what extent does the vocabulary (and data structures behind it) used in Cart and Cart Admin diverge? Would you have to create a lot of Admin-suffixed or prefixed versions of your objects if both lived in the same microservice?guillaume31– guillaume312018年02月15日 09:40:10 +00:00Commented Feb 15, 2018 at 9:40
-
I think the vocabulary would be hardly divergent at all. Possibly, we would have to add some flags to the data models in the Cart Service to note that they had been edited by users of the Admin frontendNoah Gilmore– Noah Gilmore2018年02月15日 15:33:28 +00:00Commented Feb 15, 2018 at 15:33