Skip to content

hotplug causing cloud-init to spike CPU usage #3912

@ubuntu-server-builder

Description

@ubuntu-server-builder

This bug was originally filed in Launchpad as LP: #1946003

Launchpad details
affected_projects = ['cloud-init (Ubuntu)']
assignee = None
assignee_name = None
date_closed = 2021-11-02T19:54:30.086074+00:00
date_created = 2021-10-04T14:14:52.666764+00:00
date_fix_committed = 2021-10-27T14:44:26.549722+00:00
date_fix_released = 2021-11-02T19:54:30.086074+00:00
id = 1946003
importance = critical
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1946003
milestone = None
owner = falcojr
owner_name = James Falcon
private = False
status = fix_released
submitter = falcojr
submitter_name = James Falcon
tags = []
duplicates = [1948459]

Launchpad user James Falcon(falcojr) wrote on 2021-10-04T14:14:52.666764+00:00

In 21.3, we added udev rules to enable the cloud-init hotplug functionality. If a new device is detected, we call into cloud-init to see if hotplug is supported/enabled, then proceed accordingly based on the results. There are cloud users that are creating and disposing docker containers at a very high rate. This causes many virtual ethernet adapters to be created and disposed. This is triggering cloud-init events at a high volume, consuming significant CPU. Even with the hotplug functionality being disabled, the act of checking if hotplug is enabled is causing the spikes in CPU.

The path taken is:
https://github.com/canonical/cloud-init/blob/main/udev/10-cloud-init-hook-hotplug.rules
to
https://github.com/canonical/cloud-init/blob/main/tools/hook-hotplug
to
https://github.com/canonical/cloud-init/blob/main/cloudinit/cmd/devel/hotplug_hook.py#L158

For more context, see IRC conversations from 10/1/2021 and 10/4/2021:
https://irclogs.ubuntu.com/2021/10/01/%23cloud-init.html
https://irclogs.ubuntu.com/2021/10/04/%23cloud-init.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions