SlideShare a Scribd company logo
1 of 88
Download to read offline
Microservice
Protocols of Interaction
Todd L. Montgomery
@toddlmontgomery
About me…
What is a Protocol?
Why should we care!?
@toddlmontgomery
pro·to·col noun ˈprō-tə-ˌkȯl, -ˌkōl, -ˌkäl, -kəl
...
3 b : a set of conventions governing the treatment and especially the
formatting of data in an electronic communications
system <network protocols>
...
3 a : a code prescribing strict adherence to correct etiquette
and precedence (as in diplomatic exchange and in the military
services) <a breach of protocol>
Protocols of Interaction
Wire Protocol, Method Calls, Shared Memory
Interactions, etc.
Microservice Architectures
Forced Decoupling
via an
“Asynchronous, Binary Boundary”
Forced Loose Coupling
The truth is…
Protocols can and do Couple
Protocols of Interaction
are quite important!
Protocols of Interaction Matter!
The Environment
Networks, and especially the Internet,
are Hostile Environments
Data can be
lost,
duplicated, and
re-ordered!!
TCP connections can…
be closed
unexpectedly
end in an
unknown state
be intercepted
by idiots, er Proxies
Duplicated
Re-Ordered
Lost
Which means
Data over TCP* might be…
* - When connections are re-established
Don’t assume the network
is reliable
https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing
Case Studies
Case Study 1
Loose Ordering
@toddlmontgomery
Sync
Requests
&
Responses
Request
Request
Request
Response
Response
Response
Throughput limited by
Round-Trip Time (RTT)!
@toddlmontgomery
Async
Requests
&
Responses
Request
Request
Request
Response
Response
Response
Throughput less limited by
Round-Trip Time!
@toddlmontgomery
Async
Requests
&
Responses
Correlation!
Request 0
Request 1
Request 2
Response 0
Response 1
Response 2
Aside…
Ordering is an Illusion!!
Compiler can re-order
Runtime can re-order
CPU can re-order
Ordering has to be imposed!
@toddlmontgomery
Async
Requests
&
Responses
Correlation!
Request 0
Request 1
Request 2
Response 0
Response 1
Response 2
@toddlmontgomery
Correlation!
Request 0
Request 1
Request 2
Response 0
Response 1
Response 2
Ordering
@toddlmontgomery
Correlation!
Request 0
Request 1
Request 2
Response 0
Response 1
Response 2
(Valid)
Re-Ordering
(one of many)
@toddlmontgomery
Handling the Unexpected
Request 0
Response 1
Invalid, Drop We only know of 0.
1 is unknown!
SCTP
HTTP/2 (SPDY)
…
most OSI Layer 4 protocols
Case Study 2
Can you hear me now?
Timeouts & Retries
@toddlmontgomery
Request
ACK
Processing
Handling the unexpected
@toddlmontgomery
Request
TimeoutInterval
X
@toddlmontgomery
Request
ACK
Processing
XTimeoutInterval
Retransmit at end of interval
@toddlmontgomery
ACK
Processing
…
Avoid Spurious Retransmits
Retransmit
Original
TimeoutInterval
@toddlmontgomery
Interval =
N x “typical” RTT
Account for processing delay
X
TimeoutInterval
“Average”
@toddlmontgomery
Measure! But very “noisy”?
RTTMeasurement
Variances in
processing,
transmission,
etc.
TCP Retransmit Timeout (RTO)
Err = M - A
A <- A + gErr
D <- D + h(|Err| - D)
RTO = A + 4D
M = measurement, A = smoothed average,
D = smoothed mean deviation,
g and h = gain constants (0 to 1)
TCP Retransmit Timeout (RTO)
Err = M - A
A <- A + gErr
D <- D + h(|Err| - D)
RTO = A + 4D
Do you measure on a Retransmit? NO!
@toddlmontgomery
Does processing twice hurt?
X
Original
ACK
Retrans
Process Once
Process Twice
TimeoutInterval
@toddlmontgomery
Are Original & Retransmit treated the same?
X
Original
ACK
Retrans
Process Once
Process Twice
TimeoutInterval
TCP
SCTP
Aeron
…
anything with reliability
Case Study 3
What I Need! When I Need It!
“Lifetime” Management
“Managing” Application
Working Set
or
Service Liveness
Caching Algorithms
LRU, MRU, PLRU, RR,
SLRU, LFU, …
“Liveness” is essential
@toddlmontgomery
Request
ACK
Service A
is Alive!
Service B
is Alive!
Service A Service B
Consequence of Processing
@toddlmontgomery
Keepalive
Keepalive
Service A
is Alive!
Service B
is Alive!
Service A Service B
Absence of Processing
RIP Route Deletion
Step 0 - route info broadcast @30 seconds
Step 1 (3 min) - Set Distance to Infinity (16)
Step 2 (+1 min) - Delete Route
Aside… RIP… aptly named
Aeron Driver Keepalive
Time of Last Activity = Shared Variable
Doesn’t need to be a message…
@toddlmontgomery
Bye
Bye
Service A
is gone!
Service B
is gone!
Service A Service B
Optimization, but insufficient with arbitrary failures
Liveness often exists across
transient connectivity
So…
Don’t conflate transport
state with liveness!
Like TCP connection state
Dead TCP connection
!=
Dead Service
Live TCP connection
!=
Live Service
BGP
OSPF
Transports
…
almost every protocol
Case Study 4
Elasti-What?
Self-Similar Behavior
Request
X
Request
X
Request
X
Request
X, X, X
Multiple same/similar requests at the same time
Response
X, X, X
Similar Problem…
Reliable Multicast
1, 2, 3
1, 2, 3 1, 2, 3 1, 2, 3
Non-correlated loss
X X X
NAK
1, 2, 3
NAK
2
NAK
1
NAK
3
Request individual lost data
Retransmit
1, 2, 3
1, 2, 3
1, 2, 3 1, 2, 3 1, 2, 3
Temporally/Spatially Correlated Loss
X X X
NAK
2
NAK
2
NAK
2
NAK
2, 2, 2
Multiple requests for same data
Retransmit
2, 2, 2
Request
2
Request
2
Request
2
Request
2, 2, 2
It’s a generic problem!
Request
2
Request
2
Request
2
Request
2, 2, 2
Overloading Responder & Network
Request
2
Publish Requests
Don’t Immediately Request, Listen first
Timeout!
Request
2
Request
2
Suppress
Request
Request
2
How long to wait & listen for?
Timeout!
Request
2
Request
2
Suppress
Request
Statistics to the Rescue!
SRM Backoff
RandomBackoff = [C1, C1+C2] * 1-way delay
Random is more than good enough
Request
2
Request
2
Request
2, 2
Must also shed duplicates on the responder
Response
2, 2
Shed second
“Request 2”
if too soon
X
X
SRM
PGM
Aeron
…
http://en.wikipedia.org/wiki/Scalable_Reliable_Multicast
http://www.eurecom.fr/en/publication/107/detail/optimal-multicast-feedback
Case Study 5
Hey, Slow Down!
Flow (& Congestion) Control
@toddlmontgomery
Data
Data
Data
ACK
ACK
ACK
Throughput = Data Length / RTT
RTT
Stop-And-Wait
Flow Control
Delay
Bandwidth
BDP = (Byte / sec) * sec = Bytes
BDP
(Buffer)
@toddlmontgomery
Data
ACK
RTT
Throughput = N * Data Length / RTT
… N Data
“Blobs”
So…
How big is N?
This is surprisingly hard to answer
It depends…
Big… but
Don’t overflow receiver
Don’t overflow “network”
TCP Flow Control
Receiver advertises N
TCP Congestion Control
Sender probes for network N
TCP Sender
min(Receiver N, Network N)
Only go as fast as Network & Receiver
ReactiveStreams
Subscriber uses explicit request(N)
Publisher assumes best case
http://www.reactive-streams.org/
Takeaways!
Protocols of interaction are important &
can be tremendously impactful
for better or worse…
@toddlmontgomery
Questions?
• IETF http://www.ietf.org/
• Aeron https://github.com/real-logic/Aeron
• Twitter @toddlmontgomery
Thank You!

More Related Content

What's hot

Notes mid uet solution
Notes mid uet solutionNotes mid uet solution
Notes mid uet solution
Ali Jt
 
Simple regenerating codes: Network Coding for Cloud Storage
Simple regenerating codes: Network Coding for Cloud StorageSimple regenerating codes: Network Coding for Cloud Storage
Simple regenerating codes: Network Coding for Cloud Storage
Kevin Tong
 

What's hot (8)

Paper on Optimized AES Algorithm Core Using FeedBack Architecture
Paper on Optimized AES Algorithm Core Using  FeedBack Architecture Paper on Optimized AES Algorithm Core Using  FeedBack Architecture
Paper on Optimized AES Algorithm Core Using FeedBack Architecture
 
Intake 37 12
Intake 37 12Intake 37 12
Intake 37 12
 
Notes mid uet solution
Notes mid uet solutionNotes mid uet solution
Notes mid uet solution
 
DATA SECURITY WITH AES ENCRYPTION, ELLIPTIC CURVE ENCRYPTION AND SIGNATURE
DATA SECURITY WITH AES ENCRYPTION, ELLIPTIC CURVE ENCRYPTION AND SIGNATURE DATA SECURITY WITH AES ENCRYPTION, ELLIPTIC CURVE ENCRYPTION AND SIGNATURE
DATA SECURITY WITH AES ENCRYPTION, ELLIPTIC CURVE ENCRYPTION AND SIGNATURE
 
Simple regenerating codes: Network Coding for Cloud Storage
Simple regenerating codes: Network Coding for Cloud StorageSimple regenerating codes: Network Coding for Cloud Storage
Simple regenerating codes: Network Coding for Cloud Storage
 
Network Coding for Distributed Storage Systems(Group Meeting Talk)
Network Coding for Distributed Storage Systems(Group Meeting Talk)Network Coding for Distributed Storage Systems(Group Meeting Talk)
Network Coding for Distributed Storage Systems(Group Meeting Talk)
 
CS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMSCS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMS
 
FAST DETECTION OF DDOS ATTACKS USING NON-ADAPTIVE GROUP TESTING
FAST DETECTION OF DDOS ATTACKS USING NON-ADAPTIVE GROUP TESTINGFAST DETECTION OF DDOS ATTACKS USING NON-ADAPTIVE GROUP TESTING
FAST DETECTION OF DDOS ATTACKS USING NON-ADAPTIVE GROUP TESTING
 

Similar to Microservice Protocols of Interaction

QCon NY 2014 - Evolving REST for an IoT World
QCon NY 2014 - Evolving REST for an IoT WorldQCon NY 2014 - Evolving REST for an IoT World
QCon NY 2014 - Evolving REST for an IoT World
Todd Montgomery
 
Direct Link Lan
Direct Link LanDirect Link Lan
Direct Link Lan
yanhul
 
Interprocess communication
Interprocess communicationInterprocess communication
Interprocess communication
Sushil Singh
 
An Empirical Evaluation of TCP Performance in Online Games
An Empirical Evaluation of TCP Performance in Online GamesAn Empirical Evaluation of TCP Performance in Online Games
An Empirical Evaluation of TCP Performance in Online Games
Academia Sinica
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)
NYversity
 
Bh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackopsBh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackops
Dan Kaminsky
 
Bh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackopsBh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackops
Dan Kaminsky
 

Similar to Microservice Protocols of Interaction (20)

Protocols of Interaction: Best Current Practices
Protocols of Interaction: Best Current PracticesProtocols of Interaction: Best Current Practices
Protocols of Interaction: Best Current Practices
 
QCon NY 2014 - Evolving REST for an IoT World
QCon NY 2014 - Evolving REST for an IoT WorldQCon NY 2014 - Evolving REST for an IoT World
QCon NY 2014 - Evolving REST for an IoT World
 
13 tm adv
13 tm adv13 tm adv
13 tm adv
 
IoTaConf 2014 - IoT Connectivity, Standards, and Architecture
IoTaConf 2014 - IoT Connectivity, Standards, and ArchitectureIoTaConf 2014 - IoT Connectivity, Standards, and Architecture
IoTaConf 2014 - IoT Connectivity, Standards, and Architecture
 
Direct Link Lan
Direct Link LanDirect Link Lan
Direct Link Lan
 
FEC & File Multicast
FEC & File MulticastFEC & File Multicast
FEC & File Multicast
 
Interprocess communication
Interprocess communicationInterprocess communication
Interprocess communication
 
Humming code error detector 7_communications.ppt
Humming code error detector 7_communications.pptHumming code error detector 7_communications.ppt
Humming code error detector 7_communications.ppt
 
Lec9
Lec9Lec9
Lec9
 
DATA-LINK LAYER.ppt
DATA-LINK LAYER.pptDATA-LINK LAYER.ppt
DATA-LINK LAYER.ppt
 
Tcp periodic modeling
Tcp periodic modelingTcp periodic modeling
Tcp periodic modeling
 
TCP/IP For Engineers
TCP/IP For EngineersTCP/IP For Engineers
TCP/IP For Engineers
 
Performance of BCH and RS Codes in MIMO System Using MPFEC Diversity Technique
Performance of BCH and RS Codes in MIMO System Using MPFEC Diversity TechniquePerformance of BCH and RS Codes in MIMO System Using MPFEC Diversity Technique
Performance of BCH and RS Codes in MIMO System Using MPFEC Diversity Technique
 
An Empirical Evaluation of TCP Performance in Online Games
An Empirical Evaluation of TCP Performance in Online GamesAn Empirical Evaluation of TCP Performance in Online Games
An Empirical Evaluation of TCP Performance in Online Games
 
DIY Internet: Snappy, Secure Networking with MinimaLT (JSConf EU 2013)
DIY Internet: Snappy, Secure Networking with MinimaLT (JSConf EU 2013)DIY Internet: Snappy, Secure Networking with MinimaLT (JSConf EU 2013)
DIY Internet: Snappy, Secure Networking with MinimaLT (JSConf EU 2013)
 
Network Protocols
Network ProtocolsNetwork Protocols
Network Protocols
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)
 
BreakingPoint & Fortinet RSA Conference 2011 Presentation: Evaluating Enterpr...
BreakingPoint & Fortinet RSA Conference 2011 Presentation: Evaluating Enterpr...BreakingPoint & Fortinet RSA Conference 2011 Presentation: Evaluating Enterpr...
BreakingPoint & Fortinet RSA Conference 2011 Presentation: Evaluating Enterpr...
 
Bh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackopsBh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackops
 
Bh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackopsBh us-02-kaminsky-blackops
Bh us-02-kaminsky-blackops
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Microservice Protocols of Interaction