Re: Apache + mod_php performance

Liste des GroupesRevenir à co vms 
Sujet : Re: Apache + mod_php performance
De : cross (at) *nospam* spitfire.i.gajendra.net (Dan Cross)
Groupes : comp.os.vms
Date : 27. Sep 2024, 20:39:21
Autres entêtes
Organisation : PANIX Public Access Internet and UNIX, NYC
Message-ID : <vd71l9$mnl$1@reader1.panix.com>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <vd6n70$q3fm$1@dont-email.me>,
Arne Vajhøj  <arne@vajhoej.dk> wrote:
On 9/27/2024 10:16 AM, Dan Cross wrote:
In article <vd6dh4$nrif$1@dont-email.me>,
Arne Vajhøj  <arne@vajhoej.dk> wrote:
On 9/27/2024 9:18 AM, Craig A. Berry wrote:
         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.
>
With static content yes.

Correct.  That's all you ought to be looking at under you
understand why that's slow.

With dynamic content and the volume Apache+mod_php delivers yes.

Maybe, but without a profile you really don't know.  But beyond
that, it is currently irrelevant.  You see approximately the
same numbers with static and dynamic content; this heavily
implies that the dynamic content case is not related to the
present slow-down, including it now is premature, and likely
just masks what's _actually_ wrong.

With dynamic content and high volume then CPU can matter. Tomcat
and Quercus can do over 200 req/sec, but CPU utilization fluctuate
between 150% and 250% - 4 VCPU used so not CPU bound, but could
have been if it had been just 2 VCPU.

See above.  You know that there's a problem with Apache and
static content, but you don't know _what_ that problem is.  Why
would you jump ahead of yourself worrying about things like that
until you actually understand what's going on?

In this case, concentrating on static content, CPU time consumed
by Apache itself due to poor optimization or something seems
like a low-probability root cause of the performance problems
you are seeing, as static file service like this is IO, not
compute, bound.  Keep your eye on the ball.

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.
>
Yes.

Maybe.  You really haven't done enough investigation to know, at
least going by what you've reported here.

Or actually slightly worse.
>
Prefork MPM is the multi-process model used in Apache 1.x - it is still
around in Apache 2.x, but Apache 2.x on Linux use event or worker
MPM (that are a mix of processes and threads) and Apache 2.x on Windows
use winnt MPM (that is threads only).

Ok, sure.  But as you posted earlier, Apache on VMS, as you're
using it, is using the MPM model, no?

Again, I would try to establish a baseline.  Cut out the MPM
stuff as much as you can;
>
MPM is the core of the server.

No, you misunderstand.  Try to cut down on contention due to
coordination between multiple entities; you do this by
_lowering_ the number of things at play (processes, threads,
whatever).  The architecture of the server is irrelevant in
this case; what _is_ relevant is minimizing concurrency in its
_configuration_.  Does that make sense?

                      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.
>
It increases but not enough.
>
1 -> 0.1 req/sec
150 -> 11 req/sec
300 -> 22 req/sec
>
Some things to consider: are you creating a new network
connection for each incoming request?
>
Yes. Having the load test program keep connections alive
would be misleading as real world clients would be on different
systems.

Again, you're getting ahead of yourself.  Try simulating a
single client making multiple, repeated tests to a single
server, ideally reusing a single HTTP connection.  This will
tell you whether the issue is with query processing _inside_
the server, or if it has something to do with handling new
connections for each request.  If you use HTTP keep alives
and the number of QPS jumps up, you've narrowed down your
search space.  If it doesn't, you've eliminated one more
variable, and again, you've cut down on your search space.

Does that make sense?

                                     It's possible that that's
hitting a single listener, which is then trying to dispatch the
connection to an available worker,
>
That is the typical web server model.

No, it is _a_ common model, but not _the_ "typical" model.  For
instance, many high-performance web solutions are built on an
asynchronous model, which effectively implement state machines
where state transitions yield callbacks that are distributed
across a collection of executor threads.  There's no single
"worker" or dedicated handoff.

Moreover, there are many different _ways_ to implement the
"listener hands connection to worker" model, and it _may_ be
that the way that Apache on VMS is trying to do it is
inherently slow.  We don't know, do we?  But that's what we're
trying to figure out, and that's why I'm encouraging you to
start simply and build on what you can actually know from
observation, as opposed to faffing about making guesses.

                                    using some mechanism that is
slow on VMS.
>
It is a good question how Apache on VMS is actually doing that.
>
All thread based solutions (OSU, Tomcat etc.) just pass a
pointer/reference in memory to the thread. Easy.
>
Fork create a process copy with the open socket. I am not quite
sure about the details of how it works, but it works.
>
If the model on VMS is:
>
---(HTTP)---parent---(IPC)---child
>
then it could explain being so slow.
>
I may have to read some of those bloody 3900 lines of code (in a
single file!).

Precisely.  And maybe run some more experiments.

              Is there a profiler available?  If you can narrow
down where it's spending its time, that'd provide a huge clue.
>
Or I take another path.

This is a useful exercise either way; getting to the root cause
of a problem like this may teach you something you could apply
to other, similar, problems in the future.

- Dan C.


Date Sujet#  Auteur
24 Sep 24 * Apache + mod_php performance274Arne Vajhøj
24 Sep 24 +* Re: Apache + mod_php performance267Dan Cross
25 Sep 24 i`* Re: Apache + mod_php performance266Arne Vajhøj
25 Sep 24 i `* Re: Apache + mod_php performance265Dan Cross
25 Sep 24 i  `* Re: Apache + mod_php performance264Arne Vajhøj
25 Sep 24 i   +* Re: Apache + mod_php performance262Dan Cross
25 Sep 24 i   i`* Re: Apache + mod_php performance261Arne Vajhøj
25 Sep 24 i   i +* Re: Apache + mod_php performance12Arne Vajhøj
25 Sep 24 i   i i+- Re: Apache + mod_php performance1Lawrence D'Oliveiro
25 Sep 24 i   i i+* Re: Apache + mod_php performance3Lawrence D'Oliveiro
26 Sep 24 i   i ii`* Re: Apache + mod_php performance2Arne Vajhøj
26 Sep 24 i   i ii `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
26 Sep 24 i   i i`* Re: Apache + mod_php performance7Craig A. Berry
26 Sep 24 i   i i +- Re: Apache + mod_php performance1Arne Vajhøj
26 Sep 24 i   i i `* Re: Apache + mod_php performance5Lawrence D'Oliveiro
27 Sep 24 i   i i  `* Re: Apache + mod_php performance4Arne Vajhøj
27 Sep 24 i   i i   `* Re: Apache + mod_php performance3Lawrence D'Oliveiro
27 Sep 24 i   i i    `* Re: Apache + mod_php performance2Craig A. Berry
27 Sep 24 i   i i     `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
25 Sep 24 i   i +- Re: Apache + mod_php performance1Arne Vajhøj
26 Sep 24 i   i +* Re: Apache + mod_php performance21Arne Vajhøj
26 Sep 24 i   i i+* Re: Apache + mod_php performance3Lawrence D'Oliveiro
26 Sep 24 i   i ii`* Re: Apache + mod_php performance2Arne Vajhøj
26 Sep 24 i   i ii `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
26 Sep 24 i   i i`* Re: Apache + mod_php performance17Craig A. Berry
26 Sep 24 i   i i `* Re: Apache + mod_php performance16Craig A. Berry
26 Sep 24 i   i i  +* Re: Apache + mod_php performance2Chris Townley
26 Sep 24 i   i i  i`- Re: Apache + mod_php performance1Arne Vajhøj
27 Sep 24 i   i i  `* Re: Apache + mod_php performance13Arne Vajhøj
27 Sep 24 i   i i   `* Re: Apache + mod_php performance12Lawrence D'Oliveiro
27 Sep 24 i   i i    `* Re: Apache + mod_php performance11Arne Vajhøj
27 Sep 24 i   i i     +* Re: Apache + mod_php performance3Lawrence D'Oliveiro
27 Sep 24 i   i i     i`* Re: Apache + mod_php performance2Arne Vajhøj
28 Sep 24 i   i i     i `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
27 Sep 24 i   i i     +* Re: Apache + mod_php performance2Simon Clubley
27 Sep 24 i   i i     i`- Re: Apache + mod_php performance1Arne Vajhøj
27 Sep 24 i   i i     `* Re: Apache + mod_php performance5Craig A. Berry
27 Sep 24 i   i i      `* Re: Apache + mod_php performance4Arne Vajhøj
27 Sep 24 i   i i       `* Re: Apache + mod_php performance3Dan Cross
27 Sep 24 i   i i        `* Re: Apache + mod_php performance2Arne Vajhøj
27 Sep 24 i   i i         `- Re: Apache + mod_php performance1Dan Cross
26 Sep 24 i   i +* Re: Apache + mod_php performance38Dan Cross
27 Sep 24 i   i i`* Re: Apache + mod_php performance37Arne Vajhøj
27 Sep 24 i   i i +* Re: Apache + mod_php performance2Chris Townley
27 Sep 24 i   i i i`- Re: Apache + mod_php performance1Arne Vajhøj
27 Sep 24 i   i i +* Re: Apache + mod_php performance9Dan Cross
27 Sep 24 i   i i i`* Re: Apache + mod_php performance8Arne Vajhøj
27 Sep 24 i   i i i `* Re: Apache + mod_php performance7Dan Cross
27 Sep 24 i   i i i  `* Re: Apache + mod_php performance6Arne Vajhøj
27 Sep 24 i   i i i   `* Re: Apache + mod_php performance5Dan Cross
27 Sep 24 i   i i i    `* Re: Apache + mod_php performance4Arne Vajhøj
27 Sep 24 i   i i i     `* Re: Apache + mod_php performance3Dan Cross
27 Sep 24 i   i i i      `* Re: Apache + mod_php performance2Arne Vajhøj
27 Sep 24 i   i i i       `- Re: Apache + mod_php performance1Dan Cross
28 Sep 24 i   i i `* Re: Apache + mod_php performance25Lawrence D'Oliveiro
28 Sep 24 i   i i  `* Re: Apache + mod_php performance24Arne Vajhøj
28 Sep 24 i   i i   `* Re: Apache + mod_php performance23Lawrence D'Oliveiro
28 Sep 24 i   i i    `* Re: Apache + mod_php performance22Arne Vajhøj
28 Sep 24 i   i i     +* Re: Apache + mod_php performance7Lawrence D'Oliveiro
28 Sep 24 i   i i     i`* Re: Apache + mod_php performance6Arne Vajhøj
28 Sep 24 i   i i     i `* Re: Apache + mod_php performance5Lawrence D'Oliveiro
28 Sep 24 i   i i     i  `* Re: Apache + mod_php performance4Arne Vajhøj
28 Sep 24 i   i i     i   `* Re: Apache + mod_php performance3Lawrence D'Oliveiro
28 Sep 24 i   i i     i    `* Re: Apache + mod_php performance2Arne Vajhøj
28 Sep 24 i   i i     i     `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
28 Sep 24 i   i i     `* Re: Apache + mod_php performance14Arne Vajhøj
28 Sep 24 i   i i      `* Re: Apache + mod_php performance13Lawrence D'Oliveiro
28 Sep 24 i   i i       `* Re: Apache + mod_php performance12Arne Vajhøj
28 Sep 24 i   i i        +* Re: Apache + mod_php performance3Arne Vajhøj
28 Sep 24 i   i i        i`* Re: Apache + mod_php performance2Lawrence D'Oliveiro
28 Sep 24 i   i i        i `- Re: Apache + mod_php performance1Arne Vajhøj
28 Sep 24 i   i i        `* Re: Apache + mod_php performance8Lawrence D'Oliveiro
28 Sep 24 i   i i         `* Re: Apache + mod_php performance7Arne Vajhøj
28 Sep 24 i   i i          +- Re: Apache + mod_php performance1Chris Townley
28 Sep 24 i   i i          `* Re: Apache + mod_php performance5Lawrence D'Oliveiro
29 Sep 24 i   i i           +- Re: Apache + mod_php performance1Arne Vajhøj
29 Sep 24 i   i i           `* Re: Apache + mod_php performance3Craig A. Berry
29 Sep 24 i   i i            +- Re: Apache + mod_php performance1Arne Vajhøj
30 Sep 24 i   i i            `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
28 Sep 24 i   i `* Re: Apache + mod_php performance188Arne Vajhøj
28 Sep 24 i   i  +* Re: Apache + mod_php performance56Dan Cross
28 Sep 24 i   i  i+* Re: Apache + mod_php performance51Arne Vajhøj
28 Sep 24 i   i  ii+- Re: Apache + mod_php performance1Lawrence D'Oliveiro
28 Sep 24 i   i  ii+* Re: Apache + mod_php performance48Dave Froble
1 Oct 24 i   i  iii`* Re: Apache + mod_php performance47Dan Cross
1 Oct 24 i   i  iii `* Re: Apache + mod_php performance46Arne Vajhøj
1 Oct 24 i   i  iii  +* Re: Apache + mod_php performance7Lawrence D'Oliveiro
2 Oct 24 i   i  iii  i`* Re: Apache + mod_php performance6Arne Vajhøj
2 Oct 24 i   i  iii  i `* Re: Apache + mod_php performance5Lawrence D'Oliveiro
3 Oct 24 i   i  iii  i  `* Re: Apache + mod_php performance4Arne Vajhøj
3 Oct 24 i   i  iii  i   `* Re: Apache + mod_php performance3Lawrence D'Oliveiro
3 Oct 24 i   i  iii  i    `* Re: Apache + mod_php performance2Arne Vajhøj
3 Oct 24 i   i  iii  i     `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
2 Oct 24 i   i  iii  +* Re: Apache + mod_php performance5Dan Cross
2 Oct 24 i   i  iii  i`* Re: Apache + mod_php performance4Arne Vajhøj
2 Oct 24 i   i  iii  i `* Re: Apache + mod_php performance3Dan Cross
2 Oct 24 i   i  iii  i  `* Re: Apache + mod_php performance2Arne Vajhøj
2 Oct 24 i   i  iii  i   `- Re: Apache + mod_php performance1Dan Cross
2 Oct 24 i   i  iii  `* Re: Apache + mod_php performance33Dave Froble
2 Oct 24 i   i  iii   +* Re: Apache + mod_php performance31Arne Vajhøj
2 Oct 24 i   i  iii   i`* Re: Apache + mod_php performance30Dan Cross
2 Oct 24 i   i  iii   `- Re: Apache + mod_php performance1Dan Cross
30 Sep 24 i   i  ii`- Re: Apache + mod_php performance1Dan Cross
29 Sep 24 i   i  i`* Re: Apache + mod_php performance4Arne Vajhøj
28 Sep 24 i   i  `* Re: Apache + mod_php performance131Arne Vajhøj
27 Sep 24 i   `- Re: Apache + mod_php performance1Arne Vajhøj
24 Sep 24 +* Re: Apache + mod_php performance2Lawrence D'Oliveiro
25 Sep 24 +* Re: Apache + mod_php performance2Simon Clubley
2 Oct 24 `* Re: Apache + mod_php performance2Arne Vajhøj

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal