This is the last post in our microservices migration series. I would like to end the series with highlighting some other smaller lessons that I hope might be useful, too. And in case you missed the previous posts, here they are:
Make Things Simple
Microservices architecture is complex by default. It adds extra complexities to everything —integration, transactions, testing, deployment, debug, tracing, etc. So, please try to make things simple whenever possible. Don’t overcomplicate.
If there is an option to choose an easier path for data migration, choose it. If, for any reason, synchronous direct inter communication between services is acceptable for you, then use it.
If event sourcing is not worth investments, then go with a traditional error-prone, update-based data model. There is nothing wrong with that decision if it is done deliberately. You might add audit logging via separate storage later.
If you don’t need HATEOAS and can live with level-2 services, then that is okay, too.
If authentication/authorization were checked at Gateway, there is no need to secure calls between intranet services. Use JWT to pass minimum user identity between services.
There is a great presentation by Aviran Mordo about the Wix journey to microservices. I highly recommend reviewing it. The main recommendation? Don’t forget about the YAGNI principle.
But Don’t Make Shortcuts
Microservices architecture has its standards. At first, as everything in life, they look complex. But they are complicated just because they are just not familiar to us.
Learn from pain, inconvenience, and the experience of others, but don’t make shortcuts.
If you need data from a database, create an appropriate API and make a call using it, not through direct access to a DB. If a service is responsible for more than one context, create another one — don’t violate the single responsibility principle. If integration between services becomes a bottleneck, then, according to extreme programming, do it more often.
I wish you all a great and interesting journey from monolith to microservices architecture.