preface

The single architecture is common in small or medium services. The scenario mode is a single application and a single database. A single package (such as A WAR or Jar format) that contains all the functionality required by the business is a more traditional architectural style. This article will take a theoretical and hands-on look at microservices architecture.

1. Monomer architecture

  1. The complexity is high, the whole project contains many modules, the dependency is vague, and the modification program is easy to trigger unknown problems.
  2. The expansion capability is limited. Single applications can only be expanded as a whole, but cannot be scaled based on the features of service modules.
  3. Poor stability, any minor problem, can lead to the entire application service directly down.

Second, micro-service architecture

Microservice architecture is an architectural concept. The core idea is to decouple the whole service by decomsolving service functions and requirements into different services for management. Application services are created around business patterns and can be independently developed, iterated, and deployed. Make the architecture of the project clearer.

Advantages and disadvantages of micro services

  1. A single service corresponds to a single business function, which is easy to understand, develop and maintain;
  2. Independent deployment of services, according to the number of requests for each service can be deployed to meet the needs of the scale;
  3. Database, services, architecture, business separation and other difficulties, high requirements for technical capabilities;

Iii. Project Introduction

Core content of microservice architecture case, based on several core components of SpringCloud framework, Eureka service registration and discovery component, Feign declarative WebService client component, Zuul dynamic routing gateway component. Conduct multiple data management, multiple service management construction, multiple middleware integration, multi-business separation and other modes, and build comprehensive application cases of SpringCloud micro-service framework.

The core module

  1. Business separation architecture design
  2. Integration of multiple middleware services
  3. Code block management under microservices
  4. Multiple MySQL data source management

Four, technology selection

1. Core framework components

  1. Base layer frameworks: Spring5+, SpringBoot2+, SpringCloud2+
  2. Persistence layer framework: Mybatis, Mybatis – Plus
  3. Development components: Druid, Log4j, FastJson, JodaTime, JavaMail
  4. Middleware integration: RocketMQ, Redis, Quart, ElasticSearch
  5. Data stores: MySQL, Redis, ElasticSearch

2. Code hierarchy

5. Project architecture

1. Architecture diagram

2. Architecture description

Client interface services

  1. Client service interface;

  2. Management side service interface;

  3. Data entry service interface;

  4. Data analysis service interface

Generic Service Interface

  1. RocketMQ message queue service;

  2. ElasticSearch search service;

  3. Quart timer service;

  4. Redis cache service;

  5. Basic services: Token authentication service;

  6. Basic services: MsgBox message center service;

Micro servicecomponent

  1. Routing gateway: Zuul component;

  2. Service registration and discovery: Eureka component;

  3. Interservice invocation component: Feign component;

Data storage container

MySQL, Redis, ElasticSearch

The last

Xiaobian today to share the study notes here is the end, welcome everyone to communicate, like the article remember to pay attention to me like yo!