SlideShare une entreprise Scribd logo
1  sur  42
Télécharger pour lire hors ligne
Otavio Santana
@otaviojava
HTTP / 1, HTTP /
2 and HTTP / 3:
Past, present and
the future of
APIs
Roan Brasil
@roanbrasil
Otavio Santana
@otaviojava
DevRel Engineer
+ Java Champion
+ JCP-EC-EG-EGL
+ Apache Committer
+ Eclipse Committer
+ Eclipse Project Leader
+ Book and blog writer
Speaker
Roan Brasil
@roanbrasil
Senior Engineer
+ JCP-Member
+ Open Source Contributor
+ Book and blog writer
+ Teacher
Speaker
History of HTTP
The Past, The Present and the Future
HTTP 0.9 HTTP 1.0 HTTP 1.1 HTTP 2 HTTP 3
1991 1996 1999 2015 2018
PAST PRESENT FUTURE
Three-way handshake - TCP Protocol
Sync
Sync/ACK
ACK
Response
Request
HTTP
● Resources
● client-server
How it works
● Method
● Path
● Version of the protocol
● Headers
● Cache
How it works
● Method
● Path
● Version of the protocol
● Headers
● Cache
HTTP
● Resources
● client-server
GET / HTTP/1.1
Host: developer.mozilla.org
Accept-Language: fr
HTTP/1.1 200 OK
Date: Sat, 09 Oct 2010 14:28:02 GMT
Server: Apache
Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT
ETag: "51142bc1-7449-479b075b2891b"
Accept-Ranges: bytes
Content-Length: 29769
Content-Type: text/html
<!DOCTYPE html... (here comes the 29769
bytes of the requested web page)
HTTP Status
● 1xx informational response
● 2xx successful
● 3xx redirection
● 4xx client error
● 5xx server error
1XX
● 100 Continue
● 101 Switching Protocols
● 102 Processing (WebDAV; RFC 2518)
● 103 Early Hints (RFC 8297)
2XX
● 200 OK
● 201 Created
● 202 Accepted
● 203 Non-Authoritative Information
● 204 No Content
● 205 Reset Content
● 206 Partial Content
● 207 Multi-Status
● 208 Already Reported
● 226 IM Used
3XX
● 300 Multiple Choice
● 301 Moved Permanently
● 302 Found
● 303 See Other
● 304 Not Modified
● 305 Use Proxy
● 306 unused
● 307 Temporary Redirect
● 308 Permanent Redirect
4XX
● 400 Bad Request
● 401 Unauthorized
● 402 Payment Required
● 403 Forbidden
● 404 Not Found
● 405 Method Not Allowed
● 406 Not Acceptable
● 407 Proxy Authentication Required
● 408 Request Timeout
● 409 Conflict
● 410 Gone
5XX
● 500 Internal Server Error
● 501 Not Implemented
● 502 Bad Gateway
● 503 Service Unavailable
● 504 Gateway Timeout
● 505 HTTP Version Not Supported
● 506 Variant Also Negotiates
● 507 Insufficient Storage (WebDAV)
● 508 Loop Detected (WebDAV)
● 510 Not Extended
● 511 Network Authentication Required
HTTP 1.1 - Rest
REST is acronym for REpresentational State Transfer. It is architectural style
for distributed hypermedia systems and was first presented by Roy Fielding in
2000 in his famous dissertation.
Rest - Example
Api Design
● API
● Contract First
● Contract Last
Glory of Rest
● Richardson Maturity Model
○ Model of Restful Maturity
○ Integration Problems
Glory of Rest
● Level 0
○ HTTP - transport system for
remote interactions
● Level 1
○ Individual Resources
● Level 2
○ POST
○ GET
○ DELETE
○ PATCH / PUT
● Level 3
○ HATEOAS (Hypertext As The
Engine Of Application State)
HTTP/2
● In 2009, Mike Belshe and
Roberto Peon of Google proposed
SPDY
● HTTP/2 replaces SPDY
● Same semantics HTTP/1.x
● Binary Protocol
● Introduced to improve
performance
● HTTPBis Working Group
○ Specification HTTP
○ RFC 7540
○ HPACK - RFC 7541
HTTP/2 - Response Multiplex
What is GRPC?
gRPC is a modern open source high performance remote procedure call (RPC) framework
that can run in any environment. Initially developed at Google 2015 using HTTP/2
protocol. Use protobuf as a mechanism for serializing structure data.
https://grpc.io/
https://developers.google.com/protocol-buffers/
Types of GRPC
Where must I use GRPC?
● Microservices
○ Low-latency and high-throughput communication
○ Strong API contract
● Polyglot environments
● Point-to-Point real time communication
○ Bidirectional streaming
● Network Constrained environments
○ Lightweight message format (mobile application)
HTTP/2 and GRPC - Client
HTTP/2 and GRPC - Server
HTTP/2 and Java 9
try {
HttpClient httpClient = HttpClient.newHttpClient(); //Create a HttpClient
System.out.println(httpClient.version());
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(new URI("https://www.google.com/")).GET().build();
//Create a GET request for the given URI
Map<String,List<String>> headers = httpRequest.headers().map();
headers.forEach((k, v) - > System.out.println(k + "-" + v));
HttpResponse < String > httpResponse = httpClient.send(httpRequest,
HttpResponse.BodyHandler.asString());
} catch (Exception e) {
System.out.println("message " + e);
}
Servlet 4.0
@WebServlet(value = {"/http2"})
public class Http2Servlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
PushBuilder pushBuilder = req.newPushBuilder();
pushBuilder
.path("images/kodedu-logo.png")
.addHeader("content-type", "image/png")
.push();
try(PrintWriter respWriter = resp.getWriter();){
respWriter.write("<html><img src='images/kodedu-logo.png'></html>");
}
}
}
What is RSocket?
RSocket is a binary protocol, bi-directional, multiplexed, message-based based on
Reactive Streams semantics. It provides support for four interaction models. It is transport
protocol agnostic.
https://rsocket.io/
RSocket - Client
RSocket - Server
HTTP/1.1 x HTTP/2
HTTP/1.1 x HTTP/2
Architecture Trends 2020
HTTP 3 - The Future
HTTP/1.1 x HTTP/2 x HTTP/3
HTTP/1.1 x HTTP/2 x HTTP/3
HTTP 3 - The Future
What is new in HTTP 3?
● It is a 3rd version of Hypertext Transfer Protocol (HTTP)
● New protocol specification (not ready for production yet)
● Use the same semantics of HTTP/1.* and HTTP/2, such as GET and POST operation
● August-2020 became Internet-Draft
HTTP 3 - QUIC - The Future
QUIC - Quick UDP Internet Connections
● Designed in 2012 by Jim Roskind at Google
● Reduce connection and transport latency
● Multiplexed transport over UDP
● Open source development in Chromium
● Google and Facebook are already using
HTTP 3 - Flupke
String url = "https://platform.sh/";
URI serverUrl = URI.create(url);
HttpRequest request = HttpRequest.newBuilder()
.uri(serverUrl)
.header("User-Agent", "Flupke http3 library")
.timeout(Duration.ofSeconds(10))
.build();
HttpClient client = Http3Client.newHttpClient();
HttpResponse<String> httpResponse = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println("Got HTTP response " + httpResponse);
System.out.println("- HTTP headers: " + httpResponse.headers());
Q&A Thank you

Contenu connexe

Tendances

Tendances (20)

Golang taipei #45 10th birthday
Golang taipei #45 10th birthdayGolang taipei #45 10th birthday
Golang taipei #45 10th birthday
 
Migrating python.org to buildbot 9 and python 3
Migrating python.org to buildbot 9 and python 3Migrating python.org to buildbot 9 and python 3
Migrating python.org to buildbot 9 and python 3
 
Pavimentando el camino con Jakarta EE 9 y Apache TomEE
Pavimentando el camino con Jakarta EE 9 y Apache TomEE Pavimentando el camino con Jakarta EE 9 y Apache TomEE
Pavimentando el camino con Jakarta EE 9 y Apache TomEE
 
COSCUP 2016: Project 52 每週一個小專案來學習 Golang
COSCUP 2016: Project 52 每週一個小專案來學習 GolangCOSCUP 2016: Project 52 每週一個小專案來學習 Golang
COSCUP 2016: Project 52 每週一個小專案來學習 Golang
 
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
 
Golang online course
Golang online courseGolang online course
Golang online course
 
Git for Beginners
Git for BeginnersGit for Beginners
Git for Beginners
 
Git workflows (Basics)
Git workflows (Basics)Git workflows (Basics)
Git workflows (Basics)
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
用 Go 語言實戰 Push Notification 服務
用 Go 語言實戰 Push Notification 服務用 Go 語言實戰 Push Notification 服務
用 Go 語言實戰 Push Notification 服務
 
Paving the road with Jakarta EE and Apache TomEE - JCON 2021
Paving the road with Jakarta EE  and Apache TomEE - JCON 2021Paving the road with Jakarta EE  and Apache TomEE - JCON 2021
Paving the road with Jakarta EE and Apache TomEE - JCON 2021
 
Building Command Line Tools with Golang
Building Command Line Tools with GolangBuilding Command Line Tools with Golang
Building Command Line Tools with Golang
 
Optimizing and Profiling Golang Rest Api
Optimizing and Profiling Golang Rest ApiOptimizing and Profiling Golang Rest Api
Optimizing and Profiling Golang Rest Api
 
Як РНР розробник пише код на Kotlin
Як РНР розробник пише код на KotlinЯк РНР розробник пише код на Kotlin
Як РНР розробник пише код на Kotlin
 
Introduction to github slideshare
Introduction to github slideshareIntroduction to github slideshare
Introduction to github slideshare
 
CI/CD with Rancher CLI + Jenkins
CI/CD with Rancher CLI + JenkinsCI/CD with Rancher CLI + Jenkins
CI/CD with Rancher CLI + Jenkins
 
Automate CI/CD with Rancher
Automate CI/CD with RancherAutomate CI/CD with Rancher
Automate CI/CD with Rancher
 
Juc boston2014.pptx
Juc boston2014.pptxJuc boston2014.pptx
Juc boston2014.pptx
 
Project52
Project52Project52
Project52
 
Dev + DevOps для PHP розробника
Dev + DevOps для PHP розробникаDev + DevOps для PHP розробника
Dev + DevOps для PHP розробника
 

Similaire à HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs

Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
Zoran Jeremic
 
Building+restful+webservice
Building+restful+webserviceBuilding+restful+webservice
Building+restful+webservice
lonegunman
 

Similaire à HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs (20)

Juglouvain http revisited
Juglouvain http revisitedJuglouvain http revisited
Juglouvain http revisited
 
Boost Your Content Strategy for REST APIs with Gururaj BS
Boost Your Content Strategy for REST APIs with Gururaj BSBoost Your Content Strategy for REST APIs with Gururaj BS
Boost Your Content Strategy for REST APIs with Gururaj BS
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Performance #4 network
Performance #4  networkPerformance #4  network
Performance #4 network
 
So you think you know REST - DPC11
So you think you know REST - DPC11So you think you know REST - DPC11
So you think you know REST - DPC11
 
Network basics
Network basicsNetwork basics
Network basics
 
Android Performance #4: Network
Android Performance #4: NetworkAndroid Performance #4: Network
Android Performance #4: Network
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHP
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
Talking to Web Services
Talking to Web ServicesTalking to Web Services
Talking to Web Services
 
Top 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersTop 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud Developers
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Using Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 WorldUsing Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 World
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
HTTP 프로토콜의 이해와 활용
HTTP 프로토콜의 이해와 활용HTTP 프로토콜의 이해와 활용
HTTP 프로토콜의 이해와 활용
 
