Keep some statistics for the binary cache stores
[?]
Feb 19, 2016, 1:24 PM
SOB276BAWH23OUKJUXGDWCLDIM2OISD5NKF743NTQ3L572L4BS3QCDependencies
- [2]
ZM34T2NWTypo - [3]
EOO4EFWDUse a single BinaryCacheStore for all threads - [4]
LE4VZIY5More stats - [5]
O64P4XJSKeep per-machine stats - [6]
IK2UBDAURevive jobset scheduling - [7]
H7SZRHUBUse nix::willBuildLocally() - [8]
5AIYUMTBBasic remote building - [9]
63W4T5PUhydra-queue-runner: More stats - [10]
PLOZBRTRAdd command ‘hydra-queue-runner --status’ to show current status - [11]
EYR3EW6JKeep stats for the Hydra auto scaler - [12]
GTUZLZRHAdd an S3-backed binary cache store - [13]
ZTVVUMTKJSONObject doesn't handle 64-bit integers - [14]
DWFTK56EKeep track of how many threads are waiting - [15]
73YR46NJhydra-queue-runner: Write directly to a binary cache - [16]
RQUAATWBAdd status dump facility - [17]
SODOV2CMAutomatically reload $NIX_REMOTE_SYSTEMS when it changes - [18]
24BMQDZAStart of single-process hydra-queue-runner - [19]
32HHP5CWhydra-queue-runner: Support generating a signed binary cache - [20]
N2NKSKHSRefactor local binary cache code into a subclass - [21]
A2GL5FOZMoar stats - [*]
3FQ65IXOhydra-queue-runner: Compress binary cache NARs using xz - [*]
K5G5GZY7Guard against concurrent invocations of hydra-queue-runner
Change contents
- edit in src/hydra-queue-runner/binary-cache-store.cc at line 35
const BinaryCacheStore::Stats & BinaryCacheStore::getStats(){return stats;} - edit in src/hydra-queue-runner/binary-cache-store.cc at line 68
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count(); - replacement in src/hydra-queue-runner/binary-cache-store.cc at line 72
% std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count());% duration); - replacement in src/hydra-queue-runner/binary-cache-store.cc at line 76
if (!fileExists(narInfo.url)) upsertFile(narInfo.url, narXz);if (!fileExists(narInfo.url)) {stats.narWrite++;upsertFile(narInfo.url, narXz);} elsestats.narWriteAverted++;stats.narWriteBytes += nar.size();stats.narWriteCompressedBytes += narXz.size();stats.narWriteCompressionTimeMs += duration; - edit in src/hydra-queue-runner/binary-cache-store.cc at line 90
stats.narInfoWrite++; - edit in src/hydra-queue-runner/binary-cache-store.cc at line 96
stats.narInfoRead++; - edit in src/hydra-queue-runner/binary-cache-store.cc at line 122
stats.narRead++;stats.narReadCompressedBytes += nar.size(); - edit in src/hydra-queue-runner/binary-cache-store.cc at line 135
stats.narReadBytes += nar.size(); - edit in src/hydra-queue-runner/binary-cache-store.hh at line 5
#include <atomic> - edit in src/hydra-queue-runner/binary-cache-store.hh at line 40
struct Stats{std::atomic<uint64_t> narInfoRead{0};std::atomic<uint64_t> narInfoWrite{0};std::atomic<uint64_t> narRead{0};std::atomic<uint64_t> narReadBytes{0};std::atomic<uint64_t> narReadCompressedBytes{0};std::atomic<uint64_t> narWrite{0};std::atomic<uint64_t> narWriteAverted{0};std::atomic<uint64_t> narWriteBytes{0};std::atomic<uint64_t> narWriteCompressedBytes{0};std::atomic<uint64_t> narWriteCompressionTimeMs{0};}; - edit in src/hydra-queue-runner/binary-cache-store.hh at line 55
const Stats & getStats(); - edit in src/hydra-queue-runner/binary-cache-store.hh at line 59
Stats stats; - edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 26
#if 0auto store = make_ref<LocalBinaryCacheStore>(getLocalStore(),"/home/eelco/Misc/Keys/test.nixos.org/secret","/home/eelco/Misc/Keys/test.nixos.org/public","/tmp/binary-cache");#endifauto store = std::make_shared<S3BinaryCacheStore>([]() { return openStore(); },"/home/eelco/Misc/Keys/test.nixos.org/secret","/home/eelco/Misc/Keys/test.nixos.org/public","nix-test-cache-3");;store->init();_destStore = store; - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 520
root.attr("bytesSent"); out << bytesSent;root.attr("bytesReceived"); out << bytesReceived;root.attr("bytesSent", bytesSent);root.attr("bytesReceived", bytesReceived); - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 530
root.attr("avgStepTime"); out << (float) totalStepTime / nrStepsDone;root.attr("avgStepBuildTime"); out << (float) totalStepBuildTime / nrStepsDone;root.attr("avgStepTime", (float) totalStepTime / nrStepsDone);root.attr("avgStepBuildTime", (float) totalStepBuildTime / nrStepsDone); - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 553
nested2.attr("avgStepTime"); out << (float) s->totalStepTime / s->nrStepsDone;nested2.attr("avgStepBuildTime"); out << (float) s->totalStepBuildTime / s->nrStepsDone;nested2.attr("avgStepTime", (float) s->totalStepTime / s->nrStepsDone);nested2.attr("avgStepBuildTime", (float) s->totalStepBuildTime / s->nrStepsDone); - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 565
nested2.attr("shareUsed"); out << jobset.second->shareUsed();nested2.attr("shareUsed", jobset.second->shareUsed()); - edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 585
auto store = dynamic_cast<S3BinaryCacheStore *>(&*getDestStore());if (store) {root.attr("store");JSONObject nested(out);auto & stats = store->getStats();nested.attr("narInfoRead", stats.narInfoRead);nested.attr("narInfoWrite", stats.narInfoWrite);nested.attr("narRead", stats.narRead);nested.attr("narReadBytes", stats.narReadBytes);nested.attr("narReadCompressedBytes", stats.narReadCompressedBytes);nested.attr("narWrite", stats.narWrite);nested.attr("narWriteAverted", stats.narWriteAverted);nested.attr("narWriteBytes", stats.narWriteBytes);nested.attr("narWriteCompressedBytes", stats.narWriteCompressedBytes);nested.attr("narWriteCompressionTimeMs", stats.narWriteCompressionTimeMs);nested.attr("narCompressionSavings",stats.narWriteBytes? 1.0 - (double) stats.narWriteCompressedBytes / stats.narWriteBytes: 0.0);nested.attr("narCompressionSpeed", // MiB/sstats.narWriteCompressionTimeMs? (double) stats.narWriteBytes / stats.narWriteCompressionTimeMs * 1000.0 / (1024.0 * 1024.0): 0.0);auto s3Store = dynamic_cast<S3BinaryCacheStore *>(&*store);if (s3Store) {nested.attr("s3");JSONObject nested2(out);auto & s3Stats = s3Store->getS3Stats();nested2.attr("put", s3Stats.put);nested2.attr("putBytes", s3Stats.putBytes);nested2.attr("putTimeMs", s3Stats.putTimeMs);nested2.attr("putSpeed",s3Stats.putTimeMs? (double) s3Stats.putBytes / s3Stats.putTimeMs * 1000.0 / (1024.0 * 1024.0): 0.0);nested2.attr("get", s3Stats.get);nested2.attr("getBytes", s3Stats.getBytes);nested2.attr("getTimeMs", s3Stats.getTimeMs);nested2.attr("getSpeed",s3Stats.getTimeMs? (double) s3Stats.getBytes / s3Stats.getTimeMs * 1000.0 / (1024.0 * 1024.0): 0.0);nested2.attr("head", s3Stats.head);nested2.attr("costDollarApprox",(s3Stats.get + s3Stats.head) / 10000.0 * 0.004+ s3Stats.put / 1000.0 * 0.005 ++ s3Stats.getBytes / (1024.0 * 1024.0 * 1024.0) * 0.09);}} - edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 725[24.643][24.643]
#if 0auto store = make_ref<LocalBinaryCacheStore>(getLocalStore(),"/home/eelco/Misc/Keys/test.nixos.org/secret","/home/eelco/Misc/Keys/test.nixos.org/public","/tmp/binary-cache");#endifauto store = std::make_shared<S3BinaryCacheStore>([]() { return openStore(); },"/home/eelco/Misc/Keys/test.nixos.org/secret","/home/eelco/Misc/Keys/test.nixos.org/public","nix-test-cache-3");;store->init();_destStore = store; - edit in src/hydra-queue-runner/s3-binary-cache-store.cc at line 63
}const S3BinaryCacheStore::Stats & S3BinaryCacheStore::getS3Stats(){return stats; - edit in src/hydra-queue-runner/s3-binary-cache-store.cc at line 72
stats.head++; - edit in src/hydra-queue-runner/s3-binary-cache-store.cc at line 101
stats.put++;stats.putBytes += data.size(); - edit in src/hydra-queue-runner/s3-binary-cache-store.cc at line 109
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count(); - replacement in src/hydra-queue-runner/s3-binary-cache-store.cc at line 113
% bucketName % path% data.size()% std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count());% bucketName % path % data.size() % duration);stats.putTimeMs += duration; - edit in src/hydra-queue-runner/s3-binary-cache-store.cc at line 129
stats.get++; - edit in src/hydra-queue-runner/s3-binary-cache-store.cc at line 138
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count(); - replacement in src/hydra-queue-runner/s3-binary-cache-store.cc at line 142
% bucketName % path% res.size()% std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count());% bucketName % path % res.size() % duration);stats.getBytes += res.size();stats.getTimeMs += duration; - edit in src/hydra-queue-runner/s3-binary-cache-store.hh at line 4
#include <atomic> - edit in src/hydra-queue-runner/s3-binary-cache-store.hh at line 29
struct Stats{std::atomic<uint64_t> put{0};std::atomic<uint64_t> putBytes{0};std::atomic<uint64_t> putTimeMs{0};std::atomic<uint64_t> get{0};std::atomic<uint64_t> getBytes{0};std::atomic<uint64_t> getTimeMs{0};std::atomic<uint64_t> head{0};};const Stats & getS3Stats(); - edit in src/hydra-queue-runner/s3-binary-cache-store.hh at line 43
Stats stats;