Spring boot app using hibernate and redis as cache.Problem is - redis have up-to 80K op/sec when app get 250 rps.here is spring configuration for redis (from https://redisson.org/glossary/spring-cache.html)
@Bean public CacheManager cacheManager(RedissonClient redissonClient) { return new RedissonSpringCacheManager(redissonClient) { @Override public Cache getCache(String cacheName) { Cache cache = super.getCache(cacheName); return new RedisCacheWrapper(cache); } @Override protected CacheConfig createDefaultConfig() { CacheConfig cacheConfig = new CacheConfig(ttl, maxIdleTime); cacheConfig.setMaxSize(maxSize); return cacheConfig; } }; }
hibernate just @Cache annotation on cache required entity
@Cache(region = HIBERNATE_MY_REGION, usage = CacheConcurrencyStrategy.READ_WRITE)public class MyEntity{...} and next libs<dependency><groupId>org.redisson</groupId><artifactId>redisson-hibernate-53</artifactId></dependency><dependency><groupId>org.redisson</groupId><artifactId>redisson</artifactId></dependency>
i checked app in local and opening some pages (no any hard work under the hood, just getting by id and external id) and there are profiling from redisinsignt
For now moved redis to cluster mode and up multiple slave redis modes to be able handle so many op/sec.