SlideShare a Scribd company logo
NOTES ON
NETTY (BASICS)
RICK HIGHTOWER’S
ABOUT RICK HIGHTOWER
ABOUT RICK
• Implemented Microservices, Vert.x/Netty at massive scale
• Author of QBit, microservices lib and Boon, Json parser and utility lib
• Founder of Mammatus Technology
• Rick’s Twitter, Rick’s LinkedIn, Rick’s Blog, Rick’s Slideshare
Great book on Netty
http://www.infoq.com/presentations/apple-netty
Great talk about Netty
BASIC
CONCEPTS
NETTY BASIC IO
CHANNEL, EVENTLOOP, CHANNELFUTURE
• Channel - Sockets
• EventLoop - Control Flow
• ChannelFuture - async notification
BASIC I/O OPERATIONS
INTERFACE CHANNEL
• bind(), connect(), read(), write()
• Channel reduces complexity
• EmbeddedChannel
• LocalServerChannel
• NioDatagramChannel
• NioSctpChannel
• NioSocketChannel
EVENTLOOP
INTERFACE EVENTLOOP
• Core abstraction for handling connection events
• EventLoopGroup contains one or more EventLoops
• EventLoop is bound to a single thread
• IO Events handles by single thread
• Channel is registered to a single EventLoop
• eliminates most needs for synchronization
• EventLoop can handle many channels
CHANNELFUTURE
CHANNEL FUTURE
• ChannelFuture to handle async operations
• Determine results at a later time
• addListener() to register callback for completion
• When it gets executed depends but they are executed in order of
receipt
CHANNEL HANDLER
CHANNEL HANDLER
• ChannelHandler used to implement application logic
• Handles inbound and outbound data
• methods are triggered by network events
• ChannelInboundHandler sub-interface handles incoming events
• gets implemented often for application logic
• allows you to flush data going to client
• your business logic will often rely here
CHANNELPIPELINE
CHANNEL PIPELINE
• ChannelPipeline
• forms chain of ChannelHandlers
• Channel is assigned a ChannelPipeline
• ChannelHandlers are registered with a ChannelIntializer
• ChannelHandlers operate on events by processing them and then
passing the event to the next handler in the chain
INBOUND MESSAGES GET DECODED
OUTBOUND MESSAGES GET ENCODED
ENCODERS AND DECODERS
• Inbound messages get DECODED
• Outbound messages get ENCODED
• Converting from bytes to Java objects or serializing Java objects to bytes
• Examples: ByteToMessageDecoder, MessageToByteEncoder,
ProtobufEncoder, ProtobufDecoder
• encode(), decode()
• Encoded messages get passed to next ChannelInboundHandler
• Decode messages get passed to next ChannelOutboundHandler
STARTING UP A CLIENT OR A SERVER
BOOTSTRAPPING
• Bootstrap - client bootstrap
• uses one thread
• ServerBootstrap - server bootstrap
• binds to a port
• uses two threads
• needs two channels one for listening and a second channel for handling
clients connections
• first channel creates Channels for incoming connections which get
assigned to an EventLoop
ECHO EXAMPLE
ECHO BACK MESSAGES
ECHO SERVER CHANNEL HANDLER
BINDS TO PORT REGISTERS CHANNEL HANDLER
SERVER BOOTSTRAP
SEND MESSAGES ON STARTUP AND THEN RECEIVE
ECHO CLIENT CHANNEL HANDLER
CONNECT TO SERVER GIVEN HOST AND PORT, REGISTER
HANDLER
ECHO CLIENT BOOTSTRAP
Great book on Netty
ABOUT RICK HIGHTOWER
ABOUT RICK
• Implemented Microservices, Vert.x/Netty at massive scale
• Author of QBit, microservices lib and Boon, Json parser and utility lib
• Founder of Mammatus Technology
• Rick’s Twitter, Rick’s LinkedIn, Rick’s Blog, Rick’s Slideshare

More Related Content

What's hot (20)

PDF
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Igalia
 
PDF
Netty - a pragmatic introduction
Raphael Stary
 
KEY
Twisted: a quick introduction
Robert Coup
 
PPTX
Asynchronous Python with Twisted
Adam Englander
 
PDF
iptables and Kubernetes
HungWei Chiu
 
PPTX
Coap based application for android phones
Md Syed Ahamad
 
PDF
WTF is Twisted?
hawkowl
 
PDF
An Introduction to Twisted
sdsern
 
PPTX
Breaking down a monolith
GeekNightHyderabad
 
PDF
Understanding and Extending Prometheus AlertManager
Lee Calcote
 
PDF
Opentracing 101
HungWei Chiu
 
PDF
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
wallyqs
 
PPTX
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
StreamNative
 
PDF
Software Defined Networking: The OpenDaylight Project
Great Wide Open
 
PDF
MidoNet deep dive
Taku Fukushima
 
PDF
[Draft] Fast Prototyping with DPDK and eBPF in Containernet
Andrew Wang
 
PPTX
RabbitMQ Model and Some Example Applications
Houcheng Lin
 
PPTX
Using OVSDB and OpenFlow southbound plugins
OpenDaylight
 
PDF
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
Connected
 
PDF
End-to-End Reactive Data Access Using R2DBC with RSocket and Proteus
VMware Tanzu
 
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Igalia
 
Netty - a pragmatic introduction
Raphael Stary
 
Twisted: a quick introduction
Robert Coup
 
Asynchronous Python with Twisted
Adam Englander
 
iptables and Kubernetes
HungWei Chiu
 
Coap based application for android phones
Md Syed Ahamad
 
WTF is Twisted?
hawkowl
 
An Introduction to Twisted
sdsern
 
Breaking down a monolith
GeekNightHyderabad
 
Understanding and Extending Prometheus AlertManager
Lee Calcote
 
Opentracing 101
HungWei Chiu
 
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
wallyqs
 
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
StreamNative
 
Software Defined Networking: The OpenDaylight Project
Great Wide Open
 
MidoNet deep dive
Taku Fukushima
 
[Draft] Fast Prototyping with DPDK and eBPF in Containernet
Andrew Wang
 
RabbitMQ Model and Some Example Applications
Houcheng Lin
 
Using OVSDB and OpenFlow southbound plugins
OpenDaylight
 
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
Connected
 
End-to-End Reactive Data Access Using R2DBC with RSocket and Proteus
VMware Tanzu
 

Viewers also liked (20)

PDF
Zero-Copy Event-Driven Servers with Netty
Daniel Bimschas
 
PPTX
Introduction of netty
Bing Luo
 
PDF
Netty: asynchronous data transfer
Victor Cherkassky
 
PDF
Netty from the trenches
Jordi Gerona
 
KEY
Non blocking io with netty
Zauber
 
PDF
Asynchronous, Event-driven Network Application Development with Netty
Ersin Er
 
PDF
深入浅出Netty l.t
oleone
 
PDF
Netty
Diego Pacheco
 
PDF
Real time analytics with Netty, Storm, Kafka
Trieu Nguyen
 
PDF
Optimize Performance of I/O-intensive Java applications Using Zero Copy
IndicThreads
 
PDF
Using SCTP with Scamper and Netty
Tim Boudreau
 
PPTX
Ambry : Linkedin's Scalable Geo-Distributed Object Store
Sivabalan Narayanan
 
PDF
Netty Cookbook - Chapter 1
Trieu Nguyen
 
PPTX
Experience with Kafka & Storm
Otto Mok
 
PDF
Netty Cookbook - Table of contents
Trieu Nguyen
 
PPTX
Async Redux Actions With RxJS - React Rally 2016
Ben Lesh
 
KEY
Nettyらへん
Go Tanaka
 
PDF
Apache AVRO (Boston HUG, Jan 19, 2010)
Cloudera, Inc.
 
PPTX
Java concurrency - Thread pools
maksym220889
 
PPT
Java SE 8 技術手冊第 15 章 - 通用API
Justin Lin
 
Zero-Copy Event-Driven Servers with Netty
Daniel Bimschas
 
Introduction of netty
Bing Luo
 
Netty: asynchronous data transfer
Victor Cherkassky
 
Netty from the trenches
Jordi Gerona
 
Non blocking io with netty
Zauber
 
Asynchronous, Event-driven Network Application Development with Netty
Ersin Er
 
深入浅出Netty l.t
oleone
 
Real time analytics with Netty, Storm, Kafka
Trieu Nguyen
 
Optimize Performance of I/O-intensive Java applications Using Zero Copy
IndicThreads
 
Using SCTP with Scamper and Netty
Tim Boudreau
 
Ambry : Linkedin's Scalable Geo-Distributed Object Store
Sivabalan Narayanan
 
Netty Cookbook - Chapter 1
Trieu Nguyen
 
Experience with Kafka & Storm
Otto Mok
 
Netty Cookbook - Table of contents
Trieu Nguyen
 
Async Redux Actions With RxJS - React Rally 2016
Ben Lesh
 
Nettyらへん
Go Tanaka
 
Apache AVRO (Boston HUG, Jan 19, 2010)
Cloudera, Inc.
 
Java concurrency - Thread pools
maksym220889
 
Java SE 8 技術手冊第 15 章 - 通用API
Justin Lin
 
Ad

Similar to Notes on Netty baics (20)

PDF
Netty training
Jackson dos Santos Olveira
 
PDF
Netty training
Marcelo Serpa
 
PDF
Building scalable network applications with Netty
NLJUG
 
PDF
Netty In Action 1st Edition Norman Maurer Marvin Allen Wolfthal
mpleteang
 
PPT
Socket Programming - nitish nagar
Nitish Nagar
 
PDF
Java Network Programming Third Edition 3rd Edition Elliotte Rusty Harold
dxvpbvqlbt970
 
PDF
Java Network Programming, 4th Edition.pdf
ntrgiang203
 
PPTX
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Adam Dunkels
 
PDF
Vert.x introduction
GR8Conf
 
PPTX
Event and signal driven programming techniques
Elizabeth Smith
 
PDF
Ratpack Web Framework
Daniel Woods
 
ODP
Groovy & Grails eXchange 2012 vert.x presentation
Stuart (Pid) Williams
 
PPTX
Vert.x devoxx london 2013
Stuart (Pid) Williams
 
PPT
java networking
Waheed Warraich
 
PDF
Vert.x – The problem of real-time data binding
Alex Derkach
 
PPTX
Real world Scala hAkking NLJUG JFall 2011
Raymond Roestenburg
 
PPTX
vert.x - asynchronous event-driven web applications on the JVM
jbandi
 
PPT
Server Side Technologies
tawi123
 
PPT
Lecture 5: Software platforms and services
PayamBarnaghi
 
PPT
IntroJan14.ppt
AnkitKumarSharma54
 
Netty training
Marcelo Serpa
 
Building scalable network applications with Netty
NLJUG
 
Netty In Action 1st Edition Norman Maurer Marvin Allen Wolfthal
mpleteang
 
Socket Programming - nitish nagar
Nitish Nagar
 
Java Network Programming Third Edition 3rd Edition Elliotte Rusty Harold
dxvpbvqlbt970
 
Java Network Programming, 4th Edition.pdf
ntrgiang203
 
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Adam Dunkels
 
Vert.x introduction
GR8Conf
 
Event and signal driven programming techniques
Elizabeth Smith
 
Ratpack Web Framework
Daniel Woods
 
Groovy & Grails eXchange 2012 vert.x presentation
Stuart (Pid) Williams
 
Vert.x devoxx london 2013
Stuart (Pid) Williams
 
java networking
Waheed Warraich
 
Vert.x – The problem of real-time data binding
Alex Derkach
 
Real world Scala hAkking NLJUG JFall 2011
Raymond Roestenburg
 
vert.x - asynchronous event-driven web applications on the JVM
jbandi
 
Server Side Technologies
tawi123
 
Lecture 5: Software platforms and services
PayamBarnaghi
 
IntroJan14.ppt
AnkitKumarSharma54
 
Ad

More from Rick Hightower (18)

PDF
JParse Fast JSON Parser
Rick Hightower
 
PDF
Service Mesh Talk for CTO Forum
Rick Hightower
 
PPTX
Service Mesh CTO Forum (Draft 3)
Rick Hightower
 
PDF
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
Rick Hightower
 
PPTX
Accelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
Rick Hightower
 
PPTX
Accelerate DevOps/Microservices and Kubernetes
Rick Hightower
 
PPTX
Accelerate using DevOps and CI/CD.
Rick Hightower
 
PPTX
High-speed, Reactive Microservices 2017
Rick Hightower
 
PPTX
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
Rick Hightower
 
PPTX
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
Rick Hightower
 
PPTX
High-Speed Reactive Microservices - trials and tribulations
Rick Hightower
 
PDF
High-Speed Reactive Microservices
Rick Hightower
 
PPTX
WebSocket MicroService vs. REST Microservice
Rick Hightower
 
PDF
Consul: Microservice Enabling Microservices and Reactive Programming
Rick Hightower
 
PDF
The Java Microservice Library
Rick Hightower
 
PPTX
Java JSON Benchmark
Rick Hightower
 
PPT
MongoDB quickstart for Java, PHP, and Python developers
Rick Hightower
 
PPT
Mongo DB for Java, Python and PHP Developers
Rick Hightower
 
JParse Fast JSON Parser
Rick Hightower
 
Service Mesh Talk for CTO Forum
Rick Hightower
 
Service Mesh CTO Forum (Draft 3)
Rick Hightower
 
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
Rick Hightower
 
Accelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
Rick Hightower
 
Accelerate DevOps/Microservices and Kubernetes
Rick Hightower
 
Accelerate using DevOps and CI/CD.
Rick Hightower
 
High-speed, Reactive Microservices 2017
Rick Hightower
 
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
Rick Hightower
 
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
Rick Hightower
 
High-Speed Reactive Microservices - trials and tribulations
Rick Hightower
 
High-Speed Reactive Microservices
Rick Hightower
 
WebSocket MicroService vs. REST Microservice
Rick Hightower
 
Consul: Microservice Enabling Microservices and Reactive Programming
Rick Hightower
 
The Java Microservice Library
Rick Hightower
 
Java JSON Benchmark
Rick Hightower
 
MongoDB quickstart for Java, PHP, and Python developers
Rick Hightower
 
Mongo DB for Java, Python and PHP Developers
Rick Hightower
 

Recently uploaded (20)

PDF
Rethinking Security Operations - SOC Evolution Journey.pdf
Haris Chughtai
 
PPTX
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
PDF
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PPTX
Darren Mills The Migration Modernization Balancing Act: Navigating Risks and...
AWS Chicago
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Rethinking Security Operations - SOC Evolution Journey.pdf
Haris Chughtai
 
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Darren Mills The Migration Modernization Balancing Act: Navigating Risks and...
AWS Chicago
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 

Notes on Netty baics

  • 2. ABOUT RICK HIGHTOWER ABOUT RICK • Implemented Microservices, Vert.x/Netty at massive scale • Author of QBit, microservices lib and Boon, Json parser and utility lib • Founder of Mammatus Technology • Rick’s Twitter, Rick’s LinkedIn, Rick’s Blog, Rick’s Slideshare
  • 6. NETTY BASIC IO CHANNEL, EVENTLOOP, CHANNELFUTURE • Channel - Sockets • EventLoop - Control Flow • ChannelFuture - async notification
  • 7. BASIC I/O OPERATIONS INTERFACE CHANNEL • bind(), connect(), read(), write() • Channel reduces complexity • EmbeddedChannel • LocalServerChannel • NioDatagramChannel • NioSctpChannel • NioSocketChannel
  • 8. EVENTLOOP INTERFACE EVENTLOOP • Core abstraction for handling connection events • EventLoopGroup contains one or more EventLoops • EventLoop is bound to a single thread • IO Events handles by single thread • Channel is registered to a single EventLoop • eliminates most needs for synchronization • EventLoop can handle many channels
  • 9. CHANNELFUTURE CHANNEL FUTURE • ChannelFuture to handle async operations • Determine results at a later time • addListener() to register callback for completion • When it gets executed depends but they are executed in order of receipt
  • 10. CHANNEL HANDLER CHANNEL HANDLER • ChannelHandler used to implement application logic • Handles inbound and outbound data • methods are triggered by network events • ChannelInboundHandler sub-interface handles incoming events • gets implemented often for application logic • allows you to flush data going to client • your business logic will often rely here
  • 11. CHANNELPIPELINE CHANNEL PIPELINE • ChannelPipeline • forms chain of ChannelHandlers • Channel is assigned a ChannelPipeline • ChannelHandlers are registered with a ChannelIntializer • ChannelHandlers operate on events by processing them and then passing the event to the next handler in the chain
  • 12. INBOUND MESSAGES GET DECODED OUTBOUND MESSAGES GET ENCODED ENCODERS AND DECODERS • Inbound messages get DECODED • Outbound messages get ENCODED • Converting from bytes to Java objects or serializing Java objects to bytes • Examples: ByteToMessageDecoder, MessageToByteEncoder, ProtobufEncoder, ProtobufDecoder • encode(), decode() • Encoded messages get passed to next ChannelInboundHandler • Decode messages get passed to next ChannelOutboundHandler
  • 13. STARTING UP A CLIENT OR A SERVER BOOTSTRAPPING • Bootstrap - client bootstrap • uses one thread • ServerBootstrap - server bootstrap • binds to a port • uses two threads • needs two channels one for listening and a second channel for handling clients connections • first channel creates Channels for incoming connections which get assigned to an EventLoop
  • 15. ECHO BACK MESSAGES ECHO SERVER CHANNEL HANDLER
  • 16. BINDS TO PORT REGISTERS CHANNEL HANDLER SERVER BOOTSTRAP
  • 17. SEND MESSAGES ON STARTUP AND THEN RECEIVE ECHO CLIENT CHANNEL HANDLER
  • 18. CONNECT TO SERVER GIVEN HOST AND PORT, REGISTER HANDLER ECHO CLIENT BOOTSTRAP
  • 19. Great book on Netty
  • 20. ABOUT RICK HIGHTOWER ABOUT RICK • Implemented Microservices, Vert.x/Netty at massive scale • Author of QBit, microservices lib and Boon, Json parser and utility lib • Founder of Mammatus Technology • Rick’s Twitter, Rick’s LinkedIn, Rick’s Blog, Rick’s Slideshare