Details

    • Improvement
    • Resolution: Unresolved
    • Minor
    • None
    • None
    • None
    • 9223372036854775807

    Description

      This is something Li Xi suggested a few years ago - It should be possible to do lockahead automatically by tracking the write pattern (like LU-12468) and using server-side contention checking to tell the client when to do this.  (Lockahead is currently only usable by clients which know to ask for it.)

      This should let clients get good performance when strided writes with non-stripe aligned i/o, as long as the i/o is page aligned (LDLM & OSC locks are at page granularity).

      Attachments

        Issue Links

          Activity

            [LU-12550] automatic lockahead

            As Andreas said above, the scope for automatic lockahead is pretty limited and I have no intention of reviving this work.

            However, the contention detection patch here:
            https://review.whamcloud.com/#/c/35287/6

            Can be extracted from the writeahead tracking & automatic lockahead patches and used for switching from buffered i/o (which cannot be lockless) to direct i/o (which can be lockless).

            paf0186 Patrick Farrell added a comment - As Andreas said above, the scope for automatic lockahead is pretty limited and I have no intention of reviving this work. However, the contention detection patch here: https://review.whamcloud.com/#/c/35287/6 Can be extracted from the writeahead tracking & automatic lockahead patches and used for switching from buffered i/o (which cannot be lockless) to direct i/o (which can be lockless).

            Instead of doing lockahead for small unaligned writes, I think it is probably better to just do lockless "direct" writes to the OST. That avoids the overhead of the LDLM_ENQUEUE RPC to lockahead the lock, when we still need to do the write from the client.

            Even if the lockahead was expanded to cover whole pages (risking some lock contention on the hopes that sparse random writers will have few conflicts), unaligned writes would have to do read-modify-write of the partial pages. That means at least 3 RPCs (LDLM_ENQUEUE for lockahead, OST_READ of the start/end page(s), and the OST_WRITE), but up to 6 (if separate OST_READ RPCs are sent for the start/end pages, LDLM_BL_CALLBACK if there is a conflict for the expanded lock region, and LDLM_CANCEL if the lock can't be cancelled with ELC on the OST_WRITE).

            Conversely, lockless writes would only be one OST_WRITE RPC, and may even avoid the RDMA round-trip if it is a short write that fits into the RPC request (though that is not different than the OST_WRITE for the locked write).

            adilger Andreas Dilger added a comment - Instead of doing lockahead for small unaligned writes, I think it is probably better to just do lockless "direct" writes to the OST. That avoids the overhead of the LDLM_ENQUEUE RPC to lockahead the lock, when we still need to do the write from the client. Even if the lockahead was expanded to cover whole pages (risking some lock contention on the hopes that sparse random writers will have few conflicts), unaligned writes would have to do read-modify-write of the partial pages. That means at least 3 RPCs ( LDLM_ENQUEUE for lockahead, OST_READ of the start/end page(s), and the OST_WRITE ), but up to 6 (if separate OST_READ RPCs are sent for the start/end pages, LDLM_BL_CALLBACK if there is a conflict for the expanded lock region, and LDLM_CANCEL if the lock can't be cancelled with ELC on the OST_WRITE ). Conversely, lockless writes would only be one OST_WRITE RPC, and may even avoid the RDMA round-trip if it is a short write that fits into the RPC request (though that is not different than the OST_WRITE for the locked write).
            gerrit Gerrit Updater added a comment - - edited

            Patrick Farrell (pfarrell@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35526
            Subject: LU-12550 llite: Automatic lockahead
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: b87252145170765ad40dfd390d7497f366eae171

            gerrit Gerrit Updater added a comment - - edited Patrick Farrell (pfarrell@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35526 Subject: LU-12550 llite: Automatic lockahead Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: b87252145170765ad40dfd390d7497f366eae171

            This is just a side project right now, but I have a quick prototype, and wanted to get it in git.

            pfarrell Patrick Farrell (Inactive) added a comment - This is just a side project right now, but I have a quick prototype, and wanted to get it in git.

            People

              paf0186 Patrick Farrell
              pfarrell Patrick Farrell (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: