---
title: PHP APC Potential Cache Slam Averted for Key
date: 2010-04-28T11:08:07+00:00
modified: 2013-02-24T11:25:45+00:00
image:: https://kaspars.net/wp-content/uploads/2010/04/ttl_lockup.png
permalink: https://kaspars.net/blog/php-apc-potential-cache-slam-averted-for-key
post_type: post
author:
  name: Kaspars
  avatar: https://reverse.kaspars.net/gravatar/avatar/92bfcd3a8c3a21a033a6484d32c25a40b113ec6891f674336081513d5c98ef76?s=96&d=mm&r=g
post_tag:
  - Nginx
category:
  - Web Performance
  - WordPress
---

# PHP APC Potential Cache Slam Averted for Key

[![APC opcode cache TTL lockup](https://kaspars.net/wp-content/uploads/2010/04/ttl_lockup.png?strip=all&quality=90&resize=500,355 "APC opcode cache TTL lockup")](http://t3.dotgnu.info/blog/php/user-cache-timebomb)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](http://t3.dotgnu.info/blog/php/user-cache-timebomb) 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`.