[UPDATE] [performance] Splitting Reads and Writes for better scalability

This is an update of this thread:

NOTE: I assume that you know how to setup Master-Slave database and these configurations are done after you have configured it.

So, after I successfully setup Frappe with Remote Database and created a Master Slave database, I was having problem to connect the Slave database just like in the thread that I linked above.

TL;DR: Replace

"slave_host": "<remote ip>",
"use_slave_for_read_only": 1,


"read_from_replica": 1,
"replica_host": "<remote ip>",


After looking at source code of frappe.read_only() , I saw that code checks on site_config.json if key read_from_replica is True

if conf.read_from_replica:

But, even here when you look at connect_replica() code, the code looks for replica_host and not slave_host .

Update these values and you are all set. (I think you have to run: bench restart && bench migrate if I am not mistaken.)


If slave has different user/database name and password then you have to add:

"different_credentials_for_replica": 1,
"replica_db_name": "<replica db name>"
"replica_db_password": "<password>"
1 Like

This article has a few more details


1 Like

I had no idea that this exists. No offense but the newly updated documentation is so messy that it’s giving me hard time to navigate and find what I am looking for. Most of the time I have to search on google followed by the word erpnext frappe so it can redirect me to the thing that I am looking for.


Does this also mean for a multitenants setup, the keys are put in the common_site_config.json?