[dnm/rfc] remove cilium/ebpf dependency to save 1.1M#5218
[dnm/rfc] remove cilium/ebpf dependency to save 1.1M#5218kolyshkin wants to merge 1 commit intoopencontainers:mainfrom
Conversation
5f9d63a to
5ea5d31
Compare
|
A quick observation (which is semi-relevant to this PR). The runc binary used to be 12M only a few years ago (see #3460 (comment)), and it's 15-16M now. I guess the biggest issue here is we're using packages that eventually grow in size (due to feature creep etc), which is not a problem per se, but becomes a problem together with disabled DCE, and DCE is disabled due to use of introspection/reflect in some of our dependencies. So, we are bundling some code into our binary which is never used. To re-enable DCE we need to eliminate the use of reflect.Method etc. |
This replaces use of the main cilium/ebpf package (in oc/cgroups) by own code, while keeping the usage of cilium/ebpf/asm. As a result, runc binary is about 1MB smaller, which is 7% savings: [kir@kir-tp1 runc]$ size runc.before runc text data bss dec hex filename 6492732 4615697 229160 11337589 acff75 runc.before 6018676 4319913 228392 10566981 a13d45 runc [kir@kir-tp1 runc]$ ls -la runc runc.before -rwxr-xr-x. 1 kir kir 14687496 Apr 2 16:31 runc -rwxr-xr-x. 1 kir kir 15749568 Apr 2 16:31 runc.before I am unsure if the added maintenance cost is worth the savings, so this is more like an experiment and a request for comments. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
|
@cyphar what do you think (not about the implementation, which might be rough, but about the overall approach)? |
|
Yeah this seems like a reasonable thing to do. To be honest I found the dependency on cilium here a little weird (and required a few hacks as well). |
|
It might also be a good idea to add a CI job to track binary sizes (I have something similar in libpathrs). This is much less of an issue than it used to be (now that we no longer copy the runc binary for every execution) but if we want to minimise this we need to start tracking it. |
Always wanted to have that but too lazy to implement.
Unless I'm missing something, we still do for the rootless case. |
Ah right. Though, we could in principle do the overlayfs trick for rootless too on modern kernels (it would require a not-fun amount of CGo though). |
This replaces use of the main cilium/ebpf package (in oc/cgroups) by our
own code, while keeping the usage of cilium/ebpf/asm.
As a result, runc binary is about 1MB smaller, which is ~7% savings:
I am unsure if the added maintenance cost is worth the savings, so this is more like an experiment and a request for comments.