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

Sub-doc operations handle memory inefficiently for large documents

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 3.5.0
    • 3.4.15
    • library

    Description

      Multi-lookup and multi-get operations are current allocating a new byte array on the heap for the body of every spec and copying the memory into that spec. This is creating unnecessary heap allocations and memory copies.

      The impact is minor for small spec bodies, but is very significant for large bodies. For example, if a LookupIn with a GetFull is performed, perhaps to get with XATTRs, then the entire body of the document is allocated into an array on the heap. If the document is a large one (> 85KB) this is a Gen2 allocation on the Large Object Heap.

      Instead, each spec could be managed as a ReadOnlyMemory<byte> view onto a slice of the overall operation response. This eliminates the heap allocation and the memory copy.

      Note: This is already the case for "automatic" LookupIn, such as projections or gets with expiry. It just isn't handled for explicit LookupIn and MutateIn operations.

      Attachments

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

        Activity

          People

            btburnett3 Brant Burnett
            btburnett3 Brant Burnett
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty