Reply to Re: Connection pool

Your name:

Reply:


Posted by David Haynes on 06/08/06 15:43

Jerry Stuckle wrote:
> lorento wrote:
>> Ike wrote:
>>
>>> Is anyone aware of a means of connection pooling (to MySQL, say) in php?
>>> Thanks, Ike
>>
>>
>> Making a new connection at database server using much resources like
>> memory and cpu.
>>
>> Connection pool is a cache of database connection. Instead of making
>> new connection, database server reused the old connection. This method
>> can increase performance and use few memory.
>>
>> regards,
>>
>> Lorento
>> --
>> http://blogs.deshot.com
>> http://www.mastervb.net
>> http://www.groupvita.com
>>
>
> Making a new connection takes some cpu, that's true. But it's not a
> lot. Sure, you don't have the connection overhead with a pool - but
> then you have the overhead of finding a free connection in the pool.
>
> And yes, making a new connection takes some memory. The difference is
> that when you're through with the non-pooled connection the memory is
> released. With pooled connections it isn't.
>
> Pooled connections require you to keep open the maximum number of
> connections you might ever need, and the system resources associated
> with. So if you have a bump at lunchtime and need 50 connections, you
> have to have at least 50 connections around, even at 3AM when almost no
> one is on. With non-pooled connections you only use the resources you
> need right now.
>
> Pooling is fine if your site needs dozens of database connections per
> second. Not too many websites come even close to that, though, and
> connection pooling can actually hurt system performance.

In general, I agree with you Jerry, except when you say 'So if you have
a bump at lunchtime and need 50 connections, you have to have at least
50 connections around, even at 3AM when almost no one is on.'

Most of the connection pools I have dealt with have high and low water
levels (the high to prevent demand from consuming the system and the low
to specify the minimum number of active connections). The pool then
spawns new connections on an 'as needed' basis and releases them after
some timeout period. In this respect, they act like a heap manager with
garbage collection.

Searching for a free connection can be O(1) if the connections are kept
on their own free list.

Connection pools typically require some means of persisting the shared
pool across all the programs that want access to the database which
usually rules them out if php is driven via CGI.

-david-

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация