Skip to content

leogomes/http2-netty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http2-netty

This is a Netty-based version of the tiles HTTP/2 example published by Go lang.

It shows the loading of an image composed by 200 tiles using both HTTP/2 and HTTP 1.x. You can also simulate different latencies and that's where HTTP/2 really makes a difference.

screenshot

To run the example you will need

  • Java 8
  • ALPN boot library
  • HTTP/2-powered browser (preferably Chrome 40+)
  • A patched version of Netty 4.1, if your browser doesn't support HTTP/2 Draft 16 yet.

The ALPN library must match the version of your JDK. I'm using 1.8.0_25, in the example below. Check out the documentation to know which version of ALPN boot you should use to match your installed JDK. The jars can be obtained from your local maven repository, or downloaded here.

Since Netty currently supports draft 16 of the HTTP/2 and both Chrome and Firefox are still on Draft 14, you will need to hack Netty to use draft 14. I simply changed the version constant on Http2CodecUtil, from h2-16 to h2-14, and built Netty 4.1 locally.

Finally, just build the project with:

$ mvn clean install -Prelease

and launch it making sure to set the correct path to the ALPN jar:

java -server -Xbootclasspath/p:lib/alpn-boot-8.1.2.v20141202.jar -Dhttp-port=8080 -Dhttp2-port=8443 -jar target/http2-netty.jar

About

A visual performance comparison of HTTP/2 vs HTTP 1.x

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published