title: What is more performant - reading JMX by Jolokia or getting metrics by REST apis
body: <p>Several Java-Based projects like Solr provide two ways of getting metrics:</p>
  
  <ol>
  <li>Reading JMX mbeans via Jolokia AND</li>
  <li>Reading metrics via <a href="https://cwiki.apache.org/confluence/display/solr/MBean+Request+Handler" rel="nofollow noreferrer">metrics REST apis</a></li>
  </ol>
  
  <p>Theoretically, what would be more performant?<br>
  (Assume a single node cluster for now).</p>
  
  <p>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.</p>
  
  <pre><code>Server ---&gt; JMX ---&gt; Jolokia ---&gt; REST api of Jolokia
  Server ---&gt; REST api of Server itself
  </code></pre>
  
  <p>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.</p>
  
  <p>We want to choose between one of these methods to query the metrics every minute from all Solr nodes and push to grafana.</p>
  
  <p>Some recommendation on this would be great.</p>