PHP-FPM and APC for shared hosting?
- by Tiffany Walker
We are looking into finding a way to get APC to only create one cache per account / site. This can be done with Fastcgi (last update 2006…) but with Fastcgid APC will have to create multiple caches for multiple processes run by the same account.
To get around this problem, we have been looking into PHP-FPM
PHP process manager allows multiple PHP processes to share a single APC cache.
But from what I have read (I hope I'm wrong) , even if you create a pool per process, all sites accross all pools will share the same APC cache. This brings us back to the same problem as with shared Memcached: it's not secure !
On php-fpm's site I read that you can chroot php-fpm pools and define a specific UID and GID per pool… if this is the case then shouldn't APC have to use this user and not have access to other pools cache ?
An article here (in 2011) suggests that you would need to run one process per pool creating multiple launchers on different ports and different config files with one pool per config file :
http://groups.drupal.org/node/198168
Is this still neceessary ?
If so what would be the impact of running say 800 processes of php-fpm ? Would it be mainly memory ? If so how can I work out what the memory impact would be ?
I guess that it would be better to run 800 times php-fpm then to have accounts creating multiple APC caches for a single site ?
If on average an account creates a 50MB cache and creates 3 caches per account that makes 150Mb per account which makes 120GB…
However if each account uses on average only 50Mb that would make 40GB
We will have at least 128GB of ram on our next server so 40GB is acceptable if running 800 x PHP-FPM does not create an overhead of more than 20GB !
What do you think is PHP-FPM the best way to go to provide secure APC cache on shared hosting with a server that has a decent amount of memory ?
Or should I be looking at another system ?
Thanks !