Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-88487

Avoid unnecessary allocations when comparing TagSets in ReadPreferenceSetting

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Replication

      Creating a TagSet is expensive – every time we do it, we allocate an underlying BSONArray which in turn dynamically allocates a buffer.

      We are much too cavalier with creating TagSets. For example, we will create an empty TagSet for comparison here then immediately throw away the buffer we created. We will also create an empty TagSet to feed into creating a ReadPreferenceSetting and will potentially overwrite this with another TagSet buffer.

      I have a patch that avoids these allocations – this can be a good place to start. But we have potential here to cut down on what amounts to thousands of allocations in a ten minute workload.

            Assignee:
            Unassigned Unassigned
            Reporter:
            blake.oler@mongodb.com Blake Oler
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: