Hacker News new | ask | show | jobs
by znpy 483 days ago
> Traditionally, PHP/Ruby/Python have had a process per request model

That's completely wrong for python/ruby (unless you're writing cgi scripts).

Regarding php, that's an assumption that's usually wrong as well.

Apache's mod_php will load the php interpreter within apache and keep it resident.

php-fpm will usually keep a number of processes around and not restart them unless you configure pm.max_requests to something above zero. See https://www.php.net/manual/en/install.fpm.configuration.php and look for 'pm.max_requests'

In my opinion the greatest tragedy of php is that most libraries and frameworks are written under the assumption that the whole environment will be thrown away and the whole process killed after the current request is served and thus that it's perfectly fine to litter the address space with garbage (and php's garbage collection is nothing fancy, really).

Php people should really start assuming the process executing their code will stay around (and that restarting processes is really an anti-pattern).