Is the new APCu APC User Cache shared between processes?
Asked Answered
F

1

5

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
Fremantle answered 30/12, 2015 at 16:55 Comment(1)
You might need Memcached, it does that (as opposed to APCu)Marylnmarylou
C
13

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.

Capriola answered 30/12, 2015 at 16:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.