What are Master and Slave databases and how does pairing them make web apps faster?
What are Master and Slave databases and how does pairing them make web apps faster? A database is "slaved" to a "master" when it receives a stream of updates from the master in near real-time, functioning as a copy. The "slave" must simply apply the changes that the master validated and approved. In principle, one could create a master-slave setup by transferring files really fast from one server to the other; but in practice, each database has its own specialized replication protocol. There are many reasons a replica makes queries return faster. One is that the master's CPU is less burdened by queries while the replica's CPU is less burdened by writes; so there is more CPU available to do work. Another is that data, while nominally stored to disk, is cached in RAM when that is possible; and indeed the OS does this whether the database asks for it or not and can be unpredictable about it. On the master, recently written portions of the database ...
Comments
Post a Comment