introduction to mina trustin lee [email protected] trustin
TRANSCRIPT
![Page 2: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/2.jpg)
December 13, 2005 ApacheCon US 2005 2
Agenda
• Overview• In-depth View• Implementation Demo• Future• Conclusion
![Page 3: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/3.jpg)
OverviewA Multi-purpose Infrastructure for Network Applications
![Page 4: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/4.jpg)
December 13, 2005 ApacheCon US 2005 4
What is MINA?
• Java network application framework• High productivity
• Easy-to-learn• Elegant application design
• High performance• Asynchronous · Event-driven
Overview
![Page 5: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/5.jpg)
December 13, 2005 ApacheCon US 2005 5
Elegant Application Design
• Unit test friendly• You can test your application without a
real client or server via mock objects.
• Extensible• Runtime modification of application
behavior using ‘filters’
• Maintainable and Reusable• Separation of networking code (MINA),
protocol codec, and business logic
Overview
![Page 6: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/6.jpg)
December 13, 2005 ApacheCon US 2005 6
Who Uses MINA?• The Apache Directory Project
• QuickFIX – QuickFIXEngine.org• Financial Information eXchange Protocol
• RED5 Server – OSFlash.org• Macromedia Flash Media RTMP
• JStyx – JStyx.sf.net• Styx, a file sharing NFS-like protocol
• Proprietary SMS · MMS servers
• LDAP• Kerberos
• DNS• NTP
Overview
![Page 7: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/7.jpg)
In-depth ViewA Multi-purpose Infrastructure for Network Applications
![Page 8: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/8.jpg)
December 13, 2005 ApacheCon US 2005 8
At a Glance
• IoSessionManager• Where real I/O occurs
• IoFilters• Filters I/O events · requests
• IoHandler• <Your protocol logic>
• IoSession• Represents a connection
In-depth
Remote Peer
IoSessionManager
IoHandler
IoFilterChain
Core
Extension Point
Protocol Implementation
Legend
Filtered I/O
Event I/O
Req
uest
I/O Event
Filte
red
I/O
Req
uest
Low-level
I/O
Low
-lev
el
I/O
IoFilter #1
IoFilter #2
IoFilter #3
IoSession
![Page 9: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/9.jpg)
December 13, 2005 ApacheCon US 2005 9
IoSessionManagersIn-depth
IoAcceptor IoConnector
nio::DatagramConnector
nio::SocketConnector
vmpipe::VmPipeAcceptor vmpipe::VmPipeConnector
nio::DatagramAcceptor
nio::SocketAcceptor
IoSessionManager
Server-side:Accepts
clients
Client-side:Connects to a server
And their implementation
s
![Page 10: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/10.jpg)
December 13, 2005 ApacheCon US 2005 10
IoFilters• An event & request interceptor
• Reusable • Hot-deployable
•SSL · TLS•Thread pool•SASL•Performance profiler•Lightweight firewall
•Peer blacklist•Logger•Authorization •Traffic shaper•Overload detector
In-depth
![Page 11: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/11.jpg)
December 13, 2005 ApacheCon US 2005 11
IoAcceptor IoHandler
No thread pool: single thread setting for minimal latency
IoFilters: ThreadPoolFilter
IoAcceptorThreadPoolFilter
CPU-intensive
jobs(IoFilter)
ThreadPoolFilter
IoHandler
More than one thread pool: special setting for CPU-intensive jobs
IoAcceptorThreadPoolFilter
IoHandler
One thread pool: general setting for high throughput
In-depth
![Page 12: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/12.jpg)
December 13, 2005 ApacheCon US 2005 12
IoFilters: ProtocolCodecFilter• Clear separation and reusability
• Business logic – IoHandler• Protocol codec – ProtocolCodecFilter
• Out-of-the-box• Object serialization • Text line
In-depth
![Page 13: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/13.jpg)
December 13, 2005 ApacheCon US 2005 13
IoFilters: ProtocolCodecFilters (Cont’d)Remote Peer
IoSessionManager
IoHandler
IoFilterChain
Core
Extension Point
Protocol Implementation
Legend
Filtered I/O
Event I/O
Req
uest
I/O Event
Filte
red
I/O
Req
uest
Low-level
I/O
Low
-lev
el
I/O
IoSession
ProtocolCodecFilter
Protocol Codec Factory
EncoderDecoder
Encode
Decode
In-depth
POJO → ByteBuffer
ByteBuffer → POJO
Business Logic Only!
![Page 14: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/14.jpg)
December 13, 2005 ApacheCon US 2005 14
In-VM Pipe
I/O events are converted into
‘Direct Method Invocations’
In-depth
No protocol codec No network latency Using the same API
![Page 15: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/15.jpg)
Implementation DemoA Multi-purpose Infrastructure for Network Applications
![Page 16: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/16.jpg)
December 13, 2005 ApacheCon US 2005 16
Reverse Echo Server
• Echo server which reverses a line
• Using a built-in text line protocol codec in MINA
• Click here to start the demo.
Demo
![Page 17: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/17.jpg)
FutureA Multi-purpose Infrastructure for Network Applications
![Page 18: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/18.jpg)
December 13, 2005 ApacheCon US 2005 18
Integration with Apache ASN.1 for complex protocols Users can build customized servers
with ready-made protocol codecs.
Design custom protocols just like drawing a UML!
Real-Time Management System
LDAP
Kerberos
ASN.1Codec
MINA as a PlatformFuture
MINA
HTTP
SMTP
FTP
……
Popular Protocols
Visual Protocol Designer
(ASN.1-based)
Rapidly Prototyped Protocol
Others
![Page 19: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/19.jpg)
December 13, 2005 ApacheCon US 2005 19
Real-Time Management System
• A universal m anagement v iew• JMX console and W eb browser• Real time access
• Server traffic• IoFilter Hot-deploy• Which client is sending what message now?• Which message takes too long to process?• And <what you want to monitor>
Future
![Page 20: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/20.jpg)
December 13, 2005 ApacheCon US 2005 20
We Need Your Participation!
• Sounds exciting?• Please help MINA team!
• Try MINA• Ask questions• Criticize• Report bugs• Benchmark• Contribute code• Contribute a tutorial
Future
![Page 21: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/21.jpg)
ConclusionA Multi-purpose Infrastructure for Network Applications
![Page 22: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/22.jpg)
December 13, 2005 ApacheCon US 2005 22
Conclusion
• MINA is an extensible network application framework that helps you implement your network application elegantly without compromising productivity.
• MINA will be a full-featured network application dev. & mgmt. platform if we get our efforts together.
Conclusion
![Page 23: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/23.jpg)
December 13, 2005 ApacheCon US 2005 23
Resources
• Homepage• http://directory.apache.org/subprojects/network/
• Tutorial• More useful examples
• Mailing List• [email protected]
(Please use ‘[mina]’ prefix)
![Page 24: Introduction to MINA Trustin Lee trustin@apache.org trustin](https://reader035.vdocument.in/reader035/viewer/2022062422/56649e7c5503460f94b7ee70/html5/thumbnails/24.jpg)
Thank You!Q & A