当前位置:网站首页>Web architecture design process
Web architecture design process
2022-07-07 05:40:00 【Qin Tian】
Catalog
One 、 Architecture evolution
1、 The initial set up
Framework based , Running on the Tomcat In the container . file 、 database 、 The application is on a server .
2、 Service separation
As the number of users increases , A single server cannot meet the load of the system , The application server and data server can be deployed separately , If possible, you can also deploy the file server separately .
3、 Reverse proxy
In order to improve the service processing capacity , We are Tomcat Add a proxy server in front of the container , such as Nginx、apache also . The user's request is sent to the reverse proxy , Then the reverse proxy forwards the request to the back-end server . Strictly speaking ,Nginx Belong to web The server , Generally deal with static html、css、js request , and Tomcat Belong to web Containers , Designed to handle JSP request , Of course Tomcat Also support html Of , It just didn't work Nginx All right .
4、 Dynamic and static separation
Based on the above Nginx Reverse proxy , We can also achieve Dynamic and static separation , Static requests such as html、css、js Wait for the request to be given to Nginx Handle , Dynamic requests are distributed to the backend Tomcat Handle .Nginx Upgrade to 1.9.5+ Can be opened HTTP/2.0 Time , Accelerate website access . Of course , If the company doesn't need money , CDN It's also a good choice .
5、 Service split
In this era when distributed microservices have become popular , In fact, we don't need to step on too many pits , It's easy to split . There are relatively mature technologies on the market , For example, Alibaba open source Dubbo( The official made it clear that the maintenance has begun ),Spring The family's SpringCloud, Of course, how to implement it , Both technology and business should be well controlled .
Microservices and lightweight communications :
- Synchronous communication and asynchronous communication
- The remote invocation RPC
- REST
- Message queue
6、 Continuous integration deployment
After service split , With it comes continuous integration deployment , You may use the following tools :Docker、Jenkins、Git、Maven. The basic topology is as follows :
The evolution of the entire continuous integration platform architecture is shown in the figure below :
7、 Service cluster
Linux Clusters are mainly divided into three categories ( High availability cluster , Load balancing cluster , Scientific computing cluster ). Actually , The load balancing cluster is the most common one we come into contact with in production .
(1) Load balancing implementation
- DNS Load balancing , General domain name registrants dns Server does not support
- Four layer load balancing (F5、LVS), Working in TCP Under the agreement
- Seven layer load balancing (Nginx、haproxy), Working in Http Under the agreement
(2) Distributed session
Everybody knows , Services are generally divided into stateful and stateless , And distributed sessoion For stateful Services .
8、 Read / write separation
MySql Master slave configuration , Read write separation and introduction of middleware , Open source MyCat, Ali's DRDS All good choices . If high availability is required , But there is no corresponding technical guarantee , It is recommended to use Alibaba cloud's RDS perhaps Redis Correlation database , Save time, effort and money .
9、 Cache optimization
The introduction of caching is nothing more than to reduce the pressure of back-end database services , Prevent it " Strike ". Common cache services are ,Ehcache、OsCache、MemCache、Redis, Of course, these are the mainstream cache technology implementation that can stand the test , especially Redis It has been widely used in distributed cluster services , And proved its superior performance .
10、 Message queue
1、 Asynchronous notification : For example, SMS verification , E-mail verifies these non real-time feedback logical operations .
2、 Flow cutting : It should be a common scenario in message queues , Generally, it is widely used in seckill or group robbery activities .
3、 Log processing : Logs are essential in the system , But how to deal with the logs issued by Gao and is really a technical job , Carelessness may overwhelm the whole service . We often use open source logs in our work ELK, Why add one in the middle Kafka perhaps redis That's the reason ( The difference between an influx of people and a queue ).
4、 Message communication : Point to point communication ( Individual to individual ) Or publish subscribe mode ( The chat room ).
11、 The log service
Mentioned in the message queue ELK Open source log component is a good choice for small and medium-sized start-ups .
12、 Security optimization
All these above , If there is no guarantee of safety, it may return to zero .
- Ali cloud, VPN Virtual private network and security group configuration
- If you build your own computer room , Configure the firewall security policy by yourself
- Related service access , such as Mysql、Redis、Solr If there are no special needs, try to use intranet access and set authentication
- Try to use a proxy server , Don't open too many ports
- https coordination HTTP/2.0 It's also a good choice
Two 、 Design principles
1、 High availability
- Load balancing ( Load balancing algorithm )
- Reverse proxy
- Service isolation
- Service restriction
- service degradation ( Automatic graceful degradation )
- Failover
- Time out to try again ( Agent timeout 、 Container timeout 、 Front end timeout 、 Middleware timeout 、 Database timeout 、NoSql Overtime )
- Rollback mechanism ( Online rollback 、 Database version rollback 、 Transaction rollback )
2、 High concurrency
- Client cache ( Reduce network bandwidth 、 Reduce server stress 、 Reduce network latency )
- HTTP cache
- Multi level cache
- Distributed cache
- Connection pool
- Asynchronous concurrency
3、 Distributed transactions
- Two stage submission ( Strong consistency )
- Three stage commit ( Strong consistency )
- Message middleware ( Final consistency ), Recommend Ali's RocketMQ
4、 queue
- Task queue
- Message queue
- Request queue
5、 Database technology
- Master slave copy ( extensible 、 Available backups )
- Read / write separation ( Improve query speed 、 Reduce IO bottleneck 、 High expansion )
- Vertical expansion of monomer ( Separation of business 、 High expansion 、 High performance )
- Horizontal expansion of monomer ( High expansion 、 High performance )
- Data heterogeneity
6、 Network security
- SQL Inject
- XSS attack
- CSRF attack
- Denial of service (DoS,Denial of Service) attack
7、 Load balancing
- The Internet ( Global load balancing ,DNS polling 、CDN Network distribution )
- Hardware ( Local load balancing , Load Balancer 、 Address translation gateway , Efficient but expensive )
- Software ( Local load balancing ,Linux Virtual Server、Nginx、HAProxy)
3、 ... and 、 Essential tools
1、 operating system
Linux( necessary )、 Microsoft
2、 Load balancing
DNS、F5、LVS、Nginx、OpenResty、HAproxy、 Load balancing SLB( Alibaba cloud )
3、 Distributed framework
Dubbo、Motan、Spring Cloud
4、 database middleware
DRDS ( Alibaba cloud )、Mycat、360Atlas
5、 Message queue
RabbitMQ、ZeroMQ、Redis、ActiveMQ、Kafka
6、 Registry Center
Zookeeper、Redis
7、 cache
Redis、Oscache、Memcache、Ehcache
8、 Integrated deployment
Docker、Jenkins、Git、Maven
9、 Storage
OSS、NFS、FastDFS、MogileFS
11、 database
MySql、Redis、MongoDB、PostgreSQL、Memcache、HBase
12、 The Internet
private network VPC、 Elastic public network IP、CDN
Reprint :
WEB Architecture Design Overview - A hundred miles of Twilight - Blog Garden
边栏推荐
- "Multimodal" concept
- 什么是消息队列?
- 分布式事务介绍
- 照片选择器CollectionView
- Sorry, I've learned a lesson
- 分布式事务解决方案之2PC
- K6el-100 leakage relay
- [论文阅读] Semi-supervised Left Atrium Segmentation with Mutual Consistency Training
- Mysql database learning (8) -- MySQL content supplement
- 论文阅读【Sensor-Augmented Egocentric-Video Captioning with Dynamic Modal Attention】
猜你喜欢
How Alibaba cloud's DPCA architecture works | popular science diagram
C#可空类型
Différenciation et introduction des services groupés, distribués et microservices
[论文阅读] A Multi-branch Hybrid Transformer Network for Corneal Endothelial Cell Segmentation
分布式全局ID生成方案
sql查询:将下一行减去上一行,并做相应的计算
Getting started with DES encryption
Jhok-zbl1 leakage relay
基于 hugging face 预训练模型的实体识别智能标注方案:生成doccano要求json格式
[binary tree] binary tree path finding
随机推荐
MySQL数据库学习(7) -- pymysql简单介绍
Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game
Paper reading [MM21 pre training for video understanding challenge:video captioning with pre training techniqu]
基于NCF的多模块协同实例
Paper reading [open book video captioning with retrieve copy generate network]
Unity让摄像机一直跟随在玩家后上方
拼多多新店如何获取免费流量,需要从哪些环节去优化,才能有效提升店内免费流量
Lombok plug-in
Simple case of SSM framework
消息队列:如何确保消息不会丢失
《2》 Label
The year of the tiger is coming. Come and make a wish. I heard that the wish will come true
Leakage relay llj-100fs
Taobao Commodity details page API interface, Taobao Commodity List API interface, Taobao Commodity sales API interface, Taobao app details API interface, Taobao details API interface
app clear data源码追踪
论文阅读【Sensor-Augmented Egocentric-Video Captioning with Dynamic Modal Attention】
5. Data access - entityframework integration
论文阅读【Semantic Tag Augmented XlanV Model for Video Captioning】
Pytest testing framework -- data driven
JVM(二十) -- 性能监控与调优(一) -- 概述