Login
You're viewing the ruby.social public feed.
  • Apr 29, 2025, 7:56 AM
    Has anyone seen measurable performance improvements from #PHP opcache preloading?
    I tried to set it up on a test setup but could not see any improvements, I do not know if that means I’m doing it wrong or not preloading enough stuff, or if the feature simply got obsoleted by better auto preloading integrated in PHP newer versions or something.

    The benchmarks at the time of 7.4 release says there was a 10% speedbump at the time.

    Boosts welcome.
    💬 1🔄 0⭐ 0

Replies

  • Apr 29, 2025, 8:20 AM

    @come preloading will cut time in two things from each request: loading the .php files from disk and compile them to bytecode and keep in RAM. It will only help if you have slow disks (HDDs), bad disk caches or tons of classes/functions.

    I’ve used with Magento (circa 50k classes) with PHP 7.4 and it was measurably better, but I didn’t bother with smaller projects (WP, Symfony)

    💬 0🔄 0⭐ 0
  • Apr 29, 2025, 8:22 AM

    @kassner @come There is also a little optimisation, where inheritance can be resolved at "compile time", so that it doesn't have to be done when the code is running.

    I've also never seen an improvement in production.

    💬 0🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • Apr 29, 2025, 9:19 AM

    @ocramius @come and I think its important to say, the first startup where the opcache is usually still cold is exactly the usecase the preloading tries to solve.

    For most people thats neglectable, but for others where they regularly scale up/down number of instances, which directly need to handle >100 parallel requests, that makes the initial boot up a lot more stable.

    💬 0🔄 0⭐ 0