[Solved] Problems in ehcache replication

Hello! Now I’m in troubles trying to run my application in a cluster environment using docker containers. I have a docker image with my application and a tomcat server. My application uses ehcache with “automatic” approach. Here is the ehcache.xml:

<?xml version="1.0" encoding="UTF-8"?>

xsi:noNamespaceSchemaLocation=“ehcache.xsd”>

...

I’m running the application in two different hosts machines, each one with the same version of docker (1.9.1, build a34a1d5). Below is the docker-compose.xml:

application:
ports:
- 8080:8080/tcp
- 40001:40001/tcp
- 4446:4446/tcp
environment:
DATABASE_NAME: app
DATABASE_HOST: 192.168.243.170
MEMORY_MIN: 1024m
MEMORY_MAX: 1024m
PERM_MIN: 256m
PERM_MAX: 256m
DEPLOYMENT_TYPE: cluster
DEPLOYMENT_ENABLE_SCHEDULED_TASKS: 'false’
tty: true
image: 192.168.243.171:5000/app-server
stdin_open: true

When I test the application everything seems to work fine except the cache… It doesn’t replicates among containers.

Any help will be appreciated. Thanks in advance,

I’ve extedend ehcache functionallity in order to find the others containers using rancher metadata.

Hello,
can you describe on how managed to solve this issue?
I am facing the same issue at the moment.

many thanks

Hello Ido!

As I’ve said in the previous post, I’ve extended ehcache functionallity in order to replicate the cache. By default, ehcache supports only two ways to replicate cache: manual (but if you want to scale up you have to turn down your services) and automatic (your network must support multicast). Both ways didn’t worked for me because I’m working with Rancher and It does not support multicast.

What I’ve done is:

  1. I’ve extended the class RMICacheManagerPeerProviderFactory and call a new way to replicate.
  2. I’ve extended the class RMICacheManagerPeerProvider and based on the automatic approach of ehcache, I built a new way to find the other peers (I used rancher metadata).
  3. Finally I modified the ecache file and replaced the call of RMICacheManagerPeerProviderFactory for the class of the point one.

I hope that this could help you, let me know if you need something else.

Good luck!

@juandavidgc
I am glad that you solved your problem by modifying the ehcache classes.

We are having similar issue and we are using docker swarm for our instances. I am not sure how would get other containers IP from swarm. If you could give any hints how to proceed that would be really helpful.

Thanks in advance

We are facing similar issue. Could please provide the details about the implementation of your custom replication.

Thanks

Hi, we are facing the same issue though in our side we are using manual discovery. When we tried it on our local instances ehcache works but when we applied it to docker, replication doesn’t happen. Anyone can point out what’s wrong to docker?

Note: All ports are open and allowed on the firewall

Thanks!