Nginx http2 pictures timeout

Hi All,

After I upgrade nginx to 1.9.12 and enabled http2 for my website. I
found a
wired issue related with download pictures.

My website is a photo-sharing websites. So on each page there are about
100-200 pictures, the size of each of them may from 10K to 500K.

In the past (http and https with spdy), I’m using below settings:

client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 30;
send_timeout 30;

keepalive_requests 200;
keepalive_disable none;
reset_timedout_connection on;

And everything is good. For users from different countries, they can
view
the pictures without any error.

But after I upgrade to http2, with the same settings, it seems for users
who
have a good bandwidth, everything is fine. But for users who are from
different countries, some of them experience issue that on the webpage
some
pictures can’t display properly. And if they refresh the webpage for 1
times
or more, then the whole webpage can display as normal, all pictures are
downloaded and display.

I tried to change send_timeout value from 30s to 300s, then it seems it
can
fix the problem. I used firefox to monitor the webpage load speed, I can
see
for the pictures of the webpage, the waiting time is pretty long,
sometimes
it’s more than 60s - 120s, and then firefox start to receiving the
pictures.

My understanding is that after enable http2, nginx are using
“Multiplexing
and concurrency” to send out pictures, which mean for the webpage with
200
pictures, the web browser is ready to receive all pictures when the
connections is established. But for clients who has limited network
bandwidth to the server, they can only download the pictures slowly. And
then some of the pictures will be timeout and can’t display.

So, is there any better solution to fix this kind of issue?

Posted at Nginx Forum:

Are you able to test with an alternate brand of browser to isolate if
this
is a client or server issue?

Does turning off http/2 fix the issue? It’s possible but unlikely that
network conditions have changed at the same time as your move to http/2.

Phil
Hi All,

After I upgrade nginx to 1.9.12 and enabled http2 for my website. I
found a
wired issue related with download pictures.

My website is a photo-sharing websites. So on each page there are about
100-200 pictures, the size of each of them may from 10K to 500K.

In the past (http and https with spdy), I’m using below settings:

    client_body_timeout   10;
    client_header_timeout 10;
    keepalive_timeout     30;
    send_timeout          30;

    keepalive_requests 200;
    keepalive_disable        none;
    reset_timedout_connection  on;

And everything is good. For users from different countries, they can
view
the pictures without any error.

But after I upgrade to http2, with the same settings, it seems for users
who
have a good bandwidth, everything is fine. But for users who are from
different countries, some of them experience issue that on the webpage
some
pictures can’t display properly. And if they refresh the webpage for 1
times
or more, then the whole webpage can display as normal, all pictures are
downloaded and display.

I tried to change send_timeout value from 30s to 300s, then it seems it
can
fix the problem. I used firefox to monitor the webpage load speed, I can
see
for the pictures of the webpage, the waiting time is pretty long,
sometimes
it’s more than 60s - 120s, and then firefox start to receiving the
pictures.

My understanding is that after enable http2, nginx are using
“Multiplexing
and concurrency” to send out pictures, which mean for the webpage with
200
pictures, the web browser is ready to receive all pictures when the
connections is established. But for clients who has limited network
bandwidth to the server, they can only download the pictures slowly. And
then some of the pictures will be timeout and can’t display.

So, is there any better solution to fix this kind of issue?

Posted at Nginx Forum:

On Thursday 17 March 2016 07:04:11 meteor8488 wrote:

client_body_timeout 10;

for the pictures of the webpage, the waiting time is pretty long, sometimes
So, is there any better solution to fix this kind of issue?

[…]

You can try to lower concurrency in HTTP/2 connection.

See the “http2_max_concurrent_streams” directive:
http://nginx.org/r/http2_max_concurrent_streams

wbr, Valentin V. Bartenev

Thanks for your reply.

The default value is 128 for http2_max_concurrent_streams
I tried to change it 64, no big difference.
And I also checked http2 document, it suggested that this kind of value
should not less than 100

Posted at Nginx Forum:

Hi,

Thanks for your reply.

I tried to disable http/2, then this issue got fixed.So pretty sure this
issue is caused by http2

Posted at Nginx Forum:

Having same issue using http2 both on my image and reverse proxy (both
nginx) the backend is running on sata disk and the proxy on ssd disk…
this is why the setup is as is like this.

With http2 enabled i get some weird signs, but disabling http2 makes
things
run…

So I follow this thread :slight_smile:

Posted at Nginx Forum: