Skip to content
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

koordlet: add page cache collector unit test and mend default cold memory config #1738

Merged
merged 26 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e25cb05
feat(deps): bump github.com/docker/docker
dependabot[bot] Oct 26, 2023
d267fd9
koordlet: add pagecache collector unit
BUPT-wxq Nov 1, 2023
49d5a14
koordlet:add page cache collector unit test
BUPT-wxq Nov 13, 2023
23f26de
fix uasgeWithHotPageCache and add usageWithPageCache
BUPT-wxq Oct 19, 2023
dccacfb
koordlet: add page cache collector unit test
BUPT-wxq Nov 13, 2023
08ec8c7
koordlet: add page cache collector unit test
BUPT-wxq Nov 13, 2023
948de3d
koordlet: add page cache collector unit test
BUPT-wxq Nov 13, 2023
54fb089
koordlet: add page cache collector unit test
BUPT-wxq Nov 13, 2023
3212f81
koordlet: add page cache collector unit test
BUPT-wxq Nov 13, 2023
18f6b96
koordlet: add unit test
BUPT-wxq Nov 14, 2023
c52c886
koordlet: add page cache unit test
BUPT-wxq Nov 14, 2023
016e34d
koordlet: add page cache unit test
BUPT-wxq Nov 14, 2023
9818ab9
koordlet: add page cache unit test
BUPT-wxq Nov 14, 2023
a886fa2
koordlet: add page cache unit test
BUPT-wxq Nov 15, 2023
0744fa6
koordlet: add page cache unit test
BUPT-wxq Nov 15, 2023
6e39cfc
koordlet: add page cache unit test
BUPT-wxq Nov 15, 2023
1ddfe5c
koordlet: add page cache unit test
BUPT-wxq Nov 15, 2023
25afa92
koordlet: add unit test
BUPT-wxq Nov 18, 2023
7c9d518
koordlet: add unit test
BUPT-wxq Nov 18, 2023
dacfc82
koodlet: add unit test
BUPT-wxq Nov 20, 2023
183a91a
koodlet: add unit test
BUPT-wxq Nov 20, 2023
6918ee9
koodlet: add unit test
BUPT-wxq Nov 20, 2023
00197c3
koordlet: add unit test
BUPT-wxq Nov 24, 2023
e29f4a9
koordlet: add unit test
BUPT-wxq Nov 27, 2023
3cf33d5
koordlet: add unit test
BUPT-wxq Nov 28, 2023
496ac3e
koordlet: add unit test
BUPT-wxq Nov 30, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func Test_NewColdPageCollector(t *testing.T) {
appendableDB: opt.MetricCache,
metricDB: opt.MetricCache,
started: atomic.NewBool(false),
coldBoundary: 3,
coldBoundary: system.GetKidledColdBoundary(),
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,53 +196,53 @@ func Test_collectColdPageInfo(t *testing.T) {
total_unevictable 0
`
meminfo := `MemTotal: 1048576 kB
MemFree: 262144 kB
MemAvailable: 524288 kB
Buffers: 0 kB
Cached: 262144 kB
SwapCached: 0 kB
Active: 524288 kB
Inactive: 262144 kB
Active(anon): 262144 kB
Inactive(anon): 262144 kB
Active(file): 0 kB
Inactive(file): 262144 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 0 kB
Mapped: 0 kB
Shmem: 0 kB
Slab: 0 kB
SReclaimable: 0 kB
SUnreclaim: 0 kB
KernelStack: 0 kB
PageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 0 kB
Committed_AS: 0 kB
VmallocTotal: 0 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 0 kB
DirectMap4k: 0 kB
DirectMap2M: 0 kB
DirectMap1G: 0 kB`
MemFree: 262144 kB
MemAvailable: 524288 kB
Buffers: 0 kB
Cached: 262144 kB
SwapCached: 0 kB
Active: 524288 kB
Inactive: 262144 kB
Active(anon): 262144 kB
Inactive(anon): 262144 kB
Active(file): 0 kB
Inactive(file): 262144 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 0 kB
Mapped: 0 kB
Shmem: 0 kB
Slab: 0 kB
SReclaimable: 0 kB
SUnreclaim: 0 kB
KernelStack: 0 kB
PageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 0 kB
Committed_AS: 0 kB
VmallocTotal: 0 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 0 kB
DirectMap4k: 0 kB
DirectMap2M: 0 kB
DirectMap1G: 0 kB`
testPod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "test-pod",
Expand Down Expand Up @@ -424,14 +424,14 @@ func Test_collectNodeColdPageInfo(t *testing.T) {
# ||||| [1,2) [2,5) [5,15) [15,30) [30,60) [60,120) [120,240) [240,+inf)
csei 2613248 4657152 18182144 293683200 0 0 0 0
dsei 2568192 5140480 15306752 48648192 0 0 0 0
cfei 2633728 4640768 66531328 340172800 0 0 0 0
dfei 0 0 4096 0 0 0 0 0
cfei 2633728 4640768 66531328 340172800 52834304 0 0 0
dfei 0 0 4096 0 52834304 52834304 0 0
csui 0 0 0 0 0 0 0 0
dsui 0 0 0 0 0 0 0 0
cfui 0 0 0 0 0 0 0 0
dfui 0 0 0 0 0 0 0 0
csea 765952 1044480 3784704 52834304 0 0 0 0
dsea 286720 270336 1564672 5390336 0 0 0 0
csea 765952 1044480 3784704 52834304 52834304 0 0 0
dsea 286720 270336 1564672 5390336 52834304 0 0 0
cfea 9273344 16609280 152109056 315121664 0 0 0 0
dfea 0 0 0 0 0 0 0 0
csua 0 0 0 0 0 0 0 0
Expand All @@ -440,53 +440,53 @@ func Test_collectNodeColdPageInfo(t *testing.T) {
dfua 0 0 0 0 0 0 0 0
slab 0 0 0 0 0 0 0 0`
meminfo := `MemTotal: 1048576 kB
MemFree: 262144 kB
MemAvailable: 524288 kB
Buffers: 0 kB
Cached: 262144 kB
SwapCached: 0 kB
Active: 524288 kB
Inactive: 262144 kB
Active(anon): 262144 kB
Inactive(anon): 262144 kB
Active(file): 0 kB
Inactive(file): 262144 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 0 kB
Mapped: 0 kB
Shmem: 0 kB
Slab: 0 kB
SReclaimable: 0 kB
SUnreclaim: 0 kB
KernelStack: 0 kB
PageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 0 kB
Committed_AS: 0 kB
VmallocTotal: 0 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 0 kB
DirectMap4k: 0 kB
DirectMap2M: 0 kB
DirectMap1G: 0 kB`
MemFree: 262144 kB
MemAvailable: 524288 kB
Buffers: 0 kB
Cached: 262144 kB
SwapCached: 0 kB
Active: 524288 kB
Inactive: 262144 kB
Active(anon): 262144 kB
Inactive(anon): 262144 kB
Active(file): 0 kB
Inactive(file): 262144 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 0 kB
Mapped: 0 kB
Shmem: 0 kB
Slab: 0 kB
SReclaimable: 0 kB
SUnreclaim: 0 kB
KernelStack: 0 kB
PageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 0 kB
Committed_AS: 0 kB
VmallocTotal: 0 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 0 kB
DirectMap4k: 0 kB
DirectMap2M: 0 kB
DirectMap1G: 0 kB`
helper := system.NewFileTestUtil(t)
defer helper.Cleanup()
ctrl := gomock.NewController(t)
Expand Down Expand Up @@ -530,8 +530,9 @@ func Test_collectNodeColdPageInfo(t *testing.T) {
}
assert.NoError(t, err)
got1, got2 := testGetNodeMetrics(t, c.metricDB, testNow, 5*time.Second)
assert.Equal(t, float64(7.33569024e+08), got1)
assert.Equal(t, float64(3.401728e+08), got2)
// memInfo.MemTotal*1024 - memInfo.MemFree*1024 - coldPageUsageBytes
assert.Equal(t, float64((1048576-262144)<<10-52834304), got1)
assert.Equal(t, float64(52834304), got2)
// test collect failed
helper.WriteCgroupFileContents("", system.MemoryIdlePageStats, ``)
helper.WriteProcSubFileContents(system.ProcMemInfoName, ``)
Expand Down Expand Up @@ -563,8 +564,8 @@ func Test_collectPodColdPageInfo(t *testing.T) {
# ||||| [1,2) [2,5) [5,15) [15,30) [30,60) [60,120) [120,240) [240,+inf)
csei 2613248 4657152 18182144 293683200 0 0 0 0
dsei 2568192 5140480 15306752 48648192 0 0 0 0
cfei 2633728 4640768 66531328 340172800 0 0 0 0
dfei 0 0 4096 0 0 0 0 0
cfei 2633728 4640768 66531328 340172800 0 52834304 0 0
dfei 0 0 4096 0 0 52834304 0 0
csui 0 0 0 0 0 0 0 0
dsui 0 0 0 0 0 0 0 0
cfui 0 0 0 0 0 0 0 0
Expand All @@ -579,14 +580,14 @@ func Test_collectPodColdPageInfo(t *testing.T) {
dfua 0 0 0 0 0 0 0 0
slab 0 0 0 0 0 0 0 0`
testMemStat := `
total_cache 104857600
total_rss 104857600
total_inactive_anon 104857600
total_active_anon 0
total_inactive_file 104857600
total_active_file 0
total_unevictable 0
`
total_cache 104857600
total_rss 104857600
total_inactive_anon 104857600
total_active_anon 0
total_inactive_file 104857600
total_active_file 0
total_unevictable 0
`
testPod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "test-pod",
Expand Down Expand Up @@ -810,8 +811,8 @@ func Test_kidledcoldPageCollector_collectHostAppsColdPageInfo(t *testing.T) {
# ||||| [1,2) [2,5) [5,15) [15,30) [30,60) [60,120) [120,240) [240,+inf)
csei 2613248 4657152 18182144 293683200 0 0 0 0
dsei 2568192 5140480 15306752 48648192 0 0 0 0
cfei 2633728 4640768 66531328 340172800 0 0 0 0
dfei 0 0 4096 0 0 0 0 0
cfei 2633728 4640768 66531328 340172800 0 52834304 0 0
dfei 0 0 4096 0 0 52834304 0 0
csui 0 0 0 0 0 0 0 0
dsui 0 0 0 0 0 0 0 0
cfui 0 0 0 0 0 0 0 0
Expand All @@ -826,14 +827,14 @@ func Test_kidledcoldPageCollector_collectHostAppsColdPageInfo(t *testing.T) {
dfua 0 0 0 0 0 0 0 0
slab 0 0 0 0 0 0 0 0`
testMemStat := `
total_cache 104857600
total_rss 104857600
total_inactive_anon 104857600
total_active_anon 340172800
total_inactive_file 104857600
total_active_file 0
total_unevictable 0
`
total_cache 104857600
total_rss 104857600
total_inactive_anon 104857600
total_active_anon 340172800
total_inactive_file 104857600
total_active_file 0
total_unevictable 0
`
type fields struct {
getNodeSLO *slov1alpha1.NodeSLO
SetSysUtil func(helper *system.FileTestUtil)
Expand Down Expand Up @@ -884,8 +885,8 @@ func Test_kidledcoldPageCollector_collectHostAppsColdPageInfo(t *testing.T) {
wants: wants{
hostMetric: map[string]wantMetric{
"test-host-app": {
coldPageSize: 340172800,
memWithHotCache: 209715200,
coldPageSize: 1.05668608e+08,
memWithHotCache: 4.44219392e+08,
},
},
},
Expand Down
Loading