Skip to content

Slim down Nix builds #530

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

Merged
merged 4 commits into from
Jun 11, 2025
Merged

Slim down Nix builds #530

merged 4 commits into from
Jun 11, 2025

Conversation

nightkr
Copy link
Member

@nightkr nightkr commented Jun 10, 2025

Primarily by disabling debug info.

For example, this slims down the airflow-operator image from 615MiB to 147MiB, and takes the incremental redeploy time from 57s to 29s (on my machine).

This improvement is a combination of the size of the debuginfo itself (~200MiB per binary), and not having to include build dependencies just because our debuginfo refers to them (primarily, this ended up pulling in GCC, which sits at ~260MiB just on its own).

The old behaviour (useful if you want to run it under a debugger.. though we probably want to support that separately somehow) can be restored by adding --arg debuginfo 2 to the nix-build call.

In addition, this PR adds an option to remove the shell (and associated utililties) from the built images. This can be done by setting --arg includeShell false, but is disabled by default because not all operators are compatible yet (in particular: stackabletech/secret-operator#608).

nightkr added 4 commits June 11, 2025 01:37
For example, this slims down the airflow-operator image from 615MiB to
147MiB.

This improvement is a combination of the size of the debuginfo
itself (~200MiB per binary), and not having to include build
dependencies just because our debuginfo refers to them (primarily, this
ended up pulling in GCC, which sits at ~260MiB just on its own).
@nightkr nightkr marked this pull request as ready for review June 11, 2025 00:24
@nightkr nightkr requested a review from a team June 11, 2025 00:25
@nightkr nightkr moved this to Development: Waiting for Review in Stackable Engineering Jun 11, 2025
@NickLarsenNZ NickLarsenNZ moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Jun 11, 2025
@NickLarsenNZ NickLarsenNZ self-requested a review June 11, 2025 07:02
Copy link
Member

@NickLarsenNZ NickLarsenNZ left a comment

Choose a reason for hiding this comment

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

LGTM, tested with nifi-operator.

It did still take a little long, (DONE IN: 102.86s) but I guess that's just my machine, and maybe the operator I chose to test on.

@nightkr
Copy link
Member Author

nightkr commented Jun 11, 2025

Yeah that's still pretty slow, but also not super actionable without a before-number to compare against (also, is this a fresh or incremental build?).

I obviously think there's more work to be done eventually, but if it's at least a net improvement then I'd be inclined to say that's future work.

@nightkr nightkr enabled auto-merge June 11, 2025 08:17
@nightkr nightkr added this pull request to the merge queue Jun 11, 2025
Merged via the queue into main with commit aa9aa60 Jun 11, 2025
2 checks passed
@nightkr nightkr deleted the feature/nix-slim branch June 11, 2025 09:13
@NickLarsenNZ NickLarsenNZ moved this from Development: In Review to Development: Done in Stackable Engineering Jun 11, 2025
@lfrancke lfrancke moved this from Development: Done to Done in Stackable Engineering Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants