Mall-Learning Organize-Basic-Project Introduction and Distributed Concept (1)

Foreword:

The project is developed based on reverse engineering, adopts micro-service architecture, separates front and back ends, and uses various java technologies to implement functions.

1. Project introduction

1. Project background

1) E-commerce model
There are 5 common e-commerce models on the market, B2B, B2C, C2B, C2C, O2O;
1, B2B model
B2B (Business to Business), refers to the business relationship established between merchants. For example: Alibaba
2, B2C model
B2C (Business to Consumer), is that we often see suppliers selling goods directly to users, that is, the "business-to-customer" model, which is commonly referred to as commercial retail, selling products and services directly to consumers. Such as: Suning.com, JD.com, Tmall
, Xiaomi Mall
3, C2B model
C2B (Customer to Business), that is, consumer to business. First, there is consumer demand, and then there is enterprise production, that is, first, consumers put forward the demand, and then there are production
enterprises to organize production according to demand . Online fast payment, offline high-quality service. Such as: Are you hungry, Meituan, Tao Piao Piao, JD Daojia. 2) Zhenyan Mall Zhenyan Mall is a B2C e-commerce platform that sells self-operated products to customers.






2. Project structure diagram

1) Project microservice architecture diagram
insert image description here
2) Microservice division diagram
insert image description here

3. Project technology
1) Reverse engineering
2) Separate development of front-end and back-end, vue-based background management system 3) SpringCloud
's new solution 4 ) Distributed methods such as application
monitoring, current limiting, gateway, fuse downgrade, etc. dis ,
docker 5 ) Familiar with html, css, js, vue 6) Familiar with idea development projects









2. Distributed basic concepts

1. Microservices

The microservice architectural style is like developing a separate application as a set of small services, each of which runs in its own
process and communicates using a lightweight mechanism, usually an HTTP API. These services are built around business capabilities
and are deployed independently through fully automated deployment mechanisms. These services are written in different programming languages, as well as different data
storage technologies, and keep centralized management to a minimum.
Split large single applications, micro-split services based on business boundaries, and deploy and run each service independently.

2. Cluster & Distributed & Node

Cluster is a physical form, and distributed is a way of working.
As long as it is a bunch of machines, it can be called a cluster.
A distributed system is a software system built on top of a network.
Distributed refers to distributing different services in different places.
Clustering refers to gathering several servers together to realize the same service.
For example: Taobao is a distributed system, many businesses run on different machines, and all businesses form a large business cluster. For each small business, such as user systems, one server is not enough when the access pressure is high. We
should deploy the user system to multiple servers, that is, each business system can also be clustered;
each node in the distributed system can be clustered. And the cluster is not necessarily distributed.
Node: A server in a cluster.

3. Remote call

In a distributed system, each service may be located on different hosts, but it is inevitable that the services need to call each other, which we
call remote calls.
In Spring Cloud, HTTP+JSON is used to complete the remote call. (Telecommunication)
insert image description here

4. Load balancing

insert image description here
In a distributed system, A service needs to call B service, and B service exists in multiple machines, and A
can call any server to complete the function.
In order to make each server not too busy or too idle, we can call each server in a load-balanced manner to improve
the robustness of the website.

Common debt balancing algorithm:
Round robin: select the first backend server in the healthy pool for the first request, and then select in sequence until the
last one, and then loop.
Minimum connection: Prioritize the back-end server with the least number of connections, that is, the least pressure.
This method can be considered in the case of long sessions.
Hash: Select the server to be forwarded according to the hash (hash) of the IP of the request source. This way can
ensure to a certain extent that specific users can connect to the same server. Consider this approach if your application needs to handle state and requires the user to be able to connect to the same server as before.

5. Service Registration/Discovery & Registration Center

Service A calls service B. Service A does not know which servers B service is currently on, which ones are normal, and which ones
are offline. To solve this problem, a registration center can be introduced.
insert image description here
If some services go offline, the rest of us can perceive the status of other services in real time, so as to avoid calling unavailable
services .

6. Configuration Center

insert image description here
Each service ends up with a lot of configuration, and each service may be deployed on multiple machines. We often need to change
the configuration, we can let each service obtain its own configuration in the configuration center.
The configuration center is used to centrally manage the configuration information of microservices

7. Service circuit breaker & service downgrade

In the microservice architecture, microservices communicate through the network and there is interdependence. When one of the services is unavailable,
it may cause an avalanche effect. To prevent such a situation, fault-tolerant mechanisms must be in place to protect the service.
insert image description here
1) Service fuse
a. Set the timeout of the service. When the called service often fails to reach a certain threshold, we can enable the
circuit breaker protection mechanism, and subsequent requests will no longer call this service. The local directly returns the default
data
2), service degradation
a. During the operation and maintenance period, when the system is at a peak and the system resources are tight, we can
degrade the non-core business. Downgrade: some services do not handle, or simply handle [throw exception, return NULL,
call Mock data, call Fallback processing logic].

8. APP Gateway

In the microservice architecture, API Gateway is an important component of the overall architecture. It abstracts the public functions required in microservices, and provides rich functions such as
client load balancing, automatic service fuse, grayscale publishing, unified authentication, current limiting and flow control, and log statistics, helping us solve many API management problems.

insert image description here

Guess you like

Origin blog.csdn.net/qq_44696532/article/details/131762450