14. Integration with frameworks - ALANSUDA/redisson GitHub Wiki
Redisson provides Redis based Spring Cache implementation made according to Spring Cache specification. Each Cache instance has two important parameters: ttl
and maxIdleTime
and stores data infinitely if they are not defined or equal to 0
.
Config example:
@Configuration
@ComponentScan
@EnableCaching
public static class Application {
@Bean(destroyMethod="shutdown")
RedissonClient redisson() throws IOException {
Config config = new Config();
config.useClusterServers()
.addNodeAddress("redis://127.0.0.1:7004", "redis://127.0.0.1:7001");
return Redisson.create(config);
}
@Bean
CacheManager cacheManager(RedissonClient redissonClient) {
Map<String, CacheConfig> config = new HashMap<String, CacheConfig>();
// create "testMap" cache with ttl = 24 minutes and maxIdleTime = 12 minutes
config.put("testMap", new CacheConfig(24*60*1000, 12*60*1000));
return new RedissonSpringCacheManager(redissonClient, config);
}
}
Cache configuration can be read from YAML configuration files:
@Configuration
@ComponentScan
@EnableCaching
public static class Application {
@Bean(destroyMethod="shutdown")
RedissonClient redisson(@Value("classpath:/redisson.yaml") Resource configFile) throws IOException {
Config config = Config.fromYAML(configFile.getInputStream());
return Redisson.create(config);
}
@Bean
CacheManager cacheManager(RedissonClient redissonClient) throws IOException {
return new RedissonSpringCacheManager(redissonClient, "classpath:/cache-config.yaml");
}
}
Redisson provides various Spring Cache managers with two important features:
local cache - so called near cache
is used to speed up read operations and avoid network roundtrips. It caches Spring Cache entries on Redisson side and executes read operations up to 45x faster in comparison with common implementation. Local cache instances with the same name connected to single pub/sub channel used for messaging between them, in particular to send entity update or entity invalidate event.
data partitioning - allows to scale available memory, write operations and entry eviction process for individual Spring Cache instance in Redis cluster.
Below is the list of all available managers with local cache and/or data partitioning support:
Class name | Local cache | Data partitioning |
Ultra-fast read/write |
---|---|---|---|
RedissonSpringCacheManager |
❌ | ❌ | ❌ |
RedissonSpringCacheManager available only in Redisson PRO edition |
❌ | ❌ | ✔️ |
RedissonSpringLocalCachedCacheManager available only in Redisson PRO edition |
✔️ | ❌ | ✔️ |
RedissonClusteredSpringCacheManager available only in Redisson PRO edition |
❌ | ✔️ | ✔️ |
RedissonClusteredSpringLocalCachedCacheManager available only in Redisson PRO edition |
✔️ | ✔️ | ✔️ |
Follow options object should be supplied during org.redisson.spring.cache.RedissonSpringLocalCachedCacheManager
or org.redisson.spring.cache.RedissonClusteredSpringLocalCachedCacheManager
initialization:
LocalCachedMapOptions options = LocalCachedMapOptions.defaults()
// Defines whether to store a cache miss into the local cache.
// Default value is false.
.storeCacheMiss(false);
// Defines store mode of cache data.
// Follow options are available:
// LOCALCACHE - store data in local cache only.
// LOCALCACHE_REDIS - store data in both Redis and local cache.
.storeMode(StoreMode.LOCALCACHE_REDIS)
// Defines Cache provider used as local cache store.
// Follow options are available:
// REDISSON - uses Redisson own implementation
// CAFFEINE - uses Caffeine implementation
.cacheProvider(CacheProvider.REDISSON)
// Defines local cache eviction policy.
// Follow options are available:
// LFU - Counts how often an item was requested. Those that are used least often are discarded first.
// LRU - Discards the least recently used items first
// SOFT - Uses weak references, entries are removed by GC
// WEAK - Uses soft references, entries are removed by GC
// NONE - No eviction
.evictionPolicy(EvictionPolicy.NONE)
// If cache size is 0 then local cache is unbounded.
.cacheSize(1000)
// Used to load missed updates during any connection failures to Redis.
// Since, local cache updates can't be get in absence of connection to Redis.
// Follow reconnection strategies are available:
// CLEAR - Clear local cache if map instance has been disconnected for a while.
// LOAD - Store invalidated entry hash in invalidation log for 10 minutes
// Cache keys for stored invalidated entry hashes will be removed
// if LocalCachedMap instance has been disconnected less than 10 minutes
// or whole cache will be cleaned otherwise.
// NONE - Default. No reconnection handling
.reconnectionStrategy(ReconnectionStrategy.NONE)
// Used to synchronize local cache changes.
// Follow sync strategies are available:
// INVALIDATE - Default. Invalidate cache entry across all LocalCachedMap instances on map entry change
// UPDATE - Insert/update cache entry across all LocalCachedMap instances on map entry change
// NONE - No synchronizations on map changes
.syncStrategy(SyncStrategy.INVALIDATE)
// time to live for each map entry in local cache
.timeToLive(10000)
// or
.timeToLive(10, TimeUnit.SECONDS)
// max idle time for each map entry in local cache
.maxIdle(10000)
// or
.maxIdle(10, TimeUnit.SECONDS);
Each Spring Cache instance has two important parameters: ttl
and maxIdleTime
and stores data infinitely if they are not defined or equal to 0
.
Complete config example:
@Configuration
@ComponentScan
@EnableCaching
public static class Application {
@Bean(destroyMethod="shutdown")
RedissonClient redisson() throws IOException {
Config config = new Config();
config.useClusterServers()
.addNodeAddress("redis://127.0.0.1:7004", "redis://127.0.0.1:7001");
return Redisson.create(config);
}
@Bean
CacheManager cacheManager(RedissonClient redissonClient) {
Map<String, CacheConfig> config = new HashMap<String, CacheConfig>();
// define local cache settings for "testMap" cache.
// ttl = 48 minutes and maxIdleTime = 24 minutes for local cache entries
LocalCachedMapOptions options = LocalCachedMapOptions.defaults()
.evictionPolicy(EvictionPolicy.LFU)
.timeToLive(48, TimeUnit.MINUTES)
.maxIdle(24, TimeUnit.MINUTES);
.cacheSize(1000);
// create "testMap" Redis cache with ttl = 24 minutes and maxIdleTime = 12 minutes
LocalCachedCacheConfig cfg = new LocalCachedCacheConfig(24*60*1000, 12*60*1000, options);
// Max size of map stored in Redis
cfg.setMaxSize(2000);
config.put("testMap", cfg);
return new RedissonSpringLocalCachedCacheManager(redissonClient, config);
}
}
Cache configuration could be read from YAML configuration files:
@Configuration
@ComponentScan
@EnableCaching
public static class Application {
@Bean(destroyMethod="shutdown")
RedissonClient redisson(@Value("classpath:/redisson.yaml") Resource configFile) throws IOException {
Config config = Config.fromYAML(configFile.getInputStream());
return Redisson.create(config);
}
@Bean
CacheManager cacheManager(RedissonClient redissonClient) throws IOException {
return new RedissonSpringLocalCachedCacheManager(redissonClient, "classpath:/cache-config.yaml");
}
}
Below is the configuration of Spring Cache with name testMap
in YAML format:
---
testMap:
ttl: 1440000
maxIdleTime: 720000
localCacheOptions:
invalidationPolicy: "ON_CHANGE"
evictionPolicy: "NONE"
cacheSize: 0
timeToLiveInMillis: 0
maxIdleInMillis: 0
Please note: localCacheOptions
settings are available for org.redisson.spring.cache.RedissonSpringLocalCachedCacheManager
and org.redisson.spring.cache.RedissonSpringClusteredLocalCachedCacheManager
classes only.
Please find more information regarding this chapter here.
Please find more information regarding this chapter here.
Redisson provides an implementation of JCache API (JSR-107) for Redis.
Below are examples of JCache API usage.
1. Using default config located at /redisson-jcache.yaml
:
MutableConfiguration<String, String> config = new MutableConfiguration<>();
CacheManager manager = Caching.getCachingProvider().getCacheManager();
Cache<String, String> cache = manager.createCache("namedCache", config);
2. Using config file with custom location:
MutableConfiguration<String, String> config = new MutableConfiguration<>();
// yaml config
URI redissonConfigUri = getClass().getResource("redisson-jcache.yaml").toURI();
CacheManager manager = Caching.getCachingProvider().getCacheManager(redissonConfigUri, null);
Cache<String, String> cache = manager.createCache("namedCache", config);
3. Using Redisson's config object:
MutableConfiguration<String, String> jcacheConfig = new MutableConfiguration<>();
Config redissonCfg = ...
Configuration<String, String> config = RedissonConfiguration.fromConfig(redissonCfg, jcacheConfig);
CacheManager manager = Caching.getCachingProvider().getCacheManager();
Cache<String, String> cache = manager.createCache("namedCache", config);
4. Using Redisson instance object:
MutableConfiguration<String, String> jcacheConfig = new MutableConfiguration<>();
RedissonClient redisson = ...
Configuration<String, String> config = RedissonConfiguration.fromInstance(redisson, jcacheConfig);
CacheManager manager = Caching.getCachingProvider().getCacheManager();
Cache<String, String> cache = manager.createCache("namedCache", config);
Read more here about Redisson configuration.
Provided implementation fully passes TCK tests. Here is the test module.
Along with usual JCache API, Redisson provides Asynchronous, Reactive and RxJava3 API.
Asynchronous interface. Each method returns org.redisson.api.RFuture
object.
Example:
MutableConfiguration<String, String> config = new MutableConfiguration<>();
CacheManager manager = Caching.getCachingProvider().getCacheManager();
Cache<String, String> cache = manager.createCache("myCache", config);
CacheAsync<String, String> asyncCache = cache.unwrap(CacheAsync.class);
RFuture<Void> putFuture = asyncCache.putAsync("1", "2");
RFuture<String> getFuture = asyncCache.getAsync("1");
Reactive interface. Each method returns reactor.core.publisher.Mono
object.
Example:
MutableConfiguration<String, String> config = new MutableConfiguration<>();
CacheManager manager = Caching.getCachingProvider().getCacheManager();
Cache<String, String> cache = manager.createCache("myCache", config);
CacheReactive<String, String> reactiveCache = cache.unwrap(CacheReactive.class);
Mono<Void> putFuture = reactiveCache.put("1", "2");
Mono<String> getFuture = reactiveCache.get("1");
RxJava3 interface. Each method returns one of the following object: io.reactivex.Completable
, io.reactivex.Single
, io.reactivex.Maybe
.
Example:
MutableConfiguration<String, String> config = new MutableConfiguration<>();
CacheManager manager = Caching.getCachingProvider().getCacheManager();
Cache<String, String> cache = manager.createCache("myCache", config);
CacheRx<String, String> rxCache = cache.unwrap(CacheRx.class);
Completable putFuture = rxCache.put("1", "2");
Maybe<String> getFuture = rxCache.get("1");
This feature is available only in Redisson PRO edition.
local cache - so called near cache
is used to speed up read operations and avoid network roundtrips. It caches JCache entries on Redisson side and executes read operations up to 45x faster in comparison with common implementation. Local cache instances with the same name connected to single pub/sub channel used for messaging between them, in particular to send entity update or entity invalidate event.
To use local cache org.redisson.jcache.configuration.LocalCacheConfiguration
options object should be supplied during JCache instance initialization:
LocalCacheConfiguration<String, String> configuration = new LocalCacheConfiguration<>()
// Defines whether to store a cache miss into the local cache.
// Default value is false.
.storeCacheMiss(false);
// Defines store mode of cache data.
// Follow options are available:
// LOCALCACHE - store data in local cache only and use Redis only for data update/invalidation.
// LOCALCACHE_REDIS - store data in both Redis and local cache.
.storeMode(StoreMode.LOCALCACHE_REDIS)
// Defines Cache provider used as local cache store.
// Follow options are available:
// REDISSON - uses Redisson own implementation
// CAFFEINE - uses Caffeine implementation
.cacheProvider(CacheProvider.REDISSON)
// Defines local cache eviction policy.
// Follow options are available:
// LFU - Counts how often an item was requested. Those that are used least often are discarded first.
// LRU - Discards the least recently used items first
// SOFT - Uses weak references, entries are removed by GC
// WEAK - Uses soft references, entries are removed by GC
// NONE - No eviction
.evictionPolicy(EvictionPolicy.NONE)
// If cache size is 0 then local cache is unbounded.
.cacheSize(1000)
// Used to load missed updates during any connection failures to Redis.
// Since, local cache updates can't be get in absence of connection to Redis.
// Follow reconnection strategies are available:
// CLEAR - Clear local cache if map instance has been disconnected for a while.
// LOAD - Store invalidated entry hash in invalidation log for 10 minutes
// Cache keys for stored invalidated entry hashes will be removed
// if LocalCachedMap instance has been disconnected less than 10 minutes
// or whole cache will be cleaned otherwise.
// NONE - Default. No reconnection handling
.reconnectionStrategy(ReconnectionStrategy.NONE)
// Used to synchronize local cache changes.
// Follow sync strategies are available:
// INVALIDATE - Default. Invalidate cache entry across all LocalCachedMap instances on map entry change
// UPDATE - Insert/update cache entry across all LocalCachedMap instances on map entry change
// NONE - No synchronizations on map changes
.syncStrategy(SyncStrategy.INVALIDATE)
// time to live for each map entry in local cache
.timeToLive(10000)
// or
.timeToLive(10, TimeUnit.SECONDS)
// max idle time for each map entry in local cache
.maxIdle(10000)
// or
.maxIdle(10, TimeUnit.SECONDS);
Usage examples:
LocalCacheConfiguration<String, String> config = new LocalCacheConfiguration<>();
.setEvictionPolicy(EvictionPolicy.LFU)
.setTimeToLive(48, TimeUnit.MINUTES)
.setMaxIdle(24, TimeUnit.MINUTES);
.setCacheSize(1000);
CacheManager manager = Caching.getCachingProvider().getCacheManager();
Cache<String, String> cache = manager.createCache("myCache", config);
// or
URI redissonConfigUri = getClass().getResource("redisson-jcache.yaml").toURI();
CacheManager manager = Caching.getCachingProvider().getCacheManager(redissonConfigUri, null);
Cache<String, String> cache = manager.createCache("myCache", config);
// or
Config redissonCfg = ...
Configuration<String, String> rConfig = RedissonConfiguration.fromConfig(redissonCfg, config);
CacheManager manager = Caching.getCachingProvider().getCacheManager();
Cache<String, String> cache = manager.createCache("namedCache", rConfig);
Please find more information regarding this chapter here.
Please find more information regarding this chapter here.
Please find more information regarding this chapter here.
Please note that Redis notify-keyspace-events
setting should contain Exg
letters to make Spring Session integration work.
Ensure you have Spring Session library in your classpath, add it if necessary:
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-core</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-data-24</artifactId>
<version>3.15.3</version>
</dependency>
compile 'org.springframework.session:spring-session-core:2.4.2'
compile 'org.redisson:redisson-spring-data-24:3.15.3'
Add configuration class which extends AbstractHttpSessionApplicationInitializer
class:
@Configuration
@EnableRedisHttpSession
public class SessionConfig extends AbstractHttpSessionApplicationInitializer {
@Bean
public RedissonConnectionFactory redissonConnectionFactory(RedissonClient redisson) {
return new RedissonConnectionFactory(redisson);
}
@Bean(destroyMethod = "shutdown")
public RedissonClient redisson(@Value("classpath:/redisson.yaml") Resource configFile) throws IOException {
Config config = Config.fromYAML(configFile.getInputStream());
return Redisson.create(config);
}
}
Add configuration class which extends AbstractReactiveWebInitializer
class:
@Configuration
@EnableRedisWebSession
public class SessionConfig extends AbstractReactiveWebInitializer {
@Bean
public RedissonConnectionFactory redissonConnectionFactory(RedissonClient redisson) {
return new RedissonConnectionFactory(redisson);
}
@Bean(destroyMethod = "shutdown")
public RedissonClient redisson(@Value("classpath:/redisson.yaml") Resource configFile) throws IOException {
Config config = Config.fromYAML(configFile.getInputStream());
return Redisson.create(config);
}
}
-
Add Spring Session Data Redis library in classpath:
<dependency> <groupId>org.springframework.session</groupId> <artifactId>spring-session-data-redis</artifactId> <version>2.4.2</version> </dependency>
compile 'org.springframework.session:spring-session-data-redis:2.4.2'
-
Add Redisson Spring Data Redis library in classpath:
<dependency> <groupId>org.redisson</groupId> <artifactId>redisson-spring-data-24</artifactId> <version>3.15.3</version> </dependency>
compile 'org.redisson:redisson-spring-data-24:3.15.3'
-
Define follow properties in spring-boot settings
spring.session.store-type=redis
spring.redis.redisson.file=classpath:redisson.yaml
spring.session.timeout.seconds=900
Redisson provides implementation of both org.springframework.transaction.PlatformTransactionManager
and org.springframework.transaction.ReactiveTransactionManager
interfaces to participant in Spring transactions. See also Transactions section.
@Configuration
@EnableTransactionManagement
public class RedissonTransactionContextConfig {
@Bean
public TransactionalBean transactionBean() {
return new TransactionalBean();
}
@Bean
public RedissonTransactionManager transactionManager(RedissonClient redisson) {
return new RedissonTransactionManager(redisson);
}
@Bean(destroyMethod="shutdown")
public RedissonClient redisson(@Value("classpath:/redisson.yaml") Resource configFile) throws IOException {
Config config = Config.fromYAML(configFile.getInputStream());
return Redisson.create(config);
}
}
public class TransactionalBean {
@Autowired
private RedissonTransactionManager transactionManager;
@Transactional
public void commitData() {
RTransaction transaction = transactionManager.getCurrentTransaction();
RMap<String, String> map = transaction.getMap("test1");
map.put("1", "2");
}
}
@Configuration
@EnableTransactionManagement
public class RedissonReactiveTransactionContextConfig {
@Bean
public TransactionalBean transactionBean() {
return new TransactionalBean();
}
@Bean
public ReactiveRedissonTransactionManager transactionManager(RedissonReactiveClient redisson) {
return new ReactiveRedissonTransactionManager(redisson);
}
@Bean(destroyMethod="shutdown")
public RedissonReactiveClient redisson(@Value("classpath:/redisson.yaml") Resource configFile) throws IOException {
Config config = Config.fromYAML(configFile.getInputStream());
return Redisson.createReactive(config);
}
}
public class TransactionalBean {
@Autowired
private ReactiveRedissonTransactionManager transactionManager;
@Transactional
public Mono<Void> commitData() {
Mono<RTransactionReactive> transaction = transactionManager.getCurrentTransaction();
return transaction.flatMap(t -> {
RMapReactive<String, String> map = t.getMap("test1");
return map.put("1", "2");
}).then();
}
}
Please find information regarding this chapter here.
Please find information regarding this chapter here.
This feature is available only in Redisson PRO edition.
Redisson provides integration with different monitoring systems:
Class | org.redisson.config.metrics.AppOpticsMeterRegistryProvider |
Params |
uri - AppOptics host urihostTag - tag mapped to hostapiToken - AppOptics api tokennumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-appoptics
|
Class | org.redisson.config.metrics.AtlasMeterRegistryProvider |
Params |
uri - Atlas host uriconfigUri - Atlas LWC endpoint uri to retrieve current subscriptionsevalUri - Atlas LWC endpoint uri to evaluate the data for a subscriptionnumThreads - number of threads used by scheduler (default is 4)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 10000) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-atlas
|
Class | org.redisson.config.metrics.AzureMonitorMeterRegistryProvider |
Params |
instrumentationKey - instrumentation keynumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-azure-monitor
|
Class | org.redisson.config.metrics.CloudWatchMeterRegistryProvider |
Params |
accessKey - AWS access keysecretKey - AWS secret access keynamespace - namespace valuenumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-cloudwatch
|
Class | org.redisson.config.metrics.DatadogMeterRegistryProvider |
Params |
uri - Datadog host urihostTag - tag mapped to hostapiKey - api keynumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-datadog
|
Class | org.redisson.config.metrics.DropwizardMeterRegistryProvider |
Params |
sharedRegistryName - name used to store instance in SharedMetricRegistries nameMapper - custom implementation of io.micrometer.core.instrument.util.HierarchicalNameMapper
|
Class | org.redisson.config.metrics.DynatraceMeterRegistryProvider |
Params |
uri - Dynatrace host uriapiToken - api tokendeviceId - device idnumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-dynatrace
|
Class | org.redisson.config.metrics.ElasticMeterRegistryProvider |
Params |
host - Elasticsearch host uriuserName - user namepassword - passwordnumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-elastic
|
Class | org.redisson.config.metrics.GangliaMeterRegistryProvider |
Params |
host - Ganglia host addressport - Ganglia portnumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-ganglia
|
Class | org.redisson.config.metrics.GraphiteMeterRegistryProvider |
Params |
host - Graphite host addressport - Graphite port |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-graphite
|
Class | org.redisson.config.metrics.HumioMeterRegistryProvider |
Params |
uri - Humio host urirepository - repository nameapiToken - api tokennumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-humio
|
Class | org.redisson.config.metrics.InfluxMeterRegistryProvider |
Params |
uri - Influx host uridb - db nameuserName - user namepassword - passwordnumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-influx
|
Class | org.redisson.config.metrics.JmxMeterRegistryProvider |
Params |
domain - domain namesharedRegistryName - name used to store instance in SharedMetricRegistries
|
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-jmx
|
Class | org.redisson.config.metrics.KairosMeterRegistryProvider |
Params |
uri - Kairos host uriuserName - user namepassword - passwordnumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-kairos
|
Class | org.redisson.config.metrics.NewRelicMeterRegistryProvider |
Params |
uri - NewRelic host uriapiKey - api keyaccountId - account idnumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-new-relic
|
Class | org.redisson.config.metrics.PrometheusMeterRegistryProvider |
Params |
registry - instance of PrometheusMeterRegistry object |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-prometheus
|
Class | org.redisson.config.metrics.SingnalFxMeterRegistryProvider |
Params |
apiHost - SingnalFx host uriaccessToken - access tokensource - application instance idnumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 10 secs)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-signalfx
|
Class | org.redisson.config.metrics.StackdriverMeterRegistryProvider |
Params |
projectId - project idnumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-stackdriver
|
Class | org.redisson.config.metrics.StatsdMeterRegistryProvider |
Params |
host - Statsd host addressport - Statsd portflavor - metrics format ETSY/DATADOG/TELEGRAF/SYSDIG |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-statsd
|
Class | org.redisson.config.metrics.WavefrontMeterRegistryProvider |
Params |
uri - Wavefront host urisource - application instance idapiToken - api tokennumThreads - number of threads used by scheduler (default is 2)step - update interval in ISO-8601 format (default is 1 min)batchSize - number of measurements sent per request (default is 500) |
Dependency | groupId: io.micrometer , artifactId: micrometer-registry-wavefront
|
Config config = ... // redisson config object
DropwizardMeterRegistryProvider provider = new DropwizardMeterRegistryProvider();
provider.setSharedRegistryName("mySharedRegistry");
config.setMeterRegistryProvider(provider);
YAML config is appended to Redisson config:
meterRegistryProvider: !<org.redisson.config.metrics.DropwizardMeterRegistryProvider>
sharedRegistryName: "mySharedRegistry"
The following metrics are available:
-
redisson.license.expiration-year
- A Gauge of the number of expiration year -
redisson.license.expiration-month
- A Gauge of the number of expiration month -
redisson.license.expiration-day
- A Gauge of the number of expiration day -
redisson.license.active-instances
- A Gauge of the number of active Redisson PRO clients -
redisson.executor-pool-size
- A Gauge of the number of executor threads pool size -
redisson.netty-pool-size
- A Gauge of the number of netty threads pool size
Base name: redisson.redis.<host>:<port>
-
status
- A Gauge of the string value [connected, disconnected] -
type
- A Gauge of the Redis node type [MASTER, SLAVE]
-
total-response-bytes
- A Meter of the total amount of bytes received from Redis -
response-bytes
- A Histogram of the number of bytes received from Redis -
total-request-bytes
- A Meter of the total amount of bytes sent to Redis -
request-bytes
- A Histogram of the number of bytes sent to Redis
-
connections.active
- A Counter of the number of busy connections -
connections.free
- A Counter of the number of free connections -
connections.max-pool-size
- A Counter of the number of maximum connection pool size -
connections.reconnected
- A Counter of the number of reconnected connections -
connections.total
- A Counter of the number of total connections in pool
-
operations.total
- A Meter of the number of total executed operations -
operations.total-failed
- A Meter of the number of total failed operations -
operations.total-successful
- A Meter of the number of total successful operations
-
publish-subscribe-connections.active
- A Counter of the number of active publish subscribe connections -
publish-subscribe-connections.free
- A Counter of the number of free publish subscribe connections -
publish-subscribe-connections.max-pool-size
- A Counter of the number of maximum publish subscribe connection pool size -
publish-subscribe-connections.total
- A Counter of the number of total publish subscribe connections in pool
Base name: redisson.remote-service.<name>
-
invocations.total
- A Meter of the number of total executed invocations -
invocations.total-failed
- A Meter of the number of total failed to execute invocations -
invocations.total-successful
- A Meter of the number of total successful to execute invocations
Base name: redisson.executor-service.<name>
-
tasks.submitted
- A Meter of the number of submitted tasks -
tasks.executed
- A Meter of the number of executed tasks
-
workers.active
- A Gauge of the number of busy task workers -
workers.free
- A Gauge of the number of free task workers -
workers.total
- A Gauge of the number of total task workers -
workers.tasks-executed.total
- A Meter of the number of total executed tasks by workers -
workers.tasks-executed.total-failed
- A Meter of the number of total failed to execute tasks by workers -
workers.tasks-executed.total-successful
- A Meter of the number of total successful to execute tasks by workers
Base name: redisson.map.<name>
-
hits
- A Meter of the number of get requests for data contained in cache -
misses
- A Meter of the number of get requests for data not contained in cache -
puts
- A Meter of the number of puts to the cache -
removals
- A Meter of the number of removals from the cache
Base name: redisson.map-cache.<name>
-
hits
- A Meter of the number of get requests for data contained in cache -
misses
- A Meter of the number of get requests for data not contained in cache -
puts
- A Meter of the number of puts to the cache -
removals
- A Meter of the number of removals from the cache
Base name: redisson.clustered-map-cache.<name>
-
hits
- A Meter of the number of get requests for data contained in cache -
misses
- A Meter of the number of get requests for data not contained in cache -
puts
- A Meter of the number of puts to the cache -
removals
- A Meter of the number of removals from the cache
Base name: redisson.local-cached-map.<name>
-
hits
- A Meter of the number of get requests for data contained in cache -
misses
- A Meter of the number of get requests for data not contained in cache -
puts
- A Meter of the number of puts to the cache -
removals
- A Meter of the number of removals from the cache
-
local-cache.hits
- A Meter of the number of get requests for data contained in local cache -
local-cache.misses
- A Meter of the number of get requests for data contained in local cache -
local-cache.evictions
- A Meter of the number of evictions for data contained in local cache -
local-cache.size
- A Gauge of the number of local cache size
Base name: redisson.clustered-local-cached-map.<name>
-
hits
- A Meter of the number of get requests for data contained in cache -
misses
- A Meter of the number of get requests for data not contained in cache -
puts
- A Meter of the number of puts to the cache -
removals
- A Meter of the number of removals from the cache
-
local-cache.hits
- A Meter of the number of get requests for data contained in local cache -
local-cache.misses
- A Meter of the number of get requests for data contained in local cache -
local-cache.evictions
- A Meter of the number of evictions for data contained in local cache -
local-cache.size
- A Gauge of the number of local cache size
Base name: redisson.local-cached-map-cache.<name>
-
hits
- A Meter of the number of get requests for data contained in cache -
misses
- A Meter of the number of get requests for data not contained in cache -
puts
- A Meter of the number of puts to the cache -
removals
- A Meter of the number of removals from the cache
-
local-cache.hits
- A Meter of the number of get requests for data contained in local cache -
local-cache.misses
- A Meter of the number of get requests for data contained in local cache -
local-cache.evictions
- A Meter of the number of evictions for data contained in local cache -
local-cache.size
- A Gauge of the number of local cache size
Base name: redisson.clustered-local-cached-map-cache.<name>
-
hits
- A Meter of the number of get requests for data contained in cache -
misses
- A Meter of the number of get requests for data not contained in cache -
puts
- A Meter of the number of puts to the cache -
removals
- A Meter of the number of removals from the cache
-
local-cache.hits
- A Meter of the number of get requests for data contained in local cache -
local-cache.misses
- A Meter of the number of get requests for data contained in local cache -
local-cache.evictions
- A Meter of the number of evictions for data contained in local cache -
local-cache.size
- A Gauge of the number of local cache size
Base name: redisson.topic.<name>
-
messages-sent
- A Meter of the number of messages sent for topic -
messages-received
- A Meter of the number of messages received for topic
Base name: redisson.bucket.<name>
-
gets
- A Meter of the number of get operations executed for bucket object -
sets
- A Meter of the number of set operations executed for bucket object