25
Introduction to MINA Trustin Lee [email protected] http://people.apache.org/~trustin/

TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

Introduction to MINATrustin [email protected]

http://people.apache.org/~trustin/

Page 2: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 2

Agenda

• Overview• In-depth View• Implementation Demo• Future• Conclusion

Page 3: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

OverviewA Multi-purpose Infrastructure for Network Applications

Page 4: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

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: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

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: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

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

• DNS• NTP

• LDAP• Kerberos

Overview

Page 7: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

In-depth ViewA Multi-purpose Infrastructure for Network Applications

Page 8: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

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

-leve

l I/

O

IoFilter #1

IoFilter #2

IoFilter #3

IoSession

Page 9: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 9

IoSessionManagersIn-depth

IoAcceptor IoConnector

nio::DatagramConnector

nio::SocketConnector

vmpipe::VmPipeAcceptor vmpipe::VmPipeConnector

nio::DatagramAcceptor

nio::SocketAcceptor

IoSessionManagerServer-side:

Accepts clientsClient-side:Connects to a server

And their implementations

Page 10: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 10

IoFilters

• An event & request interceptor• Reusable • Hot-deployable

•Peer blacklist•Logger•Authorization •Traffic shaper•Overload detector

•SSL · TLS•Thread pool•SASL•Performance profiler•Lightweight firewall

In-depth

Page 11: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 11

IoAcceptor IoHandler

No thread pool: single thread setting for minimal latency

IoFilters: ThreadPoolFilter

IoAcceptorThread

PoolFilter

IoHandler

One thread pool: general setting for high throughput

In-depth

Page 12: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

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: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 13

IoFilters: ProtocolCodecFilters (Cont’d)Remote Peer

IoSessionManager

IoHandler

IoFilterChain

Core

Extension Point

Protocol Implementation

Legend

IoSession

ProtocolCodecFilterEncode

Decode

In-depth

POJO →ByteBuffer

ByteBuffer→ POJO

⇒ Business Logic Only!

Page 14: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

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: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

Implementation DemoA Multi-purpose Infrastructure for Network Applications

Page 16: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

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

Demo

Page 17: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 17

Demo

Page 18: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

FutureA Multi-purpose Infrastructure for Network Applications

Page 19: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 19

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!

MINA as a PlatformFuture

Page 20: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 20

Real-Time Management System

• A universal management view• JMX console and Web 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 21: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 21

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 22: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

ConclusionA Multi-purpose Infrastructure for Network Applications

Page 23: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 23

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 24: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

December 13, 2005 ApacheCon US 2005 24

Resources

• Homepage• http://directory.apache.org/subprojects/network/

• Tutorial• More useful examples

• Mailing List• [email protected]

(Please use ‘[mina]’ prefix)

Page 25: TU14. Introduction to MINAmina.apache.org/mina-project/resources/ACUS2005.pdf · 2020. 11. 25. · •MINA is an extensible network application framework that helps you implement

Thank You!Q & A