Make computeFSClosure() single-threaded again
The fact that queryPathInfo() is synchronous meant that we needed a thread for every concurrent binary cache lookup, even though they end up being handled by the same download thread. Requiring hundreds of threads is not a good idea. So now there is an asynchronous version of queryPathInfo() that takes a callback function to process the result. Similarly, enqueueDownload() now takes a callback rather than returning a future. Thus, a command like nix path-info --store https://cache.nixos.org/ -r /nix/store/slljrzwmpygy1daay14kjszsr9xix063-nixos-16.09beta231.dccf8c5 that returns 4941 paths now takes 1.87s using only 2 threads (the main thread and the downloader thread). (This is with a prewarmed CloudFront.)
Showing
- src/libstore/binary-cache-store.cc 26 additions, 6 deletionssrc/libstore/binary-cache-store.cc
- src/libstore/binary-cache-store.hh 8 additions, 2 deletionssrc/libstore/binary-cache-store.hh
- src/libstore/download.cc 27 additions, 11 deletionssrc/libstore/download.cc
- src/libstore/download.hh 6 additions, 4 deletionssrc/libstore/download.hh
- src/libstore/http-binary-cache-store.cc 17 additions, 8 deletionssrc/libstore/http-binary-cache-store.cc
- src/libstore/local-binary-cache-store.cc 13 additions, 11 deletionssrc/libstore/local-binary-cache-store.cc
- src/libstore/local-store.cc 32 additions, 27 deletionssrc/libstore/local-store.cc
- src/libstore/local-store.hh 3 additions, 1 deletionsrc/libstore/local-store.hh
- src/libstore/misc.cc 64 additions, 40 deletionssrc/libstore/misc.cc
- src/libstore/remote-store.cc 34 additions, 30 deletionssrc/libstore/remote-store.cc
- src/libstore/remote-store.hh 3 additions, 1 deletionsrc/libstore/remote-store.hh
- src/libstore/s3-binary-cache-store.cc 30 additions, 26 deletionssrc/libstore/s3-binary-cache-store.cc
- src/libstore/store-api.cc 64 additions, 34 deletionssrc/libstore/store-api.cc
- src/libstore/store-api.hh 8 additions, 1 deletionsrc/libstore/store-api.hh
- src/libutil/util.cc 11 additions, 0 deletionssrc/libutil/util.cc
- src/libutil/util.hh 39 additions, 0 deletionssrc/libutil/util.hh
Loading
Please register or sign in to comment