Tim’s Weblog Tim's Weblog
Tim Strehle’s links and thoughts on Web apps, managing software development and Digital Asset Management, since 2002.

My comment on “PHP is meant to die” by Software Gunslinger

Software Gunslinger – PHP is meant to die:

“No matter how good or clever your idea looked on paper, if you want to keep the processes running forever they will crash, and will do it really fast under load, because of known or unknown reasons. That’s nothing you can really control, it’s because PHP is meant to die. The basic implementation, the core feature of the language, is to be suicidal, no matter what.”

I dare to disagree. We’ve been running PHP daemons on our (many) customer’s production servers for more than 15 years now (yes, on PHP 3 back then) and it has served us well. (The guy who was crazy enough to start this was a PHP Group member, so he knew what he was doing.)

There have been bugs and pain points throughout the years (as with every other technology): We discovered and reported a couple of memory leaks. We got to know gc_collect_cycles() and pcntl_signal_dispatch(). We learned to live with memory_limit (which is actually a feature keeping the processes from making the server swap due to a memory leak) the same way we have to live with JVM memory settings in Java-based software (I’m looking at you, Solr). Currently we have to tell cron to restart certain PHP processes once a day to work around a 5.3 memory leak. We’re using Supervisord for process control. (We’re storing jobs in the database, and a number of PHP CLI worker daemons process them in parallel.)

Still, all things considered, we’ve been able to run rock solid systems on many servers for more than a decade on command line PHP daemons. We’ve got a clean common PHP code base, used by both command line and Web page code. There’s certainly other ways to achieve this, but for us it’s still a very good setup.

(Via Jake A. Smith.)

Mon, 29 Apr 2013 10:49:38 +0000