dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.96k stars 244 forks source link

perf: improve php_server directive #1180

Closed dunglas closed 1 day ago

dunglas commented 4 days ago

Prevents some I/O accesses when disabling the file server and when disabling index files in subdirectory support.

AlliBalliBaba commented 2 days ago

I wonder if it would also make sense to cache the location of existing index files (unless that's something you're already doing here). The only disadvantage would be that when the index file is deleted, we'd get a PHP 500 instead of a 404.

dunglas commented 1 day ago

I think it's a good idea. We'll have to introduce a LRU cache in Caddy to do that. It may also be needed for another optimization I have in mind: caching if files (assets) exist or not for some time (configurable).

That being said, I'm currently optimizing for the framework case (Laravel/Symfony), and I think that for this specific (but very common) case I'll be able to get 0 to disk access with https://github.com/caddyserver/caddy/pull/6699 and some extra tricks to come.