Wednesday, September 07, 2011

Clustered Caching with Tangosol Coherence

 Below, in no particular order are a few items worth noting about Tangosol:
  • When installing Tangosol, make sure all the nodes are running the same version
  • Don’t use any classes in the packages – Coherence was build with its own development environment, compiler etc. contains these internal components.
  • BetFair a few years ago had 80 nodes running Tangosol Coherence. The largest installation today is around 1000 nodes.
  • Coherence uses TCMP (UDP based) protocol for data movement
  • From an installation perspective, 5 machines is probably the minimum requirement. Lots of RAM for each machine, installed across different racks to reduce the risk. The more machines the Coherence cluster contains, the lower the risk.
  • All machines in the cluster should be configured with identical config files, network settings, NIC’s (full/half duplex) etc.
  • Multi-cast disconnect issues can be as simple as a miss-configured router.
  • Production checklist
  • Near Topology (near-*)
  • During development set TTL=0 and changing the group address and port.
  • Client that come/go from the Coherence cluster should set local storage=false, while cluster servers should set local storage=true
  • NamedCache.putAll is far more efficient that put since it can reduce network hops.
  • Prior to cluster usage, run the multicast test for 24 hours.
  • Use Ethereal or similar to monitor the network to help identify unreliable sockets and NIC configuration issues.
  • Java serialization can be a performance bottleneck, consider using Coherence’s ExternalizableLite and its helper, ExternalizableHelper. Externalizable offers reduced GC and ~6x speed improvement.
  • High ticking volumns can cause problems for any application. In the case of Tangosol, and caching ticks, one possible solution is to queue the incoming ticks, and use a thread pool to insert the ticks into the cache.
Tangosol Coherence as its simplest:

import java.util.Date;

public class firstExample {
  public static void main(String[] args) throws IOException {
    try {
      Cluster cluster = CacheFactory.ensureCluster();
      NamedCache myCache = CacheFactory.getCache(“test”);
      Object existingVale = myCache.put(“message”, “someMesasge “ + new Date());

      System.out.println(“Existing Val :” + existingVale);

      Object val = myCache.get(“message”);
      System.out.println(“Val :” + val);
      System.out.println(“Press any key”);;
    }finally {

No comments: