News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Gonzalo Ayuso's Blog:
Database connection pooling with PHP and gearman
November 01, 2010 @ 09:07:51

Gonzalo Ayuso has a new post to his blog today looking at using the Gearman tool to pool database connections for his application and make them available for easy reuse.

Handling Database connections with PHP is pretty straightforward. Just open database connection, perform the actions we need, and close it. There's a little problem. We cannot create a pool of database connections. We need to create the connection in every request. Create and destroy, again and again. [...] In this post I'm going to try to explain a personal experiment to create a connection pooling using gearman.

He includes a basic database connection example with PDO, logging into a single database and fetching all of the results. To integrate this into the gearman functionality, he creates a configuration class to hold connection details and the worker code (along with some libraries to help manage the connections) that gets the results, serializes them and returns them back to the calling script.

0 comments voice your opinion now!
database connection pool gearman pdo


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: Work with XML Data in the Zend Framework

Chris Hartjes' Blog: The Devilís In The Details (or, Handling Sequences in Postgres in CakePHP)

NetTuts.com: Working With Databases in Symfony 2

Zend Developer Zone: Tutorial : Using Zend Framework Without PDO

DevShed: Working with Prepared Queries with PDO Objects in PHP 5


Community Events

Don't see your event here?
Let us know!


library extension opinion middleware voicesoftheelephpant community podcast development unittest laravel5 conference language framework series interview api introduction laravel release wordpress

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework