From theory to actual combat, we will show you how to design the microservice architecture process hand in hand!

Preface

Monolithic architecture is more common in medium to small businesses, and the scenario mode is a single application and a single database. A package (such as war format or Jar format) contains all business requirements and functions. This is a relatively traditional architecture style. The editor will analyze the microservice architecture from theory to actual combat .

1. Monolithic architecture

  1. The complexity is high, the whole project contains many modules, the dependence is fuzzy, and the modification of the program can easily trigger unknowable problems.
  2. The expansion capability is limited, and a single application can only be expanded as a whole, and cannot be scaled according to the characteristics of business modules.
  3. Poor stability, any minor problems may cause the entire application service to hang directly.

Two, microservice architecture

Microservice architecture is an architectural concept. The core idea is to decouple the business as a whole by decomposing business functions and requirements into different services for management. Create application services around business models, and application services can be developed, iterated, and deployed independently. Make the structure of the project clearer.

Advantages and disadvantages of microservices

  1. A single service corresponds to a single business function, which is convenient for understanding, development and maintenance;
  2. Services are deployed independently, and can be deployed to meet the needs of the scale according to the request volume of each service;
  3. The difficulty of database, service, architecture, business splitting, etc. has increased, requiring higher technical capabilities;

3. Project introduction

The core content of the microservice architecture case is based on several core components of the SpringCloud framework, the Eureka service registration and discovery component, the Feign declarative WebService client component, and the Zuul dynamic routing gateway component. Perform multiple data management, multiple service management construction, multiple middleware integration, multiple business splitting and other modes to build a comprehensive application case of the SpringCloud microservice framework.

Core module

  1. Business split 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. Basic layer framework: Spring5+, SpringBoot2+, SpringCloud2+
  2. Persistent layer framework: mybatis, mybatis-plus
  3. Development components: Druid, Log4j, FastJson, JodaTime, JavaMail
  4. Middleware integration: RocketMQ, Redis, Quart, ElasticSearch
  5. Data storage: MySQL, Redis, ElasticSearch

2. Code hierarchy

From theory to actual combat, we will show you how to design the microservice architecture process hand in hand!

Five, project structure

1. Architecture diagram

From theory to actual combat, we will show you how to design the microservice architecture process hand in hand!

2. Architecture description

Client interface service

  1. User-side service interface;

  2. Management service interface;

  3. Data storage service interface;

  4. Data analysis service interface

General service interface

  1. RocketMQ message queue service;

  2. ElasticSearch search engine service;

  3. Quart timer service;

  4. Redis cache service;

  5. Basic business: Token authentication service;

  6. Basic business: MsgBox message center service;

Microservice components

  1. Routing gateway: Zuul component;

  2. Service registration and discovery: Eureka component;

  3. Calling components between services: Feign components;

Data storage container

MySQL、Redis、ElasticSearch

At last

This is the end of the study notes shared by the editor today. Welcome everyone to communicate together. If you like the article, remember to follow me and like it!

Guess you like

Origin blog.51cto.com/14994509/2666651