Design,  技术

What makes it so hard to migrate to Micro service

We have been tried for so many years but since we didn’t admit we failed officially there is no formal conclusion what went wrong? Or what really made it so hard.

By reading this book Microservices patterns maybe there are couple of main reasons

  • The user interaction is very hard to change.

    Distribute the data to different micro services would cause that it would be more complex to complete one complex tasks. For example, when a customer want to create a subscription we potentially need to create an account, create a subscription, even doing payment, invoice and etc. Since we are B2B business it make it very hard to change the expectation from customer. It needs to be synchronized in one REST API call. The microservice is very efficient if we can do it asynchronously. For example when customer create an order we can create an order immediately with “pending” status and then doing the validation etc. There are some other way to do it like caching data which would not work for data change/create.
    Imaging how fast can be faster than put a bunch of SQL in one transaction. and use database transaction to control atonic.
  • Distributed Transaction.

    Distributed transaction would not work and the Saga mode is eventually consistence. If the customer expectation is synchronous API it would make one service waiting for another depended services to complete which would reduce the service availability and the performance would not be good.
  • Query data from different micro services

    We didn’t have GraphQL when we started the Microservice project which make it harder to support the same query. And even with GraphQL we would see the performance degradation by joining result and run separate queries in different data services. Even technically I believe the flexibility pays off the little bit performance hit. And we can scale out much more easily and would has less chance the system got overloaded and performance was degraded in some extreme scenario. In that perspective, the performance not necessary worse. But in the normal scenario customers may experience a little bit performance hit. And if one major customer complaint a lot and claim to leave, the project can see as a failure..

Leave a Reply

Your email address will not be published. Required fields are marked *