KBD

Keith Devens .com

Sunday, July 20, 2008 Flag waving
Beauty is the first test: there is no permanent place in this world for ugly mathematics. – G. H. Hardy (A Mathematician's Apology)
← Amazon.com: Books: The Messiah: An Oratorio Complete Vocal Score (G. Schirmer's Editions of Oratorios and Cantatas)The NY Times bogus weapons-cache story →

Daily link icon Monday, October 25, 2004

Flickr and PHP

Here's a presentation on Flickr and PHP (PDF) (to read), via Christian Langreiter.

Ok, reading:

  • "PHP 4 doesn’t have good a XML parser" - hey!
  • "Normalised data is for sissies" - heh
  • "Lots of mailers are retarded" - yeah!
  • "PHP isn’t so great at being a daemon... Leaks memory like a sieve" Damn.
  • "Programmers mainly build tools for other programmers"
← Amazon.com: Books: The Messiah: An Oratorio Complete Vocal Score (G. Schirmer's Editions of Oratorios and Cantatas)The NY Times bogus weapons-cache story →

Comments XML gif

cal wrote:

that should have read:

PHP 4 doesn’t have good a XML parser built in

∴ cal | 27-Oct-2004 5:21pm est | #6109

Keith (http://keithdevens.com/) wrote:

Ha, it's all good. I should have put a smiley face next to that "hey" to make it clear I wasn't actually offended.

Keith | 27-Oct-2004 5:56pm est | http://keithdevens.com/ | #6110

calin (http://www.php9.com) wrote:

read more about this myth "PHP isn’t so great at being a daemon... Leaks memory like a sieve":

http://www.php9.com/index.php/archives/2004/10/28/php-leaks-memory-myths/

∴ calin | 28-Oct-2004 4:53am est | http://www.php9.com | #6119

Gaetano Giunta wrote:

I'll be darned! I've had lottsa PHP scripts running as daemons for years, and nobody ever told me that. Guess I'll have to shut them off now!!!

Facts:
- PHP engine does NOT leak memory on its own
- programmers are much more likely to have leaks in their own code

a very simple example: an array that is added a value every loop iteration, say $a[] = newelement();, and is never reset.

Just as with any other daemon, be careful in what you code. Close and reopen database connections whenever a SQL error is triggered (nr.1 tip), free resources as soon as you can and so on...

∴ Gaetano Giunta | 28-Oct-2004 6:47pm est | #6129

Keith (http://keithdevens.com/) wrote:

Well, it's good to hear some counterexamples about running PHP as a daemon. I haven't done it myself, so I don't have direct experience with it. I have to assume Cal did tests with it before he coded his daemon in Java and that he's speaking from experience.

Ah, here's a comment he left on the above post at php9.com:

that comment, “like a sieve", is from a presentation i made about how we were using php for an app which is currently doing the rounds.

our experiments with php showed that it wasn’t freeing memory correctly when large variables went out of scope. the tests were basically loading big files into memory, processing them with objects and then freeing all the data - the longer the process ran, the more memory it consumed. it’s possible that it’s been fixed since, but at the time this was one of the reasons why we didn’t write any daemons in php.

Another commenter on the page claims that even PHP 5 still "leaks quite a bit". So, it seems it's still something to be wary of, at least. I'll keep in mind your tip about closing and reopening db connections upon errors, thanks.

Keith | 28-Oct-2004 10:46pm est | http://keithdevens.com/ | #6136

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

July 2008
SunMonTueWedThuFriSat
 12345
6789101112
13141516171819
20212223242526
2728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 2 posts

Recent comments XML

Spider solitaire

To answer an earlier question, I am​almost certain every game can be​beat. ...

Jared: Jul 16, 2:20pm

I hate Norton Antivirus

I HATE NORTON ANTIVIRUS IT SUCKS I​GOT AVG IT ROX! AGES TO DELETE​NORTON AN...

wade: Jul 15, 1:44am

Generated in about 0.139s.

(Used 8 db queries)

mobile phone