Netty 4 and JMX Integration

Introduction

 

This document outlines a proposal to integrate JMX Management into Netty 4.

 

Global Options and Configuration

These items are general issues to consider in the global configuration and deployment of Netty component MBeans.

  • Netty MBean domain namespace.
  • JMX Domain[s] (MBeanServer[s]) to register with.
  • Verbosity of JMX Management Interfaces
    • Optional categories of Netty components to register management interfaces for.
    • Relative level of information for each category of MBean. For example:
      1. Low: Configuration only.

      2. Medium: Activity, events and volume.
      3. High: Instrumented activity (operation elapsed time, CPU time, waits, blocks, bytes transferred etc.)
    • Stale MBean instance age-out. i.e. In cases where an MBean is created for the management of a transient Netty component such as a Channel, and an MBean for that component is registered when the component is created [or connected] but it may be desirable that the MBean remain accessible for some lingering time after the component is closed so that a user can inspect it. Eventually, in the absence of any direct JMX interfaction with the MBean, it should be aged out and be unregistered.
  • Standardized JMX ObjectName patterns per component type:
    • Useful identifying key property names and values.
    • Sufficient granularity of key property names and values to avoid ObjectName collision between MBeans created for two legitimatelly components.

 

Proposed Requirements and Implementation

  • Netty Code Base Internalized JMX Code to avoid additional library dependencies.
  • Enumerate potental extensions to Netty core classes to allow JMX supporting hooks into core class instances.
  • JMX Annotations to provide runtime meta-data and discovery of extended attributes and annotations.
  • MBeans implemented as DynamicMBeans rather than simple MBeans:
    • Supports useful and informative meta-data.
    • Allows dynamic upgrade/downgrade of verbosity/granularity by adding/removing attributes.

 

 

Managed Netty Components (Rough and Speculative)

Verbose or Extended Options

Component Type
AttributesOperationsNotificationsNotes
NettyMaster

OpenChannelCount

BoundChannelCount

ConnectedChannelCount

ChannelGroupCount

TotalBytesIn

TotalBytesOut

ChannelConnected

ChannelDisconnected

ChannelBound

ChannelUnbound

ChannelOpen

ChannelClosed

Channel

Type (ClassName)

Local Address

Remote Address

Channel ID

Interest Ops (Rendered)

State

Bound

Opened

Connected

Readable

Writable

Pipeline Handler Names

LastConnectDate

LastDisconnectDate

Child Channel ObjectNames

Parent Channel ObjectName

[Options...]

Exceptions

Timeouts

AwaitsInProgress

Calls Upstream

Calls Downstream

Bytes Upstream

Bytes Downstream

Executor[s] ObjectName[s]

Handler[s] ObjectName[s]

Connect

Disconnect

Add to Pipeline

Remove from Pipeline

ResetStats

exceptionCaught

channelStateChange

channelOpen
channelClosed
channelBound
channelUnbound
channelConnected
channelDisconnected
channelInterestChanged
childChannelOpen
childChannelClosed

channelFutureAwaitTimeout
messageReceived
writeComplete

Key Properties:

Channel ID

Remote Address

Local Address

ChannelGroup

Name

ChannelCount

Channel ObjectNames

Aggregate Channel Stats

Unbind

Same as Channel

Channel Added

Channel Removed

Key Properties:

Name

Executors / Thread Pools

ActiveCount

TaskCount

CompletedTaskCount

CorePoolSize

MaxPoolSize

KeepAliveTime

CurrentPoolSize

LargestPoolSize

QueuedTaskCount

QueueCapacity

State

Thread Stats For Pool Threads

  • User/Sys CPU Time
  • Wait Count / Time
  • Block Count / Time
TerminateState Change

Key Properties:

?

Pipelines

Aggregated Metrics

For All Contained Handlers

Key Properties:

?

Handlers

Name

Shareable

Exceptions

Calls Upstream

Calls Downstream

Bytes Upstream

Bytes Downstream

averageElapsedTime

-[ToHandle]
ResetStats

messageReceived
writeComplete

Key Properties:

Name ClassName

Instance Seq#

 

Tricky cardinality.

InternalLoggerFactoryDefaultFactory

setLoggerLevel

getLoggerLevel

LoggerLevelChange

 

 

Additional Input: