After using the cache, so that most of the data read operation access can be done without the database, but still have a portion of the read operations (including misses cache, and cache expired) and all write operations need to access the database, when the site's traffic continues to increase, The database will become a performance bottleneck for the site because of high load pressure.
At present, most of the mainstream database provides a master-slave function, by configuring the master-slave relationship between the two databases, you can synchronize the data of one database server to another server, the Web site uses this function of the database, can realize the database read and write separation, thereby improving the load pressure of the database.
When the application server writes the data, accesses the main database, the primary database synchronizes the data update to the slave database through the master-slave replication mechanism, so that when the application server reads the data, it can obtain the data from the database, in order to facilitate the application access to read and write the detached database. Usually in the application server side with a dedicated data access module (also called the data Access layer), so that the database read and write separation to the application transparent.
Database read/write separation
Schemas such as:
Summary: Database read and write separation alleviates the pressure on the database, but at the same time brings two problems:
1, the problem of data synchronization. Generally use the database to bring the data replication mechanism to solve, you can refer to: http://note.youdao.com/noteshare?id=1245e28ab69dc951bb9df9f53e9abc16&sub= e1f1b4aaeb9140d6b37b1998163dbd0b
2, the application is selected for the data source problem. For an application, all subsequent writes are taken from the main library, while the read operation goes from the library. These operations are typically done through the middleware data access layer.
Large Web site Architecture Evolution (5) database read/write separation