1. xadisk
  2. XADISK-90

Locking algorithm can be improved.


    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: filesystem
    • Labels:


      The current implementation of locking can be improved in terms of performance. Here are some potential places:

      1. In addition to normal locks over file objects, there is a special locking (called "pinning") over directories when they are to be moved. Though the current algorithm works correctly, but it has to pay some cost (even for operations other than directory move) of synchronization over a common global object called "directoriesPinnedForRename". Such kind of synchronizations can be broken into smaller level synchronization over smaller level objects like a directory tree which is actually being moved.

      2. There is a single map containing all file locks and another single map containing all directory pins. These locks/pins can rather be kept into tree structures according to their paths so that objects are distributed into their local spaces instead of burdening a global common structure (e.g. cost of rehashing the whole big map, concurrency even if an efficient concurrentHashMap is used).

      3. The new algorithm can take advantage of the fact that directory move operations are very infrequent compared to all other operations combined. So, the algorithm for a directory pin can potentially take some work off the algorithm for a routine file lock. This would enhance the overall performance.


        Nitin Verma added a comment -

        Checked-in the changes to trunk.

        Nitin Verma added a comment - Checked-in the changes to trunk.


          • Assignee:
            Nitin Verma
            Nitin Verma
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: