新的APCu APC用户缓存是否在进程之间共享? [英] Is the new APCu APC User Cache shared between processes?

查看:272
本文介绍了新的APCu APC用户缓存是否在进程之间共享?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算使用php5-apcu ubuntu软件包.

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?

这是如何工作的:

  • apache2 php prefork模块
  • php5 fpm,有多名员工
  • php-cli

推荐答案

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

规则是,只有子进程可以访问其父级创建的内容;在FCGI中,产生的进程不一定是其父进程的子进程,它们可能不是实际的派生进程.如果您的流程管理器像传统的FCGI/CGI一样工作,那么您将无法共享,如果它像FPM一样工作,并且在父级中初始化PHP并派生子解释器,那么您将没有问题.

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的prefork和PHP的FPM将在工作进程之间共享(通过父进程的内存空间).

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

CLI不会,因为每次CLI调用都是一个单独的过程.

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

您可以考虑使用诸如memcached或redis之类的东西作为替代.

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

这篇关于新的APCu APC用户缓存是否在进程之间共享?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