Guspaz wrote:
I wrote a long-lived PHP daemon back in the day (years ago, an IRC bot that managed some channels, supported custom plugins, etc) and it seemed to work pretty well. What makes PHP or Java well or poorly suited for writing a daemon? Is it just a matter of an inefficient garbage collector or something?
PS: Writing the IRC bot was a fun exercise. Funny how a lot of the programming-for-fun that I do falls into the "useless or unnecessary but fun" category. Loading plugins dynamically by including them when executed, for example, is basically a memory leak. Running the plugins in a separate instance of the PHP interpreter with a standardized manner of passing information back and forth, on the other hand, worked better.
Mmm, GC is actually nicely done in 5.3+, that's not the real issue - threading/forking is when you start getting into very very painful things. Single-threaded daemons that don't mind blocking is fine, but non-blocking execution is absolutely frightening.
(I wrote my own IRC bot in php as well, turned out quite well with uptimes of up to two months without leakage or breakdowns of any sort, and was a great learning experience - am currently rewriting her in node.js to learn node itself, and take advantage of node's async behavior)