diff --git a/extra/hhvm.conf b/extra/hhvm.conf index 6e497da8..a51bf41f 100644 --- a/extra/hhvm.conf +++ b/extra/hhvm.conf @@ -24,3 +24,9 @@ hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc hhvm.mysql.socket = /var/run/mysqld/mysqld.sock hhvm.pdo_mysql.socket = /var/run/mysqld/mysqld.sock hhvm.mysqli.socket = /var/run/mysqld/mysqld.sock + +# MySQL Optimization +# Use persistent connections and higher timeout +hhvm.mysql.connect_timeout = 1500 +hhvm.mysql.read_timeout = 2000 +hhvm.mysql.max_retry_open_on_fail = 3 diff --git a/src/Db.php b/src/Db.php index 7e101906..e8837385 100644 --- a/src/Db.php +++ b/src/Db.php @@ -17,8 +17,10 @@ public static function getInstance(): Db { private function __construct() { $this->config = parse_ini_file($this->settings_file); $options = array( - 'idle_timeout_micros' => 200000, + 'idle_timeout_micros' => 2000000, 'expiration_policy' => 'IdleTime', + 'per_key_connection_limit' => 20, + 'pool_connection_limit' => 20 ); $this->pool = new AsyncMysqlConnectionPool($options); }