SlideShare a Scribd company logo
NGINX: HTTP/2 Server Push
and gRPC
Amir Rawdat
Technical Marketing Engineer, NGINX
Formerly:
• Customer Applications Engineer, Nokia
• R&D Software Design, Mitel
Faisal Memon
Product Marketing Manager, NGINX
Formerly:
• Sr. Technical Marketing Engineer,
Riverbed
• Technical Marketing Engineer, Cisco
• Software Engineer, Cisco
Who are we?
Agenda
• Introducing NGINX
• NGINX HTTP/2 support
• HTTP/2 Server Push overview
• NGINX gRPC reverse proxy overview
• Demo
• Summary and Q&A
Where NGINX fits
Internet
Web Server
Serve content from disk
Application Gateway
FastCGI, uWSGI, Passenger…
Reverse Proxy
Caching, load balancing…
HTTP traffic
447 million
Total sites running on NGINX
Source: Netcraft February 2018 Web Server Survey
About NGINX, Inc.
• Founded in 2011, NGINX Plus first released in
2013
• VC-backed by enterprise software industry
leaders
• Offices in SF, London, Cork, Singapore,
Sydney, and Moscow
• 1,500+ commercial customers
• 200+ employees
“I wanted people to use it,
so I made it open source.”
- Igor Sysoev, NGINX creator and
founder
Agenda
• Introducing NGINX
• NGINX HTTP/2 overview
• NGINX HTTP/2 Server Push overview
• NGINX gRPC reverse proxy overview
• Demo
• Summary and Q&A
HTTP/2 Overview
Main benefits of HTTP/2:
• True connection multiplexing – No need for multiple connections, no head of line blocking
• Binary header – Less overhead, plug-ins available for WireShark
• Mandatory SSL – Browser-enforced, more secure
How NGINX Supports HTTP/2
• Backwards compatibility – Using ALPN, can support HTTP/2 alongside HTTP/1 (requires OpenSSL1.0.2 or later)
• HTTP/2 Gateway – Translates HTTP/2 into a protocol existing app servers can understand
NGINX HTTP/2 Support
• Initial release: September 2015
• NGINX 1.9.5 and later
• NGINX Plus R7 and later
• Used by 78% of all HTTP/2 enabled websites
NGINX HTTP/2 Support
• Add http2 argument to listen directive
• For clear text HTTP/2, remove SSL configuration
server {
listen 80;
server_name www.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
ssl_certificate server.crt;
ssl_certificate_key server.key;
}
Agenda
• Introducing NGINX
• NGINX HTTP/2 overview
• NGINX HTTP/2 Server Push overview
• NGINX gRPC reverse proxy overview
• Demo
• Summary and Q&A
HTTP/2 Server Push Overview
• User requests /demo.html
• Server responds with /demo.html
• Server pre-emptively sends style.css and image.jpg
• Stored in separate browser push cache until needed
• Support added in NGINX 1.13.9
HTTP/2 Server Push Testing
• HTTP sequential GETs – No optimizations
• HTTP with preload hints – Includes Preload hints in the first response
• HTTP/2 with server push – Preemptively push dependencies
HTTP/2 Server Push Testing
• HTTP/2 and HTTPS introduce one additional RTT for SSL handshake
• HTTP/2 Server push eliminates stylesheet RTT
• Reduces 2 RTT overall compared to unoptimized HTTP/2
HTTP/2 Server Push Config (Method 1)
server {
listen 443 ssl http2;
ssl_certificate server.crt;
ssl_certificate_key server.key;
root /var/www/html;
# whenever a client requests demo.html
# push /style.css, /image1.jpg, and
# /image2.jpg
location = /demo.html {
http2_push /style.css;
http2_push /image1.jpg;
http2_push /image2.jpg;
}
}
• http2_push – Defines resources to be pushed
to clients. When NGINX receives a request for
/demo.html, it will request and push
image1.jpg, and image2.jpg.
HTTP/2 Server Push Config (Method 2)
server {
listen 443 ssl http2;
ssl_certificate server.crt;
ssl_certificate_key server.key;
root /var/www/html;
# whenever a client requests demo.html
# push /style.css, /image1.jpg, and
# /image2.jpg
location = /demo.html {
http2_push_preload on;
}
}
• http2_push_preload – Instructs NGINX to parse HTTP
Link: headers and push specified resources.
• Link: </style.css>; as=style;
rel=preload, </favicon.ico>; as=image;
rel=preload
• Useful if you want application server to control what gets pushed.
HTTP/2 Server Push Config (Advanced)
server {
location = /demo.html {
add_header Set-Cookie "session=1";
add_header Link $resources;
http2_push_preload on;
}
}
map $http_cookie $resources {
"~*session=1" "";
default "</style.css>; as=style; 
rel=preload, </image1.jpg>; 
as=image; rel=preload, 
</image2.jpg>; as=style; 
rel=preload";
}
• map directive sets up following logic:
• If no session cookie push resources
• If session cookie don’t push resources
• NGINX inserts session cookie on first request
• Resources will only be pushed once per browser session
HTTP/2 Server Push Verification
• Chrome Developer Tools: The Initiator column on the Network tab indicates several resources were pushed to the client as part of a
request for /demo.html.
Agenda
• Introducing NGINX
• NGINX HTTP/2 overview
• NGINX HTTP/2 Server Push overview
• NGINX gRPC reverse proxy overview
• Demo
• Summary and Q&A
gRPC Overview
• gRPC is transported over HTTP/2. Does not work with HTTP/1.
• Can be cleartext or SSL-encrypted
• A gRPC call is implemented as an HTTP POST request
• Uses compact “protocol buffers” to exchange data between client and server
• Protocol buffers are implemented in C++ as a class
• Support added in NGINX 1.13.10
gRPC Proxying
server {
listen 80 http2;
location / {
grpc_pass grpc://localhost:50051;
}
}
• grpc_pass – Use like fastcgi_pass,
proxy_pass, etc.
• grpc:// – Use instead of http://.
gRPC Proxying with SSL Termination
server {
listen 443 ssl http2;
ssl_certificate server.crt;
ssl_certificate_key server.key;
location / {
grpc_pass grpc://localhost:50051;
}
}
• Configure SSL and HTTP/2 as usual
• Go sample application needs to modified to point to NGINX IP
Address and port.
gRPC Proxying with SSL Termination
creds := credentials.NewTLS( &tls.Config{ InsecureSkipVerify: true } )
// remember to update address to use the new NGINX listen port
conn, err := grpc.Dial( address, grpc.WithTransportCredentials( creds ) )
Modify client application, using sample Go application:
• Add crypto/tls and google.golang.org/grpc/credentials to your import list
• Modify the grpc.Dial() call to the following:.
gRPC Proxying with SSL End-to-End
server {
listen 443 ssl http2;
ssl_certificate server.crt;
ssl_certificate_key server.key;
location / {
grpc_pass grpcs://localhost:50051;
}
}
• Use grpcs instead of grpc
• Modify server to listen on SSL
cer, err := tls.LoadX509KeyPair( "cert.pem", "key.pem" )
config := &tls.Config{ Certificates: []tls.Certificate{cer} }
lis, err := tls.Listen( "tcp", port, config )
NGINX configuration:
Server configuration for sample Go application:
gRPC Routing
location /helloworld.ServiceA {
grpc_pass grpc://192.168.20.11:50051;
}
location /helloworld.ServiceB {
grpc_pass grpc://192.168.20.12:50052;
}
• Usually structured as application_name.method
gRPC Load Balancing
upstream grpcservers {
server 192.168.20.21:50051;
server 192.168.20.22:50052;
}
server {
listen 443 ssl http2;
ssl_certificate ssl/certificate.pem;
ssl_certificate_key ssl/key.pem;
location /helloworld.Greeter {
grpc_pass grpc://grpcservers;
error_page 502 = /error502grpc;
}
location = /error502grpc {
internal;
default_type application/grpc;
add_header grpc-status 14;
add_header grpc-message "unavailable";
return 204;
}
}
• gRPC server work with standard upstream blocks.
• Can use grpcs for encrypted gRPC
• If no servers are available, the /error502grpc location
returns a gRPC-compliant error message.
Agenda
• Introducing NGINX
• NGINX HTTP/2 overview
• NGINX HTTP/2 Server Push overview
• NGINX gRPC reverse proxy overview
• Demo
• Summary and Q&A
Agenda
• Introducing NGINX
• NGINX HTTP/2 overview
• NGINX HTTP/2 Server Push overview
• NGINX gRPC reverse proxy overview
• Demo
• Summary and Q&A
NGINX Conf 2018
The official event for all things NGINX
October 8-11, 2018 | Atlanta, GA
Learn how to use NGINX to modernize existing applications and build new
microservice applications. There will be two session tracks:
• NGINX Builders: Hands-on insights for developers, IT ops, and DevOps
• NGINX Designers: Strategy and trends for architects and IT leaders
Early bird registration now open: nginx.com/nginxconf
How are you planning to use Server Push and gRPC?
Let us know: nginx-inquiries@nginx.com
Summary
• NGINX 1.13.9 and later support HTTP/2 server push
• Use h2_push to have NGINX push resources
• Use h2_push_preload on; to have NGINX use the Link: header
• NGINX 1.13.10 and later support gRPC proxying
• Use grpc_pass like proxy_pass, fastcgi_pass, etc. to proxy gRPC
connections
• Use grpc:// and grpcs:// like http:// and https:// to tell NGINX
what server(s) to proxy to
• Use location blocks to route gRPC requests
• Use upstream blocks to define groups of gRPC servers to load balance
Q & ATry NGINX Plus free for 30 days: nginx.com/free-trial-request

More Related Content

What's hot (20)

PDF
5 Steps to PostgreSQL Performance
Command Prompt., Inc
 
PDF
Load Balancing MySQL with HAProxy - Slides
Severalnines
 
PDF
Understanding blue store, Ceph's new storage backend - Tim Serong, SUSE
OpenStack
 
PDF
Altinity Quickstart for ClickHouse
Altinity Ltd
 
PDF
Prometheus and Docker (Docker Galway, November 2015)
Brian Brazil
 
PPTX
virtualization and hypervisors
Gaurav Suri
 
PDF
ClickHouse Features for Advanced Users, by Aleksei Milovidov
Altinity Ltd
 
PPTX
HTTP request and response
Sahil Agarwal
 
PPTX
JSON: The Basics
Jeff Fox
 
PDF
PostgreSQL Streaming Replication Cheatsheet
Alexey Lesovsky
 
PDF
Delta Architecture
Paulo Gutierrez
 
PDF
OpenStack networking
Sim Janghoon
 
PDF
Spark Autotuning Talk - Strata New York
Holden Karau
 
PDF
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Altinity Ltd
 
PDF
ClickHouse on Kubernetes, by Alexander Zaitsev, Altinity CTO
Altinity Ltd
 
PDF
Introduction to Apache Hive
Avkash Chauhan
 
