1

I have setup symfony mysql site with mysql master slave configuration. How ever while testing with jmeter I observed that almost all load is going to master and 1-2% to the server.

Referred how to use master-slave but couldn't help. Is there any specific parameter to influence Server to pick slave connection?

PS- I am performing all read operations only

Community
  • 1
  • 1
Sagar
  • 1,315
  • 8
  • 15
  • I have the same setup and it is working perfectly fine. Are you sure the application is able to connect to both the servers!! – Broncha Jul 26 '14 at 15:49
  • yes Broncha app is able to connect to both master and slave but 95% queries go to master despite of query type(insert, update or select) – Sagar Jul 28 '14 at 05:26

1 Answers1

4

Doctrine will use the master for all queries after any kind of update.

You can tell doctrine to switch back to a slave after inserts/updates:

$em->flush();
$em->getConnection()->connect('slave');

You could also check whether you have a request listener doing inserts/updates, and apply that fix.

AdrienBrault
  • 7,747
  • 4
  • 31
  • 42