1

Several Java-Based projects like Solr provide two ways of getting metrics:

  1. Reading JMX mbeans via Jolokia AND
  2. Reading metrics via metrics REST apis

Theoretically, what would be more performant?
(Assume a single node cluster for now).

It appears that Jolokia based metrics might be more performant because Jolokia process would not go through the web-container of the Server like Jetty. Rather Jolokia would fetch the JMX metrics at a java-process-to-java-process level. REST API is surely easier to understand and parse. However it involves making a REST call that will pass through jetty, probably take up a thread for each request? etc. etc.

Server ---> JMX ---> Jolokia ---> REST api of Jolokia
Server ---> REST api of Server itself

Is Jolokia lighter-weight in this respect? Note that lighter-weight means effect on the server, not the overall latency. The metrics-fetch call should be as little taxing on the server as possible and overall latency of the metrics-fetch call is really not that important.

We want to choose between one of these methods to query the metrics every minute from all Solr nodes and push to grafana.

Some recommendation on this would be great.

user2250246
  • 3,807
  • 5
  • 43
  • 71

1 Answers1

1

There is no clear answer (and there haven't been any benchmarks yet). But as Jolokia can be considered as a REST like interface I don't expect any significant difference. In fact, ActiveMQ uses Jolokia as its metrics 'REST' interface.

The following cost factors need to be considered:

  • (Internal) Metrics query itself
  • Serialization to / from JSON / XML
  • Transport costs
  • HTTP handling overhead

Every metrics access has similar costs here. For exposing metrics, Jolokia also uses an HTTP server (either the JVM internal one or an external like Jetty) so there is no much difference.

The largest possible differences are possibly the serialisation costs (which carries a substantial portion of the load), so it depends on the JSON serialisation library used. Jolokia uses json-simple here, which is known to be quite speedy.

However, a very important aspect is which metrics should be queried. As each custom metrics API (like for Solr which you refer to) expose different kind of metrics in various formats, you need to adapt your monitoring solution to it. In contrast, as Jolokia exposes JMX which is a standard it is much more applicable in different contexts.

But at the end, only real benchmarks will give you the answer.

Roland Huß
  • 2,507
  • 15
  • 30
  • Thanks Roland. I updated my question a bit. We are more concerned on the server impact of fetching metrics by the 2 methods and want to choose the one which is least taxing on the server. – user2250246 Jun 27 '17 at 17:07