views:

445

answers:

1

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.

+2  A: 

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.

Patrick Allaert