Redis Client Metrics in Java
Redis Metrics
Redis is an open-source, in-memory data structure store commonly used to build NoSQL databases, caches, and message brokers. As with any other complex IT system, organizations that use Redis should carefully monitor their Redis deployment to ensure they continue to enjoy high performance.
Just a few useful Redis metrics are:
-
Uptime: Many use cases for Redis require extremely high availability, which makes monitoring Redis uptime a crucial statistic.
-
Memory usage: Because Redis stores data in memory, the amount of memory consumed by Redis is a valuable metric to assess performance.
-
Latency: Latency (the speed at which Redis responds to user requests) varies based on the size and complexity of the request, as well as the current load on the server.
Redis Java Metrics With Redisson
Although Redis is a widely used technology, it comes with a few caveats: for example, it’s not automatically compatible with programming languages like Java right out of the box. Instead, Java developers who want to use Redis can use a third-party Redis Java framework such as Redisson.
Redisson is a Redis Java client that implements many of the familiar Java data structures, services, and constructs, making it easy for Java programmers to begin using Redis. The Redisson PRO version provides integrations with the most popular monitoring software.
With Redisson PRO, Java developers can integrate their Redis deployment with 20 different monitoring tools, tracking the most important metrics for their business objectives. The Redis monitoring software compatible with Redisson PRO includes AppOptics, Graphite, Dynatrace, Atlas, Kairos, Amazon CloudWatch, NewRelic, Prometheus, and others.
Below is a series of code samples demonstrating how to use Redisson PRO to set up Redis monitoring with JMX, Prometheus, Dynatrace, and Influx:
Config config = ... // Redisson PRO config object
// JMX
JmxMeterRegistryProvider provider = new JmxMeterRegistryProvider();
provider.setDomain("appStats");
config.setMeterRegistryProvider(provider);
// Prometheus
PrometheusMeterRegistry registry = ...
config.setMeterRegistryProvider(new MeterRegistryWrapper(registry));
// Dynatrace
DynatraceMeterRegistryProvider p = new DynatraceMeterRegistryProvider();
p.setApiToken("Hg3M0iadsQC2Pcjk6QIW0g");
p.setUri("https://qtd9012301.live.dynatrace.com/");
p.setDeviceId("myHost");
config.setMeterRegistryProvider(p);
// Influx
InfluxMeterRegistryProvider provider = new InfluxMeterRegistryProvider();
provider.setUri("http://localhost:8086/");
provider.setDb("myinfluxdb");
provider.setUserName("admin");
provider.setPassword("admin");
config.setMeterRegistryProvider(provider);
Redisson PRO allows users to monitor a wide variety of metrics. For example, they can keep track of metrics per Redis node such as:
-
The number of bytes sent to and received from Redis.
-
The number of free, busy, and reconnected connections.
-
The number of executed, failed, and successful operations.
-
The number of active publish/subscribe connections.
Users can also monitor Redis metrics per map cache. For example, for each Redisson RMapCache object, the following metrics are available in Redisson PRO:
-
The total number of cache hits (i.e., the number of get requests for data contained in the cache).
-
The total number of cache misses (i.e., the number of get requests for data not contained in the cache).
-
The total number of put and remove operations.
The above just scratches the surface of the available Redis client metrics when using Redisson PRO. For the complete listing of Redis client metrics, check out the Redisson PRO documentation.
Similar articles
- Redis Client Tracing in Java
- Redis Java client for Azure Cache
- Redis Java client for AWS ElastiCache
- Redis Java client for Aiven Redis service
- Redis Java client with code example
- Redis Java client for AWS Redis Global Datastore
- Redis Java Client for Google Cloud Memorystore for Redis High Availability
- Redis Java client for Google Cloud Memorystore for Redis
- Redis Java Client for Amazon MemoryDB
- Redis Notifications in Java