[CSHARP-1115] Support alternate buffer pool strategies Created: 20/Nov/14  Updated: 06/Apr/15  Resolved: 06/Apr/15

Status: Closed
Project: C# Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: 2.0

Type: Improvement Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.



 Comments   
Comment by Robert Stam [ 06/Apr/15 ]

This work was done in commit:

https://github.com/mongodb/mongo-csharp-driver/commit/a5b911800f55ef13032ce5c846abe9a4110d6c8c

But the commit message failed to mention this ticket:

Comment by Robert Stam [ 06/Apr/15 ]

While the low level work to support alternate buffer pool strategies has been implemented, there is not yet a way for the user to select or supply alternate implementations.

That would presumably involve some changes to ConnectionSettings in Core, and some way to provide those values from the high level API. Support for such configuration will be in a separate ticket.

Generated at Wed Feb 07 21:38:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.