Is the new APCu APC User Cache shared between processes?

I am planning to use the php5-apcu ubuntu package.

Is the data shared between processes? In other words, if I set a cache entry in one website load, will another website load have the cache entry available, even if it is served with another process?

How does this work for:

  • the apache2 php prefork module
  • php5 fpm with multiple workers
  • php-cli

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

https://github.com/krakjoe/apcu/issues/121

The rule is that only child processes can access what their parent created; In FCGI spawned processes are not necessarily a child of their parent, they may not be actual forks. If your process manager works like conventional FCGI/CGI then you will not be able to share, if it works like FPM, and initializes PHP in a parent and forks child interpreters then you will have no problem.

Apache’s prefork and PHP’s FPM will share between worker processes (via the parent’s memory space).

The CLI will not, as each CLI invocation is a separate process.

You might consider something like memcached or redis as an alternative.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply