What is micro-services? Micro Services SpringCloud entry frame (a)! !

Recently the traditional sense of java development projects have been done bottlenecks, in addition to in-depth understanding of the source code, while he himself was slowly toward the development of micro-services here, but the first contact with the micro-services, not understand the concept of how the inside, so write posts record about the concept of micro-services? Micro service in the end is what?

First we look at Martin - Fowler a description of Mr. micro-service architecture proposed:

Micro Services is an architectural pattern, and this architecture model to meet the most basic requirements of five.

(1) micro service is a combination of a series of small services.

(2) Service may be separate micro to run.

(3) micro-services business model to be around to do the construction.

(4) any micro-services requires a separate deployment.

(5) avoided a unified, centralized service management system (decentralized management).

 

Let us look at the evolution of software projects.

Initially, All in One (stand-alone system), we can understand, a large complete project, is placed eclipse / idea, in general, traditional industries have adopted this way, all the functions of a business project have been packaged into a war package, a project to solve everything, but once a link error, all the problems are likely affected.

Subsequently, the distributed system came into being, each module / services, each separated, each forming a tiny process, so that each professional people to pay attention to what each module, independent deployment, this time he solved a big solve all the problems of the war package, which module the problem does not affect other modules, here completed a qualitative change in the architecture of the software.

Now, with further improve the technology of distributed systems in order to degrade to the lowest degree of coupling, to each module / business classified as a separate service, each service has its own database, providing a single service, can separate boot and destruction, through external configuration, both of these services, along with a library, but also has its own library, thus ensuring robust operation of this huge project, in this form, which is now in the form of micro-services even a large project may have hundreds of micro-services.

 

After reading the evolution, then we look at the advantages of micro-services:

Each service # cohesive enough, small enough, each code easier to focus.

# A small team to develop, develop simple and efficient.

# Micro-services are loosely coupled, there is a functional significance of service, development and deployment are independent.

# Micro-services may use different language to develop.

# Micro-services and third-party integration easy, and flexible way to allow easy integration of automatic deployment.

# Micro service business logic code only, and not HTML, CSS mixing or other interface components (particularly friendly separated front and rear ends).

# Each service has its own micro-storage capacity, can have its own database, you can also use a unified database.

Having the advantage, then surely it also has its own shortcomings:

# Distributed system complexity is extremely high, it is difficult to understand.

# Multi-service operation and maintenance difficult, high operation and maintenance costs (lost a war as long as the original package, now you might want to deploy tens of hundreds of services, and to monitor the status of each service).

# System Deployment relies cumbersome.

# High communication cost system.

# Strict data consistency requirements.

Of course, there can be no perfect architecture, like the coin always has two sides, but overall, it's really much higher than its advantages and disadvantages, so the technology architecture selection growing number of large projects have gradually toward micro services near.

 

These concepts are finished, come talk about the problem of our technology stack programmers are most concerned about, then a micro-service architecture need those dimensions it?

Service Development: SpringBoot, Spring, SpringMVC

Configuration and management services: Ali Diamond, Netflix and other companies Archaius

Service registration and discovery: Eureka, Consul, Zookeeper, etc.

Service call: Rest, RPC, gRPC

Fuse services: Hystrix, Envoy, etc.

Load balancing: Ribbon, Nginx, etc.

Interface call services: Feign etc.

Message queue: KafKa, RabbitMQ, ActiveMQ etc.

Service center configuration management: SpringCloudConfig, Chef, etc.

Service Routing (API Gateway): Zuul, etc.

Service Monitoring: Zabbix, Nagios, Metrics, Spectator, etc.

Full Link Trace: ZipKin, Brave, Dapper, etc.

Service deployment: Docker, OpenStack, Kubernetes etc.

Data Flow Development Kit: SpringCloud Stream

Event message bus: SpringCloud Bus

 

With these technology stack, then we need to choose a micro-services framework, and here is the reason I choose SpringCloud (personal favorite Sprng ah!), Well, that the next serious point:

(1) First Spring of social activity, for example, selected as a tomcat server, the Internet has a variety of solutions, but you can choose another glass fish Apache it almost could not find any posts to deal with the problem.

(2) we look at the big bat company with a micro-service architecture, Ali Dubbo / HSF (very comfortable), understood as the second generation of Dubbo, Jingdong JSF (Beijing comfortable), Sina microblogging Motan, Dangdang DubboX . Here, the information from the various communities understand, I feel it only after Dubbo to both Cloud and Enter the Dragon, and in view of the tendency of the Spring, I hesitate to start a Cloud of learning, but also the best available Learn at Dubbo, after all, horse dad ah.

Here on what I learned several comparative framework.

NetFlix / Spring Cloud: the complete micro-services framework; support Rest (only supported), Ribbon support a variety of pluggable serialization choice; does not support RPC; support for multiple languages

Motan: RPC framework, but integrated Zookeeper and Consul, to achieve the basic registration and discovery (and others coupling) cluster environment; does not support Rest; support RPC; does not support multiple languages

gRPC (Google RPC): RPC framework; does not support Rest; support RPC; support for multiple languages

Thrift: RPC framework; does not support Rest; support RPC; support for multiple languages

Dubbo / DubboX: service framework; does not support Rest; support RPC; does not support multiple languages

In fact, there are some, I am comprehensive look at major contrast in cloud and dubbo, but dubbo sleep for five years (it circles should all know it, dubbo community has not maintained), so the feeling is still relatively reliable Cloud.

Well, then come on? Getting started our micro-service bar, never failing to enter the official website, go from first spring.io. Let's see what SpringCloud Yes.

~~~~~~~~~~~~~~~~~~~~~~~~~ official website reading ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~

 

Published 27 original articles · won praise 1 · views 3653

Guess you like

Origin blog.csdn.net/qq_40111437/article/details/87936500