SlideShare une entreprise Scribd logo
1  sur  62
Télécharger pour lire hors ligne
AMSTERDAM 16 – 17 MAY 2017
HTTP/2 in action
Piet van Dongen
@pietvandongen
About me
Piet van Dongen…
…is a Senior Software Engineer at Luminis Arnhem.
…is a full stack engineer (Java and frontend stuff).
…thinks: people > technology.
…could have just as easily been a teacher.
…should start running again.
What are we gonna do till lunch?
What we say we do What it is we do
Introduce the talk
Try to sneak in
Check Twitter / Facebook
Dive into HTTP/2 theory
Try to sneak out again
Sneak siesta
Look at HTTP/2 in practice
Pay attention for a moment
Go back to Tweeting
Create a HTTP/2 server (live!)
Laugh at Piet fumbling
Pray to the demo gods
Answer questions
Sneak out for lunch
Dodge difficult questions
HTTP
in perspective
HTTP in perspective
• A bit of history
• The technology
• Why HTTP/2?
• New features
A bit
of history
1941
• Jorge Luis Borges' The Garden of Forking Paths
• Hypertekst-fictie
• Vannevar Bush's As We May Think
• Essay on the memex (memory + index)
• Proto hypertext system
• Collective memory
• Information explosion
• Knowledge explosion
1945
Douglas Engelbart
• 1962: Creates NLS (oN-Line System)
• 1968: The Mother of All Demos
Ted Nelson & Andries van Dam
• 1963: Nelson coins hypertext en
hypermedia
• 1967: With Van Dam: Hypertext
Editing System
• 1976: FRESS (File Retrieval and Editing
System)
1962 – 1976
• Aspen Movie Map (funded by (D)ARPA)
• First hypermedia system
1978
• Sir Tim Berners Lee bedenkt ENQUIRE (wiki)
• Peter J. Brown bedenkt Guide
• Roberto Busa bedenkt Index Thomisticus
1980
• Ben Shneiderman developes TIES (The Interactive
Encyclopedia System)
• First electronic book: Hypertext Hands-On!
1983
• Apple Computer's HyperCard
• ACM Hypertext Conference
• Storyspace (hypertext fiction software)
1987
• Sir Tim Berners Lee (CERN): WorldWideWeb
• HyperText
• Network
• Browsers
1989
• HTTP V0.9
• TCP-IP connection
• Request: GET address (no http://, host or port)
• Response: byte stream of ASCII characters
• After transfer: connection close
1991
• Browser Lynx
• Birth of the internet
• 500 web servers
1993
• W3C (World Wide Web Consortium) founded
• 10.000 web servers
1994
• HTTP V1.0
• No formal specification
• Required version number in request
• Headers
• Status codes
• New OPTIONS method
1995
• Pre-standard HTTP/1.1
• Fast adoption: Arena, Netscape, Mosaic, Lynx, IE 2.0
• March: 40% of browsers compliant
• June: 65%
1996
• Standard HTTP/1.1 (RFC 2068)
• Required header Host
• Open connections
• Better caching (ETags and headers)
• Lots of additions and improvements
1997
• HTTP/1.1 improvements (RFC 2616)
1999
• HTTPbis Working Group takes 7 years to improve
and clear up HTTP/1.1
2007
• SPDY developed by Google
2012
• A new standard: HTTP/2
2015
The
technology
Terminology
• Hypertext Transfer Protocol
• Hypertext: structured text with
linked (text) nodes
• Protocol: to transfer hypertext from
server to clients
• TCP/IP: Internet Protocol Suite
• HTTP is protocol in top layer
(application)
HTTP
TCPUDP
Application
Transport
IP Internet
Ethernet Link
The protocol from a bird's eye view
• Client / user agent asks (request)
• Methods: GET, PUT, POST, DELETE, HEAD…
• Server answers (response)
• Status codes: 200 OK, 404 Not Found, 500 Internal Server Error…
• Resources identified by URLs
• protocol://host[:port]/path
A request
GET	/	HTTP/1.1	
Host:	www.example.com	
User-Agent:	Mozilla/5.0	(Macintosh;	Intel	Mac	OS	X	10_12_3)	AppleWe
Accept:	*/*
A response
HTTP/1.1	200	OK

Content-Length:	1365

Content-Type:	text/html



<!DOCTYPE	html>

<html	lang="en">

<head><title>Hello	world	demo	page</title></head>

<body>

				<h1>Hello,	world!</h1>

</body>
Why
HTTP/2?
What is wrong with HTTP/1.1?
• Web pages contain more resources than ever
• Efficient loading using 1 request per HTTP connection is hard
• Parallel is possible, but… change of congestions
• A lot of overhead, especially headers
• Hacks needed: image sprites, data inlining, domain sharding, …
How is HTTP/2 gonna solve that?
• Binary protocol: more efficient parsing, more compact, fewer errors
• Multiplexing:
• Non ordered, interleaved if necessary
• Non blocking, but all data at once
• Just one TCP connection: less congestion, more fair on network
• Header compression with HPACK: more compact and robust
• Server push: pushing data on expected demand
• Compatible with HTTP/1.1
New
features
Binary protocol
• More efficient, easy to parse
• More compact on the wire
• Harder to read for humans
Application (HTTP)
Transport (TCP)
Network (IP)
Link (Ethernet)
Binary Framing
HEADERS frame
DATA frame
Streams, messages, frames
• Stream: bidirectional flow of bytes, contains 1 or more messages
• Message: sequence of frames, map to request of response
• Frame: smalles unit of communication, references stream
Stream 1
HEADERS
Stream 2
HEADERS
Stream 2
DATA
Stream 2
DATA
Multiplexing
• Everything on a single connection
• Messages in random order
• No guessing
• No congestion
Stream 5
DATA
Stream 1
DATA
Stream 3
DATA
Stream 3
DATA
Stream 2
DATA
Stream 3
HEADERS
Stream 1
DATA
Stream 2
DATA
Stream 1
DATA
Server push
• Multiple response for 1 request
• Serve before request
Stream 1
FRAME 2
Stream 4
FRAME 1
…Stream 1
FRAME n
Stream 4
PROMISE
Stream 2
PROMISE
:path: /blog/383
7
38: example.com
:path: /blog
19: text/html
58: Mozilla/5…
Header compression (HPACK)
• Huffman encoding
• ~30% size reduction
• Only diffs on 

subsequent requests
Stream 1
HEADERS
Stream 2
HEADERS
:method GET
:scheme https
:host example.nl
:path /blog
accept text/html
user-agent Mozilla/5…
:method GET
:scheme https
:host example.nl
:path /blog/38
accept text/html
user-agent Mozilla/5…
ALPN
• Application-Layer Protocol Negotiation
• TLS extension of application layer ClientHello (ALPN extenstion + list of protocols)
ServerHello (ALPN extenstion + selected protocol)
ChangeCipherSpec
Finished
ChangeCipherSpec
Finished
And more…
• Inherently safe (because effectively only TLS)
• Stream prioritisation
• Flow control
*
A
12
B
4
*
D
1
C
8
*
D
1
C
8
A
12
B
4
*
D
1
E
8
A
12
B
4
C
8
That's great, Piet.
How about you show us
some working code. You
promised some action.”
“
Nice pants, by the way.”“
HTTP /2
in action
HTTP/2 in action
• Implementations in the wild
• Roll your own HTTP/2-server
• HTTP/2 on a bad network
• Findings and recommendations
• Sources
Implementations
in the wild
Terminology
• ALPN: Application-Layer Protocol Negotiation, TLS extension to over
negotiate on application layer protocol
• NPN: precursor to ALPN
• Upgrade: negotiation mechanism for HTTP/1.1 => HTTP/2
• Direct: connection without upgrade / negotiation
• h2: HTTP/2 over TLS
• h2c: HTTP/2 over TCP
Servers
Name Version Negotiation Protocol
Apache HTTP 2.4.17+ ALPN, Upgrade, direct h2, h2c
NGINX 1.9.5+ ALPN, NPN, direct h2, h2c
node-http2 ALPN, NPN, direct h2
Tomcat 8.5+ ALPN, Upgrade, direct h2, h2c
http2 (Go) ALPN, NPN h2, h2-14
Jetty 9.3+ ALPN, Upgrade, direct h2, h2-17, h2-14, h2c,
h2c-17
IIS 10 ? ?
http-katana ALPN, Upgrade h2-12
Clients
Name Version Negotiation Protocol
Firefox 49+ ALPN, NPN h2-15, h2-14, h2
Chrome ALPN h2, h2-14
Internet
Explorer
Windows 10 ALPN h2
curl, libcurl ALPN, NPN, Upgrade h2-14, h2c-14
node-http2 ALPN, NPN, direct h2
http-katana ALPN, Upgrade h2-12
http2 (Go) ALPN, NPN h2, h2-14
Roll your
own HTTP/2 server
Requirements
• Java Development Kit (8+)
• Eclipse Vert.x (reactive application toolkit for JVM)
• netty-tcnative-boringssl-static (to dynamicly link TLS-support, no
longer need in Java 9)
• Some HTML, CSS and JavaScript files
• A build / run tool (Gradle in this case)
• A browser (for testing)
Application resources
• HTML: index.html
• JavaScript: application.js (pushed!)
• Style sheet: style.css (pushed!)
• Image: photo.jpg (pushed!)
Demo time!
• Sources can be found at: 

https://github.com/pietvandongen/http2-brain-upgrade

pull requests and issues are welcome!
• The Docker container image is at: 

https://hub.docker.com/r/pietvandongen/http2-demo-server/
HTTP/2
on a bad network
Comparing HTTP/1.1 to HTTP/2
HTTP/2:
Multiplexed + push
HTTP/1.1:
Sequential
HTTP/1.1:
Pipelined
HTTP/2:
Multiplexed
HTTP: high latency
HTTP/2:
Multiplexed + push
HTTP/1.1:
Sequential
HTTP/1.1:
Pipelined
HTTP/2:
Multiplexed
Demonstration
• http://http2.golang.org/gophertiles
Findings
and recommendations
Findings and recommendations
• Switch over, but use ALPN
• Try before you asume (push!)
• Start with a web project
• Don't forget the decrypter during debugging
• Read the documentation :)
Sources
Sources / literature
• https://http2.github.io/: HTTP/2 homepage curated by IETF HTTP
Working Group
• https://developers.google.com/web/fundamentals/performance/
http2/: Introduction to HTTP/2 by Google
• http://vertx.io/: Homepage of Eclipse Vert.x
• Stephen Ludin & Javier Garza, Learning HTTP/2: A Practical Guide for
Beginners (O'Reilly 2017)
• https://hpbn.co/http2/: Chapter 12 of High Performance Browser
Networking (Ilya Grigorik, O'Reilly 2013)
Any
questions?
Any questions?
• Mail me: piet.vandongen@luminis.eu
• Tweet me: https://twitter.com/pietvandongen
• Link me: https://www.linkedin.com/in/pietvandongencom/
• Visit me at Luminis (https://www.luminis.eu/)

Contenu connexe

Tendances

Tendances (20)

OpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-SideOpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-Side
 
Power-up services with gRPC
Power-up services with gRPCPower-up services with gRPC
Power-up services with gRPC
 
Http2 right now
Http2 right nowHttp2 right now
Http2 right now
 
Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speed
 
Asynchronous Python with Twisted
Asynchronous Python with TwistedAsynchronous Python with Twisted
Asynchronous Python with Twisted
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
 
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t... Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 
Easily create dashboards to manage your databases with OVH
Easily create dashboards to manage your databases with OVH Easily create dashboards to manage your databases with OVH
Easily create dashboards to manage your databases with OVH
 
Using Spark ML on Spark Errors - What do the clusters tell us?
Using Spark ML on Spark Errors - What do the clusters tell us?Using Spark ML on Spark Errors - What do the clusters tell us?
Using Spark ML on Spark Errors - What do the clusters tell us?
 
gRPC: Beyond REST
gRPC: Beyond RESTgRPC: Beyond REST
gRPC: Beyond REST
 
Series of Unfortunate Netflix Container Events - QConNYC17
Series of Unfortunate Netflix Container Events - QConNYC17Series of Unfortunate Netflix Container Events - QConNYC17
Series of Unfortunate Netflix Container Events - QConNYC17
 
gRPC in Go
gRPC in GogRPC in Go
gRPC in Go
 
gRPC - RPC rebirth?
gRPC - RPC rebirth?gRPC - RPC rebirth?
gRPC - RPC rebirth?
 
An introduction to git
An introduction to gitAn introduction to git
An introduction to git
 
What's new with Apache Camel 3? | DevNation Tech Talk
What's new with Apache Camel 3? | DevNation Tech TalkWhat's new with Apache Camel 3? | DevNation Tech Talk
What's new with Apache Camel 3? | DevNation Tech Talk
 
"How about no grep and zabbix?". ELK based alerts and metrics.
"How about no grep and zabbix?". ELK based alerts and metrics."How about no grep and zabbix?". ELK based alerts and metrics.
"How about no grep and zabbix?". ELK based alerts and metrics.
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
 
Powering tensor flow with big data using apache beam, flink, and spark cern...
Powering tensor flow with big data using apache beam, flink, and spark   cern...Powering tensor flow with big data using apache beam, flink, and spark   cern...
Powering tensor flow with big data using apache beam, flink, and spark cern...
 
Introduction to gRPC
Introduction to gRPCIntroduction to gRPC
Introduction to gRPC
 
HTTP/2 in Examples
HTTP/2 in ExamplesHTTP/2 in Examples
HTTP/2 in Examples
 

Similaire à HTTP2 in action - Piet Van Dongen - Codemotion Amsterdam 2017

Balázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a TunnelBalázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a Tunnel
hacktivity
 

Similaire à HTTP2 in action - Piet Van Dongen - Codemotion Amsterdam 2017 (20)

HTTP/2: What's new?
HTTP/2: What's new? HTTP/2: What's new?
HTTP/2: What's new?
 
HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocols
 
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the WebCleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
 
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUICA new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
 
What's New in HTTP/2
What's New in HTTP/2What's New in HTTP/2
What's New in HTTP/2
 
HTTP/2 : why upgrading the web? - DjangoCon Europe 2016 Budapest
HTTP/2 : why upgrading the web? - DjangoCon Europe 2016 BudapestHTTP/2 : why upgrading the web? - DjangoCon Europe 2016 Budapest
HTTP/2 : why upgrading the web? - DjangoCon Europe 2016 Budapest
 
A New Internet? Introduction to HTTP/2, QUIC and DOH
A New Internet? Introduction to HTTP/2, QUIC and DOHA New Internet? Introduction to HTTP/2, QUIC and DOH
A New Internet? Introduction to HTTP/2, QUIC and DOH
 
2. application layer
2. application layer2. application layer
2. application layer
 
Http2
Http2Http2
Http2
 
Massively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPMassively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHP
 
SPDY Talk
SPDY TalkSPDY Talk
SPDY Talk
 
Balázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a TunnelBalázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a Tunnel
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
 
Http2: why the web is upgrading? - bdx.io 2015
Http2: why the web is upgrading?   - bdx.io 2015Http2: why the web is upgrading?   - bdx.io 2015
Http2: why the web is upgrading? - bdx.io 2015
 
Speedup your WordPress mit Nginx und HTTP/2
Speedup your WordPress mit Nginx und HTTP/2Speedup your WordPress mit Nginx und HTTP/2
Speedup your WordPress mit Nginx und HTTP/2
 
Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.
 
HTTP 프로토콜의 이해와 활용
HTTP 프로토콜의 이해와 활용HTTP 프로토콜의 이해와 활용
HTTP 프로토콜의 이해와 활용
 
SPDY - or maybe HTTP2.0
SPDY - or maybe HTTP2.0SPDY - or maybe HTTP2.0
SPDY - or maybe HTTP2.0
 

Plus de Codemotion

Plus de Codemotion (20)

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending story
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storia
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard Altwasser
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

HTTP2 in action - Piet Van Dongen - Codemotion Amsterdam 2017

  • 1. AMSTERDAM 16 – 17 MAY 2017 HTTP/2 in action Piet van Dongen
  • 2. @pietvandongen About me Piet van Dongen… …is a Senior Software Engineer at Luminis Arnhem. …is a full stack engineer (Java and frontend stuff). …thinks: people > technology. …could have just as easily been a teacher. …should start running again.
  • 3. What are we gonna do till lunch? What we say we do What it is we do Introduce the talk Try to sneak in Check Twitter / Facebook Dive into HTTP/2 theory Try to sneak out again Sneak siesta Look at HTTP/2 in practice Pay attention for a moment Go back to Tweeting Create a HTTP/2 server (live!) Laugh at Piet fumbling Pray to the demo gods Answer questions Sneak out for lunch Dodge difficult questions
  • 5. HTTP in perspective • A bit of history • The technology • Why HTTP/2? • New features
  • 7. 1941 • Jorge Luis Borges' The Garden of Forking Paths • Hypertekst-fictie
  • 8. • Vannevar Bush's As We May Think • Essay on the memex (memory + index) • Proto hypertext system • Collective memory • Information explosion • Knowledge explosion 1945
  • 9. Douglas Engelbart • 1962: Creates NLS (oN-Line System) • 1968: The Mother of All Demos Ted Nelson & Andries van Dam • 1963: Nelson coins hypertext en hypermedia • 1967: With Van Dam: Hypertext Editing System • 1976: FRESS (File Retrieval and Editing System) 1962 – 1976
  • 10. • Aspen Movie Map (funded by (D)ARPA) • First hypermedia system 1978
  • 11. • Sir Tim Berners Lee bedenkt ENQUIRE (wiki) • Peter J. Brown bedenkt Guide • Roberto Busa bedenkt Index Thomisticus 1980
  • 12. • Ben Shneiderman developes TIES (The Interactive Encyclopedia System) • First electronic book: Hypertext Hands-On! 1983
  • 13. • Apple Computer's HyperCard • ACM Hypertext Conference • Storyspace (hypertext fiction software) 1987
  • 14. • Sir Tim Berners Lee (CERN): WorldWideWeb • HyperText • Network • Browsers 1989
  • 15. • HTTP V0.9 • TCP-IP connection • Request: GET address (no http://, host or port) • Response: byte stream of ASCII characters • After transfer: connection close 1991
  • 16. • Browser Lynx • Birth of the internet • 500 web servers 1993
  • 17. • W3C (World Wide Web Consortium) founded • 10.000 web servers 1994
  • 18. • HTTP V1.0 • No formal specification • Required version number in request • Headers • Status codes • New OPTIONS method 1995
  • 19. • Pre-standard HTTP/1.1 • Fast adoption: Arena, Netscape, Mosaic, Lynx, IE 2.0 • March: 40% of browsers compliant • June: 65% 1996
  • 20. • Standard HTTP/1.1 (RFC 2068) • Required header Host • Open connections • Better caching (ETags and headers) • Lots of additions and improvements 1997
  • 21. • HTTP/1.1 improvements (RFC 2616) 1999
  • 22. • HTTPbis Working Group takes 7 years to improve and clear up HTTP/1.1 2007
  • 23. • SPDY developed by Google 2012
  • 24. • A new standard: HTTP/2 2015
  • 26. Terminology • Hypertext Transfer Protocol • Hypertext: structured text with linked (text) nodes • Protocol: to transfer hypertext from server to clients • TCP/IP: Internet Protocol Suite • HTTP is protocol in top layer (application) HTTP TCPUDP Application Transport IP Internet Ethernet Link
  • 27. The protocol from a bird's eye view • Client / user agent asks (request) • Methods: GET, PUT, POST, DELETE, HEAD… • Server answers (response) • Status codes: 200 OK, 404 Not Found, 500 Internal Server Error… • Resources identified by URLs • protocol://host[:port]/path
  • 31. What is wrong with HTTP/1.1? • Web pages contain more resources than ever • Efficient loading using 1 request per HTTP connection is hard • Parallel is possible, but… change of congestions • A lot of overhead, especially headers • Hacks needed: image sprites, data inlining, domain sharding, …
  • 32. How is HTTP/2 gonna solve that? • Binary protocol: more efficient parsing, more compact, fewer errors • Multiplexing: • Non ordered, interleaved if necessary • Non blocking, but all data at once • Just one TCP connection: less congestion, more fair on network • Header compression with HPACK: more compact and robust • Server push: pushing data on expected demand • Compatible with HTTP/1.1
  • 34. Binary protocol • More efficient, easy to parse • More compact on the wire • Harder to read for humans Application (HTTP) Transport (TCP) Network (IP) Link (Ethernet) Binary Framing HEADERS frame DATA frame
  • 35. Streams, messages, frames • Stream: bidirectional flow of bytes, contains 1 or more messages • Message: sequence of frames, map to request of response • Frame: smalles unit of communication, references stream Stream 1 HEADERS Stream 2 HEADERS Stream 2 DATA Stream 2 DATA
  • 36. Multiplexing • Everything on a single connection • Messages in random order • No guessing • No congestion Stream 5 DATA Stream 1 DATA Stream 3 DATA Stream 3 DATA Stream 2 DATA Stream 3 HEADERS Stream 1 DATA Stream 2 DATA Stream 1 DATA
  • 37. Server push • Multiple response for 1 request • Serve before request Stream 1 FRAME 2 Stream 4 FRAME 1 …Stream 1 FRAME n Stream 4 PROMISE Stream 2 PROMISE
  • 38. :path: /blog/383 7 38: example.com :path: /blog 19: text/html 58: Mozilla/5… Header compression (HPACK) • Huffman encoding • ~30% size reduction • Only diffs on 
 subsequent requests Stream 1 HEADERS Stream 2 HEADERS :method GET :scheme https :host example.nl :path /blog accept text/html user-agent Mozilla/5… :method GET :scheme https :host example.nl :path /blog/38 accept text/html user-agent Mozilla/5…
  • 39. ALPN • Application-Layer Protocol Negotiation • TLS extension of application layer ClientHello (ALPN extenstion + list of protocols) ServerHello (ALPN extenstion + selected protocol) ChangeCipherSpec Finished ChangeCipherSpec Finished
  • 40. And more… • Inherently safe (because effectively only TLS) • Stream prioritisation • Flow control * A 12 B 4 * D 1 C 8 * D 1 C 8 A 12 B 4 * D 1 E 8 A 12 B 4 C 8
  • 41. That's great, Piet. How about you show us some working code. You promised some action.” “
  • 42. Nice pants, by the way.”“
  • 44. HTTP/2 in action • Implementations in the wild • Roll your own HTTP/2-server • HTTP/2 on a bad network • Findings and recommendations • Sources
  • 46. Terminology • ALPN: Application-Layer Protocol Negotiation, TLS extension to over negotiate on application layer protocol • NPN: precursor to ALPN • Upgrade: negotiation mechanism for HTTP/1.1 => HTTP/2 • Direct: connection without upgrade / negotiation • h2: HTTP/2 over TLS • h2c: HTTP/2 over TCP
  • 47. Servers Name Version Negotiation Protocol Apache HTTP 2.4.17+ ALPN, Upgrade, direct h2, h2c NGINX 1.9.5+ ALPN, NPN, direct h2, h2c node-http2 ALPN, NPN, direct h2 Tomcat 8.5+ ALPN, Upgrade, direct h2, h2c http2 (Go) ALPN, NPN h2, h2-14 Jetty 9.3+ ALPN, Upgrade, direct h2, h2-17, h2-14, h2c, h2c-17 IIS 10 ? ? http-katana ALPN, Upgrade h2-12
  • 48. Clients Name Version Negotiation Protocol Firefox 49+ ALPN, NPN h2-15, h2-14, h2 Chrome ALPN h2, h2-14 Internet Explorer Windows 10 ALPN h2 curl, libcurl ALPN, NPN, Upgrade h2-14, h2c-14 node-http2 ALPN, NPN, direct h2 http-katana ALPN, Upgrade h2-12 http2 (Go) ALPN, NPN h2, h2-14
  • 50. Requirements • Java Development Kit (8+) • Eclipse Vert.x (reactive application toolkit for JVM) • netty-tcnative-boringssl-static (to dynamicly link TLS-support, no longer need in Java 9) • Some HTML, CSS and JavaScript files • A build / run tool (Gradle in this case) • A browser (for testing)
  • 51. Application resources • HTML: index.html • JavaScript: application.js (pushed!) • Style sheet: style.css (pushed!) • Image: photo.jpg (pushed!)
  • 52. Demo time! • Sources can be found at: 
 https://github.com/pietvandongen/http2-brain-upgrade
 pull requests and issues are welcome! • The Docker container image is at: 
 https://hub.docker.com/r/pietvandongen/http2-demo-server/
  • 53. HTTP/2 on a bad network
  • 54. Comparing HTTP/1.1 to HTTP/2 HTTP/2: Multiplexed + push HTTP/1.1: Sequential HTTP/1.1: Pipelined HTTP/2: Multiplexed
  • 55. HTTP: high latency HTTP/2: Multiplexed + push HTTP/1.1: Sequential HTTP/1.1: Pipelined HTTP/2: Multiplexed
  • 58. Findings and recommendations • Switch over, but use ALPN • Try before you asume (push!) • Start with a web project • Don't forget the decrypter during debugging • Read the documentation :)
  • 60. Sources / literature • https://http2.github.io/: HTTP/2 homepage curated by IETF HTTP Working Group • https://developers.google.com/web/fundamentals/performance/ http2/: Introduction to HTTP/2 by Google • http://vertx.io/: Homepage of Eclipse Vert.x • Stephen Ludin & Javier Garza, Learning HTTP/2: A Practical Guide for Beginners (O'Reilly 2017) • https://hpbn.co/http2/: Chapter 12 of High Performance Browser Networking (Ilya Grigorik, O'Reilly 2013)
  • 62. Any questions? • Mail me: piet.vandongen@luminis.eu • Tweet me: https://twitter.com/pietvandongen • Link me: https://www.linkedin.com/in/pietvandongencom/ • Visit me at Luminis (https://www.luminis.eu/)