Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Very long ide time (so called TTFB) when I switch to http/2 |
|
Author |
|
clouseau
Joined: 06 May 2015 Posts: 18 Location: Serbia, Subotica
|
Posted: Mon 23 May '16 14:26 Post subject: Very long ide time (so called TTFB) when I switch to http/2 |
|
|
Hello Everyone,
In short -
when I set
Protocols http/1.1 h2
I get a page load time like this:
http://www.webpagetest.org/result/160523_TE_M5J/
And when I set to
Protocols h2 http/1.1
(so the protocol would be http/2 indeed),
I get this result:
http://www.webpagetest.org/result/160523_18_MAD/
It's mostly a standard setup I do with http/2, I've been diging for days, and I can't find any eroror (this should be signifficantly faster...)
Any ideas? |
|
Back to top |
|
icing
Joined: 22 Sep 2015 Posts: 41 Location: Münster, Germany
|
Posted: Mon 23 May '16 15:20 Post subject: |
|
|
Wow, quite a difference indeed.
If you have a web site which needs 180 resources and the first one takes already 4 seconds to load, you already have 4 seconds where the browser is idle and the server only uses a single thread. Regardless if you use HTTP/1.1 or HTTP/2.
Threads may be the keyword here: with HTTP/1.1 each connection runs in its own worker (while busy) and performs one request after another. You see this in the result page for HTTP/1.1 where the browser opens 5 new connections after the first one.
At that time, 6 threads are assigned in the server to work for this browser, exclusively. And they do one request after another.
Now, depending on your server configuration, the number of threads available for HTTP/2 processing might be much lower. mod_http2 has its own thread pool which can be configured via H2MinWorkers an H2MaxWorkers. These workers are shared between all connections.
So, if there are several HTTP/2 connections going on, they might steal each other workers, which will be visible as delay on answer times.
There are other config directives which can be used to tune performance. For example: H2MaxSessionStreams controls how many parallel request the client is allowed to send. The default is 100, but you can try if lowering it improves performance.
Also, the difference releases of mod_http2 have different ways to handle this, so: which one is used here? On which platform and which MPM module have you running?
-Stefan |
|
Back to top |
|
clouseau
Joined: 06 May 2015 Posts: 18 Location: Serbia, Subotica
|
Posted: Tue 24 May '16 14:03 Post subject: |
|
|
Thanks for the quick reply. I will look into the h2 threading issue. Actually this usually works vert well with leaving those settings on default, but it seems that I won't get away with it this time.
And yes, on http/2, it seems that Apache is rendering all with one thread.
The setup is CentOS7 but actually with a compiled from source Apache 2.4.20 and php7 (fpm), with nghttp2-1.9.2, apr-1.5.2, apt-util 1.5.4 and OpenSSL 1.0.2h
It's in MPM-Event mode at the moment. |
|
Back to top |
|
clouseau
Joined: 06 May 2015 Posts: 18 Location: Serbia, Subotica
|
Posted: Tue 24 May '16 14:57 Post subject: |
|
|
As for the H2MaxSessionStreams option, I have tried to lower it, it has effect on the number of connections established, but not much on the page load speed.
In fact, I do "motivate" parralell connections, because I want parallel downloads from the site (this is a 12-CPU-core VPS, which is apparently not happening on h2, and I see the problem there.
Kind regards,
Istvan |
|
Back to top |
|
clouseau
Joined: 06 May 2015 Posts: 18 Location: Serbia, Subotica
|
Posted: Wed 25 May '16 11:08 Post subject: |
|
|
By tweaking the parameters, i got a better result:
http://www.webpagetest.org/result/160525_ND_1D4Y/
But there are still several static files (and these come random) that takes a long delay to serve.
Any idea how can I debug this? |
|
Back to top |
|
clouseau
Joined: 06 May 2015 Posts: 18 Location: Serbia, Subotica
|
Posted: Mon 30 May '16 14:42 Post subject: |
|
|
Bump |
|
Back to top |
|
jmweb
Joined: 08 Jun 2017 Posts: 8 Location: USA, Charlotte
|
Posted: Thu 08 Jun '17 19:05 Post subject: |
|
|
I am experiencing the same issue as clouseau. I have researched solutions for days but I have been unable to achieve the performance gains promised by HTTP2. I even installed the latest standalone build of HTTP2 thinking that it would offer improvement over the one distributed with 2.4.25. If anyone can help, it will be greatly appreciated.
Server Details
CentOS 7
2GB Ram
2core CPU
Apache Details
Apache 2.4.25 w/ OpenSSL/1.0.2l
APR Version: 1.5.2
APU Version: 1.5.4
MPM Name: event
Server Architecture: 64-bit
event.c Settings
All default except for: MaxSpareThreads 100
mod_http2.c Settings
All default
Standalone build: mod_http2-1.10.5
Webpagetest.org
HTTP 1.1
HTTP2 |
|
Back to top |
|
icing
Joined: 22 Sep 2015 Posts: 41 Location: Münster, Germany
|
Posted: Fri 09 Jun '17 9:45 Post subject: |
|
|
Guys,
I am no expert in webpagetest.org, but the results indicate that you test with a max bandwidth or 5 Mbit/s.
On the example by jmweb, the site downloads ~500KB. That takes with the given bandwidth about 1 second. Given the TCP slow start and that the first resource and DNS lookup also take some time, this is as fast as it gets.
Please explain in detail what should be different, so I can understand you problem.
Cheers, Stefan |
|
Back to top |
|
jmweb
Joined: 08 Jun 2017 Posts: 8 Location: USA, Charlotte
|
Posted: Fri 09 Jun '17 11:17 Post subject: |
|
|
icing, thank you for replying. I ran two new tests without bandwidth restrictions.
Webpagetest.org
HTTP 1.1
HTTP2
My concerns are:
1. I expected HTTP2 to yield much quicker load times. The tests suggest that HTTP2 is slightly slower.
2. It appears that HTTP2's TTFB is approximately twice that of HTTP 1.1.
My questions are:
1. Are these results normal and expected?
2. If not, what settings can I modify to take full advantage of HTTP2.
Thanks again! |
|
Back to top |
|
icing
Joined: 22 Sep 2015 Posts: 41 Location: Münster, Germany
|
Posted: Fri 09 Jun '17 15:35 Post subject: |
|
|
It is silly to just count the TTFB numbers reported and forget about the overall picture. If you compare the bandwidth use, HTTP/2 gets the data transferred faster than HTTP/1.1.
If you remove your google analytics and doubleclick dependencies (I know, i know), both cases would be significantly faster. But I digress...
What you may play around with in the configuration is
Code: | H2TLSWarmUpSize 0
H2TLSCoolDownSecs 0
|
and see if that TLS record size handling has any effect on your throughput. |
|
Back to top |
|
|
|
|
|
|