SlideShare una empresa de Scribd logo
1 de 20
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

Más contenido relacionado

La actualidad más candente

Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Igalia
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example Applications
Houcheng Lin
 
End-to-End Reactive Data Access Using R2DBC with RSocket and Proteus
End-to-End Reactive Data Access Using R2DBC with RSocket and ProteusEnd-to-End Reactive Data Access Using R2DBC with RSocket and Proteus
End-to-End Reactive Data Access Using R2DBC with RSocket and Proteus
VMware Tanzu
 

La actualidad más candente (20)

Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
 
Netty - a pragmatic introduction
Netty - a pragmatic introductionNetty - a pragmatic introduction
Netty - a pragmatic introduction
 
Twisted: a quick introduction
Twisted: a quick introductionTwisted: a quick introduction
Twisted: a quick introduction
 
Asynchronous Python with Twisted
Asynchronous Python with TwistedAsynchronous Python with Twisted
Asynchronous Python with Twisted
 
iptables and Kubernetes
iptables and Kubernetesiptables and Kubernetes
iptables and Kubernetes
 
Coap based application for android phones
Coap based application for android phonesCoap based application for android phones
Coap based application for android phones
 
WTF is Twisted?
WTF is Twisted?WTF is Twisted?
WTF is Twisted?
 
An Introduction to Twisted
An Introduction to TwistedAn Introduction to Twisted
An Introduction to Twisted
 
Breaking down a monolith
Breaking down a monolithBreaking down a monolith
Breaking down a monolith
 
Understanding and Extending Prometheus AlertManager
Understanding and Extending Prometheus AlertManagerUnderstanding and Extending Prometheus AlertManager
Understanding and Extending Prometheus AlertManager
 
Opentracing 101
Opentracing 101Opentracing 101
Opentracing 101
 
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
 
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
 
Software Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight ProjectSoftware Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight Project
 
MidoNet deep dive
MidoNet deep diveMidoNet deep dive
MidoNet deep dive
 
[Draft] Fast Prototyping with DPDK and eBPF in Containernet
[Draft] Fast Prototyping with DPDK and eBPF in Containernet[Draft] Fast Prototyping with DPDK and eBPF in Containernet
[Draft] Fast Prototyping with DPDK and eBPF in Containernet
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example Applications
 
Using OVSDB and OpenFlow southbound plugins
Using OVSDB and OpenFlow southbound pluginsUsing OVSDB and OpenFlow southbound plugins
Using OVSDB and OpenFlow southbound plugins
 
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
Reaching 5 Million Messaging Connections:  Our Journey with KubernetesReaching 5 Million Messaging Connections:  Our Journey with Kubernetes
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
 
End-to-End Reactive Data Access Using R2DBC with RSocket and Proteus
End-to-End Reactive Data Access Using R2DBC with RSocket and ProteusEnd-to-End Reactive Data Access Using R2DBC with RSocket and Proteus
End-to-End Reactive Data Access Using R2DBC with RSocket and Proteus
 

Destacado

Zero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with NettyZero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with Netty
Daniel Bimschas
 
Introduction of netty
Introduction of nettyIntroduction of netty
Introduction of netty
Bing Luo
 
深入浅出Netty l.t
深入浅出Netty   l.t深入浅出Netty   l.t
深入浅出Netty l.t
oleone
 
Real time analytics with Netty, Storm, Kafka
Real time analytics with Netty, Storm, KafkaReal time analytics with Netty, Storm, Kafka
Real time analytics with Netty, Storm, Kafka
Trieu Nguyen
 
Optimize Performance of I/O-intensive Java applications Using Zero Copy
Optimize Performance of I/O-intensive Java applications Using Zero CopyOptimize Performance of I/O-intensive Java applications Using Zero Copy
Optimize Performance of I/O-intensive Java applications Using Zero Copy
IndicThreads
 
Nettyらへん
NettyらへんNettyらへん
Nettyらへん
Go Tanaka
 
Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)
Cloudera, Inc.
 

Destacado (20)

Zero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with NettyZero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with Netty
 
Introduction of netty
Introduction of nettyIntroduction of netty
Introduction of netty
 
Netty: asynchronous data transfer
Netty: asynchronous data transferNetty: asynchronous data transfer
Netty: asynchronous data transfer
 
Netty from the trenches
Netty from the trenchesNetty from the trenches
Netty from the trenches
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with netty
 
Asynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with NettyAsynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with Netty
 
深入浅出Netty l.t
深入浅出Netty   l.t深入浅出Netty   l.t
深入浅出Netty l.t
 
Netty
NettyNetty
Netty
 
Real time analytics with Netty, Storm, Kafka
Real time analytics with Netty, Storm, KafkaReal time analytics with Netty, Storm, Kafka
Real time analytics with Netty, Storm, Kafka
 
Optimize Performance of I/O-intensive Java applications Using Zero Copy
Optimize Performance of I/O-intensive Java applications Using Zero CopyOptimize Performance of I/O-intensive Java applications Using Zero Copy
Optimize Performance of I/O-intensive Java applications Using Zero Copy
 
Using SCTP with Scamper and Netty
Using SCTP with Scamper and NettyUsing SCTP with Scamper and Netty
Using SCTP with Scamper and Netty
 
Ambry : Linkedin's Scalable Geo-Distributed Object Store
Ambry : Linkedin's Scalable Geo-Distributed Object StoreAmbry : Linkedin's Scalable Geo-Distributed Object Store
Ambry : Linkedin's Scalable Geo-Distributed Object Store
 
Netty Cookbook - Chapter 1
Netty Cookbook - Chapter 1Netty Cookbook - Chapter 1
Netty Cookbook - Chapter 1
 
Experience with Kafka & Storm
Experience with Kafka & StormExperience with Kafka & Storm
Experience with Kafka & Storm
 
Netty Cookbook - Table of contents
Netty Cookbook - Table of contentsNetty Cookbook - Table of contents
Netty Cookbook - Table of contents
 
Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016
 
Nettyらへん
NettyらへんNettyらへん
Nettyらへん
 
Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)
 
Java concurrency - Thread pools
Java concurrency - Thread poolsJava concurrency - Thread pools
Java concurrency - Thread pools
 
Java SE 8 技術手冊第 15 章 - 通用API
Java SE 8 技術手冊第 15 章 - 通用APIJava SE 8 技術手冊第 15 章 - 通用API
Java SE 8 技術手冊第 15 章 - 通用API
 

Similar a Notes on Netty baics

Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...
Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...
Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...
Luis Lopez
 
Tech Tutorial by Vikram Dham: Let's build MPLS router using SDN
Tech Tutorial by Vikram Dham: Let's build MPLS router using SDNTech Tutorial by Vikram Dham: Let's build MPLS router using SDN
Tech Tutorial by Vikram Dham: Let's build MPLS router using SDN
nvirters
 
Openstack meetup-pune-aug22-overview
Openstack meetup-pune-aug22-overviewOpenstack meetup-pune-aug22-overview
Openstack meetup-pune-aug22-overview
rajdeep
 

Similar a Notes on Netty baics (20)

Messaging for IoT
Messaging for IoTMessaging for IoT
Messaging for IoT
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
How we use Twisted in Launchpad
How we use Twisted in LaunchpadHow we use Twisted in Launchpad
How we use Twisted in Launchpad
 
Openstack Overview
Openstack OverviewOpenstack Overview
Openstack Overview
 
Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...
Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...
Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...
 
Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQ
 
NATS: A Cloud Native Messaging System
NATS: A Cloud Native Messaging SystemNATS: A Cloud Native Messaging System
NATS: A Cloud Native Messaging System
 
Microservices and Best Practices
Microservices and Best Practices Microservices and Best Practices
Microservices and Best Practices
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Keystone - ApacheCon 2016
Keystone - ApacheCon 2016Keystone - ApacheCon 2016
Keystone - ApacheCon 2016
 
Brief Introduction To Kubernetes
Brief Introduction To KubernetesBrief Introduction To Kubernetes
Brief Introduction To Kubernetes
 
Journey into Reactive Streams and Akka Streams
Journey into Reactive Streams and Akka StreamsJourney into Reactive Streams and Akka Streams
Journey into Reactive Streams and Akka Streams
 
Tech Tutorial by Vikram Dham: Let's build MPLS router using SDN
Tech Tutorial by Vikram Dham: Let's build MPLS router using SDNTech Tutorial by Vikram Dham: Let's build MPLS router using SDN
Tech Tutorial by Vikram Dham: Let's build MPLS router using SDN
 
Architectures with Windows Azure
Architectures with Windows AzureArchitectures with Windows Azure
Architectures with Windows Azure
 
Openstack meetup-pune-aug22-overview
Openstack meetup-pune-aug22-overviewOpenstack meetup-pune-aug22-overview
Openstack meetup-pune-aug22-overview
 
Quick look in Reactive Extensions
Quick look in Reactive ExtensionsQuick look in Reactive Extensions
Quick look in Reactive Extensions
 
OpenStack and OpenDaylight Workshop: ONUG Spring 2014
OpenStack and OpenDaylight Workshop: ONUG Spring 2014OpenStack and OpenDaylight Workshop: ONUG Spring 2014
OpenStack and OpenDaylight Workshop: ONUG Spring 2014
 
Introduction MQTT in English
Introduction MQTT in EnglishIntroduction MQTT in English
Introduction MQTT in English
 
Workshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive StreamsWorkshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive Streams
 
Workshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive StreamsWorkshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive Streams
 

Más de Rick Hightower

Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)
Rick Hightower
 
Consul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive ProgrammingConsul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive Programming
Rick Hightower
 
The Java Microservice Library
The Java Microservice LibraryThe Java Microservice Library
The Java Microservice Library
Rick Hightower
 

Más de Rick Hightower (18)

JParse Fast JSON Parser
JParse Fast JSON ParserJParse Fast JSON Parser
JParse Fast JSON Parser
 
Service Mesh Talk for CTO Forum
Service Mesh Talk for CTO ForumService Mesh Talk for CTO Forum
Service Mesh Talk for CTO Forum
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)
 
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and MicroservicesAccelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
 
Accelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business case for Agile DevOps, CI/CD and MicroservicesAccelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
 
Accelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and KubernetesAccelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and Kubernetes
 
Accelerate using DevOps and CI/CD.
Accelerate using DevOps and CI/CD.Accelerate using DevOps and CI/CD.
Accelerate using DevOps and CI/CD.
 
High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017
 
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
Reactive Java:  Promises and Streams with Reakt (JavaOne Talk 2016)Reactive Java:  Promises and Streams with Reakt (JavaOne Talk 2016)
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
 
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
Reactive Java: Promises and Streams with Reakt  (JavaOne talk 2016)Reactive Java: Promises and Streams with Reakt  (JavaOne talk 2016)
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
 
High-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulationsHigh-Speed Reactive Microservices - trials and tribulations
High-Speed Reactive Microservices - trials and tribulations
 
High-Speed Reactive Microservices
High-Speed Reactive MicroservicesHigh-Speed Reactive Microservices
High-Speed Reactive Microservices
 
WebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST MicroserviceWebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST Microservice
 
Consul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive ProgrammingConsul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive Programming
 
The Java Microservice Library
The Java Microservice LibraryThe Java Microservice Library
The Java Microservice Library
 
Java JSON Benchmark
Java JSON BenchmarkJava JSON Benchmark
Java JSON Benchmark
 
MongoDB quickstart for Java, PHP, and Python developers
MongoDB quickstart for Java, PHP, and Python developersMongoDB quickstart for Java, PHP, and Python developers
MongoDB quickstart for Java, PHP, and Python developers
 
Mongo DB for Java, Python and PHP Developers
Mongo DB for Java, Python and PHP DevelopersMongo DB for Java, Python and PHP Developers
Mongo DB for Java, Python and PHP Developers
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

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