Skip to content

Reduce cgroups read frequency to avoid kernel kernfs clock pressure #3633

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,10 @@ func (m *manager) GetContainerInfoV2(containerName string, options v2.RequestOpt
}

func (m *manager) containerDataToContainerInfo(cont *containerData, query *info.ContainerInfoRequest) (*info.ContainerInfo, error) {
// Get the info from the container.
cinfo, err := cont.GetInfo(true)
// Get the info from the container. When GetInfo is set to false,
// it reads cgroups once every 5 seconds and gets data from containerData cache at other times,
// reducing the frequency of reading cgroups to avoid kernel kernfs clock pressure that could cause Linux machine to hang
cinfo, err := cont.GetInfo(false)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions manager/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func createManagerAndAddContainers(
spec,
nil,
).Once()
mockHandler.On("ListContainers", container.ListSelf).Return(
[]info.ContainerReference(nil),
nil,
).Once()
cont, err := newContainerData(name, memoryCache, mockHandler, false, &collector.GenericCollectorManager{}, 60*time.Second, true, clock.NewFakeClock(time.Now()))
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -181,10 +185,6 @@ func expectManagerWithContainers(containers []string, query *info.ContainerInfoR
}
spec := cinfo.Spec

h.On("ListContainers", container.ListSelf).Return(
[]info.ContainerReference(nil),
nil,
)
h.On("GetSpec").Return(
spec,
nil,
Expand Down
Loading