Uh oh!
There was an error while loading. Please reload this page.
Conversation
AlliBalliBaba
commented
Oct 10, 2024
Leak should be fixed. I think caching the os environment is the expected default for worker mode. I can add it as optional to the Caddy config though |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dunglas
commented
Oct 11, 2024
I'm in favor of both adding this cache (without an option to disable it) to mimick the FPM behavior and merging #1086. Very good work again! |
dunglas
commented
Oct 12, 2024
Can we merge this one? |
I think we can probably merge this. Super-globals (or auto_globals) still have some weirdness about them that I'm trying to understand. Their |
dunglas
commented
Oct 15, 2024
Thank you! |
I noticed that php_import_environment_variables will lock and increasingly slow down the server as more environment variables are imported.
Since many frameworks will cache environment variables in production, the import often ends up being redundant. I think it would make sense to only import them once per thread, at least in worker mode.
Some open points:
Here is a graph showing that the server slows down with an increasing amount of environment variables .

When we load the environment from a
zvalthat's cached on the thread, the slowdown is much less significant:the env variables have ~40 characters each
Note that 10 threads is the 'ideal' amount of threads on my 20 core machine when PHP does minimal work