Followed by the previous article 《Evolution of websites and databases (III). The last time I talked about adding servers, how many servers should I add and how to deploy a server website? The simplest way is to split an application.
I. Separating applications
Figure 1
1. Split the application and place it on different servers according to the pressure. The same is true for databases. Set different subdomain names for access. Images should be independent.
In this way, user access will be distributed to different servers. This advantage is obvious, and the pressure on websites is significantly increased. The disadvantage is that you haveProgramRe-development.
2. Multiple copies
Figure 2
2. Use Server Load balancer to distribute the pressure to different servers. In this way, you do not need to modify the program. Because the pressure is not very huge, simply use the Server Load balancer that comes with windows to display the purpose.
Some local problems can be solved through caching. However, databases can process the pressure in three ways.
1. database/table sharding
The principle is similar to the separation of applications on websites. The application-related parts are split and placed on different database servers.
2. Distributed Computing
When you hook up a database, applications also need to be split. However, when accessing the database, you only need to access the primary database. Other databases become black boxes, so you do not need to know the details of other databases.
3. Distribution
The principle is the same as that of multiple copies on the website. Data is also distributed to multiple copies to access different copies. The disadvantage is that the data will not be synchronized. It takes some time to synchronize data between database servers.
When the traffic increases, you need to purchase professional devices or develop complex applications to solve the problem. For example, bigtable, mapreduce, F5, etc. If you have never touched those things, you can stop talking about them. This seriesArticleIt is a summary of your work over the past few years, and I hope it will help you. If there is a better method, I hope I can enlighten you.