daemon: Buffer data sent to clients by the 'export-path' RPC.
commit9a8f9f84cc1672c45c2d204d9c234c932a8cb623
authorLudovic Courtès <ludo@gnu.org>
Thu, 1 Dec 2016 21:53:37 +0000 (1 22:53 +0100)
committerLudovic Courtès <ludo@gnu.org>
Thu, 1 Dec 2016 22:35:10 +0000 (1 23:35 +0100)
treee900669630be57c9f5eac6081b3b903afd674db9
parent0b72475301e20521e0dd9fc22881eaab4a7fe170
daemon: Buffer data sent to clients by the 'export-path' RPC.

Before that we'd have STDERR_WRITE round trips for very small amounts of
data, ranging from a few bytes for the metadata of nars to the size of
one file being exported.

With this change, something like:

  guix archive --export /gnu/store/5rrsbaghh5ix1vjcicsl60gsxilhjnf2-coreutils-8.25 | dd of=/dev/null

reports a throughput of 35 MB/s instead of 25 MB/s before.

* nix/nix-daemon/nix-daemon.cc (TunnelSink): Inherit from 'BufferedSink'
rather than 'Sink'.  Rename 'operator ()' to 'write'.
(performOp) <wopExportPath>: Add 'sink.flush' call.
nix/nix-daemon/nix-daemon.cc