如何更改替代 PHP 缓存 (APC) 中的锁定机制?

发布于 2024-08-10 19:14:36 字数 307 浏览 9 评论 0原文

我最近在 Scribd 上的一个演示中读到,Facebook 对 APC 的各种锁定机制进行了基准测试,包括文件锁(默认)、IPC 信号量锁、linux Futex 锁、pthread 互斥锁和自旋锁。您可以通过单击以下链接查看此演示文稿: APC@Facebook

我想知道是否有人知道这些源代码是否已经发布,也许在 git 或 SVN 存储库中的某个地方?从默认文件锁定切换到其他选择之一的速度优势似乎非常显着。

I recently read in a presentation on Scribd that Facebook had benchmarked a variety of locking mechanisms for APC including file locks (default), IPC semaphore locks, linux Futex locks, pthread mutex locks, and spin locks. You can view this presentation by clicking the following link: APC@Facebook

I was wondering if anybody knew off hand if any of this source code had been released, perhaps in a git or SVN repository somewhere? The speed benefits of switching from the default file locking to one of the other choices appears to be significant.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

耳根太软 2024-08-17 19:14:36

是的,它们包含在 http://pecl.php.net/package/APC。

请注意,您必须在编译时选择此选项,更准确地说:在 ./configure 时。以下是./configure的相关选项:

--enable-apc-sem            Enable semaphore locks instead of fcntl
--disable-apc-pthreadmutex  Disable pthread mutex locking
--enable-apc-spinlocks      Enable spin locks  EXPERIMENTAL

如您所见,pthread互斥锁现在已经是默认值。

Yes, they are included in source code available at http://pecl.php.net/package/APC.

Note that you have to choose this at compilation time, more precisely: at ./configure time. Here are the relevant options of ./configure:

--enable-apc-sem            Enable semaphore locks instead of fcntl
--disable-apc-pthreadmutex  Disable pthread mutex locking
--enable-apc-spinlocks      Enable spin locks  EXPERIMENTAL

As you see, pthread mutex locking is already the default now.

最后的乘客 2024-08-17 19:14:36
vi /etc/php.d/99_apc.ini

然后设置:

; Locking type = spinlock
extension = apc-spinlocks.so

; Locking type = IPC Semaphore
extension = apc-sem.so

等等。

vi /etc/php.d/99_apc.ini

then set:

; Locking type = spinlock
extension = apc-spinlocks.so

or

; Locking type = IPC Semaphore
extension = apc-sem.so

etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文