Does it make sense to have maxBufferPoolSize smaller than maxBufferSize?

Does it make sense to have a value maxBufferPoolSize less than maxBufferSize? In my opinion, the answer is no. However, the true explanation of these values from the .NET Framework BufferManager class is a bit low level and a bit confusing.

The fuzzy thing for large message tests, I can increase the value of "maxBufferSize" to a larger number than the value of "maxBufferPoolSize", and it works. I think if I didn’t allocate a sufficiently large pool (maxBufferPoolSize), it would fail for the largest allocated buffer (MaxBufferSize), but apparently this is not so.

Can someone please explain or answer this? Thanks!

+4
source share
1 answer

When the message has reached the end of its life, we try to return the buffer that was used for storage. WCF will successfully return a buffer if the shared memory held by the pool on return is <= MaxBufferPoolSize.

Similarly, when creating / receiving a message, WCF tries to take a buffer from the pool, and if the pool does not have a buffer of this size, we allocate it using GC. The maximum size for highlighting in buffer mode is protected by the size of MaxReceivedMessage.

You can check the memory usage in your application and look at the GC performance counters, and you will see that there will be a lot of time in allocating and collecting GC, because WCF will not be able to combine these buffers.

Hope this was helpful.

+3
source

All Articles