3 Replies Latest reply on Mar 23, 2005 6:19 PM by ben.wang

    Concurrency Question

    billbejeck

      Hi,

      I have a question concerning transaction isolation levels. Using the Serilizable level no write or read locks will be granted to TXN2 until TXN1 releases them. Will the same hold for n number of TreeCache instances in cluster of n machines? In other words, Will TXN1 on node a/b/c on server 1 block TXN1 on node a/b/c on server2? My undertanding of transactions is that it will not prevent read/writes on different machines in a cluster.

      Thanks,
      Bill

        • 1. Re: Concurrency Question

          The isolation level only applies to the data (or node) inside the same cache instance.

          -Ben

          • 2. Re: Concurrency Question
            abitha

            I am implementing a queue that is part of the tree cache. Each request will come in and pick the next available work from the queue, and remove that work item from the queue. The queue is shared across the cluster via the tree cache. If the transaction locking is only limited to the tree on which the txn (in this case, read and remove) occurs, then will I not have a problem with multiple requests on different servers picking up the same item (when one server has picked an item, and then removes it, but another server comes in before the txn is completed and the remove is replicated)? Do you have any suggestions on how to handle this scenario?

            Thanks, Abitha.

            • 3. Re: Concurrency Question

              If your txn spans across multiple read and remove, then you should be ok. The worst case is when it commits, it will fail on the other node (or timeout) and the work will be rolled back.

              Remember cache is used for read mostly operations. So in theory, this scenario should not occur that often.

              -Ben