PHP APC Potential Cache Slam Averted for Key

APC opcode cache TTL lockup

APC opcode cache TTL lockup

This server uses PHP 5.3 with PHP-FPM (FastCGI Process Manager) patch and APC opcode cache. Several minutes after activating APC, I noticed that some pages stopped loading. Turns out it was because of an APC timebomb bug which is when all cache writes got locked because of expiring cache entries and new writes happening at the same time. The temporary solution is to add apc.slam_defense = 0 and apc.write_lock = 1 in php.ini.

2 Comments

  1. Steve says:

    Thanks! what’s the permanent solution?

    • kaspars says:

      I think the permanent solution is to add apc.slam_defense = Off; to php.ini or to use the latest version of PHP which should have this fixed by now.

Leave a Reply