Concrete understanding Dubbo

Original: giant fish, code-named director of the giant fish April 29

Role model category dubbo relationship with the hotel, easy to understand explanation of dubbo: This article core

Estimated reading time: 10 minutes

Address reprint: https://www.jianshu.com/p/c8754f861d74

 

    dubbo management framework is applied between the modules scenarios in a distributed architecture will use the internal (service layer) of the calling process. Around this sentence, so we will extract a few key vocabulary:

Distributed Architecture 

Internal module calls 

  3. Process Management

    Now, we will set up a restaurant with background model, maps for more than three semantics. To help us understand the role of dubbo. We will go step by step, analyzing mapped dubbo background to this process, so that readers can learn the process of abstraction to figurative. Note that, in this process, the author does not necessarily always able to find a suitable to describe these abstract figurative, so deficiencies or place barely worth, you need to carefully understand and bear with me readers whichever positive solution.

    We give the hotel a name, called dubbo Hotel, then has a name, we have to take it seriously, quack.

Distributed Architecture

___________________

    Next, we will first get a distributed architecture this critical vocabulary mappings. The so-called distributed, is to complete a service, split into individual modules, each independently of each other and transferred between the various modules (dependent) to implement a complete service. Then we follow this idea to tidy up the hotel, making it a distributed architecture.

    First, on the whole, the hotel's function for us is to "eat." Originally we, as customers do not care about the food they eat is who did it, who eat the rice is cooked, garnish who buy, who to buy rice and so on. However, because we want to become distributed functional hotel, so we need to be concerned about the internal details, and we need to extract a few major "modules" to build our "distributed architecture."

Extraction "module" as follows:

1. a serving staff (Zack), the waiter responsible thing is: to provide customers with recipes, convey a la carte orders to the chef, these two core work. (Reception system)

2. The four chefs, two cooks only Western, only two other cooks Chinese food, they have the ability to develop new dishes to the menu update. (Data processing, business logic, in pairs similar clusters)

3. A will be updated daily recipes, cookbook includes Western and Chinese recipes (search system)

4. A warehouse staff, responsible for providing food to cook, and procurement of food ingredients. (Back office)

    This view above 4 "function modules", enough to support a hotel operator, other details please do not be too tangled.

    Now, Grand Hotel has been our distributed a. A person of this "distributed" Grand Hotel has far more street vendors and snack points as a waiter and a cook and when procurement is much better, because the number of large hotel guests can handle the needs of all kinds much more .

    These are the distributed architecture of the hotel.

 

Thinking time:

    About distributed, the author's idea is similar to the bottleneck station decomposition, on the one hand untied the dependent execution order to shorten the product cycle to some extent, on the other hand reduces the intensity of the work's original operator station, of course, work decomposition and increase the bit cost is contradictory problems, similar to the increase in costs caused by the server. On this issue, you can write an article for a good talk, of course, if an experienced friend can be discussed.

Internal module calls

___________________

    Then, we come to realize keyword mapping "module, called internally" in. Let's look at the relationship between the "distributed architecture" of the Grand Hotel where the "modules":

1. attendants get recipes according to customer tastes. With the development of language, access to services is to call the menu menu interface into the reference is to the customer's tastes, the menu interface, the return value is the recipe (Chinese or Western food recipes recipes).

2. Contact waiters and cooks, let cook the dishes to make it. With the development of language, is to call the waiter chef cooking interfaces, the reference point is the name of the dish customers, the chef of this interface return value is to do the dishes.

3. Cook in touch with the Treasury, is responsible for providing food to cook. With the development of language, the chef is to provide an interface to call the Treasury ingredients, into the reference is the raw material inventory, warehouse interfaces return value is the need for raw ingredients.

4. Cook the development of new dishes added to the menu to go. With the development of language, the name of the dish is the chef calls to increase the interface recipes, the parameter is the name of the new cuisine developed, no return value (can give the chef a raise, huh).

This view of the relationship above, can be seen calling the relationship between each module.

This is the internal module call.

 

