Skip to content

remote instantiation (NIX_REMOTE, --store) is an order of magnitude slower than local instantiation + nix copy #10119

Open
@Atemu

Description

Describe the bug

A clear and concise description of what the bug is.

When doing remote builds, instantiation time is unreasonably long (many seconds for a simple package). About an order of magnitude slower in fact:

$ nix run nixpkgs#hyperfine -- -w 1 -- 'nix copy $(nix-instantiate -A hello --system x86_64-linux) --to ssh-ng://remote'
Benchmark 1: nix copy $(nix-instantiate -A hello --system x86_64-linux) --to ssh-ng://remote
  Time (mean ± σ):     810.2 ms ±  34.2 ms    [User: 103.5 ms, System: 26.9 ms]
  Range (min … max):   768.9 ms … 873.3 ms    10 runs
 

$ nix run nixpkgs#hyperfine -- -w 1 -- "nix-instantiate -A hello --system x86_64-linux --store ssh-ng://remote"
Benchmark 1: nix-instantiate -A hello --system x86_64-linux --store ssh-ng://remote
  Time (mean ± σ):      8.616 s ±  0.263 s    [User: 0.632 s, System: 0.328 s]
  Range (min … max):    8.070 s …  8.949 s    10 runs
 

Steps To Reproduce

  1. nix copy $(nix-instantiate -A hello --system x86_64-linux) --to ssh-ng://remote
  2. nix-instantiate -A hello --store ssh-ng://remote
  3. Observe difference

Expected behavior

A clear and concise description of what you expected to happen.

Remote instantiation should be the same speed or faster than local instantiation + copy.

Rationale for faster than local + copy: .drv files should not need to be written locally during a remote build (certainly not in the hot path), saving many IOPS.

nix-env --version output

nix-env (Nix) 2.18.1
$ uname -a
Darwin hostname 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64 arm Darwin

Additional context

During remote instantiation, there appears to be a constant 1Mbit/s upload stream, no matter whether I previously instantiated the exact same drv or not.

Priorities

Add 👍 to issues you find important.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions