Understanding the concept of “microservices”
I am honored to have been able to participate in many cloud technology seminars recently and share my understanding of the “Microservice” concept face-to-face with my colleagues in the information industry. It is gratifying that many academics and industry predecessors have expressed their appreciation for using an analogy to explain microservices, so I decided to write a simple article to share with everyone!
What is Microservices?
First, imagine that we runa restaurant, and there is only one employee in the restaurant. This employee is extremely versatile. Whether it is hospitality, cooking, cleaning or administration, she can do any task set before her. While there may be more waiting time for guests during peak times, the restaurant is still able to operate.
However, one day the employee fell ill and the restaurant had to close the store; this is a problem that a “single structure” will inevitably encounter. Therefore, in general, a restaurant will recruit to fill up the vacancies. The waiter is responsible for reception, the chef is responsible for the infield work, the managers are responsible for the administrator duties. As a result, there are multiple people providing services, and the waiting time for guests have been reduced. If a waiter takes sick leave, the other employees can support his empty position, and the restaurant will not need to be closed for one person so the guests will be able to eat.
Based on the analogy of the restaurant, we can assign work to individual units, not only to prevent overall service collapse due to a single node interruption, but also to effectively allocate resources and make the service smoother. VMs are like these restaurant employees, you need to give them the appropriate resources (salary) to perform in their respective areas. This is the core concept of “microservices”.
As technology evolves, we can imagine using robots to replace these restaurant employees, improving the overall service quality of the restaurant since it could reduce management costs and speed up services. For example, human employees will need to account for commute time to get to work, and encounter problems like traffic games, causing them to be be late. A robot, on the other hand, can start providing services with the push of a button. A high-tech future like this sounds very efficient, but human employees also have the advantage of being human. A restaurant owner can educate employees, but he does not necessarily know how to rewrite the robot’s operating procedures. Whether to choose human or robot employees and how to effectively assign work to both is a problem that the restaurant must think about.
Humans and robots are just like VMs and containers. It is often said that “microservices” must be services that are built by containers, but this is not true. It is only because the containers are have features that are reminiscent of “micro” and “lightweight”. For a comparison between VMs and containers, please refer to my previous article for a brief discussion. The most important first step for a service provide is to determine if the VM and container are suitable for the application you are providing. If you you can deploy the application service correctly, you and your client can enjoy the benefits of microservices.