Thinking time:

    About expansion module, a distributed scenario, we can easily Expansion Module (business). Why do you say? For example the hotel, we have a demand, and now need to add a barbecue module. If you are in a scene where a single service, for example, roadside stalls, this boss will need to learn how to grill, barbecue equipment purchase, if you start selling barbecue, and also need to consider the original business (selling clutch cake) of balance between, the middle of the process, with the development of language, is the need to add new features in the original business code, and also need to consider the relationship between the original code, so the code is bound to cause confusion, long development cycle, not business stability and so on.

    In a distributed architecture, we just need to add a barbecue system, similar to adding a barbecue chef do it basically to quickly iterated business functions.

 

Process Management

___________________

    Then again, we take a look at the last Keywords: process management. This process is dubbo management functions, and we said earlier, the two key words, all about the application, the application itself has nothing to do with dubbo content.

    So why do we need to process management? With the front of the module is called internally distributed architecture of a large hotel figurative map, we can start from the hotel, to consider this issue.

    We also need to know that the hotel management, these management into every detail of the hotel, such as staff attendance, monitoring work attitude, everyday work adjustment and so on. Then I will talk about these three angles, dubbo did what.

    We finally resorted to such a map (duboode registry register, supervision center monitor, consumer provider, service provider model diagram consumer)

 

 

    Contrast how to understand it? (Note: The following scenarios can only compare to some extent, help the reader understand dubbo, comprehensive features, please refer to the official manual)

1. "registry" VS work attendance sheet

    Let's take a look at attendance management rules Hotel: The people need to work punch, normal people who work in the day time sheets in there, but this time sheets for all employees are visible.

    Let's assume a scenario, one day one of the chefs to do Chinese food does not leave to go to work, then the waiter from the attendance list on the same day informed of the situation, and then look for the next waiter cook Chinese dishes do when he that did not come to work will not go to cook, but to find another cook. You see, with this attendance sheet, we find that avoiding the waiter leave without looking chef who otherwise have to throw an exception (the cook had disappeared) to it.

 

    In dubbo, the principle is similar, all modules registered in the registry own message, of course, these modules need to meet the identity of the relationship between consumers and service providers (the requesting party [consumer] services and interfaces [side] callee ). In this way, consumers can find online service providers with the help of dubbo avoid abnormal circumstances call interface (timeout) occurs.

     

2. "Monitoring Center" VS monitoring and adjusting work

    Let's assume a scenario where two Chinese cooks in chef B is new, the waiter small check not trust his cooking level, so always looking for cooks A cook, cooks A busy results, affecting the serving efficiency, chef B is very busy, large restaurant owner discovered this situation, criticized the small check, so he should be balanced with the allocation cooking, serving not affect efficiency.

    Then, a large hotel business is getting better and better, a constant stream of diners, especially Chinese food point the guests, waiters and chefs constantly to tone down menu dishes, although the chef A and B cooks are busy, but still too late to serve , resulting in the loss of the guests, a large restaurant owner in time to observe the situation, then immediately recruiting a Chinese chef, serving the speed guaranteed.

    At the same time, by calling the boss of the menu system, we found that customers like to eat is Huaiyang, so the boss and timely adjusted its strategy, select the recruitment of Huaiyang cuisine chef is the chef, thus reducing the chef A response to a variety of dishes complexity, so that each focus on a single cuisine chef, cook faster and better eating.

     

    In dubbo, the reason is similar. Monitoring center monitors, consumers can call to record the state of the service providers (frequency and duration), we can use the service load, to adjust the deployment of server clusters, while it uses load balancing algorithm, a reasonable allocation of customers request, we also service providers can manually assign weights to achieve abler.

      The above is a dubbo process management figurative, dubbo is similar management role restaurant owner, which is responsible for the internal management of the entire distributed application system call interface, the interface can call the adaptation of internal network applications to developers It provides tools relationship between the management and supervision of modules to help developers debug and joint decision-making and improve the performance of the entire application.

     

    Article to end here, I hope readers can help this article easy to understand the role of dubbo. Back to our said at the beginning, I hope that in the analysis mapping dubbo model relationship with the hotel, the reader can learn the process of abstraction to figurative. What about dubbo other features, the intelligent reader will be able to find a suitable concrete to explain. Because I believe that, from abstract figurative, logic technology and life scenes homology.

Guess you like

Origin www.cnblogs.com/create-and-orange/p/11027855.html