2 Replies Latest reply on Oct 19, 2006 6:40 AM by manik

    MySQL replication and JBoss Cache Pattern

    nicpottier


      I'm trying to build a highly available and scalable simple store using JBoss Cache backed by mySQL and I can't help but get the feeling that I'm reinventing a wheel that has no doubt been built before.

      My requirements are:
      * high availability - a single box dying will not cause loss of data (minutes of data loss is ok however)
      * ~linear scalability - speed of gets can scale linearly with the # of cache nodes
      * it's ok for puts to be bound by DB

      My current thinking is to use JBossCache in a 'buddy' mode, backed by 2+ MySql nodes replication to each other. The cache boxes would be dedicated for caching and accessed via a simple client API.

      The client would hash it's 'key' and connect to the same cache node when doing puts and gets on the same key. Writes would write through to the MySQL DB, which would then replicate to one or more others.

      In the event of a node going down (with it's MySQL DB) then the client would detect this (or a load balancer would) and new requests would go to another Node. In theory, one of the 'buddies' should have the data available for fast lookup, but worst case it could come from the replicated DB.

      Does this sound sane? How have others combined a replicated MySQL DB with JBoss Cache to atain these goals?

      -Nic