Ehcache Configuration

Ehcache configurations for session replication

The following sections give an overview of ready to use Ehcache configurations for session replication packaged in the 3DS Server distribution.

Without replication (default): ehcache-no-replication.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?xml version="1.0"?>
<ehcache updateCheck="false" monitoring="autodetect" dynamicConfig="false">
  <cache name="pResCardRangeData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <searchable>
      <searchAttribute name="startRange" expression="key.getStartRange()"/>
      <searchAttribute name="endRange" expression="key.getEndRange()"/>
      <searchAttribute name="directoryServerUrl" expression="value.getDirectoryServerUrl()"/>
    </searchable>
  </cache>
  <cache name="pResDsData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
  </cache>
  <cache name="threeDSMethodData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="60"
         timeToIdleSeconds="60"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
  </cache>
  <cache name="resultsData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="1800"
         timeToIdleSeconds="1800"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
  </cache>
</ehcache>

Replication through RMI

Asynchronous: ehcache-rmi-async.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?xml version="1.0"?>
 
<ehcache updateCheck="false" monitoring="autodetect" dynamicConfig="false">
 
  <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
                                   properties="peerDiscovery=automatic,
              multicastGroupAddress=239.195.255.255,
              multicastGroupPort=4446,
              timeToLive=32"/>
 
  <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>
 
  <cache name="pResCardRangeData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
    <searchable>
      <searchAttribute name="startRange" expression="key.getStartRange()"/>
      <searchAttribute name="endRange" expression="key.getEndRange()"/>
      <searchAttribute name="directoryServerUrl" expression="value.getDirectoryServerUrl()"/>
    </searchable>
  </cache>
  <cache name="pResDsData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="threeDSMethodData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="60"
         timeToIdleSeconds="60"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="resultsData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="1800"
         timeToIdleSeconds="1800"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
</ehcache>
Synchronous: ehcache-rmi-sync.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?xml version="1.0"?>
 
<ehcache updateCheck="false" monitoring="autodetect" dynamicConfig="false">
 
  <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
                                   properties="peerDiscovery=automatic,
                                               multicastGroupAddress=239.195.255.255,
                                               multicastGroupPort=4446,
                                               timeToLive=32"/>
 
  <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>
 
  <cache name="pResCardRangeData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <searchable>
      <searchAttribute name="startRange" expression="key.getStartRange()"/>
      <searchAttribute name="endRange" expression="key.getEndRange()"/>
      <searchAttribute name="directoryServerUrl" expression="value.getDirectoryServerUrl()"/>
    </searchable>
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                               properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
 
  <cache name="pResDsData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                               properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="threeDSMethodData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="60"
         timeToIdleSeconds="60"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
  <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                             properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
  <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
                               properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="resultsData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="1800"
         timeToIdleSeconds="1800"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                               properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
</ehcache>

For more information about RMI and Ehcache consult Ehcache RMI Replicated Caching page.

Replication through JGroups TCP

Asynchronous: ehcache-tcp-async.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?xml version="1.0" encoding="UTF-8"?>
<ehcache updateCheck="false" name="JGroupsCache">
 
  <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
                                   properties="connect=
                                               TCP(bind_port=7800;bind_addr=localhost):
                                               TCPPING(initial_hosts=localhost[7800],localhost[7801];port_range=1;timeout=3000;num_initial_members=3):
                                               VERIFY_SUSPECT(timeout=1500):
                                               STATS:
                                               pbcast.NAKACK(retransmit_timeout=3000;use_mcast_xmit=false):
                                               UNICAST:
                                               pbcast.GMS(join_timeout=5000;print_local_addr=true)"
                                   propertySeparator="::"/>
 
  <cache name="pResCardRangeData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
 
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
    <searchable>
      <searchAttribute name="startRange" expression="key.getStartRange()"/>
      <searchAttribute name="endRange" expression="key.getEndRange()"/>
      <searchAttribute name="directoryServerUrl" expression="value.getDirectoryServerUrl()"/>
    </searchable>
  </cache>
  <cache name="pResDsData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="threeDSMethodData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="60"
         timeToIdleSeconds="60"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
  <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                             properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
  <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                               properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="resultsData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="1800"
         timeToIdleSeconds="1800"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
</ehcache>
Synchronous: ehcache-tcp-sync.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?xml version="1.0" encoding="UTF-8"?>
<ehcache updateCheck="false" name="JGroupsCache">
 
  <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
                                   properties="connect=
                                               TCP(bind_port=7800;bind_addr=localhost):
                                               TCPPING(initial_hosts=localhost[7800],localhost[7801];port_range=1;timeout=3000;num_initial_members=3):
                                               VERIFY_SUSPECT(timeout=1500):
                                               STATS:
                                               pbcast.NAKACK(retransmit_timeout=3000;use_mcast_xmit=false):
                                               UNICAST:
                                               RSVP:
                                               pbcast.GMS(join_timeout=5000;print_local_addr=true)"
                                   propertySeparator="::"/>
 
  <cache name="pResCardRangeData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
 
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
    <searchable>
      <searchAttribute name="startRange" expression="key.getStartRange()"/>
      <searchAttribute name="endRange" expression="key.getEndRange()"/>
      <searchAttribute name="directoryServerUrl" expression="value.getDirectoryServerUrl()"/>
    </searchable>
  </cache>
 
  <cache name="pResDsData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="threeDSMethodData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="60"
         timeToIdleSeconds="60"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
  <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                             properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
  <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                               properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="resultsData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="1800"
         timeToIdleSeconds="1800"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
</ehcache>

Replication through JGroups UDP

Verify that IP Multicasting is enabled and nodes can find them self on designated addresses and ports.

NOTE: You need to set bind_addr property on the cacheManagerPeerProviderFactory if you want to bind to a specific network interface card (NIC). (check It doesn't work section for more details)

Asynchronous: ehcache-udp-async.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?xml version="1.0"?>
<ehcache updateCheck="false" monitoring="autodetect" dynamicConfig="false">
 
  <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
                                   properties="connect=
                                               UDP(mcast_addr=239.195.255.255;mcast_port=7600;ip_ttl=32;mcast_send_buf_size=150000;mcast_recv_buf_size=80000):
                                               PING(timeout=2000;num_initial_members=3):
                                               MERGE2(min_interval=5000;max_interval=10000):
                                               FD_SOCK:
                                               VERIFY_SUSPECT(timeout=1500):
                                               STATS:
                                               pbcast.NAKACK:
                                               UNICAST:
                                               pbcast.STABLE(desired_avg_gossip=20000):
                                               FRAG:
                                               pbcast.GMS(join_timeout=5000;print_local_addr=true)"
                                   propertySeparator="::"
  />
 
  <cache name="pResCardRangeData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
 
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
    <searchable>
      <searchAttribute name="startRange" expression="key.getStartRange()"/>
      <searchAttribute name="endRange" expression="key.getEndRange()"/>
      <searchAttribute name="directoryServerUrl" expression="value.getDirectoryServerUrl()"/>
    </searchable>
  </cache>
  <cache name="pResDsData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="threeDSMethodData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="60"
         timeToIdleSeconds="60"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
  <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                             properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
  <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                               properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="resultsData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="1800"
         timeToIdleSeconds="1800"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=true,
                                           asynchronousReplicationIntervalMillis=100,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
</ehcache>
Synchronous: ehcache-udp-sync.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?xml version="1.0"?>
 
<ehcache updateCheck="false" monitoring="autodetect" dynamicConfig="false">
 
  <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
                                   properties="connect=
                                               UDP(mcast_addr=239.195.255.255;mcast_port=7600;ip_ttl=32;mcast_send_buf_size=150000;mcast_recv_buf_size=80000):
                                               PING(timeout=2000;num_initial_members=3):
                                               MERGE2(min_interval=5000;max_interval=10000):
                                               FD_SOCK:
                                               VERIFY_SUSPECT(timeout=1500):
                                               STATS:
                                               pbcast.NAKACK:
                                               UNICAST:
                                               RSVP:
                                               pbcast.STABLE(desired_avg_gossip=20000):
                                               FRAG:
                                               pbcast.GMS(join_timeout=5000;print_local_addr=true)"
                                   propertySeparator="::"
  />
 
  <cache name="pResCardRangeData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
 
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
    <searchable>
      <searchAttribute name="startRange" expression="key.getStartRange()"/>
      <searchAttribute name="endRange" expression="key.getEndRange()"/>
      <searchAttribute name="directoryServerUrl" expression="value.getDirectoryServerUrl()"/>
    </searchable>
  </cache>
 
  <cache name="pResDsData"
         maxEntriesLocalHeap="0"
         eternal="true"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="threeDSMethodData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="60"
         timeToIdleSeconds="60"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
  <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                             properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
  <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                               properties="bootstrapAsynchronously=false"/>
  </cache>
  <cache name="resultsData"
         maxEntriesLocalHeap="0"
         timeToLiveSeconds="1800"
         timeToIdleSeconds="1800"
         memoryStoreEvictionPolicy="LRU"
         diskPersistent="false"
         overflowToDisk="false"
         maxElementsOnDisk="0"
         eternal="false">
    <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                               properties="replicateAsynchronously=false,
                                           replicatePuts=true,
                                           replicatePutsViaCopy=true,
                                           replicateUpdates=true,
                                           replicateUpdatesViaCopy=true,
                                           replicateRemovals=true"/>
    <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
                                 properties="bootstrapAsynchronously=false"/>
  </cache>
</ehcache>

Use an Ehcache configuration

The use of an Ehcache configuration for session replication can be configured via 3DS Server Configuration Properties:

ehcache.config-xml.resource-location=[configuration_to_be_used]

To use one of the packaged configurations (e.g. ehcache-rmi-sync.xml), set the property as follows:

ehcache.config-xml.resource-location=classpath:ehcache-rmi-sync.xml

To use a custom configuration (e.g. /etc/3dss/ehcache.xml), set the property as follows:

ehcache.config-xml.resource-location=file:/etc/3dss/ehcache.xml

If you don't specify a configuration for session replication, the configuration found under $THREEDS_CONFIG_HOME/ehcache.xml is used.

Considerations when choosing an Ehcache session replication strategy

When deciding which replication strategy to choose (RMI, JGroups TCP or JGroups UDP), consider the setup of your network infrastructure and the required features from the replication:

  • Synchronous vs. asynchronous replication
    • Synchronous means high data refresh with high I/O network traffic over the network.
    • Asynchronous means working with old data but you save the network traffic.
    • Session replication in 3DS Server happens when:
      • Preparation Response data is received from the Directory Server
      • 3DS Method Notification is received with information about 3DS Method Completion
    • Note that if using JGroups setup synchronous session replication for Ehcache, there is a limitation of not fully synchronizing the nodes before response is returned by 3DS Server.
      If immediate session synchronization between the nodes is a must, use of ehcache-rmi-sync.xml configuration is recommended.
  • TCP vs. UDP replication
    • TCP is fully reliable protocol, but has restriction that all the nodes in the cluster must be known and configured before starting the system.
    • On the other hand, UDP protocol offers flexibility to subscribe and unsubscribe nodes at the replication service at runtime. It is not reliable protocol but JGroups has internal mechanisms that fix this feature.
    • UDP uses multicasting, but Virtualization technologies like Xen and VMWare may be blocking multicast. Verify that IP Multicasting is enabled and nodes can find them self on designated addresses and ports. (check It doesn't work section for more details)
    • Use of IPv6 might be source of problems, if the nodes are not able to find each other, try specifying -Djava.net.preferIP4Stack=true property when starting the nodes.
      (check Problems with IPv6 for more details)