Ashwin Sreekumar
Ashwin Sreekumar

Reputation: 151

Hibernate 2nd level Caching using redis for multiple containers

I have configured 2nd level cache for my spring-boot application using redisson-hibernate-53. Here is the redisson.yml file for that,

singleServerConfig:
  address: "redis://127.0.0.1:6379"

It seems to be working and required keys are being generated. I have a couple of doubts about scaling:

  1. If we deploy the application in multiple containers keeping the same redis db server config for each of them, will it work as expected or can there be issues ? I found stackoverflow question related to this but could not find any answers. Also could not find anything in the docs.
  2. If it works for multiple containers, what will be the performance impact ? Is it recommended to move to clustered redis config ?

Upvotes: 1

Views: 1545

Answers (1)

Ashwin Sreekumar
Ashwin Sreekumar

Reputation: 151

I got a chance to try the scenario. This is how I tested,

  • Deployed the application on 2 different ports in my local computer.
  • Checked for the keys generated and their last used OBJECT IDLETIME key and analysed the idletime after hitting from both the instances.

I found that the keys used by both the instances are the same and idle time is reset for the key by both the instances. So, I think it works fine when a single redis instance is shared across multiple instances.

About the performance impact, I guess the common disadvantages of single server instead of clustered servers apply (like performance and availability)

Upvotes: 1

Related Questions