nix-index icon indicating copy to clipboard operation
nix-index copied to clipboard

Reduce parallelism

Open techhazard opened this issue 2 years ago • 4 comments

I'm trying to run nix-index on my raspberry pi 4B (aarch64), but after a bit my load-average is 20+ and this effectively locks-up the device (even when run with nice). I can issue no commands over SSH and have to reset the power supply of the device.

Is there some way I can limit the amount of thread/jobs that are being run? I tried running it with nice -n19 nix-index --requests 4 but that still locked-up the pi (for a while there were 4 threads, but after the http requests were done it got too much).

version: nix-index 0.1.5 on NixOS 23.05

techhazard avatar Feb 27 '23 15:02 techhazard

+1 -- also locks up my Pi 3b, and my Acer Chromebook, both of which are now happily running NixOS.

EDIT: Looks like the -r flag should do this. I tried in the past without success but will try again and report back. EDIT2: Should have read more closely; OP already mentioned the --requests flag 🤦‍♂️. Didn't work for me either.

n8henrie avatar May 14 '23 11:05 n8henrie

2023-09-14_20-48-43_index Not just raspberries , my Laptop froze for a couple of minutes when indexing Would be great if we could something about this

Edit: My issue was RAM not processing power , maybe i should open a new issue

LamprosPitsillos avatar Sep 14 '23 19:09 LamprosPitsillos

nix-index uses rayon for parallelism

After reading https://github.com/rayon-rs/rayon/blob/master/FAQ.md#how-many-threads-will-rayon-spawn I thought perhaps this would work:

$ RAYON_NUM_THREADS=1 nix-index

Unfortunately on my Pi4 (4gb ram) I eventually get:

$ RAYON_NUM_THREADS=2 result/bin/nix-index                                                                                                                                                          
+ querying available packages                                                                                                                                                                                                                 
error: querying available packages failed                                                                                                                                                                                                     
caused by: nix-env failed with error: nix-env failed with signal: 9 (SIGKILL):

And on my Pi3, even as nicely as I can, I eventually get a full system lockup:

$ RAYON_NUM_THREADS=1 nice -n 19 nix-index --requests 1

n8henrie avatar Sep 19 '23 22:09 n8henrie