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

Make multi-methods that depend on Parallel.ForEach obsolete

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Major
    • 2.5.0
    • 2.5.0
    • library
    • None

    Description

      The multi-methods which depend upon Parallel.ForEach require specific tuning depending upon the hardware they are run on to get decent performance, are easy to use incorrectly, and Parallel.ForEach are better suited for compute-bound operations instead of IO-bound operations. 

      We suggest that users use the async multi/bulk methods instead:

      public void async GetKeys(List<string> keys)
      {
          var tasks = new List<Task<IOperationResult>>();
          foreach(var key in keys)
          {
              tasks.Add(bucket.GetAsync(key));
          }
          var results = await Task.WhenAll(tasks);
       
          // do something with the results
      }

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jmorris Jeff Morris
            jmorris Jeff Morris
            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