Several Java-Based projects like Solr provide two ways of getting metrics:
- Reading JMX mbeans via Jolokia AND
- 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.