In-depth understanding SpringCloud and micro-services building (Reading Thoughts) (a)


Recently I read the "in-depth understanding SpringCloud and micro-services building," the book because there is the habit of taking notes, so I want to send a finishing feelings under, but the writing is rather poor, only when the note read. Now the first chapter

Introduction of traditional monolithic architecture

Opening the traditional monolithic architecture for a simple description:
single architecture
configuration 1.nginx client domain outer inlet coming in, a whole module operation.

Earlier concurrent optimization:
1. The server load balancing (the Nginx)
2. Add the application server cluster configuration polymorphism (s architecture monomer)
3. Cache server cluster (the Redis cache)
read 4. MySQL database separate from the main heat by configuring the backup data in the primary database server is synchronized to the server from the database, can improve the load capacity separate read and write database

Cons:
1. The single architecture a lot of business code, readable, maintainable bank remains poor.
2. mass users, database access bottleneck. (Solution: distributed database, the database sub-library sub-table, the current understanding of the business is the need refinement, precision single module business scenarios, creation and operation of the table)

What micro service?

Micro services: short, micro-services architecture style single program is to be developed into a micro-services, each micro service runs in its own process, and the use of lightweight communication mechanism, usually HTTP RESTFUL API. To divide built around the operational capacity of those services, and by automating the deployment of an independent mechanism to deploy. These services may use different programming languages and different data storage technologies, in order to ensure a minimum of centralized management.
Several key points is:
1. by business a stand-alone program, a service unit
communication through HTTP protocol services to each other between 2.
3. Automated Deployment can
4. the service unit is not restricted programming language
5. There is no limit to the technical service data storage unit
6. The centralized management services
7. The micro system is a distributed service

How to divide the micro?

This is based on micro-business to divide. Complexity of the business, as well as the degree of detachable, developers and teams need to decide.

Communication between the service and the service: This can be a simple communication mechanism between the micro via HTTP service unit. It may communicate lightweight message bus by, for example: RabbitMQ, Kafaka MQ like, or by sending a message to hit the subscription message service between the communication destination and services.

Multi-module micro deployed automated deployment services considered (the DevOps), Docker containers techniques may be employed, or automated deployment tools source components Jenkins.

Centralized management service using spring-cloud Eureka components, in addition Zookeeper. Consul is a good centralized service management framework.

Micro service is a distributed architecture, its complexity than monolithic architecture more complex, should be noted that a distributed transaction, the global lock, global ID and so on.
For deployment services for micro-: Docker container technology, is the best micro-services deployment container, DevOps is a deployment tool or concept.

Three major problems currently being considered

The spread of service failure (in my opinion is to use fuses)
division services (business details, then split according to business)
distributed transaction (that is, to solve the consistency should be addressed data: Consider the two-phase commit protocol or tri phase commit);

New term : link tracking service. Cause a request comes into the process through a service unit, in response to the last operation in the multi-module, cause problems difficult to locate.
Common link tracking component has Google's Dapper, Twitter's Zipkin, and Ali Eagleeye (Hawkeye);

Spring Cloud Common Components

1, the message registration and discovery Eureka. Spring Cloud also supports Cunsul and ZooKeeper
2, the fuse assembly Hystrix
3, load balancing components Ribbon, and it is usually Eureka, zuul, RestTemplate, Fegin used in conjunction.
4, routing gateway Zuul. Ribbon together and be able to do with load balancing, intelligent routing.
5, Spring Cloud Config component configuration file unified management. Client-server side and divided. It is cooperating with the Spring Cloud Bus refresh all or specified Client Client configuration file.
6, Spring Cloud Security Spring Security component is encapsulation of the component. General assembly for use with Spring Security OAuth2 together to build authorization service, user authentication and certification authority. Token JWT to verify or secure authentication services for micro systems.
7, Spring Cloud Sleuth is a distributed link tracking component. Encapsulated Dapper, Zipkin and Kibana. Through which we can know the dependencies between services. And calling the situation.
8, Spring Cloud Stream packets are SpringCloud dataflow operations. It may be packaged Redis, RabbitMQ, Kafaka, sending and receiving messages.

Published an original article · won praise 2 · Views 163

Guess you like

Origin blog.csdn.net/weixin_38899094/article/details/103885778