SlideShare a Scribd company logo
Using SCTP with Scamper and NettyUsing SCTP with Scamper and Netty
Tim BoudreauTim Boudreau
http://timboudreau.comhttp://timboudreau.com
October 2015October 2015
What is SCTP?What is SCTP?
●
Stream control transmission protocol
●
Alternative to TCP
–
Yes, that far down the network stack!
●
Message-oriented like UDP
●
Multiple streams per connection
–
No“head of line” blocking
●
Multiple addresses per connection
●
Heartbeats built-in
Why SCTP?Why SCTP?
●
Designed for multimedia & telephony
●
But good for anything message-oriented
–
Metrics / logging data in particular
●
Supported by most OS's
–
Need lksctp-tools on Linux
Anatomy of an SCTP connectionAnatomy of an SCTP connection
●
Multiple“channels” per connection
–
Send data in sequence on a channel
–
Does not block sends on other channels
●
Association – endpoint = more than one
socket address
–
Will take the shortest path
–
Provides network-level fault tolerance
What That MeansWhat That Means
●
You can decide if you care about message-order
●
Messages don't (have to) block each other
●
Messages are either completely delivered or not
–
The application doesn't have to deal with partial messages
●
Message size not limited (unlike UDP)
●
Reliable (unlike UDP)
●
Heartbeat built-in
Why isn't SCTP more used?Why isn't SCTP more used?
●
People use what they know
●
Home routers don't always support it well via
NAT
–
Not a problem for server-server communication
Use Case – statsd-like metricsUse Case – statsd-like metrics
●
Etsy's Statsd is a popular daemon for collecting real-time
metrics
●
Receives fire-and-forget small UDP packets that update
counters, etc.
●
Statsd stores them in a back-end for visualization &
reporting
Statsd issuesStatsd issues
●
You don't know if a UDP packet was
delivered
●
Packet size must be < network MTU
–
Or the packet may be silently dropped
●
Connection not redundant
SCTP Support in JavaSCTP Support in Java
●
Very low-level
–
com.sun.nio.sctp.SctpChannel
●
Complete but hard to work with
–
Implement message loop, handlers
–
Typical NIO network API
SCTP Support in NettySCTP Support in Netty
●
Also low-level
–
But better abstractions for writing async servers
–
Buffer memory pooling to reduce allocation and
other goodies
–
Still low-level
Why Scamper?Why Scamper?
●
I wanted some higher level abstractions
●
Writing asynchronous servers doesn't have to
feel like doing something hard
–
Follow the NodeJS model: Build a highly
concurrent system out of small blocks of simple
synchronous code
Scamper – Higher Level
Abstractions
Scamper – Higher Level
Abstractions
●
Messages are objects
●
Protocols are simple to write
–
5 byte message header + payload
●
Compression & encryption can be layered on top of any
protocol
●
Standards-based wire-format for messages
–
BSON / JSON / Java serialization / roll-your-own
Scamper – DetailsScamper – Details
Determines payload encoding –
BSON, JSON, Serializaton +/-
compression or encryption.
You define message types, map them to object classes.
The payload, which is encoded/decoded for you
public static final MessageType WHAT_TIME_IS_IT = new
MessageType("dateQuery", 1, 1);
public static final MessageType THE_TIME_IS = new
MessageType("dateResponse", 1, 2);
new SctpServerAndClientBuilder("datedemo")
.bind(WHAT_TIME_IS_IT, DateQueryHandler.class)
.bind(THE_TIME_IS, DateResponseHandler.class)
.start();
Using ScamperUsing Scamper
●
Define some POJOs (or use a Map)
●
Write a handler to receive POJOs
●
Register a MessageType
–
2 shorts, and a name (for logging)
–
Identifies which handler should be called with the message
●
Create an SctpServerAndClientBuilder
●
Bind MessageType+Handler pairs
●
Start the server, or retrieve a Sender if a client
Demo
A trivial client + serverA trivial client + server
Writing a Message TypeWriting a Message Type
public static final MessageType THE_TIME_IS = new
MessageType("dateResponse", 1, 2);
●
The 1 and 2 are message identifiers – you define them (16 bit Java
shorts)
●
The name is just for logging (not sent over the wire)
●
To create a message:
Message<DateResponse> msg = THE_TIME_IS.newMessage(new
DateResponse());
sender.send(address, msg);
Writing a Message HandlerWriting a Message Handler
●
Says what type it takes in its constructor
●
Implements onMessage() to receive POJOS
●
Can reply with a new message
static class DateResponseHandler extends MessageHandler<Map, DateRecord> {
DateResponseHandler() {
super(DateRecord.class);
}
public Message<Map> onMessage(Message<DateRecord> data, ChannelHandlerContext
ctx) {
System.out.println("RECEIVE " + new Date(data.body.when) + " from "
+ctx.channel().remoteAddress());
return null; //we could reply here
}
}
public static class DateRecord implements Serializable {
public long when = System.currentTimeMillis();
}
Is It Baked Yet?Is It Baked Yet?
●
The things that work, work
●
Uses pre-release Netty 5
–
Which has been very stable
●
Getting multi-homing working on a branch
●
In-progress patches for Netty for One-to-Many
support
Scamper – How to Get ItScamper – How to Get It
●
Maven dependency :
<dependency>
<groupId>com.mastfrog</groupId>
<artifactId>scamper</artifactId>
<version>1.3-dev</version>
</dependency>
●
Need my maven repo in your pom.xml
–
Follow instructions here: http://timboudreau.com/builds
–
Will be in Maven central Real Soon Now[tm]
LinksLinks
●
Sources: https://github.com/timboudreau/scamper
●
Info: http://timboudreau.com/blog/sctp/
●
Chat Demo:
https://github.com/timboudreau/scamper-chat
●
Maven repo: http://timboudreau.com/builds/
●
Me: http://timboudreau.com @kablosna
Thanks!
Demos, Q&ADemos, Q&A
According to the RFCAccording to the RFC
●
Acknowledged error-free non-duplicated transfer of user
data
●
Data fragmentation to conform to discovered path MTU size
●
Sequenced delivery of user messages within multiple
streams, with an option for order-of-arrival delivery of
individual user messages
●
Optional bundling of multiple user messages into a single
SCTP packet, and
●
Network-level fault tolerance through supporting of multi-
homing at either or both ends of an association.
Ad

More Related Content

What's hot (20)

Performance is not an Option - gRPC and Cassandra
Performance is not an Option - gRPC and CassandraPerformance is not an Option - gRPC and Cassandra
Performance is not an Option - gRPC and Cassandra
Dave Bechberger
 
How Zhaopin contributes to Pulsar community
How Zhaopin contributes to Pulsar communityHow Zhaopin contributes to Pulsar community
How Zhaopin contributes to Pulsar community
StreamNative
 
Ingesting data streams with a serverless infrastructure
Ingesting data streams with a serverless infrastructureIngesting data streams with a serverless infrastructure
Ingesting data streams with a serverless infrastructure
Gil Colunga
 
Low latency in java 8 v5
Low latency in java 8 v5Low latency in java 8 v5
Low latency in java 8 v5
Peter Lawrey
 
Low latency microservices in java QCon New York 2016
Low latency microservices in java   QCon New York 2016Low latency microservices in java   QCon New York 2016
Low latency microservices in java QCon New York 2016
Peter Lawrey
 
GC free coding in @Java presented @Geecon
GC free coding in @Java presented @GeeconGC free coding in @Java presented @Geecon
GC free coding in @Java presented @Geecon
Peter Lawrey
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Codemotion
 
REST vs gRPC: Battle of API's
REST vs gRPC: Battle of API'sREST vs gRPC: Battle of API's
REST vs gRPC: Battle of API's
Luram Archanjo
 
Aurora
AuroraAurora
Aurora
vinodkumarlogan
 
Article http over transport protocols
Article   http over transport protocolsArticle   http over transport protocols
Article http over transport protocols
Icaro Camelo
 
Graylog2 (MongoBerlin/MongoHamburg 2010)
Graylog2 (MongoBerlin/MongoHamburg 2010)Graylog2 (MongoBerlin/MongoHamburg 2010)
Graylog2 (MongoBerlin/MongoHamburg 2010)
lennartkoopmann
 
Kraken mesoscon 2018
Kraken mesoscon 2018Kraken mesoscon 2018
Kraken mesoscon 2018
joeyzhang1989928
 
CurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious CharactersCurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious Characters
pieterh
 
RestMS Introduction
RestMS IntroductionRestMS Introduction
RestMS Introduction
pieterh
 
Preview of Apache Pulsar 2.5.0
Preview of Apache Pulsar 2.5.0Preview of Apache Pulsar 2.5.0
Preview of Apache Pulsar 2.5.0
StreamNative
 
Low latency for high throughput
Low latency for high throughputLow latency for high throughput
Low latency for high throughput
Peter Lawrey
 
NPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira NetoNPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira Neto
eurobsdcon
 
Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0
StreamNative
 
Cache scope
Cache scopeCache scope
Cache scope
Yamini Saraswathi Narimeta
 
Fosdem 2009
Fosdem 2009Fosdem 2009
Fosdem 2009
pieterh
 
Performance is not an Option - gRPC and Cassandra
Performance is not an Option - gRPC and CassandraPerformance is not an Option - gRPC and Cassandra
Performance is not an Option - gRPC and Cassandra
Dave Bechberger
 
How Zhaopin contributes to Pulsar community
How Zhaopin contributes to Pulsar communityHow Zhaopin contributes to Pulsar community
How Zhaopin contributes to Pulsar community
StreamNative
 
Ingesting data streams with a serverless infrastructure
Ingesting data streams with a serverless infrastructureIngesting data streams with a serverless infrastructure
Ingesting data streams with a serverless infrastructure
Gil Colunga
 
Low latency in java 8 v5
Low latency in java 8 v5Low latency in java 8 v5
Low latency in java 8 v5
Peter Lawrey
 
Low latency microservices in java QCon New York 2016
Low latency microservices in java   QCon New York 2016Low latency microservices in java   QCon New York 2016
Low latency microservices in java QCon New York 2016
Peter Lawrey
 
GC free coding in @Java presented @Geecon
GC free coding in @Java presented @GeeconGC free coding in @Java presented @Geecon
GC free coding in @Java presented @Geecon
Peter Lawrey
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Codemotion
 
REST vs gRPC: Battle of API's
REST vs gRPC: Battle of API'sREST vs gRPC: Battle of API's
REST vs gRPC: Battle of API's
Luram Archanjo
 
Article http over transport protocols
Article   http over transport protocolsArticle   http over transport protocols
Article http over transport protocols
Icaro Camelo
 
Graylog2 (MongoBerlin/MongoHamburg 2010)
Graylog2 (MongoBerlin/MongoHamburg 2010)Graylog2 (MongoBerlin/MongoHamburg 2010)
Graylog2 (MongoBerlin/MongoHamburg 2010)
lennartkoopmann
 
CurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious CharactersCurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious Characters
pieterh
 
RestMS Introduction
RestMS IntroductionRestMS Introduction
RestMS Introduction
pieterh
 
Preview of Apache Pulsar 2.5.0
Preview of Apache Pulsar 2.5.0Preview of Apache Pulsar 2.5.0
Preview of Apache Pulsar 2.5.0
StreamNative
 
Low latency for high throughput
Low latency for high throughputLow latency for high throughput
Low latency for high throughput
Peter Lawrey
 
NPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira NetoNPF scripting with Lua by Lourival Vieira Neto
NPF scripting with Lua by Lourival Vieira Neto
eurobsdcon
 
Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0
StreamNative
 
Fosdem 2009
Fosdem 2009Fosdem 2009
Fosdem 2009
pieterh
 

Viewers also liked (7)

Netty Cookbook - Chapter 1
Netty Cookbook - Chapter 1Netty Cookbook - Chapter 1
Netty Cookbook - Chapter 1
Trieu Nguyen
 
Netty Cookbook - Chapter 2
Netty Cookbook - Chapter 2Netty Cookbook - Chapter 2
Netty Cookbook - Chapter 2
Trieu Nguyen
 
Netty Cookbook - Table of contents
Netty Cookbook - Table of contentsNetty Cookbook - Table of contents
Netty Cookbook - Table of contents
Trieu Nguyen
 
Notes on Netty baics
Notes on Netty baicsNotes on Netty baics
Notes on Netty baics
Rick Hightower
 
Netty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and BuffersNetty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and Buffers
Rick Hightower
 
Introduction to SCTP and it's benefits over TCP and UDP
Introduction to SCTP and it's benefits over TCP and UDPIntroduction to SCTP and it's benefits over TCP and UDP
Introduction to SCTP and it's benefits over TCP and UDP
VIJAY SHARMA
 
Netty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsNetty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoops
Rick Hightower
 
Netty Cookbook - Chapter 1
Netty Cookbook - Chapter 1Netty Cookbook - Chapter 1
Netty Cookbook - Chapter 1
Trieu Nguyen
 
Netty Cookbook - Chapter 2
Netty Cookbook - Chapter 2Netty Cookbook - Chapter 2
Netty Cookbook - Chapter 2
Trieu Nguyen
 
Netty Cookbook - Table of contents
Netty Cookbook - Table of contentsNetty Cookbook - Table of contents
Netty Cookbook - Table of contents
Trieu Nguyen
 
Netty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and BuffersNetty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and Buffers
Rick Hightower
 
Introduction to SCTP and it's benefits over TCP and UDP
Introduction to SCTP and it's benefits over TCP and UDPIntroduction to SCTP and it's benefits over TCP and UDP
Introduction to SCTP and it's benefits over TCP and UDP
VIJAY SHARMA
 
Netty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsNetty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoops
Rick Hightower
 
Ad

Similar to Using SCTP with Scamper and Netty (20)

Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
ICS
 
The Internet of Things ... Babel
The Internet of Things ... BabelThe Internet of Things ... Babel
The Internet of Things ... Babel
NaLUG
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and Implementation
Varun Talwar
 
Mailerqnewpresentation
MailerqnewpresentationMailerqnewpresentation
Mailerqnewpresentation
Copernica BV
 
Gluster dev session #6 understanding gluster's network communication layer
Gluster dev session #6  understanding gluster's network   communication layerGluster dev session #6  understanding gluster's network   communication layer
Gluster dev session #6 understanding gluster's network communication layer
Pranith Karampuri
 
Ice
IceIce
Ice
Tony Deng
 
AMQP with RabbitMQ
AMQP with RabbitMQAMQP with RabbitMQ
AMQP with RabbitMQ
Spyros Papageorgiou
 
There and back again
There and back againThere and back again
There and back again
Jon Spriggs
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
Internet of Things: Protocols for M2M
Internet of Things: Protocols for M2MInternet of Things: Protocols for M2M
Internet of Things: Protocols for M2M
Charles Gibbons
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
PlatCon-19 ICMPv6SD
PlatCon-19 ICMPv6SDPlatCon-19 ICMPv6SD
PlatCon-19 ICMPv6SD
linzichao
 
UAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time CommunicationsUAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time Communications
Gerardo Pardo-Castellote
 
Mikro tik
Mikro tikMikro tik
Mikro tik
guest8423a64e
 
A Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm BasebandsA Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm Basebands
Priyanka Aash
 
Store stream data on Data Lake
Store stream data on Data LakeStore stream data on Data Lake
Store stream data on Data Lake
Marcos Rebelo
 
Messaging queue - Kafka
Messaging queue - KafkaMessaging queue - Kafka
Messaging queue - Kafka
Mayank Bansal
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
ICS
 
The Internet of Things ... Babel
The Internet of Things ... BabelThe Internet of Things ... Babel
The Internet of Things ... Babel
NaLUG
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and Implementation
Varun Talwar
 
Mailerqnewpresentation
MailerqnewpresentationMailerqnewpresentation
Mailerqnewpresentation
Copernica BV
 
Gluster dev session #6 understanding gluster's network communication layer
Gluster dev session #6  understanding gluster's network   communication layerGluster dev session #6  understanding gluster's network   communication layer
Gluster dev session #6 understanding gluster's network communication layer
Pranith Karampuri
 
There and back again
There and back againThere and back again
There and back again
Jon Spriggs
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
Internet of Things: Protocols for M2M
Internet of Things: Protocols for M2MInternet of Things: Protocols for M2M
Internet of Things: Protocols for M2M
Charles Gibbons
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
Protocols for internet of things
Protocols for internet of thingsProtocols for internet of things
Protocols for internet of things
Charles Gibbons
 
PlatCon-19 ICMPv6SD
PlatCon-19 ICMPv6SDPlatCon-19 ICMPv6SD
PlatCon-19 ICMPv6SD
linzichao
 
UAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time CommunicationsUAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time Communications
Gerardo Pardo-Castellote
 
A Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm BasebandsA Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm Basebands
Priyanka Aash
 
Store stream data on Data Lake
Store stream data on Data LakeStore stream data on Data Lake
Store stream data on Data Lake
Marcos Rebelo
 
Messaging queue - Kafka
Messaging queue - KafkaMessaging queue - Kafka
Messaging queue - Kafka
Mayank Bansal
 
Ad

Recently uploaded (20)

How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 

Using SCTP with Scamper and Netty

  • 1. Using SCTP with Scamper and NettyUsing SCTP with Scamper and Netty Tim BoudreauTim Boudreau http://timboudreau.comhttp://timboudreau.com October 2015October 2015
  • 2. What is SCTP?What is SCTP? ● Stream control transmission protocol ● Alternative to TCP – Yes, that far down the network stack! ● Message-oriented like UDP ● Multiple streams per connection – No“head of line” blocking ● Multiple addresses per connection ● Heartbeats built-in
  • 3. Why SCTP?Why SCTP? ● Designed for multimedia & telephony ● But good for anything message-oriented – Metrics / logging data in particular ● Supported by most OS's – Need lksctp-tools on Linux
  • 4. Anatomy of an SCTP connectionAnatomy of an SCTP connection ● Multiple“channels” per connection – Send data in sequence on a channel – Does not block sends on other channels ● Association – endpoint = more than one socket address – Will take the shortest path – Provides network-level fault tolerance
  • 5. What That MeansWhat That Means ● You can decide if you care about message-order ● Messages don't (have to) block each other ● Messages are either completely delivered or not – The application doesn't have to deal with partial messages ● Message size not limited (unlike UDP) ● Reliable (unlike UDP) ● Heartbeat built-in
  • 6. Why isn't SCTP more used?Why isn't SCTP more used? ● People use what they know ● Home routers don't always support it well via NAT – Not a problem for server-server communication
  • 7. Use Case – statsd-like metricsUse Case – statsd-like metrics ● Etsy's Statsd is a popular daemon for collecting real-time metrics ● Receives fire-and-forget small UDP packets that update counters, etc. ● Statsd stores them in a back-end for visualization & reporting
  • 8. Statsd issuesStatsd issues ● You don't know if a UDP packet was delivered ● Packet size must be < network MTU – Or the packet may be silently dropped ● Connection not redundant
  • 9. SCTP Support in JavaSCTP Support in Java ● Very low-level – com.sun.nio.sctp.SctpChannel ● Complete but hard to work with – Implement message loop, handlers – Typical NIO network API
  • 10. SCTP Support in NettySCTP Support in Netty ● Also low-level – But better abstractions for writing async servers – Buffer memory pooling to reduce allocation and other goodies – Still low-level
  • 11. Why Scamper?Why Scamper? ● I wanted some higher level abstractions ● Writing asynchronous servers doesn't have to feel like doing something hard – Follow the NodeJS model: Build a highly concurrent system out of small blocks of simple synchronous code
  • 12. Scamper – Higher Level Abstractions Scamper – Higher Level Abstractions ● Messages are objects ● Protocols are simple to write – 5 byte message header + payload ● Compression & encryption can be layered on top of any protocol ● Standards-based wire-format for messages – BSON / JSON / Java serialization / roll-your-own
  • 13. Scamper – DetailsScamper – Details Determines payload encoding – BSON, JSON, Serializaton +/- compression or encryption. You define message types, map them to object classes. The payload, which is encoded/decoded for you public static final MessageType WHAT_TIME_IS_IT = new MessageType("dateQuery", 1, 1); public static final MessageType THE_TIME_IS = new MessageType("dateResponse", 1, 2); new SctpServerAndClientBuilder("datedemo") .bind(WHAT_TIME_IS_IT, DateQueryHandler.class) .bind(THE_TIME_IS, DateResponseHandler.class) .start();
  • 14. Using ScamperUsing Scamper ● Define some POJOs (or use a Map) ● Write a handler to receive POJOs ● Register a MessageType – 2 shorts, and a name (for logging) – Identifies which handler should be called with the message ● Create an SctpServerAndClientBuilder ● Bind MessageType+Handler pairs ● Start the server, or retrieve a Sender if a client
  • 15. Demo A trivial client + serverA trivial client + server
  • 16. Writing a Message TypeWriting a Message Type public static final MessageType THE_TIME_IS = new MessageType("dateResponse", 1, 2); ● The 1 and 2 are message identifiers – you define them (16 bit Java shorts) ● The name is just for logging (not sent over the wire) ● To create a message: Message<DateResponse> msg = THE_TIME_IS.newMessage(new DateResponse()); sender.send(address, msg);
  • 17. Writing a Message HandlerWriting a Message Handler ● Says what type it takes in its constructor ● Implements onMessage() to receive POJOS ● Can reply with a new message static class DateResponseHandler extends MessageHandler<Map, DateRecord> { DateResponseHandler() { super(DateRecord.class); } public Message<Map> onMessage(Message<DateRecord> data, ChannelHandlerContext ctx) { System.out.println("RECEIVE " + new Date(data.body.when) + " from " +ctx.channel().remoteAddress()); return null; //we could reply here } } public static class DateRecord implements Serializable { public long when = System.currentTimeMillis(); }
  • 18. Is It Baked Yet?Is It Baked Yet? ● The things that work, work ● Uses pre-release Netty 5 – Which has been very stable ● Getting multi-homing working on a branch ● In-progress patches for Netty for One-to-Many support
  • 19. Scamper – How to Get ItScamper – How to Get It ● Maven dependency : <dependency> <groupId>com.mastfrog</groupId> <artifactId>scamper</artifactId> <version>1.3-dev</version> </dependency> ● Need my maven repo in your pom.xml – Follow instructions here: http://timboudreau.com/builds – Will be in Maven central Real Soon Now[tm]
  • 20. LinksLinks ● Sources: https://github.com/timboudreau/scamper ● Info: http://timboudreau.com/blog/sctp/ ● Chat Demo: https://github.com/timboudreau/scamper-chat ● Maven repo: http://timboudreau.com/builds/ ● Me: http://timboudreau.com @kablosna
  • 22. According to the RFCAccording to the RFC ● Acknowledged error-free non-duplicated transfer of user data ● Data fragmentation to conform to discovered path MTU size ● Sequenced delivery of user messages within multiple streams, with an option for order-of-arrival delivery of individual user messages ● Optional bundling of multiple user messages into a single SCTP packet, and ● Network-level fault tolerance through supporting of multi- homing at either or both ends of an association.