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

nix: use boehmgc with enableLargeConfig = true #43021

Merged
merged 1 commit into from Jul 6, 2018

Conversation

vcunat
Copy link
Member

@vcunat vcunat commented Jul 4, 2018

From source-code comment I expect we should be fine with that setting:
/* overflows at roughly 128 GB */
Fixes #43015 and also similar issues, hopefully.

@vcunat
Copy link
Member Author

vcunat commented Jul 4, 2018

TODO: check for this increasing memory consumption. (Thanks Eelco!)

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: nix

Partial log (click to expand)

running test tests/fetchGit.sh... [SKIP]
running test tests/fetchMercurial.sh... [SKIP]
running test tests/signing.sh... [PASS]
running test tests/run.sh... [PASS]
running test tests/brotli.sh... [PASS]
running test tests/pure-eval.sh... [PASS]
running test tests/check.sh... [PASS]
running test tests/plugins.sh... [PASS]
All tests succeeded
/nix/store/hhf1wqs9r8g70qnjwvhqpj21yyqylx3i-nix-2.0.4

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: nix

Partial log (click to expand)

running test tests/fetchGit.sh... [SKIP]
running test tests/fetchMercurial.sh... [SKIP]
running test tests/signing.sh... [PASS]
running test tests/run.sh... [PASS]
running test tests/brotli.sh... [PASS]
running test tests/pure-eval.sh... [PASS]
running test tests/check.sh... [PASS]
running test tests/plugins.sh... [PASS]
All tests succeeded
/nix/store/pzwwzlnrwrllxjy30qgw7dyl83cx15nc-nix-2.0.4

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: nix

Partial log (click to expand)

running test tests/fetchGit.sh... [SKIP]
running test tests/fetchMercurial.sh... [SKIP]
running test tests/signing.sh... [PASS]
running test tests/run.sh... [PASS]
running test tests/brotli.sh... [PASS]
running test tests/pure-eval.sh... [PASS]
running test tests/check.sh... [PASS]
running test tests/plugins.sh... [PASS]
All tests succeeded
/nix/store/aprw5brrhkni4ksp4h4rbk7r6azx2356-nix-2.0.4

@dtzWill
Copy link
Member

dtzWill commented Jul 4, 2018

Increased memory usage (as reported in #43015 (comment)) isn't necessarily a problem. Normal caveats of measuring memory usage of GC'd code apply-- boehmgc quite understandably is likely less aggressive about collecting at a given heap size when using the large config. While this could be tuned I'd suggest leaving it as-is and only worrying about what happens when memory is limited.

Maybe run a number of large builds for varying maximum heap sizes and measure heap usage and total execution time? Might be a simpler way to investigate but that's at least easy to try :).

@dtzWill
Copy link
Member

dtzWill commented Jul 5, 2018

Also-- I've tried this setting a number of times when investigating other instances where the MAX_HEAP_SECTS (or whatever :3) error is printed... but it never seemed to actually fix the problem I was encountering?

I'm not super confident I'm remembering the details right (I can dig up my notes if that'd be useful),
but mostly I just wanted to ask/check: does this actually improve or fix something for you/others?
(and if it does and it can be reproduced, can this be shared? :D)

Thanks!

@vcunat
Copy link
Member Author

vcunat commented Jul 6, 2018

I had tested this fixes the tarball job for me, of course.

@vcunat vcunat self-assigned this Jul 6, 2018
Fixes NixOS#43015 for me and hopefully also similar issues.

== Resource consumption ==

TL;DR: no change for small-memory cases, less CPU for large-memory cases.

I assume almost all of the large memory usage is just the expression
evaluation and managed by the GC, so I used just `nix-env -q...` to test.
Old and new lines for each command follow.  I tried to run each several
times, but the values were very stable (<1% difference on re-runs),
so only one line for each command-version pair is provided.

$ time nix-env -f . -qaP --description -A nix >/dev/null
- 0.06user 0.01system 0:00.07elapsed 101%CPU (0avgtext+0avgdata 29036maxresident)k
+ 0.06user 0.01system 0:00.07elapsed 102%CPU (0avgtext+0avgdata 29864maxresident)k

$ time nix-env -f . -qaP --description >/dev/null
- 6.45user 0.36system 0:06.82elapsed  99%CPU (0avgtext+0avgdata 1021024maxresident)k
+ 6.23user 0.33system 0:06.57elapsed 100%CPU (0avgtext+0avgdata  938408maxresident)k

$ time nix-env -f . --show-trace -qa --drv-path --system --meta --xml 2>&1 >/dev/null
- 56.35user 0.96system 0:31.03elapsed 184%CPU (0avgtext+0avgdata 3207708maxresident)k
+ 44.80user 0.91system 0:26.12elapsed 175%CPU (0avgtext+0avgdata 3192696maxresident)k

$ time ./result-nix-large/bin/nix-instantiate --dry-run --eval --strict \
    --show-trace ./maintainers/scripts/eval-release.nix > /dev/null
- Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS
- Command terminated by signal 6
- 175.18user 2.68system 1:17.42elapsed 229%CPU (0avgtext+0avgdata 8468440maxresident)k
+ 178.48user 2.78system 1:15.11elapsed 241%CPU (0avgtext+0avgdata 8460572maxresident)k
@vcunat
Copy link
Member Author

vcunat commented Jul 6, 2018

I believe upstream docs indicate that we should use enableLargeConfig for nix: https://github.com/ivmai/bdwgc/blob/v7.6.6/doc/README.macros#L179

Performance measurements added to the commit message; TL;DR: no change for small-memory cases, less CPU for large-memory cases.

eadwu pushed a commit to eadwu/nixpkgs that referenced this pull request Jul 6, 2018
@vcunat vcunat merged commit 1bdb138 into NixOS:master Jul 6, 2018
@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: nix

Partial log (click to expand)

running test tests/fetchGit.sh... [SKIP]
running test tests/fetchMercurial.sh... [SKIP]
running test tests/signing.sh... [PASS]
running test tests/run.sh... [PASS]
running test tests/brotli.sh... [PASS]
running test tests/pure-eval.sh... [PASS]
running test tests/check.sh... [PASS]
running test tests/plugins.sh... [PASS]
All tests succeeded
/nix/store/aprw5brrhkni4ksp4h4rbk7r6azx2356-nix-2.0.4

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: nix

Partial log (click to expand)

running test tests/signing.sh... [PASS]
running test tests/run.sh... [PASS]
running test tests/brotli.sh... [PASS]
running test tests/pure-eval.sh... [PASS]
running test tests/check.sh... [PASS]
running test tests/plugins.sh... [PASS]
All tests succeeded
warning: rewriting hashes in '/nix/store/jdrmgnhpbchpdhixg39ggwbxzqaq8i7z-nix-2.0.4-dev'; cross fingers
warning: rewriting hashes in '/nix/store/hhf1wqs9r8g70qnjwvhqpj21yyqylx3i-nix-2.0.4'; cross fingers
/nix/store/hhf1wqs9r8g70qnjwvhqpj21yyqylx3i-nix-2.0.4

@xeji
Copy link
Contributor

xeji commented Jul 6, 2018

18.03 has had some tarball failures that look similar. Should we backport this?

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: nix

Partial log (click to expand)

running test tests/fetchGit.sh... [SKIP]
running test tests/fetchMercurial.sh... [SKIP]
running test tests/signing.sh... [PASS]
running test tests/run.sh... [PASS]
running test tests/brotli.sh... [PASS]
running test tests/pure-eval.sh... [PASS]
running test tests/check.sh... [PASS]
running test tests/plugins.sh... [PASS]
All tests succeeded
/nix/store/pzwwzlnrwrllxjy30qgw7dyl83cx15nc-nix-2.0.4

@vcunat vcunat deleted the p/nix-MAX_HEAP_SECTIONS branch July 6, 2018 12:10
@vcunat
Copy link
Member Author

vcunat commented Jul 6, 2018

I haven't noticed that. If it happens, we might be more conservative there and only override nix used in the tarball job.

vcunat added a commit that referenced this pull request Jul 6, 2018
Apparently merging #43021 1bdb138 did increase memory usage
in some cases.  1 GiB for a VM memory seems still low enough to me.
@edolstra
Copy link
Member

I enabled this on Hydra, but it made no difference. nixos:trunk-combined is still failing with Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS.

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

Successfully merging this pull request may close these issues.

None yet

5 participants