[Daily 3 minutes technological Dry | face questions + answers | SpringCloud articles (a)]

1. What is the spring cloud?

spring cloud is an ordered collection of a series of frames. It uses facilitate the development of spring boot cleverly simplify the development of distributed systems infrastructure, such as service discovery registration, distribution center, message bus, load balancing, circuit breakers, monitoring and other data, can be made with the development of style spring boot and a key to start the deployment.

What is the role 2. spring cloud breaker is?

In a distributed architecture, the role of the circuit breaker mode is similar, when a service unit fails (with similar electrical short circuit), the fault monitoring circuit breaker (similar to a blown fuse), returns an error response to the caller rather than the long wait. This does not make the thread due to a fault call service is prolonged occupation does not release, to avoid the spread of a failure in a distributed system.

3. spring cloud core components of what?

  • Eureka: service registration in discovery.

  • Feign: Based on the dynamic proxy mechanism, based on notes and selected machine, stitching request url address, initiated the request.

  • Ribbon: load balancing, multiple machines from a service select one.

  • Hystrix: providing thread pooling, different services take a different thread pool to achieve the isolation of different service calls, to avoid the avalanche of service issues.

  • Zuul: gateway management by Zuul gateway forwards the request to the corresponding service.

4.SpringCloud和Dubbo

SpringCloud and Dubbo are now mainstream micro-service architecture
SpringCloud micro-service solutions under the Apache's Spring system
Dubbo is distributed service governance framework of Ali
from the technical dimension, in fact, far more than SpringCloud Dubbo, Dubbo itself is only implements service management, and SpringCloud and now has 21 sub-projects in the future will be more
so in fact, a lot of people will say that Dubbo and SpringCloud is not fair
but due to RPC and metadata registries and other reasons, the technology selection only when we one can choose between, so we often use to compare They
call Dubbo way services are using the RPC remote call, and SpringCloud using the Rest API, in fact, more in line with the official definition of micro-services
registry service point of view , Dubbo use a third-party registry ZooKeeper as its underlying implementation of the registration and discovery services, SpringCloud use Spring Cloud Netflix Eureka realization registry, of course SpringCloud ZooKeeper can also be used to achieve, but in general we do not do
service gateway, Dubbo did not realize itself only through other third-party Integration of surgery, and SpringCloud have Zuul routing gateway as a routing server, consumers request distribution, SpringCloud also supports the circuit breaker, the perfect integration of distributed version control and configuration file support git, update and implement the transaction bus service profile automatically assembly, and so a series of micro-services architecture elements

Technically speaking, the selection ~

At present selection system is mainly distributed domestically Dubbo, after all, and the high technical proficiency domestic engineer, and defects in Dubbo on other dimensions may be performed by other third-party integration framework to make up
and SpringCloud is now more popular abroad, of course, I think the domestic market will gradually bias SpringCloud, even Liu as head of Dubbo restart also published point of view, the development direction of Dubbo is actively adapt SpringCloud ecology, not conflict

Rest and RPC contrast

In fact, if carefully read the micro-service author Martin Fowler's paper, then you can find the communication mechanism between service definition is Http Rest
main flaw is that RPC calls between service providers and according to Lai Taijiang way, we need for each micro-service interface definition, and continued through inheritance released, the need for strict version control was a conflict between the service provider and the call because different versions produced does not appear
and is lightweight REST interface, provide services and do not call there is a coupling between code, but by a convention specification, but may also appear inconsistent interfaces and documentation services lead to integration problems, but that can be integrated swagger tools, code and documentation is one solution, so REST in a distributed environment under more flexible than RPC
which is why DubboX Dangdang adds support for REST of the reasons for the enhancement of Dubbo

Documentation quality and community activity

SpringCloud community activity is much higher than Dubbo, after all, due to the beam flying team led Dubbo stop updating iterations five years, while small and medium sized companies can not afford the cost of technology development leads to severe depression Dubbo community, and SpringCloud meteoric rise, and quickly occupied the micro services market, backed by Spring mix of wind and water
Dubbo after many years of accumulated documents is quite mature, for each micro-architecture system service company also has a stable status quo

5.SpringBoot和SpringCloud

SpringBoot is introduced to solve the traditional Spring Framework configuration file redundancy, the assembly of components of complex Maven-based solution designed to quickly build a single micro-service
and focus on solving SpringCloud coordination between the various micro and configuration service, between service communication, fuse, load balancing
technology and the same dimensions, and SpringCloud is dependent on SpringBoot, and is not dependent on the SpringCloud SpringBoot, can even be good integrated development and Dubbo

to sum up:

  • SpringBoot focus on quick and easy development of a single individual micro-services

  • SpringCloud is finishing governance framework for the coordination of global concern micro-services, integration and management of all micro-services, between each micro service delivery, configuration management, service discovery, circuit breakers, routing, event bus and other integrated services

  • SpringBoot does not depend on SpringCloud, SpringCloud dependent on SpringBoot, belonging to the dependencies

  • SpringBoot focus on quick and easy development of a single micro-serving individuals, SpringCloud attention to service global governance framework

ZooKeeper 6.Eureka function and can provide service registry and discovery, please talk about the difference between the two

1.ZooKeeper ensure that CP, Eureka ensure that AP

ZooKeeper registration services paralyzed during the elections, although the service will eventually recover, but unavailable during elections

Eureka each node is equal relationship, as long as there is a Eureka can ensure services are available, and query the data is not the latest

Self-protection mechanism will lead to

Eureka no longer be removed for a long time and should not receive a heartbeat expired registration service from the list

Eureka is still able to accept registration and query requests for new services, but will not be synchronized to the other node (HA)

When the network is stable, the current instance of the new registration information will be synchronized to other nodes (eventual consistency)

Eureka can be a very good response due to network failure caused the loss of some nodes on the contact, but not the same as making the whole registration system ZooKeeper paralysis

2.ZooKeeper There Leader and Follower role, Eureka each node equality

3.ZooKeeper adopt the principle of majority survive, Eureka adopt self-protection mechanism to resolve zoning issues

4.Eureka is the essence of a project, but rather a process ZooKeeper

7. Micro service between how independent communications

1. Remote Procedure Call (Remote Procedure Invocation):

That is, we often say that registration and discovery services

Direct calls to access the service through other remote procedure.

advantage:

Simple, common, because there is no middleware agent, a simpler system

Disadvantages:

Only supports the request / response model, does not support the other, such notice, request / asynchronous response, publish / subscribe, publish / asynchronous response

Reduces the availability of, because the client and server must both be available during the request

2. Message:

Use asynchronous message communication between services do. Exchanging messages between the message service pipe, so that the communication.

advantage:

The client and server decoupling, more loosely coupled

Improve the availability, because the messaging middleware caches message until the consumer can consume

Supports many communication mechanisms such notice, request / asynchronous response, publish / subscribe, publish / asynchronous response

Disadvantages:

There are additional complexities messaging middleware

8. What is the service fuse? What is service degradation

In complex distributed systems, between the micro-services call each other, there may be a variety of causes obstruction services, under high concurrency scenarios, blocking means blocking thread services, leading to the current thread unavailable , blocking all threaded server, causing the server to crash, because the relationship between service calls are synchronized, the whole micro-service system will cause an avalanche service

To address call a micro-service response time is too long or is not available then take up more and more system resources causing an avalanche effect on the need for services fusing and service degradation process.

The so-called service fuse refers to a service failure or abnormal world with a similar display in the "fuse" when an exception condition is triggered directly fuse the entire service, not been waiting for this service timeout.

Services blown fuse is equivalent to our gates, once the avalanche service, it will fuse the entire service, by maintaining its own thread pool, when the thread reaches the threshold of service degradation is initiated, if other requests continue to access the direct return fallback defaults

9. What are the advantages and disadvantages of micro services are? You say the pit encountered in project development

advantage

  • Each service sufficiently cohesive, readily be understood that the code

  • Improve development efficiency, a service only one thing

  • Micro-service small team can be developed separately

  • Micro services are loosely coupled, there is a functional significance of service

  • Can be developed in different languages, interface-oriented programming

  • Easy integration with third-party

  • Micro service is just the business logic code, and not HTML, CSS or other interface combinations

Development, two development modes
front and rear ends isolated
full stack Engineer

  • With the flexibility, public libraries connected / connecting separate library

Shortcoming

  • In charge of the distributed system

  • Multi-service operation and maintenance difficulty, with the increase in service, operation and maintenance of pressure also increased

  • System Deployment relies

  • Inter-service communication costs

  • Data consistency

  • System Integration Testing

  • Performance Monitoring

ZooKeeper 10.Eureka function and can provide service registry and discovery, please talk about the difference between the two

1.ZooKeeper ensure that CP, Eureka ensure that AP

ZooKeeper paralysis during the electoral registration service, although the service will eventually recover, but not used during the election
Eureka each node is equal relationship, as long as there is a Eureka can ensure services are available, and query the data is not the latest

Self-protection mechanism will lead to

Eureka no longer remove the service for a long time did not receive a heartbeat from the registration list should expire
Eureka still able to accept registration and query requests for new services, but will not be synchronized to the other node (HA)
when the network is stable, the current instance the new registration information will be synchronized to other nodes (eventual consistency)
Eureka can well cope with the situation due to network failure resulting in some nodes lost contact, but not the same as making the whole registration system ZooKeeper paralysis

2.ZooKeeper There Leader and Follower role, Eureka each node equal
3.ZooKeeper adopt the principle of majority survive, Eureka adopt self-protection mechanism to resolve zoning issues
on 4.Eureka is essentially a project, but rather a process ZooKeeper

Epilogue

Take these words to encourage each other, encourage each other now. The more work, the more luck if you are not the official second-generation, rich second-generation, second generation red, remember: hard work is the only shortcut to change your destiny.

Feel free to leave your opinions in the comments section to discuss improving together. If today's article gives you new inspiration, new understanding to enhance the learning ability, welcome to forward share to more people.

Welcome to our readers to join programmer ** knowledge dock ** technology group , replies "No background in public plus group " can be.

![](data:image/svg+xml;utf8,<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="620" height="23"></svg>)

Guess you want to see

1. always ask interview jvm tuning in the end is going to do?

2. Programmers should have what kind of career planning? Worth thinking about!

3. Daily 3 minutes technological Dry | face questions + answers | jvm articles (a)

4. Daily 3 minutes technological Dry | face questions + answers | jvm articles (b)

5. Daily 3 minutes technological Dry | face questions + answers | Redis articles (a)

6. Daily 3 minutes technological Dry | face questions + answers | Mysql articles (a)

7. Daily 3 minutes technological Dry | face questions + answers | RabbitMQ articles (a)

8. Daily 3 minutes technological Dry | face questions + answers | Zookeeper articles (a)

9. Daily 3 minutes technological Dry | face questions + answers | Spring & SpringMVC articles (a)

10. Daily 3 minutes technological Dry | face questions + answers | SpringBoot articles (a)

Scan below "two-dimensional code", select "public concern No."

Technical articles every day the first time served!

[Daily 3 minutes technological Dry | face questions + answers | SpringCloud articles (a)]

Guess you like

Origin blog.51cto.com/14626895/2464301