yiisoft/yii2 — pull request #4274 by qiangxue (2014-07-11 17:09:11+00:00)
Title: Support for separating Read/Write Database

Fixes #3708

Referenced: http://www.yiiframework.com/extension/dbreadwritesplitting/

Main features:

* Support a single master (for read/write) and multiple slaves (read only)
* Can detect dead slaves and use health one or the master
* Automatic detection of using whether the master or slave connection
* For pages that do not change data, only a single read connection is opened (the master will not be opened)
* all `Command::query()` operations use the slave, all `Command::execute()` operations use the master
* Transactions done with the master
* Support forcing the use of the master

Manually tested with the CRUD operations generated by Gii:

* For index, view pages, only a slave connection is open
* For create, update pages (POST), both of the master and the slave connections are used. The slave connection is used to load the model data and can be optimized by disabling the slave on the fly to use the master only.