Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce parallelism #206

Open
techhazard opened this issue Feb 27, 2023 · 3 comments
Open

Reduce parallelism #206

techhazard opened this issue Feb 27, 2023 · 3 comments

Comments

@techhazard
Copy link

techhazard commented Feb 27, 2023

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

@n8henrie
Copy link

n8henrie commented May 14, 2023

+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.

@LamprosPitsillos
Copy link

LamprosPitsillos commented Sep 14, 2023

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

@n8henrie
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants