For cluster, distributed and micro services, you may often hear about them in your work, but if you ask what kind of difference and connection there is between them, you may feel confused, today on this topic, take advantage of the weekend, to talk with you.

Figure out what it is

To compare the three, first of all, what are they?

The cluster

Clustering is the concentration of multiple servers, each of which implements the same business and does the same thing.

However, each server is not indispensable, and its main role is to alleviate concurrency and single point of failure. We can build systems with high scalability, high performance, low cost and high availability using some cheap, industry-standard hardware.

The cluster has the following features:

  • Scalability: A cluster of servers that use Scalability to perform heavy tasks as individual servers.
  • High availability: The emergence of clusters is to make the overall services of clusters as available as possible, so as to consider the error-prone computing hardware and software and avoid single point of failure.
  • Load balancing: Applications that handle loads or network traffic so that the loads can be spread as evenly as possible across a cluster of computers.
  • High Performance: Parallel computing (or parallel computing) is relative to serial computing. The purpose of parallel computing is to improve the speed of computation.

distributed

Distributed service refers to the centralization of multiple servers and the service is distributed on different machines.

Each server implements a different business in the aggregate, doing different things. A service may be responsible for several functions and is an SOA oriented architecture. Separately deployed parts exchange information with each other through various communication protocols, and each server is indispensable. If a server fails, some functions are lost or the whole cannot run.

The main function of distributed presence is to greatly improve efficiency and relieve the pressure of server access and storage. In the distributed mode, a service is divided into multiple sub-services and deployed on different servers.

For example, a large system is divided into multiple service modules. Service modules are deployed on different machines and interact with each other through interfaces.

Micro service

Microservices are small services, so small that a service corresponds to a single function.

Each microservice is focused on completing one task and doing it well, and the service can be deployed and run separately. Microservices are loosely coupled and can interact with each other through RPC. Each microservice is developed, tested, deployed, and launched by a small, independent team responsible for its entire life cycle.

In architectural design, when you have estimated the maximum users and concurrency, calculate whether a single application server can meet the requirements. If you have a small application with a few hundred users, you can do it as a single application, where all applications are deployed on a single application server. If the application has a large number of users and some functions are frequently accessed, or some functions are computatively heavy, it is recommended to split the application into multiple subsystems, each responsible for its own functions. This is the microservice architecture.

Figure out the similarities and differences

Once you know what it is, you can try to find similarities and differences.

Clustering and Distribution

Difference 1: Whether the services on multiple servers are the same.

Cluster mode: The same set of services are deployed on different servers to implement load balancing.

Distributed: Each node can be clustered, and a cluster does not have to be distributed.

For example, if more people visit your site, you can create a cluster. One response server is placed in the front, and several response servers in the back complete the same business. If there is a business visit, the response server to see which server load is not very heavy, the task will be scheduled to which one to complete.

And distributed, from the narrow sense of understanding with cluster is almost the same. But it is loosely organized, unlike a cluster where one server goes down and another can take over. Each node in the distributed system performs a different service. If a node fails, the service becomes inaccessible.

Note: In cluster mode, Session sharing is required to ensure that services will not be terminated when a Session is not obtained during switching between different servers.

Difference 2: There are different ways to improve efficiency.

1. Improving efficiency by reducing the execution time of individual tasks;

Clustering: Improves efficiency by increasing the number of tasks performed per unit of time.

For example, if a task consists of 10 subtasks and each subtask takes one hour to execute, it takes 10 hours to execute the task on one server.

  • A distributed scheme is adopted to provide 10 servers, each server is only responsible for dealing with one sub-task, regardless of the dependencies between sub-tasks, and it only takes one hour to complete the task.
  • The cluster scheme also provides 10 servers, and each server can handle the task independently. Suppose 10 tasks arrive at the same time, 10 servers will work at the same time, and after 10 hours, 10 tasks will complete. All in all, you still finish one task within an hour.

Note: Distribution requires good transaction management.

Distributed and microservices

The difference: The architecture is similar, just the way it is deployed.

** Microservices is an architectural style in which a large complex software application consists of one or more microservices. ** Each microservice in the system can be deployed independently, and each microservice is loosely coupled. Each microservice is only focused on completing one task and doing it well. In all cases, each task represents a small business capability. The application of microservices does not have to be spread across multiple servers, it can also be the same server.

Compared with distributed services, microservices have smaller granularity and lower coupling between services. Because each microservice is managed by a small, independent team, it is more agile. It is a trend that distributed services will eventually evolve into microservices architectures. However, the challenges brought by microservitization of services are also obvious, such as small granularity and large quantity of services, which will increase the difficulty of operation and maintenance in the later stage.

Is distributed a microservice?

The answer is yes.

Microservices divide modules into independent service units to realize data interaction through interfaces. Microservices in production must be distributed, and distributed applications are not necessarily microservice architectures.

conclusion

1, the cluster

Replication deployment with consistent capabilities to achieve: scalability, high availability, load balancing, and high performance;

2. Micro services

Decentralized ability to split large and complex software into multiple microservices (not necessarily distributed on multiple servers, but can be the same server);

3. Distributed

Decentralized deployment is an SOA oriented architecture in which services are deployed on different machines to implement different services and do different things.

– END –

Previous hot articles recommended:

Are you still planning to move to Go? Talk about the growth of programmers

I killed 40% of the candidates with a little open design question

Redis not sure about the interview? 40 Interview Questions to Stop You Panicking (With Answers)

A debate about code comments prompts three thoughts

Thanks for reading!