Skip to content

blockio: add blockio_reconfigure option#7418

Closed
askervin wants to merge 1 commit intocontainerd:mainfrom
askervin:5Kv_blockio_reconfigure
Closed

blockio: add blockio_reconfigure option#7418
askervin wants to merge 1 commit intocontainerd:mainfrom
askervin:5Kv_blockio_reconfigure

Conversation

@askervin
Copy link
Copy Markdown
Contributor

Reconfiguring blockio is needed in the following scenarios.

  • Block devices (/dev/*) change, for example when a CSI driver adds a new block device for a pod. Reconfiguration finds current devices and enables applying appropriate blockio parameters for them.
  • Blockio class configuration file has been updated in the system. Reconfiguration applies changes without restarting containerd.

Signed-off-by: Antti Kervinen [email protected]

@k8s-ci-robot
Copy link
Copy Markdown

Hi @askervin. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@askervin
Copy link
Copy Markdown
Contributor Author

This patch solves the issue pointed out by @d-honeybadger: blockio parameters are not applied to block devices that are created after containerd restart.

@kangclzjc
Copy link
Copy Markdown
Contributor

Does it affect the pods/containerds which are already created? For example, pod A has throttle of 100M bps, after changing the configuration, pod A should be throttled to 200M according to configuration. What will pod A do then ? Keep 100M or change to 200M ?

@askervin
Copy link
Copy Markdown
Contributor Author

askervin commented Nov 3, 2022

Does it affect the pods/containerds which are already created?

New configuration is applied only on containers that are created after the configuration change.

If containers in your pods are restarted in case of a crash, you can force recreating a container without restarting its pod (kubectl exec -it [POD_NAME] -c [CONTAINER_NAME] -- /bin/sh -c "kill 1") in order to apply new configuration.

Online adjustment of this kind of parameters without disrupting running containers could be done with NRI plugins.

@askervin askervin closed this Nov 3, 2022
@askervin
Copy link
Copy Markdown
Contributor Author

askervin commented Nov 3, 2022

An accidental Enter on a browser tab closed the issue. Reopening.

@askervin askervin reopened this Nov 3, 2022
Comment thread services/tasks/blockio_linux.go Outdated
if !blockIOEnabled || !blockIOReconfigure || blockIOConfigFilePath == "" {
return nil
}
err := blockio.SetConfigFromFile(blockIOConfigFilePath, true)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit:

Looking at this function, it looks quite heavy as it iterates all schedulers and all devices.
TODO: Maybe we need a better way to do that. (may need intel/goresctl side updates)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks @gjkim42, this is definitely a valid point. goresctrl can, for instance, skip scanning io schedulers of those block devices that it already knows.

Another thing that crossed my mind is that it would be nice to re-read block devices only once for a pod. However, it's still possible that something more hackish happens, like an init container creates new block device to the system. This patch is very conservative in this sense: it makes sure that a container always gets the most recent configuration for all block devices when created. I'd leave more complex logic and optimizations to later changes.

@mxpv
Copy link
Copy Markdown
Member

mxpv commented Aug 25, 2023

@askervin Could you pls resolve conflicts?

@mxpv mxpv added the status/needs-update Awaiting contributor update label Aug 25, 2023
Reconfiguring blockio is needed in the following scenarios.
- Block devices (/dev/*) change, for example when a CSI driver adds a
  new block device for a pod. Reconfiguration finds current devices
  and enables applying appropriate blockio parameters on them.
- Blockio class configuration file has been updated in the
  system. Reconfiguration applies changes without restarting
  containerd.

Signed-off-by: Antti Kervinen <[email protected]>
@askervin askervin force-pushed the 5Kv_blockio_reconfigure branch from d460cf1 to e07be9c Compare August 31, 2023 12:16
@askervin
Copy link
Copy Markdown
Contributor Author

@mxpv, thanks for pinging, rebasing done.

@dmcgowan dmcgowan removed the status/needs-update Awaiting contributor update label Aug 31, 2023
@k8s-ci-robot
Copy link
Copy Markdown

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2024

This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed.

@github-actions github-actions Bot added the Stale label May 2, 2024
@github-actions
Copy link
Copy Markdown

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions Bot closed this May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done
Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants