Search code examples
dockerspring-bootehcachemicroservicesstateless

Use ehcache for application deployed via docker against the stateless rule


I have an spring-boot application which I would like to deploy it into multiple docker instances and there is a load balance before the instances. However, the application uses ehcache to cache some data from a database. It makes the application stateful. So without session sticky, a same customer might hit different docker instances and see different results. My question is if I can't apply session sticky in load balance, what is the best practice to deploy an app with cache feature via docker style and still comply the rule of should-be-stateless?


Solution

  • I explain here in this devoxx video how clustered caching can help each of you docker instance share the same cache