[wanproxy/wanproxy] 0daffd: Support external storage for BufferSegments.

Juli Mallett juli at clockworksquid.com
Tue Apr 14 11:26:07 PDT 2015


  Branch: refs/heads/master
  Home:   https://github.com/wanproxy/wanproxy
  Commit: 0daffd2b8523c389c49993efb249a04df4abf059
      https://github.com/wanproxy/wanproxy/commit/0daffd2b8523c389c49993efb249a04df4abf059
  Author: Juli Mallett <juli at clockworksquid.com>
  Date:   2015-04-14 (Tue, 14 Apr 2015)

  Changed paths:
    M common/buffer.cc
    M common/buffer.h
    M common/test/buffer-segment-pullup1/buffer-segment-pullup1.cc

  Log Message:
  -----------
  Support external storage for BufferSegments.

This allows us to share data without a copy, with isolated metadata.
We can thus avoid copies in a few extra cases, particularly during
protocol parsing which makes heavy use of skip-extract-skip with
copies of Buffers.  The overhead of creating and managing the
BufferSegment instances themselves is non-trivial, but this path has
been awaiting commit from some time and I believe should go in now,
and be evaluated empirically.

Reviewed previously and in principle by @pkelsey.

Add tests for external buffers, and unsharing in the case of data
modifications where we may already have exclusive metadata.

While here, remove the BufferSegment cache.  Its purpose should be
served by better allocators these days, especially now that we are
multithreaded.  With multithreading, we would have to synchronize
access to the BufferSegment cache, while many allocators now have
their own thread-local caches.  There may be a small cost to
construction and destruction, as opposed to caching fully-formed
BufferSegments, but still.




More information about the wanproxy mailing list