httpd+h2

Tales of
Mystery and Imagination

Stefan Eissing, greenbytes GmbH / @icing

About Me

  • Computerized since 1982
  • Co-founded <green/>bytes in 2000
  • HTTP work since 2001
  • Started mod_h2 2015 on behalf of GSMA
  • Apache httpd PMC member since July

Stefan Eissing, greenbytes GmbH / @icing

Tales of
Mystery and Imagination

  • Mysteries
    • HTTP Performance
    • httpd+h2 Implementation
  • Imagination
    • httpd+h2 Development
    • HTTP Future

httpd

1990
1995
2000
2005
2010
2015
CERN httpd
1990-12-24
public domain
1993-04-30
NCSA httpd faltering
Apache 1.0
1995-12-01
Apache 2.0
2000-03-31
Apache 2.2
2005-11-29
Apache 2.4
2012-01-16
http/0.9
http/1.0
http/1.1
http/2

HTTP Performance

  • Fight the Latency!
  • Local Bliss
  • Not What It Used to be
  • The New Kid
  • Release it already!
  • Deploy a New Toy

Fight the Latency!

10 GB/s from Europe to apache.org in...

~1.5 Sec
Page Load Time
EuropeUS JapanAustralia
35
(0)
120
(50)
270
(60)
380
(120)
RTT (ms)
phys. Limit

1 html, 5 css, 5 js, 6 img, no server push

http/1: 240 ms
http/2: 255 ms
http/1: 530 ms
http/2: 410 ms
http/1: 1140 ms
http/2: 735 ms
http/1: 1570 ms
http/2: 950 ms

How?

Latency Influence:

  • 17 resources are retrieved
  • http/1 uses 6 connections
  • 17/6 = 2.83, so 3 x RTT
  • + ~1 RTT for 1st resource
  • Server Push will reduce by ~.5 RTT

Local Bliss

HTTP with ~0 Latency

~50k
requests / sec
126611111#con/client
1111612244896#max requests/con
http/1http/2

2k resource, 500k x GET, localhost, 4 clients, using ab + h2load

17600
27500 vs. 17600
(56% gain)
31300 vs. 17600
(78% gain)
22900 vs. 17600
(30% gain)
35500 vs. 17600
(102% gain)
38900 vs. 17600
(121% gain)
40200 vs. 17600
(128% gain)
40600 vs. 17600
(131% gain)
41000 vs. 17600
(133% gain)

How?

Influence of Parallel Requests:

  • 4 clients on 1/8 cores
  • Request Response Ping Pong
  • http/1: 1 req/conn, 4*6 conn => max: 24
  • http/2: 96 req/conn, 4*1 conn => max: 384

Max 24 vs 384 balls in play...

httpd+h2 Implementation

  • Not What It Used to be
  • HTTP/2 Architecture
  • Inheritance
  • The New Kid
  • Hooked
  • Configured

Not What It Used to be

Processing a h2 connection is vastly different in terms of (Connection/Request/Thread).

  • 1-1-1 (http/1)
  • 1-n-m (h2)

In h2, 1 connection has n ongoing request, worked on by m threads.

Existing runtimes are optimized for 1-1-1

HTTP/2 Architecture

Inheritance

mod_spdy

  • C/C++ hybrid SPDY engine
  • Apache httpd 2.2 pluggable
  • Solved many plumbing details
  • Honored Ancestor...

Pioneered by Matthew Steele and Bryan McQuade!

The New Kid

mod_h2

  • Completely C, written from scratch
  • Dependency: nghttp2 only
  • github.com/icing/mod_h2
  • Backported for Release 2.4.18 as mod_http2

Donated by GSMA and greenbytes in July

Hooked

  • HTTP/2 Stream Processing
    • process_connection (processing)
    • pre_connection (input_filter)
    • post_read_request (output filters)
  • ALPN/Upgrade
    • protocol_propose
    • protocol_switch
    • protocol_get

Configured

Things to observe:

  • Needs enable via Protocols
  • ALPN-able SSL Library needed
  • SSL Ciphers set properly
  • No Renegotiations!
  • Not all modules compatible (mod_logio)

HTTP/mod_h2 Future

  • Growing Up
  • VPNs and Services
  • Blind Caches

"You're off the edge of the map, mate. Here there be monsters."

Growing Up

Full list at github icing/mod_h2

  • Server Push
  • MPM Integration, Ressources
  • Performance, Master/Slave Connections
  • HTTP/2 in Backend
  • HTTP/2 Extension API

VPNs and Services

Blind Cache

  • Idea Proposed by Martin Thomson (Mozilla)
  • Caches in "HTTPS Everywhere Land":
    • Without Middlemen
    • TLS Secured Communication
    • Caching Chunks of Bytes

Ericcson Research working on a Draft, greenbytes consulting

Blind Cache, Principle

  1. PUT image.png as 938jdk893K
  2. GET /index.html
  3. PUSH map: image.png -> Cache/938jdk893K
  4. GET /938jdk893K from Cache

httpd+h2

Thanks!