PPTX
NGINX: Basics & Best Practices - EMEA Broadcast
NGINX, Inc.
 
PDF
Serving ML easily with FastAPI - meme version
Sebastián Ramírez Montaño
 
PDF
NGINX ADC: Basics and Best Practices
NGINX, Inc.
 
PPTX
Functions in php
Kamal Acharya
 
5 Steps to PostgreSQL Performance
Command Prompt., Inc
 
Load Balancing MySQL with HAProxy - Slides
Severalnines
 
Understanding blue store, Ceph's new storage backend - Tim Serong, SUSE
OpenStack
 
Altinity Quickstart for ClickHouse
Altinity Ltd
 
Prometheus and Docker (Docker Galway, November 2015)
Brian Brazil
 
virtualization and hypervisors
Gaurav Suri
 
ClickHouse Features for Advanced Users, by Aleksei Milovidov
Altinity Ltd
 
HTTP request and response
Sahil Agarwal
 
JSON: The Basics
Jeff Fox
 
PostgreSQL Streaming Replication Cheatsheet
Alexey Lesovsky
 
Delta Architecture
Paulo Gutierrez
 
OpenStack networking
Sim Janghoon
 
Spark Autotuning Talk - Strata New York
Holden Karau
 
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Altinity Ltd
 
ClickHouse on Kubernetes, by Alexander Zaitsev, Altinity CTO
Altinity Ltd
 
Introduction to Apache Hive
Avkash Chauhan
 
NGINX: Basics & Best Practices - EMEA Broadcast
NGINX, Inc.
 
Serving ML easily with FastAPI - meme version
Sebastián Ramírez Montaño
 
NGINX ADC: Basics and Best Practices
NGINX, Inc.
 
Functions in php
Kamal Acharya
 

Similar to NGINX: HTTP/2 Server Push and gRPC (20)

PDF
NGINX: HTTP/2 Server Push and gRPC – EMEA
NGINX, Inc.
 
PPTX
What’s New in NGINX Plus R15?
NGINX, Inc.
 
PDF
What’s New in NGINX Plus R15? - EMEA
NGINX, Inc.
 
PPTX
The new (is it really ) api stack
Red Hat
 
PDF
What’s New in NGINX Plus R16? – EMEA
NGINX, Inc.
 
PPTX
What's New in NGINX Plus R8
NGINX, Inc.
 
PPTX
HTTP2 and gRPC
Guo Jing
 
PPTX
What's New in HTTP/2
NGINX, Inc.
 
PPTX
What's New in NGINX Plus R7?
NGINX, Inc.
 
PDF
NGINX: Basics and Best Practices EMEA
NGINX, Inc.
 
PDF
gRPC - RPC rebirth?
Luís Barbosa
 
PPTX
NGINX: High Performance Load Balancing
NGINX, Inc.
 
PPTX
NGINX Plus R18: What's new
NGINX, Inc.
 
PPTX
NGINX Plus R20 Webinar
NGINX, Inc.
 
PPTX
NGINX: Back to Basics – APCJ
NGINX, Inc.
 
PDF
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
Ortus Solutions, Corp
 
PPTX
NGINX Basics: Ask Me Anything – EMEA
NGINX, Inc.
 
PPTX
Nginx Deep Dive Kubernetes Ingress
Knoldus Inc.
 
PPTX
What’s New in NGINX Plus R16?
NGINX, Inc.
 
PDF
Building a Web Server with NGINX
GLC Networks
 
NGINX: HTTP/2 Server Push and gRPC – EMEA
NGINX, Inc.
 
What’s New in NGINX Plus R15?
NGINX, Inc.
 
What’s New in NGINX Plus R15? - EMEA
NGINX, Inc.
 
The new (is it really ) api stack
Red Hat
 
What’s New in NGINX Plus R16? – EMEA
NGINX, Inc.
 
What's New in NGINX Plus R8
NGINX, Inc.
 
HTTP2 and gRPC
Guo Jing
 
What's New in HTTP/2
NGINX, Inc.
 
What's New in NGINX Plus R7?
NGINX, Inc.
 
NGINX: Basics and Best Practices EMEA
NGINX, Inc.
 
gRPC - RPC rebirth?
Luís Barbosa
 
NGINX: High Performance Load Balancing
NGINX, Inc.
 
NGINX Plus R18: What's new
NGINX, Inc.
 
NGINX Plus R20 Webinar
NGINX, Inc.
 
NGINX: Back to Basics – APCJ
NGINX, Inc.
 
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
Ortus Solutions, Corp
 
NGINX Basics: Ask Me Anything – EMEA
NGINX, Inc.
 
Nginx Deep Dive Kubernetes Ingress
Knoldus Inc.
 
What’s New in NGINX Plus R16?
NGINX, Inc.
 
Building a Web Server with NGINX
GLC Networks
 
Ad

More from NGINX, Inc. (20)

PDF
【NGINXセミナー】 Ingressを使ってマイクロサービスの運用を楽にする方法
NGINX, Inc.
 
PDF
【NGINXセミナー】 NGINXのWAFとは?その使い方と設定方法 解説セミナー
NGINX, Inc.
 
PDF
【NGINXセミナー】API ゲートウェイとしてのNGINX Plus活用方法
NGINX, Inc.
 
PPTX
Get Hands-On with NGINX and QUIC+HTTP/3
NGINX, Inc.
 
PPTX
Managing Kubernetes Cost and Performance with NGINX & Kubecost
NGINX, Inc.
 
PDF
Manage Microservices Chaos and Complexity with Observability
NGINX, Inc.
 
PDF
Accelerate Microservices Deployments with Automation
NGINX, Inc.
 
PDF
Unit 2: Microservices Secrets Management 101
NGINX, Inc.
 
PDF
Unit 1: Apply the Twelve-Factor App to Microservices Architectures
NGINX, Inc.
 
PDF
NGINX基本セミナー(セキュリティ編)~NGINXでセキュアなプラットフォームを実現する方法!
NGINX, Inc.
 
PDF
Easily View, Manage, and Scale Your App Security with F5 NGINX
NGINX, Inc.
 
PDF
NGINXセミナー(基本編)~いまさら聞けないNGINXコンフィグなど基本がわかる!
NGINX, Inc.
 
PDF
Keep Ahead of Evolving Cyberattacks with OPSWAT and F5 NGINX
NGINX, Inc.
 
PPTX
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
NGINX, Inc.
 
PPTX
Protecting Apps from Hacks in Kubernetes with NGINX
NGINX, Inc.
 
PPTX
NGINX Kubernetes API
NGINX, Inc.
 
PPTX
Successfully Implement Your API Strategy with NGINX
NGINX, Inc.
 
PPTX
Installing and Configuring NGINX Open Source
NGINX, Inc.
 
PPTX
Shift Left for More Secure Apps with F5 NGINX
NGINX, Inc.
 
PPTX
How to Avoid the Top 5 NGINX Configuration Mistakes.pptx
NGINX, Inc.
 
【NGINXセミナー】 Ingressを使ってマイクロサービスの運用を楽にする方法
NGINX, Inc.
 
【NGINXセミナー】 NGINXのWAFとは?その使い方と設定方法 解説セミナー
NGINX, Inc.
 
【NGINXセミナー】API ゲートウェイとしてのNGINX Plus活用方法
NGINX, Inc.
 
Get Hands-On with NGINX and QUIC+HTTP/3
NGINX, Inc.
 
Managing Kubernetes Cost and Performance with NGINX & Kubecost
NGINX, Inc.
 
Manage Microservices Chaos and Complexity with Observability
NGINX, Inc.
 
Accelerate Microservices Deployments with Automation
NGINX, Inc.
 
Unit 2: Microservices Secrets Management 101
NGINX, Inc.
 
Unit 1: Apply the Twelve-Factor App to Microservices Architectures
NGINX, Inc.
 
NGINX基本セミナー(セキュリティ編)~NGINXでセキュアなプラットフォームを実現する方法!
NGINX, Inc.
 
Easily View, Manage, and Scale Your App Security with F5 NGINX
NGINX, Inc.
 
NGINXセミナー(基本編)~いまさら聞けないNGINXコンフィグなど基本がわかる!
NGINX, Inc.
 
Keep Ahead of Evolving Cyberattacks with OPSWAT and F5 NGINX
NGINX, Inc.
 
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
NGINX, Inc.
 
Protecting Apps from Hacks in Kubernetes with NGINX
NGINX, Inc.
 
