[Info-vax] Apache + mod_php performance

Dan Cross cross at spitfire.i.gajendra.net
Fri Sep 27 10:16:31 EDT 2024


In article <vd6dh4$nrif$1 at dont-email.me>,
Arne Vajhøj  <arne at vajhoej.dk> wrote:
>On 9/27/2024 9:18 AM, Craig A. Berry wrote:
>> On 9/26/24 9:17 PM, Arne Vajhøj wrote:
>>> On 9/26/2024 9:26 PM, Lawrence D'Oliveiro wrote:
>>>> On Thu, 26 Sep 2024 21:20:38 -0400, Arne Vajhøj wrote:
>>>>> A very quick search make me think that the mailbox is only used for
>>>>> control not for data.
>>>>
>>>> Could still be a bottleneck, though.
>>>
>>> If it is only used for the parent to signal the child to terminate?
>>>
>>>>                                      That and the need for all the ASTs.
>>>
>>> Why should AST's be a problem?
>>>
>>> The "call this function when task is done" approach is
>>> a very common design today. DEC was ahead of time with
>>> that.
>>>
>>> And implementation wise then the AST's worked on VAX 700
>>> series 45 years ago. Todays systems are extremely much
>>> faster - maybe a factor 10000 faster.
>> 
>> There are some limitations around ASTs, especially when mixed with
>> threads.  The definitive wizard article is here:
>> 
>> https://forum.vmssoftware.com/viewtopic.php?t=5198
>
>Technically interesting.
>
>But I don't think it is a big problem. To me it is either an event
>driven model with single thread and everything non-blocking where
>AST's make sense or a thread model with multiple threads and everything
>blocking and no need for AST's.
>
>> But I think your basic question is why Apache is slower than Tomcat,
>> right?
>
>Yes - it can be worded that way.
>
>The question is why Apache (with PHP but that does not seem to matter)
>is so slow.
>
>Tomcat (with Quercus to provide PHP support) having much higher
>numbers on the same system proves that it is not HW or VMS.
>
>Also Apache on Windows on same CPU have much higher numbers
>(number of threads have been bumped).
>
>>         The only thing I can think of that hasn't already been mentioned
>> is that Tomcat code is JIT-compiled, which is likely to be pretty good,
>> optimized code, whereas Apache is probably either cross-compiled or
>> native-compiled with an early enough field test compiler that there are
>> no optimizations.
>
>That is a possible explanation.
>
>But the difference in numbers are crazy big.
>
>Apache getting a static text file with 2 bytes: 22 req/sec
>
>Tomcat with Quercus and PHP getting data out of a MySQL database on
>Windows and outputting HTML: over 200 req/sec
>
>Tomcat using JSP (which get triple compiled) getting data out of a MySQL
>database on Windows (with db connection pool) and outputting HTML: over
>600 req/sec.
>
>My gut feeling is that cross-compilation may contribute to but not
>fully explain the difference.

Almost certainly not; this is an IO bound application, not CPU
bound.

My strong suspicion is that what you're seeing is the result of
a serious impedance mismatch between the multi-process model
Apache was written to use, and its realization using the event
signalling infrastructure on VMS.  You're undoubtedly hitting
some sort of serialization point, but with added overhead; at
that point, Amdahl's law dominates.

Again, I would try to establish a baseline.  Cut out the MPM
stuff as much as you can; ideally, see what kind of numbers you
can get fetching your text file from a single Apache process.
Simply adding more threads or worker processes is unlikely to
significantly increase performance, and indeed the numbers you
posted are typical of performance collapse one usually sees due
to some kind of contention bottleneck.

Some things to consider: are you creating a new network
connection for each incoming request?  It's possible that that's
hitting a single listener, which is then trying to dispatch the
connection to an available worker, using some mechanism that is
slow on VMS.  Is there a profiler available?  If you can narrow
down where it's spending its time, that'd provide a huge clue.

	- Dan C.



More information about the Info-vax mailing list