Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-3022

Improve lock contention getting collection CIDs

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 3.2.5
    • 3.2.4
    • library
    • None
    • 1

    Description

      CouchbaseCollection.PopulateCidAsync is called whenever the collection doesn't have a CID yet (which is always the case the first time the collection is used). If there is a sudden spate of requests for operations on the collection, they may all call PopulateCidAsync and find the CID unpopulated nearly simultaneously.

      The current approach has each of them wait 2.5s for a lock to become available. The first one to acquire the lock does the operation and then releases the lock. The others will then acquire the lock and find the CID has been set and return.

      This approach causes all of the operations which flooded in to wait for a lock asynchronously. They can then only process one at a time as they each acquire the lock, and as they release it the next waiter is scheduled on the thread pool. This is very slow and can cause timeouts as some of the operations never receive the lock before the 2.5s timeout.

      Attachments

        For Gerrit Dashboard: NCBC-3022
        # Subject Branch Project Status CR V

        Activity

          People

            richard.ponton Richard Ponton
            btburnett3 Brant Burnett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty