stackconf 2023 | How the Network Protocols You Choose Ultimately Affect Your Applications by Andrei Pokhilko.pdf

NETWAYS
NETWAYSNETWAYS
How the Network Protocols You Choose
Ultimately Affect Your Applications
Andrey Pokhilko
Open Source Dev Leader @ Komodor
Communication Efficiency at World War 2
Communication Efficiency at World War 2
Average word length in language:
English ~ 4.7
German ~ 6.4
“We need fire support!”
vs
“Wir brauchen Feuerunterstützung!”
30% longer!
The effects of communication protocol
build up over time and scale,
resulting sensible outcomes.
HTTP/1.1
HTTP/2
HTTP/3
gRPC
protobuf
JSON
Avro
Thrift
Kafka
TCP
UDP
Going to mention
How did I learn
this?
3
1
2
Performance Testing
Traffic capture in Kubernetes
Troubleshooting K8s on all
levels
The Sweetest Thing 😉
Low-hanging fruits
from changing the defaults
Why we fear to change the defaults?
Junior DevOps is changing the Defaults Senior DevOps is changing the Defaults
Simple Method:
4 things to remember
1 Goal: Optimization
Costs, Quality, MTTR
Security and service quality
Public
Internet
Traffic volume and infra costs
Wi-Fi
GPRS / LTE
2 Sides
3 Layers
● How the app uses protocol
● To choose and tune
● You rarely can change it
(cloud, NOC, OS admin)
Transport Layer
Application Protocol
Business Logic
4 Things to Tune
Connection opening Encryption
Compression Serialization
Popular Protocols
HTTP/1.1
● From 1997, still the main workhorse
● Simple and plain-text on wire
● “Open TCP transport connection, write into it, then read from it”
HTTP/1.1 Anatomy: Open TCP, read and write
POST /restapi/alerts/add HTTP/1.1
Accept: application/json
Authorization: Basic dGVzdHVzZXIwMTpuZXRjb29s
Content-Type: application/json
Host: localhost
Connection: keep-alive
Content-Length: 984
{
"FirstOccurrence": 1341412087,
"Node": "localhost",
"AlertKey": "JUnitEventInstance",
"Summary": "This is a test event",
"LastOccurrence": 1341412087,
"Identifier": "JunitEventTestInstance####1",
"OwnerGID": 0,
"Severity": 4,
}
HTTP/1.1 201 Created
Location: http://localhost/restapi/alerts/status/kf/12481
Cache-Control: no-cache
Server: libnhttpd
Date: Wed Jul 4 15:31:53 2012
Connection: Keep-Alive
Content-Type: application/json;charset=UTF-8
Content-Length: 304
{
"entry": {
"affectedRows": 1,
"keyField": "12481%3ANCOMS",
"uri": "http://localhost/restapi/kf/12481"
}
}
Request Response
HEADERS
BODY
REQUEST STATUS
Optimizing HTTP/1.1: Keep-Alive connections
x2 slower
+23% CPU
Optimizing HTTP/1.1: TLS opening costs
x2 slower
+23% CPU
x111
slower
x20
CPU
Reuse TCP connections!
Optimizing HTTP: Compression
x2 slower
+23% CPU
x111
slower
x20
CPU
+38%
CPU
-18%
bytes
HTTP/1.1 Standard Compression
POST /restapi/alerts/add HTTP/1.1
Accept: application/json
Authorization: Basic dGVzdHVzZXIwMTpuZXRjb29s
Content-Type: application/json
Host: localhost
Connection: keep-alive
Content-Length: 984
{
"FirstOccurrence": 1341412087,
"Node": "localhost",
"AlertKey": "JUnitEventInstance",
"Summary": "This is a test event",
"LastOccurrence": 1341412087,
"Identifier": "JunitEventTestInstance####1",
"OwnerGID": 0,
"Severity": 4,
}
HTTP/1.1 201 Created
Location: http://localhost/restapi/alerts/status/kf/12481
Cache-Control: no-cache
Server: libnhttpd
Date: Wed Jul 4 15:31:53 2012
Connection: Keep-Alive
Content-Type: application/json;charset=UTF-8
Content-Length: 304
{
"entry": {
"affectedRows": 1,
"keyField": "12481%3ANCOMS",
"uri": "http://localhost/restapi/kf/12481"
}
}
Request Response
The biggest problem with HTTP/1.1
The biggest problem with HTTP/1.1
The biggest problem with HTTP/1.1
The biggest problem with HTTP/1.1
HTTP/2
Header Compression
Connection Multiplexing
Built-in WebSocket
HTTP/1.1
+
HTTP/2 matters mostly outside the cluster.
HTTP/2 Connection Multiplexing
Single TCP Socket
HTTP/2 is Still Not Enough
TCP “sloth slow start” TCP “head of line blocking”
HTTP/3
● TCP => UDP
● QUIC + TLS
● Browsers be like
HTTP Evolution Summary
Great progress for browsers!
Dev focus is in microservices today, do we care?
Comms edge is owned by cloud and CDN…
Like a virgin HTTP/1.1!
The future looks like…
More Protocols
GraphQL
Request
{
orders {
id
productsList {
product {
Name
Price
}
Quantity
}
totalAmount
}
}
Shrink Me!!!
Response
{
"data": {
"orders": [
{
"id": 1,
"productsList": [
{
"product": {
"name": "orange",
"price": 1.5
},
"quantity": 100
}
],
"totalAmount": 150
}
]
}
}
gRPC
Protobuf Serialization Generated Code
HTTP/2 Transport
Alternatives are Apache Thrift and Avro.
It’s mostly about coding preferences.
Message Queue Protocols
Message broker riding a car
Message Queue Protocols
● Most are binary, TCP-based
● Some HTTP in the cloud (Amazon SQS)
● Compression is on you
AMQP & MQTT
● 50% of cases or more
● Not much to tune, mind the connection costs
Kafka
● Not much to tune in protocol layer
● Acknowledgements and commits costs time
● Message batching to reduce overhead
● Data serialization: JSON, Protobuf, Avro
Data Serialization
JSON Encode and Decode speed is not the same
JSON in different tech is not the same
JSON vs Protobuf
JSON vs Protobuf: Faster or Not?
!!!
JSON vs Protobuf: Binary Data Stands Out
x30 times faster!
Much more graphs are
there, but the time is
running out!
Summary
Quick
Checklist
2 sides to optimize
● Inside cluster
● Outside cluster
3 layers to understand
● Transport layer
● Application protocol
● Business logic
4 things to tune
● Connection reuse
● Compression
● Encryption
● Serialization
“
Premature optimization
is the root of all evil.
by D. Knuth
“
THANK YOU!
andrei@komodor.io
1 von 50

Recomendados

HTML5, HTTP2, and You 1.1 von
HTML5, HTTP2, and You 1.1HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1Daniel Austin
3.7K views39 Folien
Next generation web protocols von
Next generation web protocolsNext generation web protocols
Next generation web protocolsDaniel Austin
1.4K views36 Folien
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web von
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 WebSteffen Gebert
1.5K views64 Folien
Meetup Tech Talk on Web Performance von
Meetup Tech Talk on Web PerformanceMeetup Tech Talk on Web Performance
Meetup Tech Talk on Web PerformanceJean Tunis
132 views56 Folien
Chapter 2 von
Chapter 2Chapter 2
Chapter 2Videoguy
338 views104 Folien
Netty @Apple: Large Scale Deployment/Connectivity von
Netty @Apple: Large Scale Deployment/ConnectivityNetty @Apple: Large Scale Deployment/Connectivity
Netty @Apple: Large Scale Deployment/ConnectivityC4Media
2.7K views37 Folien

Más contenido relacionado

Similar a stackconf 2023 | How the Network Protocols You Choose Ultimately Affect Your Applications by Andrei Pokhilko.pdf

The new (is it really ) api stack von
The new (is it really ) api stackThe new (is it really ) api stack
The new (is it really ) api stackLuca Mattia Ferrari
101 views48 Folien
Introduction to HTTP/2 von
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2Ido Flatow
845 views47 Folien
APIs at the Edge von
APIs at the EdgeAPIs at the Edge
APIs at the EdgeLuca Mattia Ferrari
17 views46 Folien
Tcp protocols von
Tcp protocolsTcp protocols
Tcp protocolsmaliksiddique1
61 views2 Folien
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612 von
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612Avenga Germany GmbH
818 views54 Folien
Introducing HTTP/2 von
Introducing HTTP/2Introducing HTTP/2
Introducing HTTP/2Ido Flatow
3.1K views37 Folien

Similar a stackconf 2023 | How the Network Protocols You Choose Ultimately Affect Your Applications by Andrei Pokhilko.pdf(20)

Introduction to HTTP/2 von Ido Flatow
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
Ido Flatow845 views
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612 von Avenga Germany GmbH
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612
Introducing HTTP/2 von Ido Flatow
Introducing HTTP/2Introducing HTTP/2
Introducing HTTP/2
Ido Flatow3.1K views
Web performance Part 1 "Networking theoretical basis" von Binary Studio
Web performance Part 1 "Networking theoretical basis"Web performance Part 1 "Networking theoretical basis"
Web performance Part 1 "Networking theoretical basis"
Binary Studio1.1K views
From Fast To SPDY von Mike Belshe
From Fast To SPDYFrom Fast To SPDY
From Fast To SPDY
Mike Belshe2.2K views
Improving performance by changing the rules from fast to SPDY von Cotendo
Improving performance by changing the rules   from fast to SPDYImproving performance by changing the rules   from fast to SPDY
Improving performance by changing the rules from fast to SPDY
Cotendo399 views
Communication Mechanisms, Past, Present & Future von Muhammad Ali
Communication Mechanisms, Past, Present & FutureCommunication Mechanisms, Past, Present & Future
Communication Mechanisms, Past, Present & Future
Muhammad Ali150 views
Scaling Streaming - Concepts, Research, Goals von kamaelian
Scaling Streaming - Concepts, Research, GoalsScaling Streaming - Concepts, Research, Goals
Scaling Streaming - Concepts, Research, Goals
kamaelian765 views
Computer network (10) von NYversity
Computer network (10)Computer network (10)
Computer network (10)
NYversity888 views
Slides for protocol layering and network applications von jajinekkanti
Slides for protocol layering and network applicationsSlides for protocol layering and network applications
Slides for protocol layering and network applications
jajinekkanti4.9K views
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google von Ambassador Labs
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, GoogleBringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Ambassador Labs6.3K views
Chapter2 application layer von Khánh Ghẻ
Chapter2 application layerChapter2 application layer
Chapter2 application layer
Khánh Ghẻ219 views

Último

UNIT XIII Cognitive Process.pptx von
UNIT XIII Cognitive Process.pptxUNIT XIII Cognitive Process.pptx
UNIT XIII Cognitive Process.pptxProf. (Dr.) Rahul Sharma
92 views62 Folien
PRESENTATION.pptx von
PRESENTATION.pptxPRESENTATION.pptx
PRESENTATION.pptxyunuskhan558800
7 views14 Folien
Use of Economic Evidence in Cartel Cases – ROBERTS – December 2023 OECD discu... von
Use of Economic Evidence in Cartel Cases – ROBERTS – December 2023 OECD discu...Use of Economic Evidence in Cartel Cases – ROBERTS – December 2023 OECD discu...
Use of Economic Evidence in Cartel Cases – ROBERTS – December 2023 OECD discu...OECD Directorate for Financial and Enterprise Affairs
76 views14 Folien
Competition and Innovation - The Role of Innovation in Enforcement Cases – OE... von
Competition and Innovation - The Role of Innovation in Enforcement Cases – OE...Competition and Innovation - The Role of Innovation in Enforcement Cases – OE...
Competition and Innovation - The Role of Innovation in Enforcement Cases – OE...OECD Directorate for Financial and Enterprise Affairs
156 views4 Folien
Serial Acquisitions and Industry Roll-ups – KOKKORIS – December 2023 OECD dis... von
Serial Acquisitions and Industry Roll-ups – KOKKORIS – December 2023 OECD dis...Serial Acquisitions and Industry Roll-ups – KOKKORIS – December 2023 OECD dis...
Serial Acquisitions and Industry Roll-ups – KOKKORIS – December 2023 OECD dis...OECD Directorate for Financial and Enterprise Affairs
140 views8 Folien
Alternatives to Leniency Programmes – SERBIA – December 2023 OECD discussion von
Alternatives to Leniency Programmes – SERBIA – December 2023 OECD discussionAlternatives to Leniency Programmes – SERBIA – December 2023 OECD discussion
Alternatives to Leniency Programmes – SERBIA – December 2023 OECD discussionOECD Directorate for Financial and Enterprise Affairs
43 views5 Folien

Último(20)

Maximiliano Roa - eRetail Week Blended [Professional] Experience 2023 von eCommerce Institute
Maximiliano Roa - eRetail Week Blended [Professional] Experience 2023Maximiliano Roa - eRetail Week Blended [Professional] Experience 2023
Maximiliano Roa - eRetail Week Blended [Professional] Experience 2023
What I learnt in Antarctica about leadership, well-being and climate change von kristinashields1
What I learnt in Antarctica about leadership, well-being and climate changeWhat I learnt in Antarctica about leadership, well-being and climate change
What I learnt in Antarctica about leadership, well-being and climate change
kristinashields124 views
unmasking toxicity in online gaming von aminabumelha
unmasking toxicity in online gamingunmasking toxicity in online gaming
unmasking toxicity in online gaming
aminabumelha5 views
ERGONOMIC RISK ASSESSMENT (ERA).pptx von j967z4hcnp
ERGONOMIC RISK ASSESSMENT (ERA).pptxERGONOMIC RISK ASSESSMENT (ERA).pptx
ERGONOMIC RISK ASSESSMENT (ERA).pptx
j967z4hcnp8 views
a timeline of the history of linguistics- BAUTISTA- BELGERA.pdf von FordBryantSadio
a timeline of the history of linguistics- BAUTISTA- BELGERA.pdfa timeline of the history of linguistics- BAUTISTA- BELGERA.pdf
a timeline of the history of linguistics- BAUTISTA- BELGERA.pdf
FordBryantSadio8 views
CIS1- Final-Project- COPY-Presentation-JinHuan Chen, Tammy Ling, JingCheng Zh... von tmmling
CIS1- Final-Project- COPY-Presentation-JinHuan Chen, Tammy Ling, JingCheng Zh...CIS1- Final-Project- COPY-Presentation-JinHuan Chen, Tammy Ling, JingCheng Zh...
CIS1- Final-Project- COPY-Presentation-JinHuan Chen, Tammy Ling, JingCheng Zh...
tmmling13 views

stackconf 2023 | How the Network Protocols You Choose Ultimately Affect Your Applications by Andrei Pokhilko.pdf