Reply to Re: Garbage collection

Your name:

Reply:


Posted by Jerry Stuckle on 04/27/07 04:02

Iván Sánchez Ortega wrote:
> amygdala wrote:
>
>> Finally my gutfeeling tells me, that when a script stops, the memory that
>> was taken up by the script would clear instantly, but that doesn't always
>> seem the case considering what some people here have mentioned about it.
>> What's the real deal?
>
> Keep in mind things like persistent database connections - they'll use a
> little bit of resources, but they're worth on the ling run. Session
> variables also take some resources.
>

I disagree here. I have never found a use for persistent connections in
your average site.

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).

For instance - if you have a Halloween site with get real popular on
October 31st. You could need 100 connections for a short while. But
since you're using persistent connections, you'll need at least 100
connections allocated all the time.

OTOH, using non-persistent connections mean you're only using them when
you need them. On your average site this will probably average out to
well under 1 connection over a period of time. But on Halloween you can
get the 100 connections.

And connecting does take that long - most of the time it's completely
unnoticeable.

Google, which is constantly accessing their database thousands of times
per second would be a good case for persistent connection. But I don't
personally know anyone who's averaging even a dozen concurrent db
connection over a day, much less the entire year.

> Also, the PHP interpreter is smart enough to cache the *code* of the
> script - obviously, the heap and stack of every run is destroyed after the
> run is complete. Expect the PHP engine to keep half-parsed code somewhere
> in memory.
>
>
>
> But, as I always say, PHP is a high-level language - the Zend guys worry
> about memory allocation so you don't have to. You *do* have to worry about
> the algorithms your app use: they make the real difference.
>
> If you were programming in C, I'd tell you lots of memory management tips.
> But now, I'll tell you to go to your library to read the Design Patterns
> book (by the Gang of Four). Make a beautiful design, implement nice
> algorithms, don't worry about the low-level stuff.
>
>
>
> Cheers,


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

[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

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