Very slow connection to mariadb server

43 views Asked by At

I've 3 debian's servers:

  • Server A: debian with Apache, PHP...
  • Server B (old): debian with MySQL
  • Server C (new): debian with mariadb

When server A connects to server B, it's very fast: around 0,002s, but when server A connects to server C, it's slow: between 0,3s and 1,5s!

I am using this code to test:

$begin = microtime(true);
$db_c = new PDO('mysql:host='.$dburl.';dbname='.$dbtable.';charset=utf8',$dblogin,$dbpass);
$db_c->query("SET NAMES 'utf8'");
$db_c->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$end = microtime(true);
$temps = $end - $begin;`

When I tried to ping server B or C from serer A, I got the same response.

I tried to modify lot of global variables of mariadb. I used the previous global variables of server B to have the same, or better. But nothing changes.

0

There are 0 answers