SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
Building High Performance
Scalable TCP/IP Servers with
Apache MINA
Originally presented at ApacheCon Europe 2006 in Dublin

Latest slides and code samples at http://people.apache.org/~proyal

Presented by Peter Royal, <proyal@apache.org>




                                                                     1
Goals of this presentation
•Introduction to MINA
•Demonstration of what it can do
•Converting blocking-IO code to MINA
•Hopefully inspire you to use it :)




                                       2
What is MINA
•Multipurpose Infrastructure for Networked Applications
•A framework (the F word!) for building networked clients
 and servers based on non-blocking IO
•http://directory.apache.org/subprojects/mina/




                                                            3
Brief history of MINA
•Started out as Netty2 from Trustin Lee
•Joined the Directory Project as the SEDA-based directory
 needed an asynchronous I/O layer.




                                                            4
IoHandler




             IoFilter




                         Inbound
             IoFilter
Outbound




             IoFilter




           IoProcessor


           IoAcceptor




           Network
                                   Architectural overview

                                                        5
IoSession
•Holder of state for a connection (either client-side or
 server-side)
•Passed along with every event
•Important Methods
  •write
  •close
  •get/setAttribute




                                                           6
IoHandler
•Akin to a Servlet           IoHandler



•Endpoint of a filter chain
                               IoFilter


•Important Methods
                               IoFilter


  •sessionOpened
                               IoFilter

  •messageReceived
                             IoProcessor

  •sessionClosed
                             IoAcceptor




                                           7
IoFilterChain
•Chain of IoFilter's for each IoSession
•Can setup template chains per IoConnector/IoAcceptor
•Dynamic addition/removal




                                                        8
IoFilters
•Akin to a ServletFilter            IoHandler



•View/Hack/Slash the event stream
                                      IoFilter


•Important Methods
                                      IoFilter


  •sessionOpened
                                      IoFilter

  •messageReceived
                                    IoProcessor

  •filterWrite
                                    IoAcceptor


  •sessionClosed



                                                  9
IoAcceptor
•Server-side entry point.                IoHandler



•Accepts incoming connections and fires
                                           IoFilter
 events to an IoHandler
•Important Methods                         IoFilter




  •bind                                    IoFilter




                                         IoProcessor


                                         IoAcceptor




                                                       10
IoConnector
•Client-side entry point
•Initiate connections to a remote service, and fires events to
 an IoHandler
•Important Methods
  •connect




                                                                11
IoProcessor
•Internal component                       IoHandler



•Handles reading and writing data to an
                                            IoFilter
 underlying connection
•Each connection is associated with a       IoFilter



 single IoProcessor (shared amongst
                                            IoFilter
 multiple connections)
                                          IoProcessor


                                          IoAcceptor




                                                        12
Our Sample Application
•Persistent connections from clients
•Serialize java objects across the wire
•Clients connect and are given a unit of work, which in this
 case, is just an instruction for how long to wait until getting
 their next instruction.




                                                                   13
Monitoring Performance
•Thread activity via jconsole
•CPU Activity via Activity Monitor
  •(or your favorite tool)




                                     14
Limitations

              15
Scalability
•JVM limit on number of threads
•The lovely java.lang.OutOfMemoryError: unable to
 create new native thread




                                                    16
Lets convert to MINA!
•Server side first
  •(Client to come soon)




                           17
Re-testing

             18
New Limitations?
•Java Serialization takes up CPU time
  •(a profiler would reveal this)
•OS limit of per-process open files
  •(consult the documentation for your OS)
  •sysctl / ulimit to view/change on unix-like systems




                                                         19
MINA on the client
•Since we will be using MINA's built-in support for building
 protocols, the ProtocolCodecFilter
  •Any socket client can talk to MINA
  •We’re using MINA on both sides for simplicity in our
   examples.




                                                               20
Client is just like the server
•IoHandler and IoFilter's
•Can re-use filters on both client and server sides.




                                                      21
Implementing the protocol.

                             22
It still works!

                  23
Filters that ship today
•Logging
•Compression
•Blacklist
•SSL
  •Requires Java 5




                          24
Filters we are working on
•Traffic Shaping
•Rate Limiting
•Performance Monitoring




                            25
Some things built on MINA
•LDAP - Apache DS <http://directory.apache.org/
 subprojects/apacheds/index.html>

•Flash - red5 <http://www.osflash.org/red5>

•HTTP - AsyncWeb <http://asyncweb.safehaus.org/>




                                                   26
Performance Tips
•Set the number of IoProcessor’s to be equal to the number
 of CPU cores.

•Benchmark! Users have found both heap and direct
 buffers, pooled and not pooled, to be beneficial depending
 on their workloads.

•For ultra-low latency with small message sizes on a local
 lan, disable Nagle’s algorithm; the TCP_NODELAY flag.




                                                             27
Questions?

             28
Thank You!

             29

Contenu connexe

Tendances

The Unilever Effective Leadership The How 2012
The Unilever Effective Leadership The How 2012The Unilever Effective Leadership The How 2012
The Unilever Effective Leadership The How 2012Dr Yvonne Sum, CSP
 
Pengurusan pertumbuhan perniagaan
Pengurusan pertumbuhan perniagaanPengurusan pertumbuhan perniagaan
Pengurusan pertumbuhan perniagaanNor Syazwani
 
Gizi seimbang ting2
Gizi seimbang ting2Gizi seimbang ting2
Gizi seimbang ting20142361861
 
Ciri-ciri Keusahawanan.pdf
Ciri-ciri Keusahawanan.pdfCiri-ciri Keusahawanan.pdf
Ciri-ciri Keusahawanan.pdfmohdapik
 
A Presentation On Planing & Organizing (Principles Of Management)
A Presentation On Planing & Organizing (Principles Of Management)A Presentation On Planing & Organizing (Principles Of Management)
A Presentation On Planing & Organizing (Principles Of Management)Robin Bepary
 
MGT 162 : Sample, UiTM Dungun December 2019
MGT 162 : Sample, UiTM Dungun December 2019MGT 162 : Sample, UiTM Dungun December 2019
MGT 162 : Sample, UiTM Dungun December 2019AnisNatasha8
 
9. pembangunan produk baharu & kitaran hayat produk
9. pembangunan produk baharu & kitaran hayat produk9. pembangunan produk baharu & kitaran hayat produk
9. pembangunan produk baharu & kitaran hayat produkyunnach
 
Peranan kesatuan sekerja
Peranan kesatuan sekerja   Peranan kesatuan sekerja
Peranan kesatuan sekerja Zafarul_Irshard
 
KESIMPULAN (GEJALA SOSIAL)
KESIMPULAN (GEJALA SOSIAL)KESIMPULAN (GEJALA SOSIAL)
KESIMPULAN (GEJALA SOSIAL)Teacher Nasrah
 
3.2 struktur & fungsi reproduktif wanita
3.2 struktur & fungsi reproduktif wanita3.2 struktur & fungsi reproduktif wanita
3.2 struktur & fungsi reproduktif wanitaMohd Arif
 
Chapter 1 : Foundations Of Management
Chapter 1 : Foundations Of ManagementChapter 1 : Foundations Of Management
Chapter 1 : Foundations Of ManagementPeleZain
 
Analisis Peranan Pengurus dalam Organisasi
Analisis Peranan Pengurus dalam OrganisasiAnalisis Peranan Pengurus dalam Organisasi
Analisis Peranan Pengurus dalam OrganisasiFara Megat
 
Kaedah meningkatkan jualan dengan facebook
Kaedah meningkatkan jualan dengan facebookKaedah meningkatkan jualan dengan facebook
Kaedah meningkatkan jualan dengan facebookMuhamad Lokman
 

Tendances (20)

Ent300 Module03
Ent300 Module03Ent300 Module03
Ent300 Module03
 
The Unilever Effective Leadership The How 2012
The Unilever Effective Leadership The How 2012The Unilever Effective Leadership The How 2012
The Unilever Effective Leadership The How 2012
 
Pengurusan pertumbuhan perniagaan
Pengurusan pertumbuhan perniagaanPengurusan pertumbuhan perniagaan
Pengurusan pertumbuhan perniagaan
 
Gizi seimbang ting2
Gizi seimbang ting2Gizi seimbang ting2
Gizi seimbang ting2
 
Chap 5 MGT162
Chap 5 MGT162Chap 5 MGT162
Chap 5 MGT162
 
Ciri-ciri Keusahawanan.pdf
Ciri-ciri Keusahawanan.pdfCiri-ciri Keusahawanan.pdf
Ciri-ciri Keusahawanan.pdf
 
A Presentation On Planing & Organizing (Principles Of Management)
A Presentation On Planing & Organizing (Principles Of Management)A Presentation On Planing & Organizing (Principles Of Management)
A Presentation On Planing & Organizing (Principles Of Management)
 
MGT 162 : Sample, UiTM Dungun December 2019
MGT 162 : Sample, UiTM Dungun December 2019MGT 162 : Sample, UiTM Dungun December 2019
MGT 162 : Sample, UiTM Dungun December 2019
 
Chap 2 MGT 162
Chap 2   MGT 162Chap 2   MGT 162
Chap 2 MGT 162
 
Who is manager
Who is managerWho is manager
Who is manager
 
9. pembangunan produk baharu & kitaran hayat produk
9. pembangunan produk baharu & kitaran hayat produk9. pembangunan produk baharu & kitaran hayat produk
9. pembangunan produk baharu & kitaran hayat produk
 
Peranan kesatuan sekerja
Peranan kesatuan sekerja   Peranan kesatuan sekerja
Peranan kesatuan sekerja
 
KESIMPULAN (GEJALA SOSIAL)
KESIMPULAN (GEJALA SOSIAL)KESIMPULAN (GEJALA SOSIAL)
KESIMPULAN (GEJALA SOSIAL)
 
PGDM
PGDMPGDM
PGDM
 
3.2 struktur & fungsi reproduktif wanita
3.2 struktur & fungsi reproduktif wanita3.2 struktur & fungsi reproduktif wanita
3.2 struktur & fungsi reproduktif wanita
 
Chapter 1 : Foundations Of Management
Chapter 1 : Foundations Of ManagementChapter 1 : Foundations Of Management
Chapter 1 : Foundations Of Management
 
Analisis Peranan Pengurus dalam Organisasi
Analisis Peranan Pengurus dalam OrganisasiAnalisis Peranan Pengurus dalam Organisasi
Analisis Peranan Pengurus dalam Organisasi
 
Kaedah meningkatkan jualan dengan facebook
Kaedah meningkatkan jualan dengan facebookKaedah meningkatkan jualan dengan facebook
Kaedah meningkatkan jualan dengan facebook
 
Pelan dan dongakan
Pelan dan dongakanPelan dan dongakan
Pelan dan dongakan
 
Pbsm ;(
Pbsm ;(Pbsm ;(
Pbsm ;(
 

En vedette

Apache MINA: The high-performance protocol construction toolkit.
Apache MINA: The high-performance protocol construction toolkit.Apache MINA: The high-performance protocol construction toolkit.
Apache MINA: The high-performance protocol construction toolkit.osi
 
Rapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINARapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINAtrustinlee
 
Apache Mina
Apache MinaApache Mina
Apache Minalake xie
 
Nio sur Netty par Mouhcine Moulou - 3 avril 2014
Nio sur Netty par Mouhcine Moulou - 3 avril 2014Nio sur Netty par Mouhcine Moulou - 3 avril 2014
Nio sur Netty par Mouhcine Moulou - 3 avril 2014SOAT
 
Chalet management system (e cha m)
Chalet management system (e cha m)Chalet management system (e cha m)
Chalet management system (e cha m)HoneySah
 
Intro to Distributed Database Management System
Intro to Distributed Database Management SystemIntro to Distributed Database Management System
Intro to Distributed Database Management SystemAli Raza
 
Programming TCP/IP with Sockets
Programming TCP/IP with SocketsProgramming TCP/IP with Sockets
Programming TCP/IP with Socketselliando dias
 
Distributed Databases
Distributed DatabasesDistributed Databases
Distributed Databaseselliando dias
 
Lecture 11 - distributed database
Lecture 11 - distributed databaseLecture 11 - distributed database
Lecture 11 - distributed databaseHoneySah
 
Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slideselliando dias
 
Distributed Database Management System
Distributed Database Management SystemDistributed Database Management System
Distributed Database Management SystemHardik Patil
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming TutorialJignesh Patel
 
Distributed Database System
Distributed Database SystemDistributed Database System
Distributed Database SystemSulemang
 

En vedette (18)

Apache MINA: The high-performance protocol construction toolkit.
Apache MINA: The high-performance protocol construction toolkit.Apache MINA: The high-performance protocol construction toolkit.
Apache MINA: The high-performance protocol construction toolkit.
 
Mina2
Mina2Mina2
Mina2
 
Rapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINARapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINA
 
Introduction to Apache MINA
Introduction to Apache MINAIntroduction to Apache MINA
Introduction to Apache MINA
 
Apache Mina
Apache MinaApache Mina
Apache Mina
 
NIO 2
NIO 2NIO 2
NIO 2
 
Nio sur Netty par Mouhcine Moulou - 3 avril 2014
Nio sur Netty par Mouhcine Moulou - 3 avril 2014Nio sur Netty par Mouhcine Moulou - 3 avril 2014
Nio sur Netty par Mouhcine Moulou - 3 avril 2014
 
Chalet management system (e cha m)
Chalet management system (e cha m)Chalet management system (e cha m)
Chalet management system (e cha m)
 
Intro to Distributed Database Management System
Intro to Distributed Database Management SystemIntro to Distributed Database Management System
Intro to Distributed Database Management System
 
Programming TCP/IP with Sockets
Programming TCP/IP with SocketsProgramming TCP/IP with Sockets
Programming TCP/IP with Sockets
 
Distributed Databases
Distributed DatabasesDistributed Databases
Distributed Databases
 
Database fragmentation
Database fragmentationDatabase fragmentation
Database fragmentation
 
Lecture 11 - distributed database
Lecture 11 - distributed databaseLecture 11 - distributed database
Lecture 11 - distributed database
 
Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Distributed Database Management System
Distributed Database Management SystemDistributed Database Management System
Distributed Database Management System
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming Tutorial
 
Distributed database
Distributed databaseDistributed database
Distributed database
 
Distributed Database System
Distributed Database SystemDistributed Database System
Distributed Database System
 

Similaire à Building High Performance Scalable TCP/IP Servers with Apache MINA

JDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKJDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKWolfgang Weigend
 
CrossWorlds: Unleash the Power of Domino for Connections Development
CrossWorlds: Unleash the Power of Domino for Connections Development CrossWorlds: Unleash the Power of Domino for Connections Development
CrossWorlds: Unleash the Power of Domino for Connections Development LetsConnect
 
MySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMorgan Tocker
 
NFV Infrastructure Manager with High Performance Software Switch Lagopus
NFV Infrastructure Manager with High Performance Software Switch Lagopus NFV Infrastructure Manager with High Performance Software Switch Lagopus
NFV Infrastructure Manager with High Performance Software Switch Lagopus Hirofumi Ichihara
 
AFNetworking
AFNetworking AFNetworking
AFNetworking joaopmaia
 
026 Neo4j Data Loading (ETL_ELT) Best Practices - NODES2022 AMERICAS Advanced...
026 Neo4j Data Loading (ETL_ELT) Best Practices - NODES2022 AMERICAS Advanced...026 Neo4j Data Loading (ETL_ELT) Best Practices - NODES2022 AMERICAS Advanced...
026 Neo4j Data Loading (ETL_ELT) Best Practices - NODES2022 AMERICAS Advanced...Neo4j
 
Gradual migration to MicroProfile
Gradual migration to MicroProfileGradual migration to MicroProfile
Gradual migration to MicroProfileRudy De Busscher
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfilePayara
 
The First Mile -- Edge and IoT Data Collection with Apache NiFi and MiNiFi
The First Mile -- Edge and IoT Data Collection with Apache NiFi and MiNiFiThe First Mile -- Edge and IoT Data Collection with Apache NiFi and MiNiFi
The First Mile -- Edge and IoT Data Collection with Apache NiFi and MiNiFiDataWorks Summit
 
컨테이너 기술 소개 - Warden, Garden, Docker
컨테이너 기술 소개 - Warden, Garden, Docker컨테이너 기술 소개 - Warden, Garden, Docker
컨테이너 기술 소개 - Warden, Garden, Dockerseungdon Choi
 
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFiThe First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFiDataWorks Summit
 
Ext osad initial-eval-march2015
Ext osad initial-eval-march2015Ext osad initial-eval-march2015
Ext osad initial-eval-march2015Daneyon Hansen
 
Apache Geode Meetup, London
Apache Geode Meetup, LondonApache Geode Meetup, London
Apache Geode Meetup, LondonApache Geode
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Hannes Lowette
 
BYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiBYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiDataWorks Summit
 
Using the Java Client Library by Noah Crowley, DevRel | InfluxData
Using the Java Client Library by Noah Crowley, DevRel | InfluxDataUsing the Java Client Library by Noah Crowley, DevRel | InfluxData
Using the Java Client Library by Noah Crowley, DevRel | InfluxDataInfluxData
 
2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advoc...
2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advoc...2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advoc...
2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advoc...InfluxData
 
Road to NODES - Handling Neo4j Data with Apache Hop
Road to NODES - Handling Neo4j Data with Apache HopRoad to NODES - Handling Neo4j Data with Apache Hop
Road to NODES - Handling Neo4j Data with Apache HopNeo4j
 
Social Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoSocial Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoPaul Withers
 

Similaire à Building High Performance Scalable TCP/IP Servers with Apache MINA (20)

JDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKJDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDK
 
CrossWorlds: Unleash the Power of Domino for Connections Development
CrossWorlds: Unleash the Power of Domino for Connections Development CrossWorlds: Unleash the Power of Domino for Connections Development
CrossWorlds: Unleash the Power of Domino for Connections Development
 
MySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big Data
 
NFV Infrastructure Manager with High Performance Software Switch Lagopus
NFV Infrastructure Manager with High Performance Software Switch Lagopus NFV Infrastructure Manager with High Performance Software Switch Lagopus
NFV Infrastructure Manager with High Performance Software Switch Lagopus
 
AFNetworking
AFNetworking AFNetworking
AFNetworking
 
026 Neo4j Data Loading (ETL_ELT) Best Practices - NODES2022 AMERICAS Advanced...
026 Neo4j Data Loading (ETL_ELT) Best Practices - NODES2022 AMERICAS Advanced...026 Neo4j Data Loading (ETL_ELT) Best Practices - NODES2022 AMERICAS Advanced...
026 Neo4j Data Loading (ETL_ELT) Best Practices - NODES2022 AMERICAS Advanced...
 
Gradual migration to MicroProfile
Gradual migration to MicroProfileGradual migration to MicroProfile
Gradual migration to MicroProfile
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfile
 
The First Mile -- Edge and IoT Data Collection with Apache NiFi and MiNiFi
The First Mile -- Edge and IoT Data Collection with Apache NiFi and MiNiFiThe First Mile -- Edge and IoT Data Collection with Apache NiFi and MiNiFi
The First Mile -- Edge and IoT Data Collection with Apache NiFi and MiNiFi
 
컨테이너 기술 소개 - Warden, Garden, Docker
컨테이너 기술 소개 - Warden, Garden, Docker컨테이너 기술 소개 - Warden, Garden, Docker
컨테이너 기술 소개 - Warden, Garden, Docker
 
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFiThe First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
The First Mile - Edge and IoT Data Collection With Apache Nifi and MiniFi
 
Ext osad initial-eval-march2015
Ext osad initial-eval-march2015Ext osad initial-eval-march2015
Ext osad initial-eval-march2015
 
Apache Geode Meetup, London
Apache Geode Meetup, LondonApache Geode Meetup, London
Apache Geode Meetup, London
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
 
BYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiBYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFi
 
How we use Twisted in Launchpad
How we use Twisted in LaunchpadHow we use Twisted in Launchpad
How we use Twisted in Launchpad
 
Using the Java Client Library by Noah Crowley, DevRel | InfluxData
Using the Java Client Library by Noah Crowley, DevRel | InfluxDataUsing the Java Client Library by Noah Crowley, DevRel | InfluxData
Using the Java Client Library by Noah Crowley, DevRel | InfluxData
 
2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advoc...
2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advoc...2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advoc...
2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advoc...
 
Road to NODES - Handling Neo4j Data with Apache Hop
Road to NODES - Handling Neo4j Data with Apache HopRoad to NODES - Handling Neo4j Data with Apache Hop
Road to NODES - Handling Neo4j Data with Apache Hop
 
Social Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoSocial Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and Domino
 

Plus de elliando dias

Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScriptelliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structureselliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de containerelliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Librarieselliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Webelliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduinoelliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorceryelliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Designelliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makeselliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebookelliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Studyelliando dias
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introductionelliando dias
 

Plus de elliando dias (20)

Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introduction
 

Dernier

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 

Dernier (20)

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 

Building High Performance Scalable TCP/IP Servers with Apache MINA

  • 1. Building High Performance Scalable TCP/IP Servers with Apache MINA Originally presented at ApacheCon Europe 2006 in Dublin Latest slides and code samples at http://people.apache.org/~proyal Presented by Peter Royal, <proyal@apache.org> 1
  • 2. Goals of this presentation •Introduction to MINA •Demonstration of what it can do •Converting blocking-IO code to MINA •Hopefully inspire you to use it :) 2
  • 3. What is MINA •Multipurpose Infrastructure for Networked Applications •A framework (the F word!) for building networked clients and servers based on non-blocking IO •http://directory.apache.org/subprojects/mina/ 3
  • 4. Brief history of MINA •Started out as Netty2 from Trustin Lee •Joined the Directory Project as the SEDA-based directory needed an asynchronous I/O layer. 4
  • 5. IoHandler IoFilter Inbound IoFilter Outbound IoFilter IoProcessor IoAcceptor Network Architectural overview 5
  • 6. IoSession •Holder of state for a connection (either client-side or server-side) •Passed along with every event •Important Methods •write •close •get/setAttribute 6
  • 7. IoHandler •Akin to a Servlet IoHandler •Endpoint of a filter chain IoFilter •Important Methods IoFilter •sessionOpened IoFilter •messageReceived IoProcessor •sessionClosed IoAcceptor 7
  • 8. IoFilterChain •Chain of IoFilter's for each IoSession •Can setup template chains per IoConnector/IoAcceptor •Dynamic addition/removal 8
  • 9. IoFilters •Akin to a ServletFilter IoHandler •View/Hack/Slash the event stream IoFilter •Important Methods IoFilter •sessionOpened IoFilter •messageReceived IoProcessor •filterWrite IoAcceptor •sessionClosed 9
  • 10. IoAcceptor •Server-side entry point. IoHandler •Accepts incoming connections and fires IoFilter events to an IoHandler •Important Methods IoFilter •bind IoFilter IoProcessor IoAcceptor 10
  • 11. IoConnector •Client-side entry point •Initiate connections to a remote service, and fires events to an IoHandler •Important Methods •connect 11
  • 12. IoProcessor •Internal component IoHandler •Handles reading and writing data to an IoFilter underlying connection •Each connection is associated with a IoFilter single IoProcessor (shared amongst IoFilter multiple connections) IoProcessor IoAcceptor 12
  • 13. Our Sample Application •Persistent connections from clients •Serialize java objects across the wire •Clients connect and are given a unit of work, which in this case, is just an instruction for how long to wait until getting their next instruction. 13
  • 14. Monitoring Performance •Thread activity via jconsole •CPU Activity via Activity Monitor •(or your favorite tool) 14
  • 16. Scalability •JVM limit on number of threads •The lovely java.lang.OutOfMemoryError: unable to create new native thread 16
  • 17. Lets convert to MINA! •Server side first •(Client to come soon) 17
  • 19. New Limitations? •Java Serialization takes up CPU time •(a profiler would reveal this) •OS limit of per-process open files •(consult the documentation for your OS) •sysctl / ulimit to view/change on unix-like systems 19
  • 20. MINA on the client •Since we will be using MINA's built-in support for building protocols, the ProtocolCodecFilter •Any socket client can talk to MINA •We’re using MINA on both sides for simplicity in our examples. 20
  • 21. Client is just like the server •IoHandler and IoFilter's •Can re-use filters on both client and server sides. 21
  • 24. Filters that ship today •Logging •Compression •Blacklist •SSL •Requires Java 5 24
  • 25. Filters we are working on •Traffic Shaping •Rate Limiting •Performance Monitoring 25
  • 26. Some things built on MINA •LDAP - Apache DS <http://directory.apache.org/ subprojects/apacheds/index.html> •Flash - red5 <http://www.osflash.org/red5> •HTTP - AsyncWeb <http://asyncweb.safehaus.org/> 26
  • 27. Performance Tips •Set the number of IoProcessor’s to be equal to the number of CPU cores. •Benchmark! Users have found both heap and direct buffers, pooled and not pooled, to be beneficial depending on their workloads. •For ultra-low latency with small message sizes on a local lan, disable Nagle’s algorithm; the TCP_NODELAY flag. 27