Even with object serialization (PDO objects cannot be serialized). As far as I known we cannot pass PDO instances from gearman worker to gearman client. $dbh = new PDO('pgsql:dbname=pg1 host=localhost', 'user', 'pass') īasically the idea is to use a gearman worker to perform every database operations. This is an example of SELECT statement with PDO and PHP Another purpose of this experiment is create a prepared statements’ cache not only for the current request but also for all ones. In this post I’m going to try to explain a personal experiment to create a connection pooling using gearman. There are some third-party solutions like SQL relay or pgpool2 (if you use PostgreSQL like me). ![]() We need to create the connection in every request. We cannot create a pull of database connections. Just open database connection, perform the actions we need, and close it. Handling Database connections with PHP is pretty straightforward.
0 Comments
Leave a Reply. |