2

We are running nginx on a debian system as our loadbalancer

nginx version: nginx/1.9.10
built with OpenSSL 1.0.2e 3 Dec 2015 (running with OpenSSL 1.0.2g  1 Mar 2016)

We had http2 activated in our server like this:

server {
   listen 443 ssl http2;
   ....
}

All requests are proxied to our application server. We are logging the request_time and upstream_time from nginx.

We switched recently our iOS hybrid app from UIWebView to WKWebView in Week 13, see what happened:

enter image description here

The upstream_time stayed the same but our request time suddenly raised as more and more users updated their app to the new version.

Today we decided to give it a try and deactivate http2. We only removed the word "http2" from our server config:

server {
   listen 443 ssl;
   ....
}

See what happened:

enter image description here

It seems http2 is not production ready. I don't know if it is server side or client side. Maybe even the request_time is not properly logged inside nginx.

Does anybody has more info about using http2 with nginx and/or WKWebView?

Janning
  • 1,191
  • 1
  • 19
  • 35
  • http://nginx.org/en/docs/http/ngx_http_v2_module.html β€œThe module is **experimental**, caveat emptor applies.” – Alexey Ten Apr 07 '16 at 15:35
  • Your average response time increased from 41ms to 82ms when you turned https2 off, if I read the data correctly. The maximum came down though. What exactly is your problem / question? – Tim Jun 15 '16 at 21:09

3 Answers3

3

Research suggest there is a bug in Ubuntu/Debian nginx package which causes low http2 performance, you need to use alternative distribution/compile nginx from source code yourself (it's really easy and will take like 5 minutes of your time).

For debian you may have to replace that configuration line in that building guide with something like:

 ./configure --with-cc-opt='-march=native -O2 -pipe' --prefix=/usr --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-pcre-jit --with-ipv6 --with-file-aio --with-ipv6 --with-http_v2_module --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module -with-http_v2_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --user=www-data --group=www-data --with-openssl=../openssl-1.0.2h --add-module=../nginx-http-auth-digest --add-module=../ngx_cache_purge --add-module=../ngx_pagespeed-release-1.11.33.2-beta

Or just use any recent guide on the internet. It must have building with OpenSSL 1.0.2h version or higher in it, or it's just not recent enough. Here is one that should do: https://ethitter.com/2016/06/nginx-openssl-1-0-2-http-2-alpn/

Anubioz
  • 3,597
  • 17
  • 23
0

The average response time is expected to be bigger with HTTP/2 because it has bigger overhead due to another layer of multiplexing.

VBart
  • 8,159
  • 3
  • 24
  • 25
-1

The IETF team is keeping track of client & server support here: https://github.com/http2/http2-spec/wiki/Implementations

WKWebView is not marked as supported yet. It works fine on other mobile browsers though.