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

influxdb (on nixos): reduce closure size by 99.99% (and a bit) #28127

Merged
merged 2 commits into from Aug 11, 2017

Conversation

peterhoeg
Copy link
Member

Motivation for this change

The influxdb nixos module pulls in collectd in order to fetch a single file which pulls in a number of other things (java, gtk and loads more).

This PR creates a separate derivation for the just the data bits and makes it configurable for influxdb.

Closure size before: 897M
Closure size after: 36K

My question is - should we instead change the collectd derivation to properly use multiple outputs and then stick the data bits in there instead of making the separate collectd-data derivation?

@joachifm @fpletz

Things done

Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers.

  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@@ -68,7 +68,7 @@ let

collectd = [{
enabled = false;
typesdb = "${pkgs.collectd}/share/collectd/types.db";
typesdb = "${cfg.collectdPackage}/share/collectd/types.db";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a use-case for not using the data-only variant? If not, maybe just do that, at least for the initial version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll do that. There is really only one collectd package anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on the multiple outputs alternative?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong opinion on it. Conceptually I think multiple-outputs is cleaner but not sure if there are any practical benefits in this case.

Is it possible to deploy collectd without the data? If so, that'd be a good case for moving the data to a separate output. Another thing to consider is that without hardlinking optimization you'd waste quite a bit of space if both the data-only and the full collectd paths end up being referenced by a gc root.

@fpletz
Copy link
Member

fpletz commented Aug 11, 2017

I would prefer to use multiple outputs here if collectd still works or we can make it work with the data being in another output. But this approach is also fine for now. 👍

@peterhoeg
Copy link
Member Author

I've updated the PR to just reference collectd-data directly. If everyone is OK with this I'll go ahead and merge it (unless I'm beaten to it...)

@peterhoeg peterhoeg merged commit b6f7713 into NixOS:master Aug 11, 2017
@peterhoeg peterhoeg deleted the f/collectd branch August 11, 2017 16:01
@peterhoeg peterhoeg restored the f/collectd branch August 14, 2017 00:40
@peterhoeg peterhoeg deleted the f/collectd branch September 18, 2017 07:42
@peterhoeg peterhoeg restored the f/collectd branch September 18, 2017 11:45
@peterhoeg peterhoeg deleted the f/collectd branch September 26, 2017 10:02
@peterhoeg peterhoeg restored the f/collectd branch September 26, 2017 12:48
@peterhoeg peterhoeg deleted the f/collectd branch September 29, 2017 00:45
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

Successfully merging this pull request may close these issues.

None yet

3 participants