• Hi,
    I’m thinking about using Opcache on server with WordPress (only). I’m looking for advice on the validate_timestamps settings. By default it is enabled so PHP will check the file timestamp for the opcache.revaliddate_freq value.

    But I read somewhere that if you are updating the new code files could get mixed up with old ones so it seems a bit unsafe.

    An option would be to disable opcache.revalidate_freq so PHP files are never checked for updated code. Code modifications are only run after restart of reload of PHP this way which is a bit of a hassle with for example automatic WordPress udpates.

    So would enabling opcache.validate_timestamps be a problem with a server that has only wordpress sites?

    • This topic was modified 4 years, 3 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Yui

    (@fierevere)

    永子

    Code modifications are only run after restart of reload of PHP this way which is a bit of a hassle with for example automatic WordPress udpates.

    If you are sure that PHP will be restarted after update, then you can disable opcache.validate_timestamps

    You still can set a large value for opcache.revalidate_freq
    to be safer, instead of disabling timestamp validation.

    Performance boost is minimal, so i dont see real point in disabling opcache.validate_timestamps

    fstat() calls on fast server and fast filesystem (on SSD) with enough free memory (available for filesystem cache) should be fast to keep opcache.revalidate_freq in range of 3-15 sec

    PS: here are good news for you with WordPress 5.5

    Opcode Cache Invalidation in WordPress 5.5

    • This reply was modified 4 years, 3 months ago by Yui.
    Thread Starter handig

    (@handig)

    Thanks. The WP 5.5 news is really nice. In the meantime I was thinking about using WP OPcache plugin to automatically flush opcache when WordPress is updated.

    And I was thinking about setting opcache to:
    opcache.revalidate_freq=60
    opcache.validate_timestamps=1

    This way updated pages are ‘there’ in 60 seconds.

    And other non-default opcache settings:
    opcache.memory_consumption=512
    opcache.max_accelerated_files=50000
    to avoid opcache to be full/prevent opcache to restart cache.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Should opcache.validate_timestamps be enabled or disabled?’ is closed to new replies.