You are here: Re: Garbage collection « PHP Programming Language « IT news, forums, messages
Re: Garbage collection

Posted by Jerry Stuckle on 05/01/07 02:46

Chung Leong wrote:
> On Apr 27, 5:02 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> Using persistent connections mean you need to allocate the maximum
>> connections you might ever need - and keep them allocated all the time.
>> This takes resources away from both the OS and the DBMS (and your
>> network if the DBMS is on a different server).
>
> That's not entirely true. In a Apache + PHP system, there would be one
> persistent connections (of one type) per child process. The number of
> idle processes does not equal the maximum number of connections.
> Apache will spawn more child processes as necessary. And it will shut
> down extra spares if there are too many. Persistent connections owned
> by these unwanted children would then be closed.
>
> Persistent connections are problematic when the number of database
> connections are limited. When the number of Apache processes exceeds
> this number, obviously some of them wouldn't be able to get a
> connection. And those that do own connections might not even be using
> them--they could be handling file downloads for instance.
>
> I think it's conceivable that a server could run out of database
> connections while there is zero database activity:
>
> 1. A visitor goes to page to download a file
> 2. The PHP script open a persistent connection in order to log the
> download in the database
> 3. The browser reuses the same HTTP connection (keep-alive) for the
> download
> 4. For the next three hours, the child process handling the request
> just sits on the DB connection
>
> Repeat a hundred times or two and all connections will be exhausted.
> Not an efficient scheme at all.
>

Chung,

Ah, but the number of persistent connections is a MySQL parameter, and
is not limited to the Apache process. They may be C/C++ connections,
for instance. Or CLI, PEAR, or anything else which can connect to MySQL.

It has nothing to do with the number of Apache processes running - MySQL
will keep the connections open even if Apache itself shuts down.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this 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

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