Skip to content

APCu cache fragmentation can cause PHP processes to lock up #138

@danielbachhuber

Description

@danielbachhuber

This issue is long overdue but...

Pantheon isn’t running WP LCache in production because we’ve discovered a problem with APCu’s memory allocation algorithm. If your configuration gets to a point where APCu is >95% full and heavily sharded, then APCu can cause your PHP processes to lock up and your web node to stop serving requests. This is a problem specific to APCu, and not LCache, so you could see it manifest with any APCu-based object cache drop-in.

[...]

At a high level, the memory allocation problem manifests itself when the APCu is heavily fragmented and close to full (> 99% utilization). It reproduces consistently if you can mock the environment correctly. The symptom of the issue is that PHP processes begin to lock up when APCu can no longer write new cache entries. One process locking causes all of the other processes to lock because APCu becomes inaccessible.

Here’s a script you can use to reproduce the issue in a test environment: https://gist.github.com/danielbachhuber/e0b39ae91a6a2b7ab79232df145f8b5a

From https://wordpress.org/support/topic/heavy-iops-and-database-use/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions