{"id":1646,"date":"2013-04-29T00:00:00","date_gmt":"2013-04-28T22:00:00","guid":{"rendered":"https:\/\/wwwneu.strehle.de\/tim\/weblog\/archives\/2013\/04\/29\/1597\/"},"modified":"2013-04-29T00:00:00","modified_gmt":"2013-04-28T22:00:00","slug":"1597","status":"publish","type":"post","link":"https:\/\/www.strehle.de\/tim\/weblog\/archives\/2013\/04\/29\/1597\/","title":{"rendered":"My comment on \u201cPHP is meant to die\u201d by Software Gunslinger"},"content":{"rendered":"<p>Software Gunslinger \u2013 <a href=\"http:\/\/software-gunslinger.tumblr.com\/post\/47131406821\/php-is-meant-to-die\">PHP is meant to die<\/a>:<\/p>\n<p>\u201cNo 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\u2019s nothing you can really control, it\u2019s because PHP is meant to die. The basic implementation, the core feature of the language, is to be suicidal, no matter what.\u201d<\/p>\n<p>I dare to disagree. We\u2019ve been running PHP daemons on our (many) customer\u2019s production servers for more than 15 years now (yes, on PHP 3 back then) and it has served us well. (The <a href=\"http:\/\/de.linkedin.com\/in\/thiescarntzen\">guy<\/a> who was crazy enough to start this was a PHP Group member, so he knew what he was doing.)<\/p>\n<p>There have been bugs and pain points throughout the years (as with every other technology): We discovered and <a href=\"https:\/\/bugs.php.net\/search.php?search_for=leak&amp;boolean=0&amp;limit=30&amp;order_by=&amp;direction=DESC&amp;cmd=display&amp;status=All&amp;bug_type=All&amp;project=All&amp;php_os=&amp;phpver=&amp;cve_id=&amp;assign=&amp;author_email=tim%40digicol.de&amp;bug_age=0&amp;bug_updated=0\">reported<\/a> a couple of memory leaks. We got to know <a href=\"http:\/\/www.php.net\/manual\/en\/function.gc-collect-cycles.php\">gc_collect_cycles()<\/a> and <a href=\"http:\/\/www.php.net\/manual\/en\/function.pcntl-signal-dispatch.php\">pcntl_signal_dispatch()<\/a>. 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\u2019m 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\u2019re using <a href=\"http:\/\/supervisord.org\">Supervisord<\/a> for process control. (We\u2019re storing jobs in the database, and a number of PHP CLI worker daemons process them in parallel.)<\/p>\n<p>Still, all things considered, we\u2019ve been able to run rock solid systems on many servers for more than a decade on command line PHP daemons. We\u2019ve got a clean common PHP code base, used by both command line and Web page code. There\u2019s certainly other ways to achieve this, but for us it\u2019s still a very good setup.<\/p>\n<p>(Via <a href=\"https:\/\/twitter.com\/jakeasmith\/status\/328735585302888449\">Jake A. Smith<\/a>.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Software Gunslinger \u2013 PHP is meant to die: \u201cNo 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\u2019s nothing you can really control, it\u2019s because PHP is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_share_on_mastodon":"0"},"categories":[1],"tags":[],"class_list":["post-1646","post","type-post","status-publish","format-standard","hentry","category-weblog"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/posts\/1646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/comments?post=1646"}],"version-history":[{"count":0,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/posts\/1646\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/media?parent=1646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/categories?post=1646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/tags?post=1646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}