NGINX Kubernetes API
NGINX, Inc.
 
Successfully Implement Your API Strategy with NGINX
NGINX, Inc.
 
Installing and Configuring NGINX Open Source
NGINX, Inc.
 
Shift Left for More Secure Apps with F5 NGINX
NGINX, Inc.
 
How to Avoid the Top 5 NGINX Configuration Mistakes.pptx
NGINX, Inc.
 
Ad

Recently uploaded (20)

PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 

NGINX: HTTP/2 Server Push and gRPC

  • 1. NGINX: HTTP/2 Server Push and gRPC
  • 2. Amir Rawdat Technical Marketing Engineer, NGINX Formerly: • Customer Applications Engineer, Nokia • R&D Software Design, Mitel Faisal Memon Product Marketing Manager, NGINX Formerly: • Sr. Technical Marketing Engineer, Riverbed • Technical Marketing Engineer, Cisco • Software Engineer, Cisco Who are we?
  • 3. Agenda • Introducing NGINX • NGINX HTTP/2 support • HTTP/2 Server Push overview • NGINX gRPC reverse proxy overview • Demo • Summary and Q&A
  • 4. Where NGINX fits Internet Web Server Serve content from disk Application Gateway FastCGI, uWSGI, Passenger… Reverse Proxy Caching, load balancing… HTTP traffic
  • 5. 447 million Total sites running on NGINX Source: Netcraft February 2018 Web Server Survey
  • 6. About NGINX, Inc. • Founded in 2011, NGINX Plus first released in 2013 • VC-backed by enterprise software industry leaders • Offices in SF, London, Cork, Singapore, Sydney, and Moscow • 1,500+ commercial customers • 200+ employees
  • 7. “I wanted people to use it, so I made it open source.” - Igor Sysoev, NGINX creator and founder
  • 8. Agenda • Introducing NGINX • NGINX HTTP/2 overview • NGINX HTTP/2 Server Push overview • NGINX gRPC reverse proxy overview • Demo • Summary and Q&A
  • 9. HTTP/2 Overview Main benefits of HTTP/2: • True connection multiplexing – No need for multiple connections, no head of line blocking • Binary header – Less overhead, plug-ins available for WireShark • Mandatory SSL – Browser-enforced, more secure
  • 10. How NGINX Supports HTTP/2 • Backwards compatibility – Using ALPN, can support HTTP/2 alongside HTTP/1 (requires OpenSSL1.0.2 or later) • HTTP/2 Gateway – Translates HTTP/2 into a protocol existing app servers can understand
  • 11. NGINX HTTP/2 Support • Initial release: September 2015 • NGINX 1.9.5 and later • NGINX Plus R7 and later • Used by 78% of all HTTP/2 enabled websites
  • 12. NGINX HTTP/2 Support • Add http2 argument to listen directive • For clear text HTTP/2, remove SSL configuration server { listen 80; server_name www.example.com; return 301 https://$host$request_uri; } server { listen 443 ssl http2; ssl_certificate server.crt; ssl_certificate_key server.key; }
  • 13. Agenda • Introducing NGINX • NGINX HTTP/2 overview • NGINX HTTP/2 Server Push overview • NGINX gRPC reverse proxy overview • Demo • Summary and Q&A
  • 14. HTTP/2 Server Push Overview • User requests /demo.html • Server responds with /demo.html • Server pre-emptively sends style.css and image.jpg • Stored in separate browser push cache until needed • Support added in NGINX 1.13.9
  • 15. HTTP/2 Server Push Testing • HTTP sequential GETs – No optimizations • HTTP with preload hints – Includes Preload hints in the first response • HTTP/2 with server push – Preemptively push dependencies
  • 16. HTTP/2 Server Push Testing • HTTP/2 and HTTPS introduce one additional RTT for SSL handshake • HTTP/2 Server push eliminates stylesheet RTT • Reduces 2 RTT overall compared to unoptimized HTTP/2
  • 17. HTTP/2 Server Push Config (Method 1) server { listen 443 ssl http2; ssl_certificate server.crt; ssl_certificate_key server.key; root /var/www/html; # whenever a client requests demo.html # push /style.css, /image1.jpg, and # /image2.jpg location = /demo.html { http2_push /style.css; http2_push /image1.jpg; http2_push /image2.jpg; } } • http2_push – Defines resources to be pushed to clients. When NGINX receives a request for /demo.html, it will request and push image1.jpg, and image2.jpg.
  • 18. HTTP/2 Server Push Config (Method 2) server { listen 443 ssl http2; ssl_certificate server.crt; ssl_certificate_key server.key; root /var/www/html; # whenever a client requests demo.html # push /style.css, /image1.jpg, and # /image2.jpg location = /demo.html { http2_push_preload on; } } • http2_push_preload – Instructs NGINX to parse HTTP Link: headers and push specified resources. • Link: </style.css>; as=style; rel=preload, </favicon.ico>; as=image; rel=preload • Useful if you want application server to control what gets pushed.
  • 19. HTTP/2 Server Push Config (Advanced) server { location = /demo.html { add_header Set-Cookie "session=1"; add_header Link $resources; http2_push_preload on; } } map $http_cookie $resources { "~*session=1" ""; default "</style.css>; as=style; rel=preload, </image1.jpg>; as=image; rel=preload, </image2.jpg>; as=style; rel=preload"; } • map directive sets up following logic: • If no session cookie push resources • If session cookie don’t push resources • NGINX inserts session cookie on first request • Resources will only be pushed once per browser session
  • 20. HTTP/2 Server Push Verification • Chrome Developer Tools: The Initiator column on the Network tab indicates several resources were pushed to the client as part of a request for /demo.html.
  • 21. Agenda • Introducing NGINX • NGINX HTTP/2 overview • NGINX HTTP/2 Server Push overview • NGINX gRPC reverse proxy overview • Demo • Summary and Q&A
  • 22. gRPC Overview • gRPC is transported over HTTP/2. Does not work with HTTP/1. • Can be cleartext or SSL-encrypted • A gRPC call is implemented as an HTTP POST request • Uses compact “protocol buffers” to exchange data between client and server • Protocol buffers are implemented in C++ as a class • Support added in NGINX 1.13.10
  • 23. gRPC Proxying server { listen 80 http2; location / { grpc_pass grpc://localhost:50051; } } • grpc_pass – Use like fastcgi_pass, proxy_pass, etc. • grpc:// – Use instead of http://.
  • 24. gRPC Proxying with SSL Termination server { listen 443 ssl http2; ssl_certificate server.crt; ssl_certificate_key server.key; location / { grpc_pass grpc://localhost:50051; } } • Configure SSL and HTTP/2 as usual • Go sample application needs to modified to point to NGINX IP Address and port.
  • 25. gRPC Proxying with SSL Termination creds := credentials.NewTLS( &tls.Config{ InsecureSkipVerify: true } ) // remember to update address to use the new NGINX listen port conn, err := grpc.Dial( address, grpc.WithTransportCredentials( creds ) ) Modify client application, using sample Go application: • Add crypto/tls and google.golang.org/grpc/credentials to your import list • Modify the grpc.Dial() call to the following:.
  • 26. gRPC Proxying with SSL End-to-End server { listen 443 ssl http2; ssl_certificate server.crt; ssl_certificate_key server.key; location / { grpc_pass grpcs://localhost:50051; } } • Use grpcs instead of grpc • Modify server to listen on SSL cer, err := tls.LoadX509KeyPair( "cert.pem", "key.pem" ) config := &tls.Config{ Certificates: []tls.Certificate{cer} } lis, err := tls.Listen( "tcp", port, config ) NGINX configuration: Server configuration for sample Go application:
  • 27. gRPC Routing location /helloworld.ServiceA { grpc_pass grpc://192.168.20.11:50051; } location /helloworld.ServiceB { grpc_pass grpc://192.168.20.12:50052; } • Usually structured as application_name.method
  • 28. gRPC Load Balancing upstream grpcservers { server 192.168.20.21:50051; server 192.168.20.22:50052; } server { listen 443 ssl http2; ssl_certificate ssl/certificate.pem; ssl_certificate_key ssl/key.pem; location /helloworld.Greeter { grpc_pass grpc://grpcservers; error_page 502 = /error502grpc; } location = /error502grpc { internal; default_type application/grpc; add_header grpc-status 14; add_header grpc-message "unavailable"; return 204; } } • gRPC server work with standard upstream blocks. • Can use grpcs for encrypted gRPC • If no servers are available, the /error502grpc location returns a gRPC-compliant error message.
  • 29. Agenda • Introducing NGINX • NGINX HTTP/2 overview • NGINX HTTP/2 Server Push overview • NGINX gRPC reverse proxy overview • Demo • Summary and Q&A
  • 30. Agenda • Introducing NGINX • NGINX HTTP/2 overview • NGINX HTTP/2 Server Push overview • NGINX gRPC reverse proxy overview • Demo • Summary and Q&A
  • 31. NGINX Conf 2018 The official event for all things NGINX October 8-11, 2018 | Atlanta, GA Learn how to use NGINX to modernize existing applications and build new microservice applications. There will be two session tracks: • NGINX Builders: Hands-on insights for developers, IT ops, and DevOps • NGINX Designers: Strategy and trends for architects and IT leaders Early bird registration now open: nginx.com/nginxconf How are you planning to use Server Push and gRPC? Let us know: [email protected]
  • 32. Summary • NGINX 1.13.9 and later support HTTP/2 server push • Use h2_push to have NGINX push resources • Use h2_push_preload on; to have NGINX use the Link: header • NGINX 1.13.10 and later support gRPC proxying • Use grpc_pass like proxy_pass, fastcgi_pass, etc. to proxy gRPC connections • Use grpc:// and grpcs:// like http:// and https:// to tell NGINX what server(s) to proxy to • Use location blocks to route gRPC requests • Use upstream blocks to define groups of gRPC servers to load balance
  • 33. Q & ATry NGINX Plus free for 30 days: nginx.com/free-trial-request

Editor's Notes

  • #5: - We will
  • #6: NGINX Plus gives you all the tools you need to deliver your application reliably. Web Server NGINX is a fully featured web server that can directly serve static content. NGINX Plus can scale to handle hundreds of thousands of clients simultaneously, and serve hundreds of thousands of content resources per second. Application Gateway NGINX handles all HTTP traffic, and forwards requests in a smooth, controlled manner to PHP, Ruby, Java, and other application types, using FastCGI, uWSGI, and Linux sockets. Reverse Proxy NGINX is a reverse proxy that you can put in front of your applications. NGINX can cache both static and dynamic content to improve overall performance, as well as load balance traffic enabling you to scale-out.
  • #7: Source: https://news.netcraft.com/archives/category/web-server-survey/ From there NGINX grew rapidly and now is used by over 447 million websites world wide, including Uber, Netflix, Airbnb, Twitch, Stripe and other innovative companies. NOTE: In “Misc. Extras” section, there is a slide of relevant OSS users.
  • #9: - Bring it back to open source
  • #10: - We will
  • #11: - We will
  • #12: Supported ALPN distros: Debian 9, Ubunu 16.04, Redhat 7.4
  • #13: - We will
  • #15: - We will
  • #16: Part of HTTP/2 specification
  • #18: HTTP/2 requires one extra rtt.
  • #23: - We will
  • #24: Part of HTTP/2 specification
  • #25: Part of HTTP/2 specification
  • #26: Part of HTTP/2 specification
  • #27: Part of HTTP/2 specification
  • #28: Part of HTTP/2 specification
  • #29: Part of HTTP/2 specification
  • #30: Part of HTTP/2 specification
  • #31: - We will
  • #32: - We will