Using Cassandra Metrics for monitoring

34 views
Skip to first unread message

Vishal Sharma

unread,
Mar 29, 2018, 6:58:15 AM3/29/18
to DataStax C++ Driver for Apache Cassandra User Mailing List
I have been using Cassandra and its C++ driver to write APIs to insert and fetch data for some time now. However now that I've created my cluster, I want to develop monitoring tools for my cluster.

I want to build an application(preferably in C++ as I've never programmed in Java till now) which will store Cluster management specific attributes like memory utilization of each node in the cluster, latency of each operation, space occupied by each table on each node etc. I read about 'Metrics in Cassandra(https://cassandra.apache.org/doc/latest/operating/metrics.html) but I don't know how exactly to use them in building my application as I've not worked on Java before(excuse me for that!).

Can such application be built using C++?

If it's very complicated in C++, then, how can you please illustrate how to collect these Metrics in Java? As per the link above, the metrics can be collected via JMX.
I've come across possibly another way of collecting these metrics in Java in this link(https://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metrics.html). This one uses the datastax's java driver. Is there a difference in these 2 methods or are they the same? Also is it not recommended to collect metrics via JMX because there's a warning in (metrics.dropwizard.io/3.1.0/manual/core) suggesting to not try to gather metrics from production environment as JMX’s RPC API is fragile! Please help!

Michael Fero

unread,
Mar 29, 2018, 2:07:35 PM3/29/18
to DataStax C++ Driver for Apache Cassandra User Mailing List
Hello Vishal,

> Can such application be built using C++?

Accessing JMX is only available within the JVM via local or remote calls. These mbeans (or properties) can be exposed using Jolokia and then intercepted via HTTP inside your C++ application.

> If it's very complicated in C++, then, how can you please illustrate how to collect these Metrics in Java? As per the link above, the metrics can be collected via JMX.

Here is an article from Oracle that can get you started with collecting JMX metrics using Java; http://www.oracle.com/technetwork/articles/javase/jmx-138825.html.

> I've come across possibly another way of collecting these metrics in Java in this link(https://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Metrics.html). This one uses the datastax's java driver. Is there a difference in these 2 methods or are they the same?

The metrics in the DataStax Java driver are pertinent to the drivers performance; these same performance metrics are available when using the DataStax C/C++ driver https://docs.datastax.com/en/developer/cpp-driver/latest/topics/metrics/.

> Also is it not recommended to collect metrics via JMX because there's a warning in (metrics.dropwizard.io/3.1.0/manual/core) suggesting to not try to gather metrics from production environment as JMX’s RPC API is fragile! Please help!

I would not agree that the JMX's RPC API is fragile; however it may be true that frequent calls to a production server could impact performance of your node (and cluster). This is something that you will need to determine in your own environment.

~Fero
Reply all
Reply to author
Forward
0 new messages