swooletw / laravel-swoole

High performance HTTP server based on Swoole. Speed up your Laravel or Lumen applications.
MIT License
4.04k stars 390 forks source link

[question] does this support mysql persistent connection or mysql connection pooling #531

Closed Kristian-Tan closed 1 year ago

Kristian-Tan commented 2 years ago

This is question rather than issue/bug.

Does this support mysql persistent connection or mysql connection pooling?

https://openswoole.com/docs/modules/mysqli-connection-pool

Quoted from link above:

Connection pool is used to reduce the TCP reconnect overhead, can be used to increase the application performance. You can use the build-in MysqliPool to manage a pool of connection to database servers or remote services.

Edit: after a little observation, it seems that it defaults to using persistent connection (reusing same connection for each workers, the number of active connection in SHOW FULL PROCESSLIST equals to config.swoole_http.worker_num config), but does not support connection pool. I've also tried to add 'options' => [ \PDO::ATTR_PERSISTENT => true/false, ], in config/database.php inside connections item but it still persistent

Observed (cmiiw):

Arkanius commented 1 year ago

Hi @Kristian-Tan ,

you're right, we dont support connection pool, our implementation uses persistent connection