1. The difference between traditional projects and Internet projects
Traditional projects:
OA, HR, CRM and other systems. Target group: corporate employees.
Features: fewer project users, relatively less concurrency, and high user tolerance.
Internet projects:
Taobao, Tmall, JD.com Target group: Internet
Features: Large number of users, large number of visits, more emphasis on user experience : aesthetics, functionality, speed, stability
For Internet projects, back-end engineers can intervene in speed and stability
Speed: Opening a new page takes just a moment, and there is no delay between pages.
Stability: 99.9% of the website can be accessed normally throughout the year without any problems
2. Architecture goals of large-scale Internet projects:
Characteristics of Internet projects:
-
Many users
-
Large traffic and high concurrency
-
Massive Data
-
vulnerable
-
Cumbersome functions
-
Change quickly
Measuring website performance metrics
- Response time : The total time it takes to execute a request from the start time to the last time the response data is received
- Concurrency : the number of requests that the system can handle at the same time
- Number of concurrent connections : refers to the client initiating a request to the server and establishing a TCP connection. The total number of TCP connections to the server per second
- Number of requests : QPS (Query Per Second) refers to the number of requests per second
- Number of concurrent users : How many users are there per unit time
- Throughput : refers to the number of requests that the system can handle per unit time
- QPS: Query Per Second refers to how many requests per second
- TPS: Transaction Per Second Number of transactions per second
- A transaction refers to the process in which a client sends a request to the server and the server responds. The client starts timing when it sends a request and ends when it receives the server's response. This is used to calculate the time used and the number of completed transactions.
Architectural goals of Internet projects
- High performance: Provide a fast access experience
- High availability: website services can always be accessed normally
- Scalable: By increasing or decreasing hardware, processing capabilities can be increased or decreased (big promotion of capacity expansion)
- High scalability: low coupling between systems, easy to add or remove new functional modules by adding or removing them
- Security: Provide secure website access and data encryption, secure storage strategy
- Agility: adapt to needs and respond quickly
Clustered and distributed
Cluster:
- Popular description: Many machines, doing the same thing
- Professional description: A business module deployed on a polymorphic server
distributed:
-
Popular description: There are many machines, and each cluster does different things. Together, it is a complex event (professional things are done professionally, because each thing has different performance requirements)
-
Professional description: A large business system is divided into small business sections and deployed on different machines.
Projects under the cluster architecture meet the following characteristics:
-
High performance: The cluster is scalable. If the performance is not enough, machines can be added to ensure performance.
-
High availability: As long as one machine is not down, the service can be provided
The cluster distributed architecture can well meet the architectural goals of the Internet system.
-
High performance: The cluster is scalable. If the performance is not enough, machines can be added to ensure performance.
-
High availability: As long as one machine is not down, the service can be provided
-
Scalable: Dynamically expand and shrink different service clusters according to the performance requirements of different services.
-
High scalability: When you need to add or reduce certain services, just increase or decrease the clusters that respond to the service.
Architecture evolution
Monolithic architecture
All services are deployed on one server
- Advantages: Simple development and deployment, preferred for small projects
- shortcoming:
- Large amount of code and slow project startup
- Poor reliability
- Poor scalability
- Poor scalability and maintainability
- Low performance
vertical architecture
Vertical architecture is to split multiple modules in a single architecture into multiple independent projects to form multiple independent single architectures .
Problems with monolithic architecture:
- Project starts slowly
- Poor reliability
- Poor scalability
- Poor scalability and maintainability
- Low performance
Problems with vertical architecture:
- Too many duplicate functions
Distributed architecture
Distributed architecture refers to extracting public business modules on the basis of vertical architecture and providing them as independent services to other consumers to achieve service sharing and reuse.
- RPC:Remote Procedure Call remote procedure call.
Problems with vertical architecture:
- Too many duplicate functions
Problems with distributed architecture:
- Once the service provider changes, all providers need to change
SOA architecture
SOA: (Service-Oriented Architecture, service-oriented architecture) is a component model that splits different functional units of an application (called services) and connects them through defined interfaces and contracts for these services
ESB: (Enterparise Service Bus) enterprise service bus, service intermediary. Mainly provides interaction between services. ESB includes functions such as: load balancing, flow control, encryption processing, service monitoring, exception handling, emergency monitoring, etc.
Problems with distributed architecture:
- Once the service provider changes, all providers need to change
Microservice architecture
- Microservice architecture is a sublimation of SOA. Microservice architecture emphasizes a key point: "Business needs to be completely componentized and service-oriented." The original single business system will be split into multiple systems that can be independently developed, designed, and operated. Small applications, interaction and integration between these small applications are completed through various services
- Microservice architecture = 80% SOA service architecture thinking + 100% component architecture thinking + 80% domain modeling thinking
Features:
- Services are componentized: developers can freely choose development technologies, and teams do not need to be the same
- Interaction between services generally uses REST API
- Decentralization: Each microservice has its own private database to persist business data
- Automated deployment: Split the application into independent individual services to facilitate automated deployment, testing, operation and maintenance