Preface
Micro-services in recent years a fire, not yet heard the micro-service in itself is a news. Advocating micro-service information blog A catch a lot, this article wants to give everyone to cool down, to say that the micro-service transformation process of various pits and pain, and finally gave a bit of their own advice.
MicroServices are good things, but not everything. micro-services in Wonderland
The introduction of micro-services triggered the industry to promote the big guy, the following diagram shows the system of micro-service reconfiguration process.
The benefits of microservices are many, including but not limited to the following:
1. Each module can be independently developed, iterated,
2. Separation of technology stacks between different teams can be based on the characteristics of the team to use more appropriate technology to solve the problem
3. Splitting the system into fine-grained services often means higher reusability
MicroServices are as beautiful as they are in Wonderland, but they are another sight to implement.
the path of thorns to Wonderland
Micro-services are indeed technological trends, but the path to MicroServices is not a road, but a path fraught with uncertainty, and the following describes the various pains in transition. the pain of mining pits
Compared to the traditional architecture, micro-service as a new thing, but its reference is very rich, in fact, a little too rich, to go online any search is a variety of blogs, reference materials, but 99% of them are stuck in the very surface, and many still have some errors. It takes a lot of time to sift through the useful stuff, and you have to build a prototype test to be assured that you want to step into the micro-service pit is to step on a lot of, from the beginning of the technology selection, to the middle of the reconstruction and trial operation, and even on-line operation and the final scale is the alarming ah. People's Pain
A team that loves technology and dares to challenge itself is essential to a successful transformation.
The transformation of General MicroServices is initiated by team technology leaders (architects), and the underlying developers often do not have the relevant skills, which requires the development team to learn a lot of new technologies in a short period of time, which may be a huge challenge for some members, so the team is less efficient when the system has just entered the transition period, The bug frequency will be a large probability event.
At this point, the pressure from the management began to increase, a lot of team transformation is at this stage halfway. At the same time looking at the team of various fire fighting, for the actual development experience of micro-service people's needs are more urgent, but the people tend to be more difficult than gold, so this time will go through a considerable team of technical suspended and personnel missing, all kinds of frustration and compromise.
the pain of testing
Testing is perhaps the biggest challenge in MicroServices, before the transformation of the entire system is one, so after the development, want to test only in the development machine packaging run, the developers themselves can be initially measured, found problems in development, and then handed over to the testers, Testers are also thrown into the test frame or directly initiated to do a manual regression test on OK. But after the transition to a microservices architecture, it is not easy to start the whole system locally after development, and testers are faced with the same problem, often starting the system before each test in the start-up period, which takes a lot of effort.
The testing scheme in MicroServices currently has several main directions:
1. Shared Services
By building a complete set of shared services to provide a common test base for development and testing, development and testing requires only the services involved in deployment, and shared services are configured by configuring other services.
This is the simplest implementation, but there are a lot of problems, such as: test data problems, multi-point test conflict issues and dynamic routing and configuration problems of the system
2.mock Other Services
I believe everyone has been exposed to the mock in the unit test, and this program is a direct mock and modification services related to other services, to ensure that the development and testing between the independence and isolation, while testing has a power-like, in the CI/CD can also run smoothly.
Wiremock is a good choice.
3. Contract-Type programming
This is a further program, from the development phase of the use of contract model, so that the development and testing to ensure the unity of practice, there are many, there is no too much introduction.
Recommended
1. Do not blindly turn to microservices, microservices may be the medicine to save you but it could be the last straw to crush the team.
2. MicroServices are a technical system that needs to be adapted to the testing, monitoring, deployment, operation and completion of the technology stack, the lack of these micro-services is poison, so the technical team to do a good job of technical reserves.
3. The transformation of MicroServices is a lengthy process that requires considerable resources and the courage to test and error, ensuring the support of management.
4. It is better to find a new small project to do verification, and then consider the reappearance of the system to promote;