Mysql – PHP connection for Mysql is very slow in another server

MySQLmysql5

Few days ago, we moved our mysql database to another host because of some limitations with our current host. Everything is fine (Seem same performance and speed on our PHP framework based website) except one script that executes a mass update between two tables and excel files. This script would take less than 3 hours to update inventory before(PHP and mysql were hosted on same company). But, same script is taking about 9/10+ hours to update inventory in new database server(that's the only change we made and database is now hosted on another company). I just know that performance can depend on mysql server version too. But, is not that too much? Could I improve that?

Best Answer

If the servers are no longer located together in the same hosting, it is fairly normal that things will be slower. There are things you can do to reduce overhead, like connection pooling, and ensuring that the mysql connection has dedicated bandwidth, but it's doubtful you'll be able to reproduce the sort of speed and bandwidth you had between two machines in a single data center.

The other thing you could try is running the update script entirely on a machine located in the same DC as your MySQL server.

Related Topic