DEV Community

Oleksii Kraievyi
Oleksii Kraievyi

Posted on

Dependencies in microservices world

Today we had a brainstorm meeting about how we can eliminate direct dependencies between services in our application. What inputs do we have

  1. 15-20 microservices
  2. some of them have cyclic dependencies (service A calls service B and service B calls service A)
  3. calls does not create anything, just getting some external data

After some brief discussions we've came up with some solutions

  1. We have case when we need to go to external service on each call via middleware and check if user can have an access to app and we can't really eliminate this one. We have a cache on external service , but we've also decided to introduce local cache to even have no network calls
  2. We have cases when the validation on one service is dependent on state in another service. In this case, we decided to store local copy of this state in scope of single service. We have all needed infrastructure for integration events so it's just the matter of time. (There's also one good point, I've pulled from this meeting - "if you need to call an external service for querying, there's possibility of a bad solution. and for commands - it's completely fine to call 3-rd party services")
  3. And the last one is just removing depedency)) What can be easier that that ? We've check a couple of our scenarios and decided that for some cases we don't even need to call external service at all since it won't affect data integrity. For example, we've queried external service to check if resource is found when we were searching data on grid. Isn't this awesome ?

So, notes are written, time to create some tech stories in jira

Top comments (0)