JMX monitoring
By default rubris registers a number of MBeans with the default JMX server. It does not create its own MBean Server nor does rubris control the security for the JMX endpoint. This should be secured as per normal practice for the JVM.
The MBeans cover statistics for the HTTP polling, Websocket timings, connected clients, internal timing behaviours, rpc statistics and subscription details.
HTTP Stats
The Http MBean exposes:
- protocolTimings This is a histogram of the HTTP roundtrip timings from request receipt -> response completion. The histogram is represented in 10ms blocks that record the number of requests in each period.
0-10:9
1050-1060:1
2010-2020:1
3030-3040:1
...
As shown above we can see that the histogram has large deviations well above the expected 10ms range. This is due to the fact that the long polling nature of the http request is held on the server (for up to a maximum of 10s). Therefore we would not expect any timings to be above this value.
This histogram is present for other timings in the same format.
- logRequests This turns on or off HTTP logging. It is recommended that the HTTP namespace is directed to another file as turning this on becomes very busy given the long poll behaviour.
WS Stats
The WS MBeans expose
- WS upgrade count
- Failed WS upgrade count
- Inbound protocol timings A histogram showing the timings each the WS inbound frame until its processing completion (again in 10ms segments)
- outbound processing timings A histogram showing the timings of each outbound set of data and its encoding into a WS frame (in 10ms segments)
EngineIO Stats
The EngineIO stats are differentiated again by HTTP and WS processing.
The core proxy handler enables the maxDriftTime to be set/cleared.
The HTTP MBean exports
- Duplicate pings (if the client receives a ping before it has processed its own)
- Count of received Pings
- Count of sent Pongs
- Ping timings A histogram of the amount of time between the Ping request -> Pong response written to the outbound buffer.
- Protocol Timings A histogram showing the time it takes to process each EngineIO packet process from the receipt of the request to the completion of when the messages are handed off to the client. This is in segments of 2ms.
- LogHeartbeats This can be used to turn on or off the logging of the EIO heartbeat.
The WS MBean is a duplicate of the HTTP details but for data that passes along the WS pathway rather than the HTTP path.
Socket Acceptor
The acceptor MBean exports a histogram in 1ms segments detailing the time it takes to accept the TCP socket connections. This time is for a batch of socket which may be 1 or more.
Client data
The Client namespace MBeans provide 2 functions:
- The ClientManager
This shows the number of connected clients (defined as unique EngineIO client instances).
The Client MBean also exposes operations to
- Destroy a client instance (which closes the client on the server and will result in an error on the client)
- Retrieve the set of ClientIds
- For any ClientID retrieve the client info. This shows the state of the client, its last ping time, the current DirectQueue Depth for the client, the set of Conversations and Subscriptions.
- Wildcard details for the Client The wildcard MBean shows the channels that wildcards are registered on. The MBean also enables the querying of each Channel to return the patterns that are registered on the channel and which current topics currently match the pattern.
Server
The server MBean enables the viewing of the Config that the server was initialised with.
Module
The module namespace MBeans detail information regarding the internals of the server’s operation. As described in the config docs <../configuration/index.html#module> each module has its own threads that deal with processing incoming sockets, notifying and processing outbound events etc. the general behaviour of each one of these loops is in essence similar to a game loop where on each pass it processes all the pending channels, or incoming reads that have notified to have something to do.
The timings in the MBean are the beginning to end of that loop. So for example the GenericNotifier MBean (which is responsible for all the outbound writes) will show something like:
0-1: 3094
1-2:136
2-3:1
...
the above histogram shows us that the vast majority of these cycles took 1ms. The timings will vary according to how much work is involved in each loop. so processing 1000 sockets will show significantly longer times as the time is for each poll cycle for all the sockets combined. In saying that timings should be generally low and above 1 second is an indication that something is amiss.
Similarly, the reader MBean shows the time from the first socket to be read, the inbound path processing of the sockets and ends after the final socket read in that notification set has completed and the data processed. Again this makes the timing dependent upon the numbers of events.
These numbers are generally useful to identify issues in a coarse way, e.g when the calling read thread is being blocked or is is performing work directly in the application’s code when instead the inbound messages should be handed off immediately for asynchronous processing.
Also shown in these MBeans are:
- Module MBean
- The connection count (number of sockets currently connected)
- Rejected socket count
- Reader MBean
- max configured channels
- current sockets registered with the internal epoll
- read loop timings
- Writer MBean
- the number of blocked sends (when the outbound write has overrun the OS TCP buffer and is temporarily blocked)
- The limited count - the number of times a socket has been rate limited
- reactivated socket count - number of times a socket has been rescheduled following a blocked write
The blocked write numbers should normally be 0 or low. A higher number indicates issues such as oversized outbound buffers (compared to the OS TCP write buffer), slow clients or large messages (e.g you will get a number of blocked writes when trying to push a 1Mb message into a 256k buffer)
Channel Details
The remaining MBeans cover the individual channels. 1 for each RPC channel and 1 for each subscription Channel.
The RPC MBeans show: * A histogram of the RPC timings (the amount of time for message handoff form the initial read) * inbound and outbound byte count
The Subscription MBean varies slightly on whether it is private or shared
- Private Channels
- batch size for the channel
- A histogram of message timings ()
- the queue size for each private topic
- Shared Channels
- The number of topics on the channel
- the configured expected clients per subscription
- if the channel is grouped or not
- if requires snapshot is enabled
- a histogram showing the timings for each subscribe message (this can be 1 or more topics)
- If the topic supports wildcards
- the number of wildcards registered
- the wildcard char
- Additionally the MBean also has operations that
- Retrieves the Clients by TopicId
- Retrieve the set of TopicIds