Merge pull request #8267 from helen-frank/feature/OptimizationcheckBinarySizes
Optimization containerd-stress
This commit is contained in:
commit
fe3cd1781b
@ -158,8 +158,13 @@ func criCleanup(ctx context.Context, client internalapi.RuntimeService) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, sb := range sandboxes {
|
for _, sb := range sandboxes {
|
||||||
client.StopPodSandbox(sb.Id)
|
if err := client.StopPodSandbox(sb.Id); err != nil {
|
||||||
client.RemovePodSandbox(sb.Id)
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := client.RemovePodSandbox(sb.Id); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -22,7 +22,6 @@ import (
|
|||||||
|
|
||||||
func setRlimit() error {
|
func setRlimit() error {
|
||||||
rlimit := int64(100000)
|
rlimit := int64(100000)
|
||||||
if rlimit > 0 {
|
|
||||||
var limit syscall.Rlimit
|
var limit syscall.Rlimit
|
||||||
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
|
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -33,6 +32,5 @@ func setRlimit() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import (
|
|||||||
|
|
||||||
func setRlimit() error {
|
func setRlimit() error {
|
||||||
rlimit := uint64(100000)
|
rlimit := uint64(100000)
|
||||||
if rlimit > 0 {
|
|
||||||
var limit syscall.Rlimit
|
var limit syscall.Rlimit
|
||||||
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
|
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -38,6 +37,5 @@ func setRlimit() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -18,27 +18,34 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const defaultPath = "/usr/local/bin/"
|
||||||
|
|
||||||
var binaries = []string{
|
var binaries = []string{
|
||||||
"ctr",
|
defaultPath + "ctr",
|
||||||
"containerd",
|
defaultPath + "containerd",
|
||||||
"containerd-shim",
|
defaultPath + "containerd-shim",
|
||||||
"containerd-shim-runc-v1",
|
defaultPath + "containerd-shim-runc-v1",
|
||||||
"containerd-shim-runc-v2",
|
defaultPath + "containerd-shim-runc-v2",
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkBinarySizes checks and reports the binary sizes for the containerd compiled binaries to prometheus
|
// checkBinarySizes checks and reports the binary sizes for the containerd compiled binaries to prometheus
|
||||||
func checkBinarySizes() {
|
func checkBinarySizes() {
|
||||||
for _, name := range binaries {
|
for _, name := range binaries {
|
||||||
fi, err := os.Stat(filepath.Join("/usr/local/bin", name))
|
fi, err := os.Stat(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Error("stat binary")
|
logrus.WithError(err).Error("stat binary")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fi.IsDir() {
|
||||||
|
logrus.Error(name, "is not a file")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
binarySizeGauge.WithValues(name).Set(float64(fi.Size()))
|
binarySizeGauge.WithValues(name).Set(float64(fi.Size()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user