WUG Days 2022 Brno - Networking in .NET 7.0 and YARP -- Karel Zikmund
WUG Days 2022 Brno - Networking in .NET 7.0 and YARP -- Karel ZikmundWUG Days 2022 Brno - Networking in .NET 7.0 and YARP -- Karel Zikmund
WUG Days 2022 Brno - Networking in .NET 7.0 and YARP -- Karel Zikmund
 
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
 
Android httpclient
Android httpclientAndroid httpclient
Android httpclient
 
Building+restful+webservice
Building+restful+webserviceBuilding+restful+webservice
Building+restful+webservice
 
マイクロサービスバックエンドAPIのためのRESTとgRPC
マイクロサービスバックエンドAPIのためのRESTとgRPCマイクロサービスバックエンドAPIのためのRESTとgRPC
マイクロサービスバックエンドAPIのためのRESTとgRPC
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
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?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 

HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs

  • 1. Otavio Santana @otaviojava HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs Roan Brasil @roanbrasil
  • 2. Otavio Santana @otaviojava DevRel Engineer + Java Champion + JCP-EC-EG-EGL + Apache Committer + Eclipse Committer + Eclipse Project Leader + Book and blog writer Speaker
  • 3. Roan Brasil @roanbrasil Senior Engineer + JCP-Member + Open Source Contributor + Book and blog writer + Teacher Speaker
  • 4. History of HTTP The Past, The Present and the Future HTTP 0.9 HTTP 1.0 HTTP 1.1 HTTP 2 HTTP 3 1991 1996 1999 2015 2018 PAST PRESENT FUTURE
  • 5. Three-way handshake - TCP Protocol Sync Sync/ACK ACK Response Request
  • 7. How it works ● Method ● Path ● Version of the protocol ● Headers ● Cache
  • 8. How it works ● Method ● Path ● Version of the protocol ● Headers ● Cache
  • 9. HTTP ● Resources ● client-server GET / HTTP/1.1 Host: developer.mozilla.org Accept-Language: fr HTTP/1.1 200 OK Date: Sat, 09 Oct 2010 14:28:02 GMT Server: Apache Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT ETag: "51142bc1-7449-479b075b2891b" Accept-Ranges: bytes Content-Length: 29769 Content-Type: text/html <!DOCTYPE html... (here comes the 29769 bytes of the requested web page)
  • 10. HTTP Status ● 1xx informational response ● 2xx successful ● 3xx redirection ● 4xx client error ● 5xx server error
  • 11. 1XX ● 100 Continue ● 101 Switching Protocols ● 102 Processing (WebDAV; RFC 2518) ● 103 Early Hints (RFC 8297)
  • 12. 2XX ● 200 OK ● 201 Created ● 202 Accepted ● 203 Non-Authoritative Information ● 204 No Content ● 205 Reset Content ● 206 Partial Content ● 207 Multi-Status ● 208 Already Reported ● 226 IM Used
  • 13. 3XX ● 300 Multiple Choice ● 301 Moved Permanently ● 302 Found ● 303 See Other ● 304 Not Modified ● 305 Use Proxy ● 306 unused ● 307 Temporary Redirect ● 308 Permanent Redirect
  • 14. 4XX ● 400 Bad Request ● 401 Unauthorized ● 402 Payment Required ● 403 Forbidden ● 404 Not Found ● 405 Method Not Allowed ● 406 Not Acceptable ● 407 Proxy Authentication Required ● 408 Request Timeout ● 409 Conflict ● 410 Gone
  • 15. 5XX ● 500 Internal Server Error ● 501 Not Implemented ● 502 Bad Gateway ● 503 Service Unavailable ● 504 Gateway Timeout ● 505 HTTP Version Not Supported ● 506 Variant Also Negotiates ● 507 Insufficient Storage (WebDAV) ● 508 Loop Detected (WebDAV) ● 510 Not Extended ● 511 Network Authentication Required
  • 16. HTTP 1.1 - Rest REST is acronym for REpresentational State Transfer. It is architectural style for distributed hypermedia systems and was first presented by Roy Fielding in 2000 in his famous dissertation.
  • 18. Api Design ● API ● Contract First ● Contract Last
  • 19. Glory of Rest ● Richardson Maturity Model ○ Model of Restful Maturity ○ Integration Problems
  • 20. Glory of Rest ● Level 0 ○ HTTP - transport system for remote interactions ● Level 1 ○ Individual Resources ● Level 2 ○ POST ○ GET ○ DELETE ○ PATCH / PUT ● Level 3 ○ HATEOAS (Hypertext As The Engine Of Application State)
  • 21. HTTP/2 ● In 2009, Mike Belshe and Roberto Peon of Google proposed SPDY ● HTTP/2 replaces SPDY ● Same semantics HTTP/1.x ● Binary Protocol ● Introduced to improve performance ● HTTPBis Working Group ○ Specification HTTP ○ RFC 7540 ○ HPACK - RFC 7541
  • 22. HTTP/2 - Response Multiplex
  • 23. What is GRPC? gRPC is a modern open source high performance remote procedure call (RPC) framework that can run in any environment. Initially developed at Google 2015 using HTTP/2 protocol. Use protobuf as a mechanism for serializing structure data. https://grpc.io/ https://developers.google.com/protocol-buffers/
  • 25. Where must I use GRPC? ● Microservices ○ Low-latency and high-throughput communication ○ Strong API contract ● Polyglot environments ● Point-to-Point real time communication ○ Bidirectional streaming ● Network Constrained environments ○ Lightweight message format (mobile application)
  • 26. HTTP/2 and GRPC - Client
  • 27. HTTP/2 and GRPC - Server
  • 28. HTTP/2 and Java 9 try { HttpClient httpClient = HttpClient.newHttpClient(); //Create a HttpClient System.out.println(httpClient.version()); HttpRequest httpRequest = HttpRequest.newBuilder() .uri(new URI("https://www.google.com/")).GET().build(); //Create a GET request for the given URI Map<String,List<String>> headers = httpRequest.headers().map(); headers.forEach((k, v) - > System.out.println(k + "-" + v)); HttpResponse < String > httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandler.asString()); } catch (Exception e) { System.out.println("message " + e); }
  • 29. Servlet 4.0 @WebServlet(value = {"/http2"}) public class Http2Servlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { PushBuilder pushBuilder = req.newPushBuilder(); pushBuilder .path("images/kodedu-logo.png") .addHeader("content-type", "image/png") .push(); try(PrintWriter respWriter = resp.getWriter();){ respWriter.write("<html><img src='images/kodedu-logo.png'></html>"); } } }
  • 30. What is RSocket? RSocket is a binary protocol, bi-directional, multiplexed, message-based based on Reactive Streams semantics. It provides support for four interaction models. It is transport protocol agnostic. https://rsocket.io/
  • 36. HTTP 3 - The Future
  • 37. HTTP/1.1 x HTTP/2 x HTTP/3
  • 38. HTTP/1.1 x HTTP/2 x HTTP/3
  • 39. HTTP 3 - The Future What is new in HTTP 3? ● It is a 3rd version of Hypertext Transfer Protocol (HTTP) ● New protocol specification (not ready for production yet) ● Use the same semantics of HTTP/1.* and HTTP/2, such as GET and POST operation ● August-2020 became Internet-Draft
  • 40. HTTP 3 - QUIC - The Future QUIC - Quick UDP Internet Connections ● Designed in 2012 by Jim Roskind at Google ● Reduce connection and transport latency ● Multiplexed transport over UDP ● Open source development in Chromium ● Google and Facebook are already using
  • 41. HTTP 3 - Flupke String url = "https://platform.sh/"; URI serverUrl = URI.create(url); HttpRequest request = HttpRequest.newBuilder() .uri(serverUrl) .header("User-Agent", "Flupke http3 library") .timeout(Duration.ofSeconds(10)) .build(); HttpClient client = Http3Client.newHttpClient(); HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println("Got HTTP response " + httpResponse); System.out.println("- HTTP headers: " + httpResponse.headers());