[patch] pthread rwlock support

29 views
Skip to first unread message

Antony Dovgal

unread,
Feb 4, 2011, 4:29:23 AM2/4/11
to eaccelerator
Hello all.

I've been evaluating eAccelerator for some time here and found out that it
shows very high CPU usage under certain (pretty high) load.
Particularly about 150 rps I could see load average reaching ~30-40 (with 200 PHP-FPM processes running).
Another (completely identical) server running the same PHP binary but with APC showed LA about 4-5.

So it looks like spinlocks is not the best choice after all, therefore I spent some time and
added pthread rwlocks "semaphores" support to eAccelerator.
Here is the patch for trunk:
https://github.com/tony2001/eaccelerator/commit/3b673d229a92872072e940ed934c051ee3cc86ff

I can confirm that the patch does indeed fix this particular problem for me.

I also took the liberty of applying some minor patches to configure and sources:
* changed config.m4 to use proper PHP_ARG_WITH/PHP_ARG_ENABLED routines
* added semaphores and shared memory type to phpinfo() output
* fixed lots of typos =)

You can find the sources in the master branch:
https://github.com/tony2001/eaccelerator/commits/master

I'm going to continue working on some optimizations for eAccelerator,
what I have at the moment is located in the alt branch:
https://github.com/tony2001/eaccelerator/commits/alt

--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime statistics for PHP

Antony Dovgal

unread,
Feb 4, 2011, 5:01:39 AM2/4/11
to cronfy, eaccelerator
On 02/04/2011 12:36 PM, cronfy wrote:
> Hello,
>
> Why did you prefer eAccelerator over APC?

I didn't say I do.
I just said I've been evaluating it.

> APC supports variable storage in shared memory

We don't use it here, so this is not a factor to me.

> and looks for us to work more stable with different CMS's. Would like
> to know your opinion.

At the moment we experience quite frequent deadlocks with APC and Gopal
(he's behind APC) wasn't able to help us with that.

See here for more details:
http://bugs.php.net/bug.php?id=46025
http://pecl.php.net/bugs/bug.php?id=17589
I did try the patch in the report, it didn't change anything.

That said, we've been happy with APC for quite some time (several years in fact),
the problem with the deadlocks has arised after we've reached certain load.
There is also a problem of mysterious fatal errors appearing from time to time,
but it's so sporadic I'm not even sure it's APC's fault.

eAccelerator on the other hand doesn't seem to suffer from these problems.
Which doesn't mean that it won't deadlock if we add some more load, of course.

As I've already said, I'm just looking at the things and trying to figure out a way to make things work.
ATM eAccelerator sources look quite simple to me (comparing to APC sources) and I believe
I should be able to tweak them the way I need instead of relying on maintainer to do it.

Reply all
Reply to author
Forward
0 new messages