Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1115

Support alternate buffer pool strategies

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.0
    • None
    • BSON
    • None

    Description

      We use a buffer pool to hold buffers uses during I/O (i.e. sending and receiving message). Using a buffer pool helps reduce the amount of work the garbage collection must do.

      We currently have a single static ByteBufferFactory which gets its chunks from exactly one kind of pool, a BsonChunkPool.

      It would be good to abstract the notion of a buffer pool to an interface to enable us to have multiple implementations.

      This interface could look like:

      public interface IBsonChunkSource : IDisposable
      {
          IBsonChunk GetChunk(int requestedSize);
      }
      

      What are actually pooled are chunks, not entire buffers, which are made up of multiple chunks.

      I think it's better that the name of the interface not include the word "Pool", since the source may or may not involve a pool.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: