Recently, I went out for an interview and was asked about the relationship between microservices and distribution. As the previous projects were all extremely old single-machine systems, I was confused on the spot. So again this record to facilitate future review.
Micro service
Simply service is very small, small to a service that corresponds to a single function, only do one thing, and the service can run separate deployment, communications between the service can interact with each other by RPC, every micro service is developed by independent small team, testing, deployment, online, is responsible for its entire life cycle.
What is microservices architecture
When applied to the design of architecture and logical architecture is done first, and then do physical architecture, when you get demand, estimated after the biggest users and concurrency, the elder brother of the calculation sheet application server whether can meet the demand, if users only hundreds of small applications, single application can be done, it will all functions are deployed in an application service, if users is very big, In addition, some functions are frequently accessed or some functions are computatively heavy. Therefore, it is recommended to split the application into multiple subsystems, each of which is responsible for its own functions. This is the microservice architecture.
Let’s talk about what distributed is
Distributed services as the name implies, a service is distributed on different machines. A service may be responsible for several functions. It is oriented to SOA architecture and services interact with each other through RPC. After the logical architecture design should do physical architecture design, system application deployed in more than a server or a virtual machine, and a part of each separate each other through the communication protocol communication information, even distributed deployment, production environment of service It must be distributed deployment, but the application of distributed deployment Are not necessarily micro service architecture, For example, in cluster deployment, the same application is replicated to different servers, but the logical function is still a single application.
After all that, let’s talk about the difference in nature between microservices and distribution
First micro service than distributed, its granularity is more thin, the coupling between service is lower and because each micro service by independent small group responsible for developing, so it’s more agility, and more suitable for the current agile development, distributed services eventually to micro service architecture evolution, this is a kind of trend, but the challenges brought by the micro service is also obvious, For example, the service granularity becomes finer and the number of services increases, resulting in higher maintenance costs.