[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/06: daemon: Buffer data sent to clients by the 'export-path' RPC.
From: |
Ludovic Courtès |
Subject: |
03/06: daemon: Buffer data sent to clients by the 'export-path' RPC. |
Date: |
Thu, 1 Dec 2016 22:35:31 +0000 (UTC) |
civodul pushed a commit to branch master
in repository guix.
commit 9a8f9f84cc1672c45c2d204d9c234c932a8cb623
Author: Ludovic Courtès <address@hidden>
Date: Thu Dec 1 22:53:37 2016 +0100
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 | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 9b29b3e..682f9a2 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -203,11 +203,11 @@ static void stopWork(bool success = true, const string &
msg = "", unsigned int
}
-struct TunnelSink : Sink
+struct TunnelSink : BufferedSink
{
Sink & to;
- TunnelSink(Sink & to) : to(to) { }
- virtual void operator () (const unsigned char * data, size_t len)
+ TunnelSink(Sink & to) : BufferedSink(64 * 1024), to(to) { }
+ virtual void write(const unsigned char * data, size_t len)
{
writeInt(STDERR_WRITE, to);
writeString(data, len, to);
@@ -433,6 +433,7 @@ static void performOp(bool trusted, unsigned int
clientVersion,
startWork();
TunnelSink sink(to);
store->exportPath(path, sign, sink);
+ sink.flush();
stopWork();
writeInt(1, to);
break;
- branch master updated (4b67098 -> 463fb7d), Ludovic Courtès, 2016/12/01
- 01/06: offload: Remove redundant call to 'topologically-sorted' in 'send-file'., Ludovic Courtès, 2016/12/01
- 03/06: daemon: Buffer data sent to clients by the 'export-path' RPC.,
Ludovic Courtès <=
- 05/06: offload: Gracefully report connection failures., Ludovic Courtès, 2016/12/01
- 02/06: offload: Warn about the lack of zlib support., Ludovic Courtès, 2016/12/01
- 04/06: store: Increase buffering for the '%stderr-write' upcall., Ludovic Courtès, 2016/12/01
- 06/06: offload: Do not abort when a machine is unreachable., Ludovic Courtès, 2016/12/01