Skip to content

[V1] containerd makes binaries bigger due to importing std plugin #11202

Closed

Description

@pgimalac

What is the problem you're trying to solve

Importing the plugin standard library package makes binaries significantly bigger, due to disabling some dead code elimination (cmd/link/internal/ld/deadcode.go) and symbol names being longer (cmd/link/internal/ld/lib.go).

github.com/containerd/containerd imports github.com/containerd/containerd/plugin which imports plugin on amd64:

Image

As shown in DataDog/datadog-agent#32538, just removing the import on amd64 reduces the size of one of our binaries from 218MB to 150MB (-31%).

I would like to suggest adding a specific build tag to remove this import. I know using the static_build tag would do the same, but since it is used by many other dependencies I'm worried it would have unexpected consequences...

Describe the solution you'd like

Have a way to use containerd v1 types and functions without having to import the plugin package, and without changing behavior of other dependencies.

Additional context

No response

Activity

  1. added
    area/toolchain
    on Dec 27, 2024
  2. added a commit that references this issue on Jan 6, 2025
  3. pgimalac commented on Jan 6, 2025

    @pgimalac
    Author

    A build tag no_dynamic_plugins was added to releases 1.7 and 2.0, using it removes the import of the plugin package, making binaries importing containerd (and containerd itself) significantly smaller.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/toolchainkind/feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions