In-depth understanding of SOA

 What is SOA? SOA is Service-Oriented Architecture in English, which means service-oriented programming in Chinese. It is an idea, a methodology, and a distributed service architecture (specifically, Baidu).

     Purpose: SOA solves the multi-service messy problem, SOA architecture solves the complexity of data services, and SOA has another name, called service governance.

     Through a system, let's take a look at the evolution of the architecture (from unified to distributed):

   

        When our project was relatively small, we only had one system, and we wrote them together and put them on a server, but as the platform became larger and the amount of data became larger and larger, we had to divide the database and put more The database of each module is placed on the corresponding server, and each module can call its own subsystem.

     

     With the prompt of the further complexity of our system, we have to further improve the performance of the system. We divide multiple modules into multiple subsystems, and multiple subsystems directly call each other (because SOA is generally used in large-scale projects, it is more complex, Therefore, the general system will not be integrated again, and will be split into multiple ones, which will be made into services and call each other). When our e-commerce UI performs a task of placing an order, multiple services directly call each other, and the system can call the corresponding subsystems respectively through the data bus.

     Enterprise data bus: The enterprise data bus is not an integration of multiple sub-modules. It acts as a data channel here. The data bus does not care about the business. The data bus adjusts the service according to the given address and protocol, and the upper end does not care what the service is. , looking only for the data bus.

     The above figures should be relatively clear. With the deepening of the business, we have to adjust the system, which is the splitting of data and business, and finally each subsystem provides services on the opposite side.

     Another point to mention is the figure below. The IP library and several subsystems below are public services, which provide functions respectively, and are also part of the SOA methodology.

2. The main usage scenarios of SOA are as follows:

   

From the above figure, we can see that multiple subsystems directly interact with each other, and the calls to each other are very messy, so we are very uncomfortable, so we use our SOA architecture, SOA is also called service governance, SOA is to help us organize services The messy relationship between calls is managed, and then a unified standard is provided to manage our services as shown in the figure below. In the past, our services interacted with each other, but now we only interact with the data bus, so that the system becomes unify.

Unified standards: protocols, addresses, and interaction methods of each system.

New interactive mode: each system registers with the data bus according to the unified standard. When each subsystem calls other subsystems, we do not care if other subsystems are found. We only recruit the data bus, and the data bus will find other subsystems according to the unified standard. subsystem, so the data bus acts as a passer-by here.

Benefits of SOA:

  1. To reduce user costs, users do not need to care about the language between each service, and they do not need to know if they are called, as long as they find the data bus through a unified standard.

 2. The relationship service between programs is simple

 3. Identify which programs have problems (hang up)

Disadvantage: prompts the complexity of the system, and the performance has a corresponding impact.

3. What is the data bus?

      In fact, I wrote above that the data bus plays the role of a scheduling service. The data bus is not an integrated service. The data bus updates a scheduling framework. Each service needs to register a service with the data bus according to the agreement, so how to register that? In fact, the data bus is like a dictionary structure,

      A key in the data bus corresponds to a value, the key refers to the service name, and the value is the scheduling method of the service. Another point to note is that the data bus is only a guide, and the service does not pass through the data bus, as shown in the yellow picture above. line path.

     The data bus is implemented through domain name resolution: a domain name is bound to multiple servers, ajax can also, dns can also be used to resolve domain names.

     In fact, the data bus also has some advanced applications, such as heartbeat detection, load balancing, etc., so I won't go into details. At present, Ali's dubbo and zookeeper are used for the data bus.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326688372&siteId=291194637