php phalcon框架数据库连接改为长连接后,插入性能极大提升

php phalcon框架数据库连接改为长连接后,压力测试插入性能极提升3倍多

<?php
 
// Create a connection with PDO options
$connection = new \Phalcon\Db\Adapter\Pdo\Mysql(
    [
        "host"     => "localhost",
        "username" => "root",
        "password" => "sigma",
        "dbname"   => "test_db",
        "options"  => [ //这里加上此附加参数
            PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'",
            PDO::ATTR_PERSISTENT => true,//长连接
        ]
    ]
);

 

php phalcon框架数据库连接改为长连接后,插入性能极大提升
标签: