apache mod_php performance

Hello Everyone!

I have been doing some benchmarks with apache and php and found out that apache 2.4.29 (Remi repo) with php 7.2 is slower than apache 2.4.6 (Centos 7 repo) with the same version of apache. I even tried compiling apache with the same results. Does anybody have a clue why is this?. I also tried disabling almost all apache modules, same result.

thanks in advance

Btw.
I am using CentOS 7.4.1708 (linux 3.10.0-693.5.2.el7.x86_64)
LVL 6
Ludwig DiehlSystems ArchitectAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
State which Apache MPM you're using with 2.4.29 + if you're using HTTP2.

I'm getting 1,000,000+ requests/minute out of Apache-2.4.29 + PHP-7.1.12 + WordPress right now.

Today I'm setting up an LXD + PHP-7.2 site + will post my speed test data when generated.

You may be hitting this https://bugs.php.net/bug.php?id=75488 Opcache bug.

I notice you mention using mod_php which will surely destroy your speed.

CentOS packaging tends to be... sigh... I'll say it... not ready for prime time...

I only use Ubuntu for client site hosting, because their packaging handles problems like I'm going to describe.

1) As of Apache 2.4.26 support for running HTTP2 + mod_php was deprecated, because it was always buggy.

2) Debian/Ubuntu packaging enforces this + RedHat/CentOS may incorrectly allow it. Also if you build from scratch you can force using mod_php + HTTP2.

3) The correct/fastest Apache Stack == Apache-2.4.29 + mpm_event + mod_http2 + PHP FPM.

This stack will easily produce many 1000s of requests/second throughput. If you try forcing mod_php into an HTTP2 stack, then your speed will circle the drain quickly.
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
PHP-7.2 speed tests... Respectable... 0 failures @ 1M+ reqs/min... Sufficient for most sites...

lxd: net11-ubuntu-zesty-php72 # h2speed --compact --count=1000 https://net11.ubuntu.zesty.php72.davidfavor.com/hello.php
h2load -ph2c -t16 -c16 -m16 -n16000 https://net11.ubuntu.zesty.php72.davidfavor.com/hello.php
finished in 900.59ms, 17766.13 req/s, 2.07MB/s
requests: 16000 total, 16000 started, 16000 done, 16000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 16000 2xx, 0 3xx, 0 4xx, 0 5xx
Requests per second: 17,766.13
Requests per minute: 1,065,967.8
Requests per hour  : 63,958,068

Open in new window


My LAMP Stack package details.
0
Ludwig DiehlSystems ArchitectAuthor Commented:
So you recommend using  Apache-2.4.29 + mpm_event + mod_http2 + PHP FPM. However I have read that mod_http2 consumes more memory and CPU.
0
Ludwig DiehlSystems ArchitectAuthor Commented:
btw should I use  the thread-safe or the non-thread version with the configuration you suggest?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.