Why should split into a distributed system, why use Dubbo?

Read this article takes about 6 minutes.

Author: yanglbme

1, face questions

Why the system to split? How to split the system? After the split dubbo can not do?

2, the interviewer heart analysis

From the beginning of this issue were part of a distributed system, many students give me feedback that out now distributed as a standard, no company does not ask you distributed thing.

If you do not stuff distributed, it simply can not resume watching, no one will let you go to the interview.

In fact, why is this so?

This is because of the overall development of large technology industry.

In earlier years, I have the impression at the beginning of 2010, the entire IT industry, few people talk about distributed, let alone micro-services.

Although many large companies such as BAT, because of the complexity of the system, a distributed architecture is very early, a lot of service, but the service is mostly based on a micro-frame their practice to achieve it.

But really, that time, we attach great importance to ssh2, many small and medium companies mostly play almost struts2, spring, hibernate, a little later, before entering the combination spring mvc, spring, mybatis of.

At that time the technical level of the industry is that, when the oracle is fire, very popular administrator oracle, oracle IT performance optimization What are the big men Sha Zhao ah.

Big Data nobody even mention, when OCP, OCM certification training institutions, not fire.

But really with the times, slowly, many companies began to accept the distributed system architecture, which is particularly critical to have an impact on the industry, is Ali's dubbo, to some extent, the pushing Ali here advancement of the technology industry.

It is because of Ali's dubbo, many small and medium companies can only be based on dubbo, to split the system into many of the service, each person is responsible for a service, you do not have code conflict, the service can be autonomous, they choose what technology can .

If it changes every time you publish a service would be a good service on the line, do not all of the FBI together, each release are hundreds of thousands of lines of code, or even hundreds of millions of lines of code.

Even today, I am very pleased to see the interview distributed systems to industry standard, and any ordinary programmers are the master of this thing, in fact, this is the industry's progress, but also the technical progress of all IT yard farmers.

So now distributed to all standard, then of course the interviewer will ask, because many companies are now distributed micro-architecture services, of course, have investigated the interviewer that you visit.

3 Tips

If a classmate to see here, I day, I do not know what is a distributed system? I do not know what is dubbo?

Then you quickly Baidu ah, I found a dubbo entry, go inside to experience.

Distributed systems, I sentence you to explain, is the original 20 million lines of code in the system, now split into 20 small systems, each small system 1 million lines of code.

It is based on the original code directly between the spring call, now split open, the small system 20 deployed on different machines, do have a basis dubbo rpc call, and in response to requests by network communication between the interface and the interface.

On this meaning.

4, face questions Analysis

(1) Why do you want to split the system?

Look up online, the answer is extremely fragmented and complex, it is trivial, because a big lump. But I am here to give you an intuitive feel:

1) if it does not split a large system hundreds of thousands of lines of code, 20 maintain a personal code is simply a tragedy ah.

Code is often a change to change the conflict, and merge the various code violations to be processed, a very time-consuming;

I often change my code, you call me, cause you have to re-test code, troublesome to death;

Then each release systems are hundreds of thousands of lines of code released together, together everyone was on tenterhooks ready on-line, on-line hundreds of thousands of lines of code, you may have to do a lot on the line every inspection, much of the processing is abnormal, is simply and cumbersome and painful;

And if I'm going to upgrade technology to the latest version of the spring, is not enough, as this may result in your code being given, I dare not make change technology.

Suppose a system is 200,000 lines of code, in which A small change inside the 1000 lines of code, but when released at this time is that this large-scale systems 200,000 lines of code together release.

It means that the line of code on a variety of possible changes on 200 000, 20 people, everyone nervously in front of a computer, etc., after on-line, check the log to see that they are responsible together there is no problem.

A small checks for 1 million lines of code responsible for their own corresponding functions to ensure ok flash people;

Unfortunately a result, when a small line A accidentally modify a configuration line of the machine, results in an additional feature of some 20,000 lines of code and small small B C responsible corresponding wrong.

Dozens of people responsible for maintaining the application of a single block of hundreds of thousands of lines of code, every time on-line, ready for several weeks, on-line -> Deployment -> Check responsible for their own functions.

Recently from 2013 to now, 5 years time, by 2013, basically the world of BAT;

2013, there are several small giant started its rapid development, the market, tens of billions of dollars, tens of billions of dollars are valued;

By 2015, there was in addition to BAT, there are a few small Internet industry giants appear.

There are certain little giant, now the valuation of tens of billions of dollars in small giant, started out five years ago when the core of the business, dozens of people, maintain the application of a single block

Maintenance applications single block, in part 0-1 from the inside, is very appropriate, because at that time, is no on-line system, no technical challenge, we developed methodically.

ssh + mysql + tomcat, might deploy several machines now.

Result to die, then the line on the system, the rapid development of business, 100,000 users -> 1 million users -> 10 million users -> millions of users.

2) After the split, the whole world fresh, the system hundreds of thousands of lines of code, split into 20 service, each service on average 1 to 2 million lines of code, each service deployed on separate machines.

20 projects, 20 of git warehouse, 20 yards farmers, everyone maintains its own service that it is its own separate code, it does not matter with others.

No code violations, and cool.

Every time you test my own code on it, cool.

Every time you release a little of my own service on it, cool.

Technically thinking about how to upgrade on how to upgrade and maintain the same interface on it, cool.

So simply, stating, if the amount of code that is hundreds of thousands of lines of large-scale projects, there are dozens of teams, so if you do not split system, development efficiency is extremely low, a lot of problems.

But after the split system, each person is responsible for a small portion of their own just fine, you can easily play casual get.

After the split distributed systems, can greatly enhance the efficiency of the development team of complex large-scale systems.

However, it must also be reminded that, after splitting the system into a distributed system, the problem faced by a large number of distributed systems is also coming up, so the problems are in the back of the complex technical challenges around distributed systems in Say.

(2) how the system splits?

This problem could have said a lot, you can wander up the domain-driven design model, say a little small, I do not want to give you too academic argument, because you can not answer back, passed directly speak .

Or is it simply, when we all know how to answer on the line.

Distributed system split system, split into multiple services, split into micro-architecture services, demolition of many wheels.

He gave up a first-round demolition of architect Well, the first round;

Team continues to expand, the demolition of a good service, the beginning is one person to maintain 1 million lines of code, then more and more complex business systems, this service is 100,000 lines of code, 5 people;

The second round, a service -> 5 services, each 20,000 lines of code, each responsible for a service.

If it is more than a maintenance service, <= 3 individuals maintain this service;

Ideally, dozens of people, one person responsible for one or two to three services;

A service job becomes larger, the amount of code more and more, a classmate, in charge of a service, the code amount of 100,000 has become the line, he overwhelmed himself, he is now a man apart, five services, 1 personal wore, responsible for five people, then recruit people, two individuals, students took to the three individuals responsible for five services, two individuals each person is responsible for two services, one person is responsible for a service.

I personally recommend, a service code is not too much, about 1 million lines, two or three million Chengsi it!

Most of the system is to carry out multiple rounds of split, the first split, probably more than the previous modules that will split open up, such as the electricity supplier system to split the order system, merchandise system, procurement systems, storage systems, system users, and so on it.

But behind each system and may become more complex, such as the procurement system which is divided into a supplier management system, purchase order management systems, order systems and split into shopping cart system, the price system, order management system .

Pull a really deep deep, so here give you an example, you feel, is the core meaning according to the situation, split the first round, followed by more complex if the system can continue to spin. According to an example you responsible for your own system, to consider just fine.

(3) After the split dubbo you can not do?

Yes, of course, a big deal most times, that is, between the various systems, based directly on spring mvc, interface to communicate with each other on the plain http.

But this is definitely a problem, because the http interface communication costly to maintain them, you have to consider a variety of messy problems timeout retry, load balancing and so on.

For example, the system calls your order merchandise systems, merchandise systems deployed five machines, how do you put a uniform training and preparation that request 5 machines? Is not that load balancing? If you do it all yourself is possible, but really very painful.

So dubbo plainly, it is a rpc framework, is the local interface is invoked.

But dubbo will delegate the call request with the remote communications network machine, you dispose of load balancing, and the service instance offline auto-sensing, and retry timeouts, and so on messy problem.

Then you do not have to do with dubbo it.


Original link:

https://github.com/doocs/advanced-java/blob/master/docs/distributed-system/why-dubbo.md



·END·

Programmers growth path

Although the road is far, certainly the line to

This paper originating in the "road programmer growth of" micro-channel public number of the same name, reply "1024" you know, give a praise chant.

Reply [520] receive the best programmers learning

Reply to [256] View Java programmers growth plan


Past wonderful review


Reproduced in: https: //juejin.im/post/5cff0f31f265da1bb67a0e56

Guess you like

Origin blog.csdn.net/weixin_34375233/article/details/91416143