In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what are the Internet architecture models commonly used in web development". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. hierarchical architecture
Hierarchical architecture (layered architecture) is the most common software architecture and the de facto standard architecture. If you don't know what architecture to use, use it.
This architecture divides the software into several horizontal layers, each with a clear role and division of labor, and there is no need to know the details of the other layers. Layers communicate with each other through interfaces.
Although there is no clear agreement on how many layers the software must be divided into, a four-tier structure is the most common.
Presentation layer (presentation): user interface, responsible for vision and user interaction
Business layer (business): implementing business logic
Persistence layer (persistence): provides data, and the SQL statement is placed at this layer
Database (database): saving data
Some software add a service layer (service) between logic layer and persistence layer to provide some general interfaces needed by different business logic.
The user's request will be processed through these four layers in turn, and no one can be skipped.
Advantages
Simple structure, easy to understand and develop
Programmers with different skills can be divided and responsible for different layers, which is naturally suitable for the organizational structure of most software companies.
Each layer can be tested independently, and the interfaces of other layers can be solved by simulation.
Shortcoming
Once the environment changes, it is usually troublesome and time-consuming when the code needs to adjust or add functionality.
Deployment is troublesome, even if it is only modified in a small place, it often requires the whole software to be redeployed, so it is not easy to release continuously.
When you upgrade the software, you may need to suspend the entire service.
Poor scalability. When there is a large increase in user requests, each layer must be expanded in turn, which can be difficult because each layer is internally coupled.
Second, event-driven architecture
An event (event) is a notification issued by the software when the state changes.
Event-driven architecture (event-driven architecture) is a software architecture that communicates through events. It is divided into four parts.
Event queue (event queue): the entrance to receive events
Distributor (event mediator): distribute different events to different business logic units
Event channel (event channel): the channel of contact between the dispatcher and the processor
Event handler (event processor): implements the business logic. After processing, an event is issued to trigger the next action.
For simple projects, event queues, dispatchers, and event channels can be integrated, and the whole software is divided into two parts: event agents and event handlers.
Advantages
Distributed asynchronous architecture, high decoupling between event handlers and good software expansibility
Wide applicability, all types of projects can be used
The performance is better, because of the asynchronous nature of events, the software is not easy to cause blockage.
Event handlers can be loaded and unloaded independently, making it easy to deploy
Shortcoming
When it comes to asynchronous programming (considering remote communication, loss of response, etc.), development is relatively complex.
It is difficult to support atomic operations because event passage involves multiple processors and is difficult to roll back
Distributed and asynchronous features make this architecture difficult to test
Third, micronucleus architecture
Microkernel architecture (microkernel architecture), also known as "plug-in architecture" (plug-in architecture), means that the kernel of the software is relatively small, and the main functions and business logic are implemented through plug-ins.
The core usually contains only the minimum functions that the system is running. Plug-ins are independent of each other, and the communication between plug-ins should be minimized to avoid the problem of interdependence.
Advantages
Good functional extensibility (extensibility). If you need any function, you can develop a plug-in.
Functions are isolated, and plug-ins can be loaded and unloaded independently, making it easier to deploy
Highly customizable to meet different development needs
Can be developed step by step, gradually increasing the function
Shortcoming
The scalability is poor, and the kernel is usually a separate unit, which is not easy to be distributed.
Development is relatively difficult because it involves the communication between the plug-in and the kernel, as well as the internal plug-in registration mechanism
IV. Micro-service architecture
Micro-service architecture (microservices architecture) is the upgrade of service-oriented architecture (service-oriented architecture, abbreviated SOA).
Each service is a separate separately deployed unit. These units are distributed, decoupled from each other and connected through remote communication protocols (such as REST, SOAP).
The micro-service architecture is divided into three implementation modes.
RESTful API model: services are provided through API, and cloud services fall into this category
RESTful application model: services are provided through traditional network protocols or application protocols, and there is usually a multi-functional application, which is common within the enterprise.
Centralized message mode: message broker (message broker) is used to implement message queuing, load balancing, unified logging and exception handling. The disadvantage is that there will be a single point of failure, and message agents may have to be clustered.
Advantages
Good scalability and low coupling between services
Easy to deploy, the software is split from a single deployable unit into multiple services, each of which is a deployable unit
Easy to develop, each component can be continuously integrated development, can be real-time deployment, continuous upgrade
Easy to test, you can test each service individually
Shortcoming
Because of the emphasis on mutual independence and low coupling, services may be split in great detail. This causes the system to rely on a large number of micro-services, becoming messy and bulky, and poor performance.
Once communication is required between services (that is, one service uses another), the entire architecture becomes complex. Typical examples are some generic Utility classes, and one solution is to copy them into each service and trade redundancy for architectural simplicity.
The distributed nature makes it difficult for this architecture to implement atomic operations, and transaction rollback will be more difficult.
V. Cloud Architecture
Cloud architecture (cloud architecture), which mainly solves the problems of scalability and concurrency, is the easiest architecture to extend.
The main reason for its high scalability is that it does not use a central database, but copies all the data into memory and becomes replicable in-memory data units. Then, the business processing capacity is encapsulated into processing units (prcessing unit). When the number of visits increases, a new processing unit is built; when the number of visits decreases, the processing unit is closed. In the absence of a central database, the biggest bottleneck in scalability disappeared. Since the data of each processing unit is in memory, it is best to persist the data.
This pattern is mainly divided into two parts: processing unit (processing unit) and virtual middleware (virtualized middleware).
Processing unit: implementing business logic
Virtual middleware: responsible for communication, sessions maintenance, data replication, distributed processing, and deployment of processing units.
Virtual middleware contains four components.
Message middleware (Messaging Grid): manages user requests and session, and decides which processing unit to assign to when a request comes in.
Data middleware (Data Grid): copy data to each processing unit, that is, data synchronization. Make sure that all processing units get the same data.
Processing middleware (Processing Grid): optionally, if a request involves different types of processing units, the middleware is responsible for coordinating the processing units
Deployment middleware (Deployment Manager): responsible for starting and shutting down the processing unit, monitoring load and response time, when the load increases, the new processing unit starts, and when the load decreases, the processing unit is closed.
Advantages
High load and high scalability
Dynamic deployment
Shortcoming
Complex implementation and high cost
It is mainly suitable for website applications, but not for large database applications with large amounts of data throughput.
It is difficult to test
This is the end of the content of "what are the common Internet architecture models used in web development?" Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.