当前位置:网站首页>Evolution of large website system architecture

Evolution of large website system architecture

2021-10-22 10:36:13 Bird's nest

original text : The evolution of large-scale website system architecture , author : Li Ping

A mature large website ( Such as Taobao 、 Jingdong etc. ) The system architecture of is not complete and high-performance at the beginning of design 、 High availability 、 Safety and other characteristics , It always increases with the number of users , The expansion of business functions is gradually evolving , In the process , Development mode 、 Technology Architecture 、 Design ideas have also changed a lot , Even technicians have developed from several people to a department or even a product line . Therefore, the mature system architecture is improved with the business expansion , It's not done overnight ; Systems with different business characteristics , Will have their own focus , For example, Taobao. , To solve the massive search of product information 、 Place an order 、 payment , Tencent, for example , To solve hundreds of millions of users' real-time message transmission , Baidu needs to deal with massive search requests , They all have their own business characteristics , The system architecture is also different . However, we can also learn from these different Website backgrounds , Find out the common technology , These technologies and means can be widely used in the architecture of large-scale website system , The following describes the evolution process of large-scale website system , To understand these technologies and means .

One 、 First site architecture

Original architecture , Applications 、 database 、 Files are all deployed on one server , Pictured :

Two 、 application 、 data 、 File separation

As the business expands , A server can no longer meet the performance requirements , So the application 、 database 、 Files are deployed on separate servers , And configure different hardware according to the purpose of the server , Best performance .

3、 ... and 、 Using cache to improve website performance

While hardware optimizes performance , At the same time, it also optimizes performance through software , In most web systems , Will use cache technology to improve system performance , Using cache mainly comes from the existence of hot data , Most site visits follow 28 principle ( namely 80% Access requests for , End up in 20% Data on ), So we can cache the hot data , Reduce access paths to these data , Improve user experience .

The common way to implement cache is local cache 、 Distributed cache . Of course, CDN、 Reverse agent, etc , Let's talk about this later . Local cache , As the name implies, cache the data on the application server , Can exist in memory , Files can also exist ,OSCache Is a common local cache component . Local caching is characterized by high speed , However, due to the limited local space, the amount of cache data is limited . The characteristics of distributed cache are , Massive data can be cached , And it's very easy to expand , Often used in portal websites , The speed is not as fast as the local cache , The common distributed cache is Memcached、Redis.

Four 、 Using cluster to improve the performance of application server

Application server as portal of website , Will take on a lot of requests , We often share the number of requests through the application server cluster . Deploy load balancing server in front of application server to schedule user requests , Distribute requests to multiple application server nodes according to the distribution policy .

The commonly used hardware of load balancing technology includes F5, The price is quite expensive , Software is available. LVS、Nginx、HAProxy.LVS Four layer load balancing , Select internal server based on destination address and port ,Nginx It's seven layer load balancing and HAProxy Support four levels 、 Seven layer load balancing , Internal server can be selected according to message content , therefore LVS Better distribution path Nginx and HAProxy, Better performance , and Nginx and HAProxy More configurable , If it can be used for dynamic and static separation ( According to the characteristics of the request message , Select static resource server or application server ).

5、 ... and 、 Database read / write separation and database / table splitting

As the number of users increases , Database becomes the biggest bottleneck , The common means to improve the performance of database is to separate reading from writing and to divide tables , As the name implies, the separation of read and write is to divide the database into read database and write database , Realize data synchronization through the main and standby functions . The sub database and sub table can be divided into horizontal segmentation and vertical segmentation , Horizontal switch is to split a large database table , For example, user table . Vertical segmentation is to switch according to different services , Such as user business 、 Commodity business related tables are placed in different databases .

6、 ... and 、 Use CDN And reverse proxy to improve website performance

If our servers are all deployed in the computer room of Chengdu , For Sichuan users, access is fast , But for users in Beijing, access is slow , This is because Sichuan and Beijing belong to different developed regions of China Telecom and China Unicom respectively , Beijing users need to go through a long path through the Internet router to access the servers in Chengdu , The same goes for the return path , So the data transmission time is relatively long . In this case , Often used CDN solve ,CDN Cache data content to operator's computer room , Users access data from the nearest operator first , This greatly reduces the path of network access . More professional CDN Blue flood for operators 、 Net residence .

And reverse proxy , It is the computer room deployed on the website , Access the reverse proxy server first when the user request arrives , The reverse proxy returns the cached data to the user , If there is no cached data, the application server will continue to get , It also reduces the cost of getting data . Reverse agents have Squid,Nginx.

7、 ... and 、 Using a distributed file system

Users increase day by day , More and more business , More and more documents are produced , Single file server can no longer meet the requirements . Need distributed file system support . Common distributed file systems are NFS.

Query for mass data , We use nosql Database and search engine can achieve better performance . Not all data should be placed in relational data . frequently-used NOSQL Yes mongodb and redis, Search engines have lucene.

Nine 、 Business splitting of application server

As the business expands further , The application has become very bloated , At this point, we need to split the application into business segments , For example, baidu is divided into news 、 Webpage 、 Pictures and other businesses . Each business application is responsible for relatively independent business operation . Services communicate with each other through messages or share databases .

Ten 、 Build distributed services

At this time, we found that each business application will use some basic business services , For example, user services 、 Order service 、 Payment services 、 Security service , These services are the basic elements to support various business applications . We extract these services and build distributed services using the partial service framework . Taobao's Dubbo It's a good choice .

Summary

The architecture of large-scale websites is constantly improved according to business needs , Specific design and consideration will be made according to different business characteristics , This article is just about some techniques and means involved in a regular large-scale website .

Reference material

  1. 《 Technical framework of large website 》 —— Li Zhi Hui
  2. 《 Massive operation and maintenance planning 》 —— Tang Wen

版权声明
本文为[Bird's nest]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/10/20211009000611565t.html

随机推荐