Binding MySQL to run from the public or private LAN IP address - which one is faster
So we have 2 servers all running at the same web host. We have bind MySQL to listen on the public ip-address of the database server and the web server connects to it from the public ip. Both servers run on the same private network.
Currently, the DB connect method from our php script takes about 3ms to connect to the MySQL database server host.
My question is, would MySql data interaction from the web server be faster if we bind it to listen on the private lan address on the database server instead of the public IP? or is it the same regardless and it wont make a different.
Solution 1:
Packets to the public ip most likely travel through your firewall, and packets to the private ip most likely don't. So yes, it will probably be (slightly) faster to use the private ip.