2 Replies Latest reply on Jan 11, 2006 11:06 PM by bdueck

    TxInterceptor.transactions should be ConcurrentHashMap not S

      Manik;

      I'd like to change TxInterceptor.transactions from a SyncSet to a ConcurrentHashMap.

      The problem is that TxInterceptor.transactions is constantly being written to and read from. With the SyncSet using the ReadWriteLock you have now, there can only be a single writer at a time. This causes contention across threads.

      This becomes very noticeable in high concurrency situations. For example, in a test of 32-threaded test of my application, application performance nearly doubled by changing from the SyncSet you declared to a ConcurrentHashMap.

      There is an underlying principle at play here with respect to the kinds of collection classes we should be using in a given situation. In this case the TxInterceptor is global across the whole cache, and has a high rate of reads and writes since client threads will constantly be starting and stopping transactions (i.e. even if the client threads are only reading the cache, we'll still be writing to TxInterceptor.transactions). In situations like this ConcurrentHashMap is the only collection class that makes sense. Similar situation is with the TransactionTable class (mentioned in my earlier post).

      I see you're doing a bunch of changes in that area and don't want to step into an area that you're working on. Can you make this change or let me know when it's safe for me to do so?

      Brian.