Mysql – Is it ok to use 4 application server against one database server

haproxyload balancingMySQLreplication

Initially I have two database server (Master Master Replication config with Haproxy load balancing) A and B. And two application server say P and Q.
Both P and Q is pointed towards A will move to B in case of failure. OLTP operations are huge in numbers per minute.

Now we are adding two more app servers R and S.

Just want to know experts opinion. Is it ok to point both R and S towards A?
Or should I use B this time.

Please suggest.

Best Answer

Having 4 application servers pointed at the same DB is not a problem. You may want to monitor the various metrics such as connection counts on each server. In theory, there may be a few more connections than previously but that is ok. You may also want to start planning on sharding. A cheap and easy way to do this is to have auto increment offsets being different on each machine. This would allow you to use both machines in a distributed fashion rather than a failover (failover would still work).

I would just be careful on the other side of the fence. With 2 additional application servers people might suspect that they're able to double the traffic.