In situations where a large number of tx are being created and destroyed concurrently, the TransactionReaper represents a potential bottleneck due to the necessary synchronization. For most worklolads this is insignificant as it is dominated by the objectstore I/O. However, for tx scenarios that don't write the store (1PC, local resources, etc) it's a potential problem, so it's worth tuning a bit.

      There are some things we can do to reduce the workload inside the synchronized scope.

      1- ReaperElements are kept in a sorted list, by expiry time. To impose the total ordering required by SortedSet, items with the same expire time (to the nearest ms) are distinguished by Uid. This is an expensive comparison. Introduce a sequence number or other cheap (i.e. int) element to the sort order so as to lessen the comparison (i.e. set insert/remove) cost.

      2 - When a new tx is inserted into the reaper queue, we can avoid waking the reaper and having it recalculate the sleep interval, provided the new tx is not at the head of the queue i.e. does not have an expire time earlier than the existing wakeup time.

      3 - Some debug logging is performed in synchronized blocks. Whilst this should not be removed, we can ensure it correctly checks the log threshold configuration, as generating log output statements unnecessarily is expensive

      4 - The transactions and timeouts collections are currently synchronized Collections. Since almost all access to them is guarded by a lock on the TransactionReaper instance, they could be replaced by unsynchronized versions with a little work. This may or may not be helpful.

        Gliffy Diagrams


            Issue Links



                • Assignee:
                  jhalliday Jonathan Halliday
                  jhalliday Jonathan Halliday
                • Votes:
                  0 Vote for this issue
                  1 Start watching this issue


                  • Created: