2 ms·
s/you built/you spent LLM tokens to build/g The general idea makes sense. PHP, particularly modern Java-style PHP, is notorious for loading sometimes thousands
by mschuster91 7d ago
s/you built/you spent LLM tokens to build/g
The general idea makes sense. PHP, particularly modern Java-style PHP, is notorious for loading sometimes thousands of files for every single request. I think there's opcache enabled by default, so the load on the filesystem is reduced by quite a bit, but even opcache still needs to do some sort of parsing for each request that comes in.
- noir_lord 7d ago> I think there's opcache enabled by default. Indeed, it's on by default in 8.5 and is no longer considered a non-optional extension (it's compiled in) - you can turn it off at runtime but it will be bundled, largely so they could have it on my default[1][2] and it simplifies integration of something that was universally integrated de facto before that. It was probably due/overdue but I actually like that they are conservative with which extensions become part of the "core" and in reality almost every packaging of PHP has included it back to 5.5 and having worked on large production systems written in PHP I can't think of a single one that didn't use it it in production. There is also FrankenPHP (and others) which negate much of that overhead (in worker mode). While introducing other issues you do have to be careful of that would be less of an issue in "classic" mode (literally what FrankenPHP calls it). There isn't a tonne of good info out of what you gain in the switch from nginx/php-fpm to FrankenPHP though it does seem like you do gain in some ways (but it's very application dependent). [1] https://wiki.php.net/rfc/make_opcache_required https://wiki.php.net/rfc/make_opcache_required [2] https://www.php.net/manual/en/opcache.configuration.php https://www.php.net/manual/en/opcache.configuration.php
- EGreg 7d agoWhether the opcache is enabled or not, the vast majority of production PHP code is I/O bound - workers wait for the network or filesystem or database. Roadrunner, FrankenPHP and Swoole try to make it evented like Node, but require you to rewrite all your code to use their libraries. For everything from mysql to curl. This lets you run your PHP unmodified, in 2 different ways: 1) with long persistent workers, clearing all statics and globals between requests 2) if that doesn’t work, eg because your functions have static variables inside etc. then you can use the fork mode, which can still handle 100x as many users as php-fpm due to the amount of RAM each of the workers takes up aa that’s the point!