Article From:https://www.cnblogs.com/zourui4271/p/9689427.html

Today, we’ll talk to everyone about the structure of distributed systems. Before we begin to talk about the routine, let’s first consider a question. Why do we need to have a distributed architecture?

Most developers probably never touch distributed systems, and there’s no need for distributed systems architectures. Why? Because there is no need for a distributed architecture when access or QPS does not reach the performance bottleneck of a single machine. If the volume of business is up, general.How will it be solved?

 

The first thing to consider is machine upgrading. Vertical scaling of machine configuration begins with finding the bottleneck of current performance: CPU, memory, hard disk, or bandwidth. It’s usually the most direct and efficient way to solve the problem. Bandwidth is notEnough? With bandwidth, 1G is not good enough to use 100G. CPU 8 core is not enough? Engage in 32 core 96 core. This is the first solution that most companies can think of, and the most efficient, fastest and safest way to do it.

Secondly, the system is split, the main process of the services provided and the branch line process combed out, according to the process of system split. Like a tree, the core business acts as the backbone process, and other systems are split as needed, just like the branches and leaves of a tree. There are so many ways to split the front and rear ends.Split by domain, split by team, and of course, these splits generally follow the organizational structure.

If not, upgrade technology and replace more efficient or suitable technology. For example, change from Oracle to HBase. From the A database connection pool to the B database connection pool. Technological change is also a tremendous support for business volume, the same machine with different technologies, efficiencyThe degree of play can be said to be very different.

The last resort is to think about distributed architecture, and there’s really no way to spend that much money. Because the distributed architecture will certainly bring a lot of consistency problems, originally only need to access a machine, now need to access N, then how to ensure the consistency of N machines, toEven if the master-slave backup is finished, just synchronize the data regularly. Now how to manage the data of N devices, and even how to manage the cluster itself, will become a fatal problem.

So only when the volume of business has reached a certain level, a single machine can not carry it, will start to pile up money to upgrade the machine, system splitting, technology change, continue to pile up money to upgrade the machine, system splitting.. From time to time, found that the cost is too high or technology has reached the line. Finally, we have no choice but to choose a distributed architecture.

But the advantages of distributed architecture are also obvious, with a group of inexpensive devices to provide a high-performance, high throughput and stable system, the following begins with the common distributed cluster architecture.

1、Pure load balancing.

In front of a cluster, a component that distributes traffic is preceded by a component that distributes traffic, and the machines in the cluster provide undifferentiated services, which is most common in common web servers. At present, the mainstream approach is the cloud on the entire cluster machine, scaling the cloud server elasticity according to real-time scheduling.Common load balancing includes hardware level F5, software level nginx and so on.

2、Leading election type

The message of the whole cluster will be forwarded to the leader of the cluster. It is a master-slavers. The difference is that the master is temporarily elected. Once the Master goes down, the cluster will immediately elect a new leader to continue serving the outside world.The typical application of the leader election structure is ElasticSearch, zookeeper.

3、Block chain type

Every node in the entire cluster can be logged, but the content of the record is legitimate only if it is recognized by the entire cluster of N machines. Typical applications include Bit Coin and Hyperledger.

4、master-slavertype

The whole cluster takes a master as the backbone and carries out cluster scheduling. Interaction is like this, typically putting all the management types of data on the master, and the specific data on the slaver, when actually invoked, the client calls m firstAster gets the information of the server stored in the data and then interacts with the slave itself. The typical system has Hadoop. Cluster, HBase cluster, Redis cluster and so on.

5、Regular consistency Hash

This architecture type usually appears in the design of the database partition table. According to the rules, the database is divided into tables, and the rules engine is used to confirm the library and tables before the query, and then the specific application is accessed. Why do we need consistency Hash? In fact, you can use anything, just for this type of application.Consistency Hash is more common.

All right, so far, I’ve finished with most of the distributed clustering routines I know, and summarized them.

1、Upgrading machine configuration is the most direct way to upgrade. No use for distribution.

2、The core of distributed is business splitting and traffic distribution.

Link of this Article: Distributed architecture

Leave a Reply

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