Home  >  Article  >  Backend Development  >  Summary of learning on large-scale website optimization: website architecture issues

Summary of learning on large-scale website optimization: website architecture issues

WBOY
WBOYOriginal
2016-08-08 09:30:481066browse

In the past two days, I watched the videos of teacher Han Shunping on the "Chuanzhi Podcast". Now let’s summarize the first few pictures we learned! Sharpening a knife makes it easier to chop firewood!

Question 1. The structure of the website.

First, let’s understand the architecture of modern large-scale website server clusters.那 Just when I just learned PHP, the server's architecture in my mind is like this (as shown in Figure 1)

(Figure 1)

As shown in the figure, multiple customers access the server at the same time, the server access the website, this way The result is that every time a customer visits the website, he will access the database, which will lead to frequent access to the database, causing the website to run slowly. Once an accident occurs in the database, the data may be difficult to retrieve. Such an architecture can only be used at best. It can support a small and medium-sized website. For large websites, such an architecture with more than one million visits will definitely not work, so now many websites adopt the following architecture (as shown in the picture)


The access process is as follows

1 The user accesses the load balancer, and the load balancer uses polling technology to allocate servers to the browser (load balancing)

2. The server processes user requests. If it wants to access the database, it will first ask the cache server (memcache or redis) query Whether there is the required data

If there is, the data will be returned directly. If not, it will enter 3

3 database load balancing. When the request from the server is received, the corresponding database will be allocated and the data will be read out.

(Using database read-write separation technology)

4 ​​After the data is returned to the server, it will be saved in the cache server (memcache or redis). If it is accessed next time, the cache server will be accessed first (caching technology)

5 The data passes through the server Will be returned to the user's browser.

This is what I know, and I hope there are shortcomings. I hope you can correct me in time.

The above introduces the website architecture issues related to the learning summary of large-scale website optimization, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn