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

Update badger to latest version #11546

Open
Tracked by #14931
kruskall opened this issue Aug 31, 2023 · 25 comments
Open
Tracked by #14931

Update badger to latest version #11546

kruskall opened this issue Aug 31, 2023 · 25 comments

Comments

@kruskall
Copy link
Member

We are using an older badger version that is no longer supported. We should switch to the newer/latest version (currently v4)

@simitt simitt added this to the 8.12 milestone Aug 31, 2023
@axw
Copy link
Member

axw commented Oct 23, 2023

When we're ready for this, we should revive #11344 and replace/update the GC test.

@simitt simitt removed this from the 8.12 milestone Jan 4, 2024
@simitt simitt assigned kyungeunni and unassigned kyungeunni May 24, 2024
@carsonip
Copy link
Member

This needs to be tested thoroughly, as my experiments show that the memory profiles (v2 vs v4) look quite different:

v2: https://github.com/carsonip/tbs-badger-playground/tree/main/prefetch
v4: https://github.com/carsonip/tbs-badger-playground/tree/badgerv4/prefetch

@carsonip
Copy link
Member

carsonip commented Oct 8, 2024

Updated the playground: https://github.com/carsonip/tbs-badger-playground

TLDR

TLDR: The point that worries me is that the fix we applied in #13464 will be less effective as you may notice a perf regression in -prefetch=hybrid -hit=false case from badgerv2 to v4. rbytes does not seem to be different in badger v4 for any prefetch values. It appears that badgerv4 just reads the entire db on startup, which is also why its performance characteristics just cannot be analyzed using this simple playground.

v2:

0.07user 0.05system 0:00.17elapsed 73%CPU (0avgtext+0avgdata 66048maxresident)k
87152inputs+16outputs (227major+7109minor)pagefaults 0swaps
259:0 rbytes=44634112 wbytes=0 rios=579 wios=0 dbytes=0 dios=0
252:0 rbytes=44634112 wbytes=4096 rios=330 wios=1 dbytes=0 dios=0
252:1 rbytes=44634112 wbytes=0 rios=330 wios=0 dbytes=0 dios=0

v4:

0.24user 0.65system 0:02.23elapsed 40%CPU (0avgtext+0avgdata 685568maxresident)k
1910256inputs+48outputs (4576major+28993minor)pagefaults 0swaps
259:0 rbytes=978063360 wbytes=0 rios=9373 wios=2 dbytes=0 dios=0
252:0 rbytes=978063360 wbytes=4096 rios=4872 wios=3 dbytes=0 dios=0
252:1 rbytes=978063360 wbytes=0 rios=4872 wios=2 dbytes=0 dios=0

full results

badger v2

=== ./prefetch run -dir foo -prefetch=false -hit=false
Running as unit: run-re225b6318cb84569ba9c4bda26a17c4e.scope; invocation ID: fd0507988a9d4b5aa0633fea5d13a300
badger 2024/10/08 11:07:25 INFO: All 2 tables opened in 18ms
badger 2024/10/08 11:07:25 INFO: Replaying file id: 26 at offset: 60607284
badger 2024/10/08 11:07:25 INFO: Replay took: 2.452µs
2024/10/08 11:07:25 0 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        24752396 kB	->	MemFree:        24666464 kB	=	-85932 kB
MemAvailable:   33893428 kB	->	MemAvailable:   33858328 kB	=	-35100 kB
Buffers:          153572 kB	->	Buffers:          153736 kB	=	164 kB
Cached:          6504868 kB	->	Cached:          6555548 kB	=	50680 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         20926952 kB	->	Active:         20976148 kB	=	49196 kB
Inactive:        8048156 kB	->	Inactive:        8063696 kB	=	15540 kB
Active(anon):   19457728 kB	->	Active(anon):   19471632 kB	=	13904 kB
Inactive(anon):  7118264 kB	->	Inactive(anon):  7118264 kB	=	0 kB
Active(file):    1469224 kB	->	Active(file):    1504516 kB	=	35292 kB
Inactive(file):   929892 kB	->	Inactive(file):   945432 kB	=	15540 kB
Unevictable:     2684652 kB	->	Unevictable:     2684652 kB	=	0 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:            136160 kB	->	Dirty:            136224 kB	=	64 kB
Writeback:             0 kB	->	Writeback:             0 kB	=	0 kB
AnonPages:      25001604 kB	->	AnonPages:      25015496 kB	=	13892 kB
Mapped:          2343540 kB	->	Mapped:          2380248 kB	=	36708 kB
Shmem:           4396608 kB	->	Shmem:           4396600 kB	=	-8 kB
KReclaimable:    7474124 kB	->	KReclaimable:    7474124 kB	=	0 kB
Slab:            8397788 kB	->	Slab:            8397796 kB	=	8 kB
SReclaimable:    7474124 kB	->	SReclaimable:    7474124 kB	=	0 kB
SUnreclaim:       923664 kB	->	SUnreclaim:       923672 kB	=	8 kB
KernelStack:       65712 kB	->	KernelStack:       65816 kB	=	104 kB
PageTables:       201324 kB	->	PageTables:       201572 kB	=	248 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   54651488 kB	->	Committed_AS:   54731568 kB	=	80080 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      215144 kB	->	VmallocUsed:      215240 kB	=	96 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  1775616 kB	->	ShmemHugePages:  1775616 kB	=	0 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
0.06user 0.05system 0:00.16elapsed 73%CPU (0avgtext+0avgdata 66176maxresident)k
87264inputs+16outputs (225major+7028minor)pagefaults 0swaps
259:0 rbytes=44679168 wbytes=0 rios=611 wios=0 dbytes=0 dios=0
252:0 rbytes=44679168 wbytes=0 rios=361 wios=0 dbytes=0 dios=0
252:1 rbytes=44679168 wbytes=0 rios=361 wios=0 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=true -hit=false
Running as unit: run-ra6b2c539e9dc48da9ccaa8125f309b9d.scope; invocation ID: ca81faa31c834008b69808af112cff56
badger 2024/10/08 11:07:28 INFO: All 2 tables opened in 24ms
badger 2024/10/08 11:07:28 INFO: Replaying file id: 26 at offset: 60607284
badger 2024/10/08 11:07:28 INFO: Replay took: 4.705µs
2024/10/08 11:07:33 0 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        25304572 kB	->	MemFree:        24862476 kB	=	-442096 kB
MemAvailable:   33972764 kB	->	MemAvailable:   33719864 kB	=	-252900 kB
Buffers:            2436 kB	->	Buffers:            5904 kB	=	3468 kB
Cached:          6488988 kB	->	Cached:          8427436 kB	=	1938448 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         15904768 kB	->	Active:         16447316 kB	=	542548 kB
Inactive:       12929300 kB	->	Inactive:       14202492 kB	=	1273192 kB
Active(anon):   14534216 kB	->	Active(anon):   15012496 kB	=	478280 kB
Inactive(anon): 12033888 kB	->	Inactive(anon): 11629212 kB	=	-404676 kB
Active(file):    1370552 kB	->	Active(file):    1434820 kB	=	64268 kB
Inactive(file):   895412 kB	->	Inactive(file):  2573280 kB	=	1677868 kB
Unevictable:     2646448 kB	->	Unevictable:     2845188 kB	=	198740 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:              1764 kB	->	Dirty:              1952 kB	=	188 kB
Writeback:           152 kB	->	Writeback:             4 kB	=	-148 kB
AnonPages:      24990688 kB	->	AnonPages:      25061724 kB	=	71036 kB
Mapped:          2351048 kB	->	Mapped:          4032092 kB	=	1681044 kB
Shmem:           4361404 kB	->	Shmem:           4562176 kB	=	200772 kB
KReclaimable:    7134436 kB	->	KReclaimable:    5581496 kB	=	-1552940 kB
Slab:            8047108 kB	->	Slab:            6433308 kB	=	-1613800 kB
SReclaimable:    7134436 kB	->	SReclaimable:    5581496 kB	=	-1552940 kB
SUnreclaim:       912672 kB	->	SUnreclaim:       851812 kB	=	-60860 kB
KernelStack:       65776 kB	->	KernelStack:       66080 kB	=	304 kB
PageTables:       201644 kB	->	PageTables:       205828 kB	=	4184 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   54729036 kB	->	Committed_AS:   55039848 kB	=	310812 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      215288 kB	->	VmallocUsed:      215560 kB	=	272 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  1789952 kB	->	ShmemHugePages:  1984512 kB	=	194560 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
6.13user 10.60system 0:04.89elapsed 341%CPU (0avgtext+0avgdata 1732648maxresident)k
3390792inputs+16outputs (420031major+223036minor)pagefaults 0swaps
259:0 rbytes=1736097792 wbytes=0 rios=413529 wios=0 dbytes=0 dios=0
252:0 rbytes=1736097792 wbytes=4096 rios=413281 wios=1 dbytes=0 dios=0
252:1 rbytes=1736097792 wbytes=0 rios=413281 wios=0 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=hybrid -hit=false
Running as unit: run-r09d3d210626d4bd4bff70aec6d0218ab.scope; invocation ID: 5b9a9cece3f54effbe350a50246bf254
badger 2024/10/08 11:07:36 INFO: All 2 tables opened in 19ms
badger 2024/10/08 11:07:36 INFO: Replaying file id: 26 at offset: 60607284
badger 2024/10/08 11:07:36 INFO: Replay took: 3.134µs
2024/10/08 11:07:36 0 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        26635164 kB	->	MemFree:        26550760 kB	=	-84404 kB
MemAvailable:   33769664 kB	->	MemAvailable:   33737360 kB	=	-32304 kB
Buffers:           58840 kB	->	Buffers:           58992 kB	=	152 kB
Cached:          6633592 kB	->	Cached:          6685388 kB	=	51796 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         18836024 kB	->	Active:         18907752 kB	=	71728 kB
Inactive:       10052052 kB	->	Inactive:       10067768 kB	=	15716 kB
Active(anon):   17470276 kB	->	Active(anon):   17505620 kB	=	35344 kB
Inactive(anon):  9124180 kB	->	Inactive(anon):  9124180 kB	=	0 kB
Active(file):    1365748 kB	->	Active(file):    1402132 kB	=	36384 kB
Inactive(file):   927872 kB	->	Inactive(file):   943588 kB	=	15716 kB
Unevictable:     2818552 kB	->	Unevictable:     2818552 kB	=	0 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:            142080 kB	->	Dirty:            142016 kB	=	-64 kB
Writeback:             0 kB	->	Writeback:             0 kB	=	0 kB
AnonPages:      25014444 kB	->	AnonPages:      25049660 kB	=	35216 kB
Mapped:          2344808 kB	->	Mapped:          2382268 kB	=	37460 kB
Shmem:           4536028 kB	->	Shmem:           4536032 kB	=	4 kB
KReclaimable:    5573088 kB	->	KReclaimable:    5573088 kB	=	0 kB
Slab:            6424464 kB	->	Slab:            6424456 kB	=	-8 kB
SReclaimable:    5573088 kB	->	SReclaimable:    5573088 kB	=	0 kB
SUnreclaim:       851376 kB	->	SUnreclaim:       851368 kB	=	-8 kB
KernelStack:       65792 kB	->	KernelStack:       65920 kB	=	128 kB
PageTables:       201740 kB	->	PageTables:       201996 kB	=	256 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   54806756 kB	->	Committed_AS:   54894176 kB	=	87420 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      215288 kB	->	VmallocUsed:      215304 kB	=	16 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  1974272 kB	->	ShmemHugePages:  1974272 kB	=	0 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
0.07user 0.05system 0:00.17elapsed 73%CPU (0avgtext+0avgdata 66048maxresident)k
87152inputs+16outputs (227major+7109minor)pagefaults 0swaps
259:0 rbytes=44634112 wbytes=0 rios=579 wios=0 dbytes=0 dios=0
252:0 rbytes=44634112 wbytes=4096 rios=330 wios=1 dbytes=0 dios=0
252:1 rbytes=44634112 wbytes=0 rios=330 wios=0 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=false -hit=true
Running as unit: run-rb83b107be8bf428f93bed61cace3f04a.scope; invocation ID: 26f6d496da5343b5bbc3234ff359d310
badger 2024/10/08 11:07:39 INFO: All 2 tables opened in 18ms
badger 2024/10/08 11:07:39 INFO: Replaying file id: 26 at offset: 60607284
badger 2024/10/08 11:07:39 INFO: Replay took: 2.609µs
2024/10/08 11:08:07 891000 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        26655676 kB	->	MemFree:        24207032 kB	=	-2448644 kB
MemAvailable:   33770856 kB	->	MemAvailable:   33415604 kB	=	-355252 kB
Buffers:            3252 kB	->	Buffers:          159376 kB	=	156124 kB
Cached:          6597200 kB	->	Cached:          8601764 kB	=	2004564 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         18851764 kB	->	Active:         19201160 kB	=	349396 kB
Inactive:       10023488 kB	->	Inactive:       12031636 kB	=	2008148 kB
Active(anon):   17476516 kB	->	Active(anon):   17740784 kB	=	264268 kB
Inactive(anon):  9124180 kB	->	Inactive(anon):  9123436 kB	=	-744 kB
Active(file):    1375248 kB	->	Active(file):    1460376 kB	=	85128 kB
Inactive(file):   899308 kB	->	Inactive(file):  2908200 kB	=	2008892 kB
Unevictable:     2750068 kB	->	Unevictable:     2817932 kB	=	67864 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:            142916 kB	->	Dirty:            162960 kB	=	20044 kB
Writeback:             0 kB	->	Writeback:             0 kB	=	0 kB
AnonPages:      25025404 kB	->	AnonPages:      25289860 kB	=	264456 kB
Mapped:          2344092 kB	->	Mapped:          4150048 kB	=	1805956 kB
Shmem:           4463196 kB	->	Shmem:           4529904 kB	=	66708 kB
KReclaimable:    5572832 kB	->	KReclaimable:    5572204 kB	=	-628 kB
Slab:            6424060 kB	->	Slab:            6424200 kB	=	140 kB
SReclaimable:    5572832 kB	->	SReclaimable:    5572204 kB	=	-628 kB
SUnreclaim:       851228 kB	->	SUnreclaim:       851996 kB	=	768 kB
KernelStack:       65904 kB	->	KernelStack:       66448 kB	=	544 kB
PageTables:       201684 kB	->	PageTables:       205976 kB	=	4292 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   54738760 kB	->	Committed_AS:   54965532 kB	=	226772 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      215352 kB	->	VmallocUsed:      215992 kB	=	640 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  1914880 kB	->	ShmemHugePages:  2054144 kB	=	139264 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
1.30user 4.86system 0:28.39elapsed 21%CPU (0avgtext+0avgdata 1830528maxresident)k
3616112inputs+16outputs (440138major+8396minor)pagefaults 0swaps
259:0 rbytes=1851461632 wbytes=0 rios=441698 wios=0 dbytes=0 dios=0
252:0 rbytes=1851461632 wbytes=4096 rios=441449 wios=1 dbytes=0 dios=0
252:1 rbytes=1851461632 wbytes=0 rios=441449 wios=0 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=true -hit=true
Running as unit: run-r4d441094d6a94e699efc453f4cb85858.scope; invocation ID: 516df13a2c584ea9a1104fd51fb1ecce
badger 2024/10/08 11:08:11 INFO: All 2 tables opened in 18ms
badger 2024/10/08 11:08:11 INFO: Replaying file id: 26 at offset: 60607284
badger 2024/10/08 11:08:11 INFO: Replay took: 2.215µs
2024/10/08 11:08:16 891000 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        26598192 kB	->	MemFree:        24625828 kB	=	-1972364 kB
MemAvailable:   33557816 kB	->	MemAvailable:   33477776 kB	=	-80040 kB
Buffers:            4112 kB	->	Buffers:            5952 kB	=	1840 kB
Cached:          6363152 kB	->	Cached:          8198280 kB	=	1835128 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         19017692 kB	->	Active:         19134716 kB	=	117024 kB
Inactive:        9874888 kB	->	Inactive:       11695572 kB	=	1820684 kB
Active(anon):   17649288 kB	->	Active(anon):   17694624 kB	=	45336 kB
Inactive(anon):  9123416 kB	->	Inactive(anon):  9123416 kB	=	0 kB
Active(file):    1368404 kB	->	Active(file):    1440092 kB	=	71688 kB
Inactive(file):   751472 kB	->	Inactive(file):  2572156 kB	=	1820684 kB
Unevictable:     2673068 kB	->	Unevictable:     2617376 kB	=	-55692 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:             20516 kB	->	Dirty:             20248 kB	=	-268 kB
Writeback:             8 kB	->	Writeback:             0 kB	=	-8 kB
AnonPages:      25198556 kB	->	AnonPages:      25243896 kB	=	45340 kB
Mapped:          2348932 kB	->	Mapped:          4146608 kB	=	1797676 kB
Shmem:           4384896 kB	->	Shmem:           4329176 kB	=	-55720 kB
KReclaimable:    5571956 kB	->	KReclaimable:    5571908 kB	=	-48 kB
Slab:            6423620 kB	->	Slab:            6423808 kB	=	188 kB
SReclaimable:    5571956 kB	->	SReclaimable:    5571908 kB	=	-48 kB
SUnreclaim:       851664 kB	->	SUnreclaim:       851900 kB	=	236 kB
KernelStack:       66176 kB	->	KernelStack:       66416 kB	=	240 kB
PageTables:       201880 kB	->	PageTables:       205824 kB	=	3944 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   54725568 kB	->	Committed_AS:   54875420 kB	=	149852 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      215720 kB	->	VmallocUsed:      215928 kB	=	208 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  1910784 kB	->	ShmemHugePages:  1869824 kB	=	-40960 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
8.57user 11.33system 0:05.73elapsed 347%CPU (0avgtext+0avgdata 1845248maxresident)k
3616120inputs+16outputs (449055major+242953minor)pagefaults 0swaps
259:0 rbytes=1851465728 wbytes=0 rios=441699 wios=0 dbytes=0 dios=0
252:0 rbytes=1851465728 wbytes=4096 rios=441450 wios=1 dbytes=0 dios=0
252:1 rbytes=1851465728 wbytes=0 rios=441450 wios=0 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=hybrid -hit=true
Running as unit: run-r0964e8c5f761434cafd1f3aaa51d41f9.scope; invocation ID: 7dd3177e969b41fea03f10cbd099e954
badger 2024/10/08 11:08:19 INFO: All 2 tables opened in 18ms
badger 2024/10/08 11:08:19 INFO: Replaying file id: 26 at offset: 60607284
badger 2024/10/08 11:08:19 INFO: Replay took: 2.779µs
2024/10/08 11:08:26 891000 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        26344108 kB	->	MemFree:        24607412 kB	=	-1736696 kB
MemAvailable:   33369556 kB	->	MemAvailable:   33741580 kB	=	372024 kB
Buffers:            5508 kB	->	Buffers:          151588 kB	=	146080 kB
Cached:          6427380 kB	->	Cached:          8306236 kB	=	1878856 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         19069996 kB	->	Active:         19063156 kB	=	-6840 kB
Inactive:        9902832 kB	->	Inactive:       11969776 kB	=	2066944 kB
Active(anon):   17663400 kB	->	Active(anon):   17614660 kB	=	-48740 kB
Inactive(anon):  9123416 kB	->	Inactive(anon):  9123416 kB	=	0 kB
Active(file):    1406596 kB	->	Active(file):    1448496 kB	=	41900 kB
Inactive(file):   779416 kB	->	Inactive(file):  2846360 kB	=	2066944 kB
Unevictable:     2670540 kB	->	Unevictable:     2586372 kB	=	-84168 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:             21864 kB	->	Dirty:            138308 kB	=	116444 kB
Writeback:             0 kB	->	Writeback:            48 kB	=	48 kB
AnonPages:      25210240 kB	->	AnonPages:      25162344 kB	=	-47896 kB
Mapped:          2353884 kB	->	Mapped:          4153696 kB	=	1799812 kB
Shmem:           4384392 kB	->	Shmem:           4299756 kB	=	-84636 kB
KReclaimable:    5571644 kB	->	KReclaimable:    5571520 kB	=	-124 kB
Slab:            6423304 kB	->	Slab:            6423300 kB	=	-4 kB
SReclaimable:    5571644 kB	->	SReclaimable:    5571520 kB	=	-124 kB
SUnreclaim:       851660 kB	->	SUnreclaim:       851780 kB	=	120 kB
KernelStack:       66256 kB	->	KernelStack:       66400 kB	=	144 kB
PageTables:       201868 kB	->	PageTables:       205512 kB	=	3644 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   54755380 kB	->	Committed_AS:   55004400 kB	=	249020 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      215672 kB	->	VmallocUsed:      216088 kB	=	416 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  1931264 kB	->	ShmemHugePages:  1857536 kB	=	-73728 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
8.63user 11.54system 0:06.50elapsed 310%CPU (0avgtext+0avgdata 1845376maxresident)k
3616112inputs+16outputs (448041major+235313minor)pagefaults 0swaps
259:0 rbytes=1851461632 wbytes=0 rios=441698 wios=0 dbytes=0 dios=0
252:0 rbytes=1851461632 wbytes=4096 rios=441449 wios=1 dbytes=0 dios=0
252:1 rbytes=1851461632 wbytes=0 rios=441449 wios=0 dbytes=0 dios=0
===

badger v4

=== ./prefetch run -dir foo -prefetch=false -hit=false
Running as unit: run-rc381262fe5994a91bdab0f71adf56c4d.scope; invocation ID: 70250a2bc16147b7a41da2634cc4869d
badger 2024/10/08 16:03:07 INFO: All 33 tables opened in 21ms
badger 2024/10/08 16:03:07 INFO: Discard stats nextEmptySlot: 0
badger 2024/10/08 16:03:07 INFO: Set nextTxnTs to 9900
badger 2024/10/08 16:03:07 INFO: Deleting empty file: foo/000001.vlog
2024/10/08 16:03:09 0 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        20607188 kB	->	MemFree:        17336840 kB	=	-3270348 kB
MemAvailable:   29567412 kB	->	MemAvailable:   27323972 kB	=	-2243440 kB
Buffers:            3440 kB	->	Buffers:            5808 kB	=	2368 kB
Cached:          7229728 kB	->	Cached:          8254076 kB	=	1024348 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         25041748 kB	->	Active:         28055036 kB	=	3013288 kB
Inactive:        9635596 kB	->	Inactive:        9684588 kB	=	48992 kB
Active(anon):   22499332 kB	->	Active(anon):   24535000 kB	=	2035668 kB
Inactive(anon):  8898336 kB	->	Inactive(anon):  8898336 kB	=	0 kB
Active(file):    2542416 kB	->	Active(file):    3520036 kB	=	977620 kB
Inactive(file):   737260 kB	->	Inactive(file):   786252 kB	=	48992 kB
Unevictable:     2173624 kB	->	Unevictable:     2173624 kB	=	0 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:             10568 kB	->	Dirty:             10384 kB	=	-184 kB
Writeback:             0 kB	->	Writeback:             0 kB	=	0 kB
AnonPages:      29618020 kB	->	AnonPages:      31653852 kB	=	2035832 kB
Mapped:          3496488 kB	->	Mapped:          4220812 kB	=	724324 kB
Shmem:           4089020 kB	->	Shmem:           4089024 kB	=	4 kB
KReclaimable:    6412756 kB	->	KReclaimable:    6412712 kB	=	-44 kB
Slab:            7294700 kB	->	Slab:            7294844 kB	=	144 kB
SReclaimable:    6412756 kB	->	SReclaimable:    6412712 kB	=	-44 kB
SUnreclaim:       881944 kB	->	SUnreclaim:       882132 kB	=	188 kB
KernelStack:       71120 kB	->	KernelStack:       71616 kB	=	496 kB
PageTables:       225088 kB	->	PageTables:       231384 kB	=	6296 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   60544980 kB	->	Committed_AS:   63709784 kB	=	3164804 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      220980 kB	->	VmallocUsed:      221204 kB	=	224 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  2027520 kB	->	ShmemHugePages:  2027520 kB	=	0 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
3.27user 3.62system 0:02.26elapsed 305%CPU (0avgtext+0avgdata 2821744maxresident)k
1919368inputs+928512outputs (3406major+702981minor)pagefaults 0swaps
259:0 rbytes=982728704 wbytes=0 rios=9142 wios=1 dbytes=0 dios=0
252:0 rbytes=982728704 wbytes=475381760 rios=4873 wios=496 dbytes=0 dios=0
252:1 rbytes=982728704 wbytes=475348992 rios=4873 wios=459 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=true -hit=false
Running as unit: run-raa0700d2f802454aa780b136b65e87a6.scope; invocation ID: d389cfe1dac547a5838b3ed063b48c2c
badger 2024/10/08 16:03:12 INFO: All 23 tables opened in 16ms
badger 2024/10/08 16:03:12 INFO: Discard stats nextEmptySlot: 0
badger 2024/10/08 16:03:12 INFO: Set nextTxnTs to 9900
badger 2024/10/08 16:03:12 INFO: Deleting empty file: foo/000002.vlog
2024/10/08 16:03:14 0 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        20327036 kB	->	MemFree:        19466300 kB	=	-860736 kB
MemAvailable:   29297348 kB	->	MemAvailable:   29432016 kB	=	134668 kB
Buffers:            2512 kB	->	Buffers:            3148 kB	=	636 kB
Cached:          7241264 kB	->	Cached:          8236204 kB	=	994940 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         25057228 kB	->	Active:         26118428 kB	=	1061200 kB
Inactive:        9636044 kB	->	Inactive:        9657340 kB	=	21296 kB
Active(anon):   22505064 kB	->	Active(anon):   22592156 kB	=	87092 kB
Inactive(anon):  8898336 kB	->	Inactive(anon):  8898336 kB	=	0 kB
Active(file):    2552164 kB	->	Active(file):    3526272 kB	=	974108 kB
Inactive(file):   737708 kB	->	Inactive(file):   759004 kB	=	21296 kB
Unevictable:     2174072 kB	->	Unevictable:     2174136 kB	=	64 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:             11060 kB	->	Dirty:              8396 kB	=	-2664 kB
Writeback:             0 kB	->	Writeback:            84 kB	=	84 kB
AnonPages:      29623668 kB	->	AnonPages:      29710896 kB	=	87228 kB
Mapped:          3496712 kB	->	Mapped:          4086592 kB	=	589880 kB
Shmem:           4089472 kB	->	Shmem:           4089536 kB	=	64 kB
KReclaimable:    6412648 kB	->	KReclaimable:    6412648 kB	=	0 kB
Slab:            7294848 kB	->	Slab:            7294872 kB	=	24 kB
SReclaimable:    6412648 kB	->	SReclaimable:    6412648 kB	=	0 kB
SUnreclaim:       882200 kB	->	SUnreclaim:       882224 kB	=	24 kB
KernelStack:       71344 kB	->	KernelStack:       71488 kB	=	144 kB
PageTables:       225132 kB	->	PageTables:       227560 kB	=	2428 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   60553268 kB	->	Committed_AS:   60780308 kB	=	227040 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      220964 kB	->	VmallocUsed:      221060 kB	=	96 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  2027520 kB	->	ShmemHugePages:  2027520 kB	=	0 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
0.23user 0.67system 0:02.28elapsed 39%CPU (0avgtext+0avgdata 684800maxresident)k
1910000inputs+48outputs (4577major+28910minor)pagefaults 0swaps
259:0 rbytes=977932288 wbytes=0 rios=9370 wios=0 dbytes=0 dios=0
252:0 rbytes=977932288 wbytes=12288 rios=4869 wios=3 dbytes=0 dios=0
252:1 rbytes=977932288 wbytes=0 rios=4869 wios=0 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=hybrid -hit=false
Running as unit: run-r8b38f0d796a54510a978b4a6bcb05261.scope; invocation ID: f9e03aa1d65c4711bd711bd9985f1b1a
badger 2024/10/08 16:03:17 INFO: All 23 tables opened in 16ms
badger 2024/10/08 16:03:17 INFO: Discard stats nextEmptySlot: 0
badger 2024/10/08 16:03:17 INFO: Set nextTxnTs to 9900
badger 2024/10/08 16:03:17 INFO: Deleting empty file: foo/000003.vlog
2024/10/08 16:03:20 0 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        20450492 kB	->	MemFree:        19509844 kB	=	-940648 kB
MemAvailable:   29411416 kB	->	MemAvailable:   29447380 kB	=	35964 kB
Buffers:            2120 kB	->	Buffers:            5480 kB	=	3360 kB
Cached:          7232904 kB	->	Cached:          8206044 kB	=	973140 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         25062076 kB	->	Active:         26112872 kB	=	1050796 kB
Inactive:        9628380 kB	->	Inactive:        9645980 kB	=	17600 kB
Active(anon):   22510724 kB	->	Active(anon):   22602548 kB	=	91824 kB
Inactive(anon):  8898336 kB	->	Inactive(anon):  8898328 kB	=	-8 kB
Active(file):    2551352 kB	->	Active(file):    3510324 kB	=	958972 kB
Inactive(file):   730044 kB	->	Inactive(file):   747652 kB	=	17608 kB
Unevictable:     2173560 kB	->	Unevictable:     2173624 kB	=	64 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:              9384 kB	->	Dirty:              9460 kB	=	76 kB
Writeback:             0 kB	->	Writeback:             0 kB	=	0 kB
AnonPages:      29629452 kB	->	AnonPages:      29721256 kB	=	91804 kB
Mapped:          3496648 kB	->	Mapped:          4085280 kB	=	588632 kB
Shmem:           4088956 kB	->	Shmem:           4089024 kB	=	68 kB
KReclaimable:    6411736 kB	->	KReclaimable:    6411768 kB	=	32 kB
Slab:            7293660 kB	->	Slab:            7293864 kB	=	204 kB
SReclaimable:    6411736 kB	->	SReclaimable:    6411768 kB	=	32 kB
SUnreclaim:       881924 kB	->	SUnreclaim:       882096 kB	=	172 kB
KernelStack:       71376 kB	->	KernelStack:       71504 kB	=	128 kB
PageTables:       225184 kB	->	PageTables:       227376 kB	=	2192 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   60556624 kB	->	Committed_AS:   60780612 kB	=	223988 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      220964 kB	->	VmallocUsed:      221156 kB	=	192 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  2027520 kB	->	ShmemHugePages:  2027520 kB	=	0 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
0.24user 0.65system 0:02.23elapsed 40%CPU (0avgtext+0avgdata 685568maxresident)k
1910256inputs+48outputs (4576major+28993minor)pagefaults 0swaps
259:0 rbytes=978063360 wbytes=0 rios=9373 wios=2 dbytes=0 dios=0
252:0 rbytes=978063360 wbytes=4096 rios=4872 wios=3 dbytes=0 dios=0
252:1 rbytes=978063360 wbytes=0 rios=4872 wios=2 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=false -hit=true
Running as unit: run-r1ce7e4207a0646b39771814d06d117f0.scope; invocation ID: 593df81350254301ae91d4f27e700984
badger 2024/10/08 16:03:23 INFO: All 23 tables opened in 17ms
badger 2024/10/08 16:03:23 INFO: Discard stats nextEmptySlot: 0
badger 2024/10/08 16:03:23 INFO: Set nextTxnTs to 9900
badger 2024/10/08 16:03:23 INFO: Deleting empty file: foo/000004.vlog
2024/10/08 16:03:26 891000 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        20385544 kB	->	MemFree:        18899808 kB	=	-1485736 kB
MemAvailable:   29371420 kB	->	MemAvailable:   28872384 kB	=	-499036 kB
Buffers:            1692 kB	->	Buffers:            2628 kB	=	936 kB
Cached:          7258548 kB	->	Cached:          8244324 kB	=	985776 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         25073852 kB	->	Active:         26724932 kB	=	1651080 kB
Inactive:        9641376 kB	->	Inactive:        9648540 kB	=	7164 kB
Active(anon):   22510648 kB	->	Active(anon):   23182192 kB	=	671544 kB
Inactive(anon):  8898328 kB	->	Inactive(anon):  8898328 kB	=	0 kB
Active(file):    2563204 kB	->	Active(file):    3542740 kB	=	979536 kB
Inactive(file):   743048 kB	->	Inactive(file):   750212 kB	=	7164 kB
Unevictable:     2174136 kB	->	Unevictable:     2174136 kB	=	0 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:             10316 kB	->	Dirty:             10196 kB	=	-120 kB
Writeback:             0 kB	->	Writeback:             0 kB	=	0 kB
AnonPages:      29629316 kB	->	AnonPages:      30300944 kB	=	671628 kB
Mapped:          3496908 kB	->	Mapped:          4463228 kB	=	966320 kB
Shmem:           4089536 kB	->	Shmem:           4089536 kB	=	0 kB
KReclaimable:    6411832 kB	->	KReclaimable:    6411832 kB	=	0 kB
Slab:            7293996 kB	->	Slab:            7294296 kB	=	300 kB
SReclaimable:    6411832 kB	->	SReclaimable:    6411832 kB	=	0 kB
SUnreclaim:       882164 kB	->	SUnreclaim:       882464 kB	=	300 kB
KernelStack:       71280 kB	->	KernelStack:       71696 kB	=	416 kB
PageTables:       225132 kB	->	PageTables:       228892 kB	=	3760 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   60556696 kB	->	Committed_AS:   61432544 kB	=	875848 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      221012 kB	->	VmallocUsed:      221316 kB	=	304 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  2027520 kB	->	ShmemHugePages:  2027520 kB	=	0 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
3.47user 1.20system 0:03.23elapsed 144%CPU (0avgtext+0avgdata 1651416maxresident)k
1954264inputs+48outputs (1076major+192704minor)pagefaults 0swaps
259:0 rbytes=1000595456 wbytes=0 rios=8551 wios=2 dbytes=0 dios=0
252:0 rbytes=1000595456 wbytes=4096 rios=4842 wios=3 dbytes=0 dios=0
252:1 rbytes=1000595456 wbytes=0 rios=4842 wios=2 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=true -hit=true
Running as unit: run-r08eba68bbcd84497b0c1ef680bef2657.scope; invocation ID: b8dd923d6aa440e7ac0c62bccebeae54
badger 2024/10/08 16:03:29 INFO: All 23 tables opened in 18ms
badger 2024/10/08 16:03:29 INFO: Discard stats nextEmptySlot: 0
badger 2024/10/08 16:03:29 INFO: Set nextTxnTs to 9900
badger 2024/10/08 16:03:29 INFO: Deleting empty file: foo/000005.vlog
2024/10/08 16:03:34 891000 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        20364824 kB	->	MemFree:        18849172 kB	=	-1515652 kB
MemAvailable:   29344988 kB	->	MemAvailable:   28889604 kB	=	-455384 kB
Buffers:            4884 kB	->	Buffers:            6364 kB	=	1480 kB
Cached:          7249172 kB	->	Cached:          8309048 kB	=	1059876 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         25076068 kB	->	Active:         26738604 kB	=	1662536 kB
Inactive:        9634468 kB	->	Inactive:        9709140 kB	=	74672 kB
Active(anon):   22511888 kB	->	Active(anon):   23188836 kB	=	676948 kB
Inactive(anon):  8898328 kB	->	Inactive(anon):  8898328 kB	=	0 kB
Active(file):    2564180 kB	->	Active(file):    3549768 kB	=	985588 kB
Inactive(file):   736140 kB	->	Inactive(file):   810812 kB	=	74672 kB
Unevictable:     2174008 kB	->	Unevictable:     2174680 kB	=	672 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:             11672 kB	->	Dirty:              4596 kB	=	-7076 kB
Writeback:            56 kB	->	Writeback:             0 kB	=	-56 kB
AnonPages:      29631096 kB	->	AnonPages:      30307516 kB	=	676420 kB
Mapped:          3508012 kB	->	Mapped:          4463456 kB	=	955444 kB
Shmem:           4089372 kB	->	Shmem:           4090044 kB	=	672 kB
KReclaimable:    6412052 kB	->	KReclaimable:    6412060 kB	=	8 kB
Slab:            7294080 kB	->	Slab:            7294332 kB	=	252 kB
SReclaimable:    6412052 kB	->	SReclaimable:    6412060 kB	=	8 kB
SUnreclaim:       882028 kB	->	SUnreclaim:       882272 kB	=	244 kB
KernelStack:       71648 kB	->	KernelStack:       71568 kB	=	-80 kB
PageTables:       225256 kB	->	PageTables:       228612 kB	=	3356 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   60563312 kB	->	Committed_AS:   61439064 kB	=	875752 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      221244 kB	->	VmallocUsed:      221172 kB	=	-72 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  2027520 kB	->	ShmemHugePages:  2027520 kB	=	0 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
9.11user 1.87system 0:04.78elapsed 229%CPU (0avgtext+0avgdata 1661132maxresident)k
1954440inputs+48outputs (1096major+194752minor)pagefaults 0swaps
259:0 rbytes=1000685568 wbytes=0 rios=8552 wios=2 dbytes=0 dios=0
252:0 rbytes=1000685568 wbytes=4096 rios=4843 wios=3 dbytes=0 dios=0
252:1 rbytes=1000685568 wbytes=8192 rios=4843 wios=4 dbytes=0 dios=0
===
=== ./prefetch run -dir foo -prefetch=hybrid -hit=true
Running as unit: run-r0364b19dc8244a95b8afa51a0314a381.scope; invocation ID: 8eb21e495547444697b48c4c282ebecf
badger 2024/10/08 16:03:37 INFO: All 23 tables opened in 18ms
badger 2024/10/08 16:03:37 INFO: Discard stats nextEmptySlot: 0
badger 2024/10/08 16:03:37 INFO: Set nextTxnTs to 9900
badger 2024/10/08 16:03:37 INFO: Deleting empty file: foo/000006.vlog
2024/10/08 16:03:42 891000 values read
MemTotal:       65504044 kB	->	MemTotal:       65504044 kB	=	0 kB
MemFree:        20436900 kB	->	MemFree:        18886788 kB	=	-1550112 kB
MemAvailable:   29397620 kB	->	MemAvailable:   28888188 kB	=	-509432 kB
Buffers:            4656 kB	->	Buffers:            7416 kB	=	2760 kB
Cached:          7229584 kB	->	Cached:          8267388 kB	=	1037804 kB
SwapCached:            0 kB	->	SwapCached:            0 kB	=	0 kB
Active:         25054920 kB	->	Active:         26738068 kB	=	1683148 kB
Inactive:        9633080 kB	->	Inactive:        9672940 kB	=	39860 kB
Active(anon):   22508760 kB	->	Active(anon):   23191112 kB	=	682352 kB
Inactive(anon):  8898328 kB	->	Inactive(anon):  8898328 kB	=	0 kB
Active(file):    2546160 kB	->	Active(file):    3546956 kB	=	1000796 kB
Inactive(file):   734752 kB	->	Inactive(file):   774612 kB	=	39860 kB
Unevictable:     2173656 kB	->	Unevictable:     2173592 kB	=	-64 kB
Mlocked:             480 kB	->	Mlocked:             480 kB	=	0 kB
SwapTotal:             0 kB	->	SwapTotal:             0 kB	=	0 kB
SwapFree:              0 kB	->	SwapFree:              0 kB	=	0 kB
Zswap:                 0 kB	->	Zswap:                 0 kB	=	0 kB
Zswapped:              0 kB	->	Zswapped:              0 kB	=	0 kB
Dirty:              6120 kB	->	Dirty:               660 kB	=	-5460 kB
Writeback:             0 kB	->	Writeback:             0 kB	=	0 kB
AnonPages:      29627624 kB	->	AnonPages:      30309856 kB	=	682232 kB
Mapped:          3496352 kB	->	Mapped:          4469572 kB	=	973220 kB
Shmem:           4089016 kB	->	Shmem:           4088956 kB	=	-60 kB
KReclaimable:    6412016 kB	->	KReclaimable:    6412040 kB	=	24 kB
Slab:            7293820 kB	->	Slab:            7294412 kB	=	592 kB
SReclaimable:    6412016 kB	->	SReclaimable:    6412040 kB	=	24 kB
SUnreclaim:       881804 kB	->	SUnreclaim:       882372 kB	=	568 kB
KernelStack:       71296 kB	->	KernelStack:       71584 kB	=	288 kB
PageTables:       225048 kB	->	PageTables:       228624 kB	=	3576 kB
SecPageTables:         0 kB	->	SecPageTables:         0 kB	=	0 kB
NFS_Unstable:          0 kB	->	NFS_Unstable:          0 kB	=	0 kB
Bounce:                0 kB	->	Bounce:                0 kB	=	0 kB
WritebackTmp:          0 kB	->	WritebackTmp:          0 kB	=	0 kB
CommitLimit:    32752020 kB	->	CommitLimit:    32752020 kB	=	0 kB
Committed_AS:   60567996 kB	->	Committed_AS:   61522548 kB	=	954552 kB
VmallocTotal:   34359738367 kB	->	VmallocTotal:   34359738367 kB	=	0 kB
VmallocUsed:      220996 kB	->	VmallocUsed:      221236 kB	=	240 kB
VmallocChunk:          0 kB	->	VmallocChunk:          0 kB	=	0 kB
Percpu:            30400 kB	->	Percpu:            30400 kB	=	0 kB
HardwareCorrupted:     0 kB	->	HardwareCorrupted:     0 kB	=	0 kB
AnonHugePages:         0 kB	->	AnonHugePages:         0 kB	=	0 kB
ShmemHugePages:  2027520 kB	->	ShmemHugePages:  2027520 kB	=	0 kB
ShmemPmdMapped:        0 kB	->	ShmemPmdMapped:        0 kB	=	0 kB
FileHugePages:         0 kB	->	FileHugePages:         0 kB	=	0 kB
FilePmdMapped:         0 kB	->	FilePmdMapped:         0 kB	=	0 kB
Unaccepted:            0 kB	->	Unaccepted:            0 kB	=	0 kB
HugePages_Total:       0	->	HugePages_Total:       0	=	0 
HugePages_Free:        0	->	HugePages_Free:        0	=	0 
HugePages_Rsvd:        0	->	HugePages_Rsvd:        0	=	0 
HugePages_Surp:        0	->	HugePages_Surp:        0	=	0 
Hugepagesize:       2048 kB	->	Hugepagesize:       2048 kB	=	0 kB
Hugetlb:               0 kB	->	Hugetlb:               0 kB	=	0 kB
DirectMap4k:      606196 kB	->	DirectMap4k:      606196 kB	=	0 kB
DirectMap2M:    18972672 kB	->	DirectMap2M:    18972672 kB	=	0 kB
DirectMap1G:    47185920 kB	->	DirectMap1G:    47185920 kB	=	0 kB
9.50user 1.96system 0:04.95elapsed 231%CPU (0avgtext+0avgdata 1658384maxresident)k
1954280inputs+48outputs (1093major+194520minor)pagefaults 0swaps
259:0 rbytes=1000603648 wbytes=0 rios=8553 wios=2 dbytes=0 dios=0
252:0 rbytes=1000603648 wbytes=4096 rios=4844 wios=3 dbytes=0 dios=0
252:1 rbytes=1000603648 wbytes=8192 rios=4844 wios=4 dbytes=0 dios=0
===

@kruskall
Copy link
Member Author

Opened #14427 to update badger, still need to figure out a broken test and any change in behaviour

@kruskall
Copy link
Member Author

broken test has been fixed, PR is ready

@kruskall
Copy link
Member Author

Benchmark diff main vs badger v4 (tail sampling enabled and sample_rate:1):

                          │   main.txt   │             badger.txt              │
                          │    sec/op    │    sec/op      vs base              │
10000AggregationGroups-64   267.1m ± 26%    285.5m ± 41%       ~ (p=0.485 n=6)
1000Transactions-64         9.983m ±  7%   10.375m ±  2%  +3.93% (p=0.002 n=6)
AgentAll-64                 256.9m ±  1%    268.8m ±  4%  +4.61% (p=0.002 n=6)
AgentGo-64                  54.95m ±  1%    56.03m ±  2%  +1.98% (p=0.002 n=6)
AgentNodeJS-64              36.53m ±  6%    34.08m ±  1%  -6.72% (p=0.002 n=6)
AgentPython-64              113.1m ±  4%    104.0m ±  0%  -8.03% (p=0.002 n=6)
AgentRuby-64                58.60m ±  2%    53.83m ±  2%  -8.13% (p=0.002 n=6)
OTLPTraces-64               8.978µ ±  3%    9.309µ ±  2%  +3.69% (p=0.026 n=6)
geomean                     23.13m          23.03m        -0.40%

                          │      main.txt       │                 badger.txt                  │
                          │ error_responses/sec │ error_responses/sec  vs base                │
10000AggregationGroups-64          0.000 ± 0%              0.000 ± 0%       ~ (p=1.000 n=6) ¹
1000Transactions-64                0.000 ± 0%              0.000 ± 0%       ~ (p=1.000 n=6) ¹
AgentAll-64                        0.000 ± 0%              0.000 ± 0%       ~ (p=1.000 n=6) ¹
AgentGo-64                         0.000 ± 0%              0.000 ± 0%       ~ (p=1.000 n=6) ¹
AgentNodeJS-64                     0.000 ± 0%              0.000 ± 0%       ~ (p=1.000 n=6) ¹
AgentPython-64                     0.000 ± 0%              0.000 ± 0%       ~ (p=1.000 n=6) ¹
AgentRuby-64                       0.000 ± 0%              0.000 ± 0%       ~ (p=1.000 n=6) ¹
OTLPTraces-64                      0.000 ± 0%              0.000 ± 0%       ~ (p=1.000 n=6) ¹
geomean                                       ²                        +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                          │   main.txt    │             badger.txt              │
                          │  errors/sec   │ errors/sec   vs base                │
10000AggregationGroups-64    0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=6) ¹
1000Transactions-64          0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=6) ¹
AgentAll-64                 1.401k ± 1%     1.339k ± 4%  -4.42% (p=0.002 n=6)
AgentGo-64                  1.911k ± 1%     1.873k ± 2%  -1.96% (p=0.002 n=6)
AgentNodeJS-64              1.341k ± 6%     1.438k ± 1%  +7.23% (p=0.002 n=6)
AgentPython-64               636.7 ± 4%      692.3 ± 0%  +8.74% (p=0.002 n=6)
AgentRuby-64                2.287k ± 2%     2.489k ± 2%  +8.83% (p=0.002 n=6)
OTLPTraces-64                0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=6) ¹
geomean                                 ²                +2.19%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                          │   main.txt    │             badger.txt             │
                          │  events/sec   │  events/sec   vs base              │
10000AggregationGroups-64    42.35k ± 31%   39.32k ± 51%       ~ (p=0.394 n=6)
1000Transactions-64         100.19k ±  8%   96.39k ±  2%  -3.79% (p=0.002 n=6)
AgentAll-64                  70.15k ±  1%   67.16k ±  4%  -4.26% (p=0.002 n=6)
AgentGo-64                   95.26k ±  1%   93.41k ±  2%  -1.94% (p=0.002 n=6)
AgentNodeJS-64               55.08k ±  6%   59.05k ±  1%  +7.20% (p=0.002 n=6)
AgentPython-64               62.08k ±  4%   67.50k ±  0%  +8.74% (p=0.002 n=6)
AgentRuby-64                 64.05k ±  2%   69.72k ±  2%  +8.84% (p=0.002 n=6)
OTLPTraces-64                111.4k ±  3%   107.4k ±  2%  -3.60% (p=0.026 n=6)
geomean                      71.62k         71.84k        +0.32%

                          │   main.txt    │             badger.txt             │
                          │   gc_cycles   │  gc_cycles   vs base               │
10000AggregationGroups-64    285.5 ± 205%   186.0 ± 51%  -34.85% (p=0.002 n=6)
1000Transactions-64          200.5 ±  89%   161.5 ± 78%        ~ (p=0.394 n=6)
AgentAll-64                  142.0 ±   4%   117.5 ±  5%  -17.25% (p=0.002 n=6)
AgentGo-64                   142.5 ±   4%   114.5 ±  5%  -19.65% (p=0.002 n=6)
AgentNodeJS-64               137.5 ±  15%   122.5 ±  9%        ~ (p=0.167 n=6)
AgentPython-64               133.5 ±   6%   115.0 ±  3%  -13.86% (p=0.002 n=6)
AgentRuby-64                 123.5 ±  19%   105.0 ± 13%  -14.98% (p=0.002 n=6)
OTLPTraces-64               103.00 ±  15%   87.50 ± 12%  -15.05% (p=0.002 n=6)
geomean                      151.0          123.0        -18.57%

                          │    main.txt    │              badger.txt              │
                          │ max_goroutines │ max_goroutines  vs base              │
10000AggregationGroups-64      773.0 ± 29%      845.5 ± 31%       ~ (p=0.937 n=6)
1000Transactions-64            301.5 ±  4%      311.0 ±  6%       ~ (p=0.457 n=6)
AgentAll-64                    191.5 ± 34%      197.5 ± 31%       ~ (p=0.089 n=6)
AgentGo-64                     184.0 ±  5%      180.5 ±  2%       ~ (p=0.329 n=6)
AgentNodeJS-64                 190.5 ±  3%      191.5 ±  4%       ~ (p=0.848 n=6)
AgentPython-64                 199.0 ±  5%      201.0 ±  4%       ~ (p=0.219 n=6)
AgentRuby-64                   185.0 ±  2%      186.5 ±  3%       ~ (p=0.656 n=6)
OTLPTraces-64                  408.0 ±  0%      416.5 ±  1%  +2.08% (p=0.002 n=6)
geomean                        263.9            269.7        +2.23%

                          │    main.txt    │              badger.txt               │
                          │ max_heap_alloc │ max_heap_alloc  vs base               │
10000AggregationGroups-64     1.331G ±  5%    1.826G ± 651%  +37.23% (p=0.002 n=6)
1000Transactions-64           2.676G ± 36%    3.645G ±  34%        ~ (p=0.180 n=6)
AgentAll-64                   4.021G ±  2%    4.781G ±   2%  +18.90% (p=0.002 n=6)
AgentGo-64                    3.737G ±  2%    4.508G ±   1%  +20.63% (p=0.002 n=6)
AgentNodeJS-64                3.932G ±  1%    4.610G ±   1%  +17.25% (p=0.002 n=6)
AgentPython-64                4.043G ±  1%    5.174G ±   1%  +27.98% (p=0.002 n=6)
AgentRuby-64                  3.860G ±  1%    5.139G ±   3%  +33.13% (p=0.002 n=6)
OTLPTraces-64                 3.741G ±  1%    5.818G ±   9%  +55.51% (p=0.002 n=6)
geomean                       3.245G          4.229G         +30.34%

                          │     main.txt     │               badger.txt                │
                          │ max_heap_objects │ max_heap_objects  vs base               │
10000AggregationGroups-64       9.651M ±  6%     10.215M ± 254%   +5.85% (p=0.015 n=6)
1000Transactions-64             28.00M ± 45%      32.55M ±  48%        ~ (p=0.485 n=6)
AgentAll-64                     43.79M ±  2%      39.13M ±   4%  -10.65% (p=0.002 n=6)
AgentGo-64                      42.40M ±  2%      37.24M ±   1%  -12.19% (p=0.002 n=6)
AgentNodeJS-64                  42.00M ±  1%      36.27M ±   2%  -13.65% (p=0.002 n=6)
AgentPython-64                  42.75M ±  2%      38.58M ±   2%   -9.75% (p=0.002 n=6)
AgentRuby-64                    44.32M ±  1%      43.21M ±   5%   -2.50% (p=0.002 n=6)
OTLPTraces-64                   43.06M ±  1%      52.66M ±  16%  +22.29% (p=0.002 n=6)
geomean                         33.84M            33.38M          -1.35%

                          │   main.txt   │              badger.txt              │
                          │   max_rss    │    max_rss     vs base               │
10000AggregationGroups-64   4.473G ±  1%   5.585G ± 232%  +24.88% (p=0.002 n=6)
1000Transactions-64         5.922G ± 18%   7.644G ±  21%  +29.08% (p=0.026 n=6)
AgentAll-64                 7.392G ±  1%   8.820G ±   1%  +19.32% (p=0.002 n=6)
AgentGo-64                  7.034G ±  1%   8.375G ±   1%  +19.07% (p=0.002 n=6)
AgentNodeJS-64              7.233G ±  1%   8.561G ±   1%  +18.36% (p=0.002 n=6)
AgentPython-64              7.407G ±  1%   9.075G ±   2%  +22.53% (p=0.002 n=6)
AgentRuby-64                7.153G ±  0%   8.877G ±   1%  +24.10% (p=0.002 n=6)
OTLPTraces-64               7.087G ±  0%   9.690G ±   7%  +36.72% (p=0.002 n=6)
geomean                     6.631G         8.231G         +24.13%

                          │        main.txt         │                  badger.txt                   │
                          │ mean_available_indexers │ mean_available_indexers  vs base              │
10000AggregationGroups-64                57.52 ± 0%                57.87 ± 1%  +0.62% (p=0.006 n=6)
1000Transactions-64                      55.62 ± 3%                55.72 ± 1%       ~ (p=0.234 n=6)
AgentAll-64                              54.25 ± 0%                54.25 ± 0%       ~ (p=0.719 n=6)
AgentGo-64                               54.45 ± 0%                54.43 ± 0%       ~ (p=0.370 n=6)
AgentNodeJS-64                           54.41 ± 0%                54.36 ± 0%  -0.09% (p=0.009 n=6)
AgentPython-64                           54.25 ± 0%                54.20 ± 0%  -0.09% (p=0.009 n=6)
AgentRuby-64                             54.36 ± 0%                54.31 ± 0%  -0.10% (p=0.009 n=6)
OTLPTraces-64                            54.85 ± 0%                55.30 ± 1%  +0.82% (p=0.004 n=6)
geomean                                  54.95                     55.04       +0.16%

                          │    main.txt    │               badger.txt               │
                          │  metrics/sec   │   metrics/sec    vs base               │
10000AggregationGroups-64   3.858k ±   22%    3.406k ±    8%  -11.71% (p=0.009 n=6)
1000Transactions-64          3.762 ± 4108%     3.747 ±   15%        ~ (p=0.937 n=6)
AgentAll-64                 10.72k ±    1%    10.31k ±    4%   -3.76% (p=0.002 n=6)
AgentGo-64                  4.374k ±    0%    4.289k ±    2%   -1.94% (p=0.002 n=6)
AgentNodeJS-64              3.263k ±    6%    3.496k ±    1%   +7.14% (p=0.002 n=6)
AgentPython-64              18.72k ±    4%    20.35k ±    0%   +8.74% (p=0.002 n=6)
AgentRuby-64                4.696k ±    2%    5.112k ±    2%   +8.85% (p=0.002 n=6)
OTLPTraces-64               89.27m ± 1515%   106.80m ± 1926%        ~ (p=0.589 n=6)
geomean                      602.7             620.3           +2.92%

                          │    main.txt    │              badger.txt              │
                          │   spans/sec    │  spans/sec    vs base                │
10000AggregationGroups-64   24.75k ± 37%     23.15k ± 63%       ~ (p=0.394 n=6)
1000Transactions-64         13.88m ±   ?     14.02m ±   ?       ~ (p=0.870 n=6)
AgentAll-64                 42.04k ±  1%     40.20k ±  4%  -4.39% (p=0.002 n=6)
AgentGo-64                  62.84k ±  1%     61.62k ±  2%  -1.94% (p=0.002 n=6)
AgentNodeJS-64              29.04k ±  6%     31.13k ±  1%  +7.20% (p=0.002 n=6)
AgentPython-64              36.07k ±  4%     39.22k ±  0%  +8.73% (p=0.002 n=6)
AgentRuby-64                37.68k ±  2%     41.02k ±  2%  +8.84% (p=0.002 n=6)
OTLPTraces-64                0.000 ±  0%      0.000 ±  0%       ~ (p=1.000 n=6) ¹
geomean                                  ²                 +1.47%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                          │   main.txt    │             badger.txt             │
                          │    txs/sec    │   txs/sec     vs base              │
10000AggregationGroups-64    13.74k ± 28%   12.77k ± 41%       ~ (p=0.485 n=6)
1000Transactions-64         100.18k ±  8%   96.38k ±  2%  -3.79% (p=0.002 n=6)
AgentAll-64                  15.99k ±  1%   15.29k ±  4%  -4.39% (p=0.002 n=6)
AgentGo-64                   26.14k ±  1%   25.63k ±  2%  -1.94% (p=0.002 n=6)
AgentNodeJS-64               21.43k ±  6%   22.98k ±  1%  +7.20% (p=0.002 n=6)
AgentPython-64               6.651k ±  4%   7.231k ±  0%  +8.73% (p=0.002 n=6)
AgentRuby-64                 19.39k ±  2%   21.10k ±  2%  +8.84% (p=0.002 n=6)
OTLPTraces-64                111.4k ±  3%   107.4k ±  2%  -3.60% (p=0.026 n=6)
geomean                      25.47k         25.55k        +0.31%

                          │    main.txt    │              badger.txt               │
                          │      B/op      │      B/op       vs base               │
10000AggregationGroups-64   263.6Mi ± 104%   283.8Mi ± 129%        ~ (p=0.093 n=6)
1000Transactions-64         16.19Mi ±   9%   17.76Mi ±   8%   +9.70% (p=0.026 n=6)
AgentAll-64                 501.3Mi ±   4%   502.3Mi ±   4%        ~ (p=0.132 n=6)
AgentGo-64                  100.8Mi ±   0%   102.2Mi ±   0%   +1.37% (p=0.002 n=6)
AgentNodeJS-64              66.32Mi ±   0%   66.26Mi ±   0%   -0.08% (p=0.009 n=6)
AgentPython-64              208.8Mi ±   0%   206.6Mi ±   0%   -1.07% (p=0.002 n=6)
AgentRuby-64                102.4Mi ±   0%   102.0Mi ±   1%   -0.41% (p=0.002 n=6)
OTLPTraces-64               12.47Ki ±   0%   15.15Ki ±   4%  +21.55% (p=0.002 n=6)
geomean                     37.27Mi          38.99Mi          +4.62%

                          │   main.txt   │             badger.txt             │
                          │  allocs/op   │  allocs/op    vs base              │
10000AggregationGroups-64   3.264M ± 15%   3.287M ± 29%       ~ (p=0.699 n=6)
1000Transactions-64         206.7k ±  7%   209.3k ±  8%       ~ (p=0.699 n=6)
AgentAll-64                 5.422M ±  3%   5.366M ±  6%       ~ (p=1.000 n=6)
AgentGo-64                  1.204M ±  0%   1.201M ±  0%  -0.29% (p=0.002 n=6)
AgentNodeJS-64              684.2k ±  0%   675.0k ±  0%  -1.34% (p=0.002 n=6)
AgentPython-64              2.105M ±  0%   2.077M ±  0%  -1.36% (p=0.002 n=6)
AgentRuby-64                1.235M ±  0%   1.223M ±  1%  -0.96% (p=0.002 n=6)
OTLPTraces-64                153.5 ±  0%    167.5 ±  4%  +9.12% (p=0.002 n=6)
geomean                     431.5k         434.6k        +0.71%

@kruskall
Copy link
Member Author

To reproduce:

Requirements:

apm-server.yml:

apm-server:
  host: "127.0.0.1:8200"
  expvar:
    enabled: true
  sampling.tail:
    enabled: true
    policies:
     - sample_rate: 1
output.elasticsearch:
  hosts: ["localhost:9200"]
  • run apm-server: go run ./x-pack/apm-server/. -e -c apm-server.yml -E apm-server.pprof.enabled=true
  • run moxy: git clone https://github.com/elastic/apm-perf && cd cmd/moxy && go run main.go
  • run benchmarks: cd systemtest && go run ./cmd/apmbench/. -run='Benchmark' -benchtime=2m -count=6 -warmup-time=5m -agents=64 -detailed=true -event-rate=0/s -cpuprofile=cpu.out -memprofile=mem.out

@marclop
Copy link
Contributor

marclop commented Oct 29, 2024

Looking at the benchmark results. Is it fair to say that memory usage increased by ~24-30% while throughput remained generally the same? Just to double check, main.txt are the results from the main branch with TBS enabled, right?

                          │    main.txt    │              badger.txt               │
                          │ max_heap_alloc │ max_heap_alloc  vs base               │
geomean                       3.245G          4.229G         +30.34%

                          │   main.txt   │              badger.txt              │
                          │   max_rss    │    max_rss     vs base               │
geomean                     6.631G         8.231G         +24.13%

                          │   main.txt    │             badger.txt             │
                          │  events/sec   │  events/sec   vs base              │
geomean                      71.62k         71.84k        +0.32%

@simitt
Copy link
Contributor

simitt commented Oct 29, 2024

Given the performance degression that upgrading to v4 would bring, @axw and I discussed following alternative:

Short term (8.16):

  • fork badger and point APM Server to the fork, still using v2
  • update beats version, which uses the v4 version of upstream badger

Are we overlooking some other version dependency problems here or should this solve the current issues without requiring us to update to v4 for the TBS logic ?

>= 8.17:

  • timebox the effort to take a closer look into v4 and whether the increased memory usage could easily be fixed and whether this would be worth it (what are problems caused by using v2 except for the library version conflicts).

@kruskall
Copy link
Member Author

Looking at the benchmark results. Is it fair to say that memory usage increased by ~24-30% while throughput remained generally the same? Just to double check, main.txt are the results from the main branch with TBS enabled, right?

Yes, that's correct 👍

Are we overlooking some other version dependency problems here or should this solve the current issues without requiring us to update to v4 for the TBS logic ?

I think we can workaround the issue by pinning the ristretto version (#14469). ristretto also retracted v1 and released v2 and badger already updated to it in main so once badger v4.4.0 is released we can drop the replace directive.

@kruskall
Copy link
Member Author

kruskall commented Oct 29, 2024

Opened PR for main (#14469), 8.x (#14470) and 8.16 (#14471)

@rubvs
Copy link
Contributor

rubvs commented Oct 29, 2024

For reference, I get more extreme results running it locally. The left is using elastic/main and the right is using kruskall/feat/badger-v4:

  • Cmd: go run ./cmd/apmbench/. -run='BenchmarkAgentAll' -benchtime=2m -count=6 -warmup-time=5m -agents=64 -detailed=true -event-rate=0/s -cpuprofile=cpu.out -memprofile=mem.out
            │ main-benchmark-result.txt │ bagder-benchmark-result.txt  │
            │          sec/op           │   sec/op     vs base         │
AgentAll-64                 112.4m ± 1%   105.6m ± 8%  ~ (p=0.065 n=6)

            │ main-benchmark-result.txt │      bagder-benchmark-result.txt       │
            │    error_responses/sec    │ error_responses/sec  vs base           │
AgentAll-64                  0.000 ± 0%            0.000 ± 0%  ~ (p=1.000 n=6) ¹
¹ all samples are equal

            │ main-benchmark-result.txt │ bagder-benchmark-result.txt  │
            │        errors/sec         │ errors/sec   vs base         │
AgentAll-64                 3.202k ± 1%   3.409k ± 7%  ~ (p=0.058 n=6)

            │ main-benchmark-result.txt │    bagder-benchmark-result.txt     │
            │        events/sec         │  events/sec   vs base              │
AgentAll-64                 66.32k ± 1%   70.71k ± 31%  +6.61% (p=0.002 n=6)

            │ main-benchmark-result.txt │  bagder-benchmark-result.txt   │
            │         gc_cycles         │   gc_cycles    vs base         │
AgentAll-64                 1.982k ± 8%   1.579k ± 590%  ~ (p=0.065 n=6)

            │ main-benchmark-result.txt │   bagder-benchmark-result.txt   │
            │      max_goroutines       │ max_goroutines  vs base         │
AgentAll-64                  185.5 ± 8%      193.0 ± 13%  ~ (p=0.093 n=6)

            │ main-benchmark-result.txt │      bagder-benchmark-result.txt       │
            │      max_heap_alloc       │ max_heap_alloc  vs base                │
AgentAll-64                 650.3M ± 3%    1374.3M ± 26%  +111.35% (p=0.002 n=6)

            │ main-benchmark-result.txt │       bagder-benchmark-result.txt       │
            │     max_heap_objects      │ max_heap_objects  vs base               │
AgentAll-64                 2.864M ± 4%       5.618M ± 33%  +96.18% (p=0.002 n=6)

            │ main-benchmark-result.txt │    bagder-benchmark-result.txt     │
            │          max_rss          │   max_rss    vs base               │
AgentAll-64                 1.068G ± 3%   1.895G ± 7%  +77.43% (p=0.002 n=6)

            │ main-benchmark-result.txt │       bagder-benchmark-result.txt        │
            │  mean_available_indexers  │ mean_available_indexers  vs base         │
AgentAll-64                  39.80 ± 0%                39.78 ± 0%  ~ (p=0.110 n=6)

            │ main-benchmark-result.txt │ bagder-benchmark-result.txt  │
            │        metrics/sec        │ metrics/sec  vs base         │
AgentAll-64                 24.47k ± 1%   26.06k ± 7%  ~ (p=0.065 n=6)

            │ main-benchmark-result.txt │    bagder-benchmark-result.txt     │
            │         spans/sec         │  spans/sec    vs base              │
AgentAll-64                 33.42k ± 1%   35.61k ± 38%  +6.56% (p=0.002 n=6)

            │ main-benchmark-result.txt │     bagder-benchmark-result.txt     │
            │          txs/sec          │    txs/sec     vs base              │
AgentAll-64                 5.231k ± 1%   5.562k ± 189%  +6.35% (p=0.002 n=6)

            │ main-benchmark-result.txt │  bagder-benchmark-result.txt  │
            │           B/op            │     B/op      vs base         │
AgentAll-64                456.3Mi ± 0%   451.6Mi ± 3%  ~ (p=0.065 n=6)

            │ main-benchmark-result.txt │ bagder-benchmark-result.txt  │
            │         allocs/op         │  allocs/op   vs base         │
AgentAll-64                 4.501M ± 0%   4.487M ± 4%  ~ (p=0.132 n=6)

@1pkg
Copy link
Member

1pkg commented Oct 30, 2024

Quickly running the same experiment and comparing the memory profiles difference between v4 and v2, it looks to be partially attributed to ristretto cache (as @kruskall mentioned above) it showed about +250MB of memory in use plus extra allocations.

Looking at the badger documentation for v2 and v4. It seems to track with the default BlockCacheSize size change from 0 to 256MB.

I ran two extra benchmarks with reducing the cache size down to 1MB and 0MB (for 0MB also compression has to be disabled link). Both runs indeed reduced memory usage and allocation but inflicted throughput penalties.

It seems that we need to adjust this cache size based on the available memory dynamically, similarly to how we configure go-docappender.

@kruskall
Copy link
Member Author

Further testing related to beats version:

  • tested that elastic-agent managed apm-server starts (installed elastic-agent, replaced apm-server binary with locally compiled version of this branch and made sure it started)
  • tested that environment flag works as intended (flag provided but not defined: -environment #14280)

@simitt
Copy link
Contributor

simitt commented Nov 8, 2024

For 8.16 a remediation of the issue was merged.
Going forward, let's do following
(1) Identify whether we can upgrade to v4 with the solution @1pkg suggested in #11546 (comment) without significant performance impact
(2) If (1) doesn't turn out to valid for 8.x, then evaluate whether the current state can be considered good enough for the next 8.x releases and the lifetime of 8.latest. If not, timebox investigations to e.g. fork badger v4 and see if modifications can be applied that would bring resource usage in alignment with current behavior
(3) Implement a v4 solution for 9.0.

@simitt
Copy link
Contributor

simitt commented Nov 29, 2024

@kruskall can you please update this issue with the latest evolvements and eventually close it.

@kruskall
Copy link
Member Author

kruskall commented Dec 2, 2024

A small summary of the current situation:

right now APM Server is using badger v2 and with a replace directive to avoid the compatibility issue with jaeger (can be dropped once the new jaeger version is out).

I think the current situation is unlikely to create issues in 8.x (especially that ristretto has proper versioning). Not sure if we want to close this or schedule it for 9.x.

@simitt
Copy link
Contributor

simitt commented Dec 9, 2024

Good to hear that this is fixed for 8.x.

For 9.0 IMO we should still find a solution with a supported badger version to avoid future problems with the unsupported version. @1pkg left a recommendation for variable cache settings, this could be worth looking into.

@axw what's your opinion on this?

@axw
Copy link
Member

axw commented Dec 9, 2024

Agreed, that would ideal, otherwise we may face similar issues in the future.

@carsonip
Copy link
Member

carsonip commented Dec 16, 2024

Looking at the badger documentation for v2 and v4. It seems to track with the default BlockCacheSize size change from 0 to 256MB.

I ran two extra benchmarks with reducing the cache size down to 1MB and 0MB (for 0MB also compression has to be disabled link). Both runs indeed reduced memory usage and allocation but inflicted throughput penalties.

Just ran some macro benchmarks by running apmbench -rewrite-ids -rewrite-timestamps -benchtime=5m -run=BenchmarkAgentAll sending to a local apm-server to ES on ESS.

Contrary to @1pkg 's observation, when setting compression to None and block cache to 0MB, badger v4 is able to maintain badger v2's throughput, which is 20% faster than badgerv4 with 256MB block cache and compression.

bench badgerv4 at commit 940de53 (disable block cache)
88k sampled decision/min
611k trace doc/min
BenchmarkAgentAll 205 1554709740 ns/op

bench badgerv4 at commit d175b05 (v4 with new default block cache)
70k sampled decision/min
458k trace doc / min
BenchmarkAgentAll 200 1944691602 ns/op

bench badger v2 at commit d1b93c9
80k sampled decision / minute
590k trace doc / minute
BenchmarkAgentAll 230 1591265861 ns/op

Haven't measured memory usage yet.

@1pkg
Copy link
Member

1pkg commented Dec 16, 2024

Looking at the badger documentation for v2 and v4. It seems to track with the default BlockCacheSize size change from 0 to 256MB.
I ran two extra benchmarks with reducing the cache size down to 1MB and 0MB (for 0MB also compression has to be disabled link). Both runs indeed reduced memory usage and allocation but inflicted throughput penalties.

Just ran some macro benchmarks by running apmbench -rewrite-ids -rewrite-timestamps -benchtime=5m -run=BenchmarkAgentAll sending to a local apm-server to ES on ESS.

Contrary to @1pkg 's observation, when setting compression to None and block cache to 0MB, badger v4 is able to maintain badger v2's throughput, which is 20% faster than badgerv4 with 256MB block cache and compression.

bench badgerv4 at commit 940de53 (disable block cache) 88k sampled decision/min 611k trace doc/min BenchmarkAgentAll 205 1554709740 ns/op

bench badgerv4 at commit d175b05 (v4 with new default block cache) 70k sampled decision/min 458k trace doc / min BenchmarkAgentAll 200 1944691602 ns/op

bench badger v2 at commit d1b93c9 80k sampled decision / minute 590k trace doc / minute BenchmarkAgentAll 230 1591265861 ns/op

Haven't measured memory usage yet.

@carsonip interesting results, I didn't log well the setup that I used last time and I don't think I spent much time doing the full benchmark last time (I think I ran BenchmarkAgentAll for 1m). So the results you got should be more comprehensive, I remember eyeballing memory profile the most last time and trying to correlate cache influence over allocations and memory in use.

@carsonip
Copy link
Member

carsonip commented Dec 30, 2024

Another set of result:
badgerv4 with no block cache and no compression: https://github.com/elastic/apm-server/actions/runs/12552649601

 BenchmarkAgentAll-512	     517	 293812872 ns/op	         0 error_responses/sec	      1225 errors/sec	     19828 events/sec	       674.0 gc_cycles	       722.0 max_goroutines	1247540176 max_heap_alloc	   4908214 max_heap_objects	1722654720 max_rss	        17.18 mean_available_indexers	      9372 metrics/sec	      8087 spans/sec	 269249778 tbs_lsm_size	 134217728 tbs_vlog_size	      1144 txs/sec	452575834 B/op	 4448204 allocs/op
BenchmarkAgentAll-512	     534	 293777333 ns/op	         0 error_responses/sec	      1225 errors/sec	     19826 events/sec	       712.0 gc_cycles	       770.0 max_goroutines	1282704480 max_heap_alloc	   4793181 max_heap_objects	1773473792 max_rss	        17.17 mean_available_indexers	      9369 metrics/sec	      8088 spans/sec	 335631722 tbs_lsm_size	 134217728 tbs_vlog_size	      1144 txs/sec	452331670 B/op	 4451153 allocs/op
BenchmarkAgentAll-512	     519	 292027168 ns/op	         0 error_responses/sec	      1233 errors/sec	     19948 events/sec	       678.0 gc_cycles	       818.0 max_goroutines	1306723000 max_heap_alloc	   4944887 max_heap_objects	1490796544 max_rss	        17.04 mean_available_indexers	      9428 metrics/sec	      8136 spans/sec	 335631722 tbs_lsm_size	 134217728 tbs_vlog_size	      1151 txs/sec	451642167 B/op	 4419291 allocs/op
BenchmarkAgentAll-512	     541	 287883835 ns/op	         0 error_responses/sec	      1251 errors/sec	     20238 events/sec	       706.0 gc_cycles	       763.0 max_goroutines	1333194952 max_heap_alloc	   4963839 max_heap_objects	1634623488 max_rss	        17.04 mean_available_indexers	      9567 metrics/sec	      8253 spans/sec	  88697585 tbs_lsm_size	 134217728 tbs_vlog_size	      1167 txs/sec	449497365 B/op	 4430850 allocs/op
BenchmarkAgentAll-512	     543	 286779792 ns/op	         0 error_responses/sec	      1255 errors/sec	     20309 events/sec	       729.0 gc_cycles	       713.0 max_goroutines	1301608576 max_heap_alloc	   5018192 max_heap_objects	1640165376 max_rss	        17.10 mean_available_indexers	      9597 metrics/sec	      8285 spans/sec	 155029303 tbs_lsm_size	 134217728 tbs_vlog_size	      1172 txs/sec	450746710 B/op	 4433983 allocs/op
BenchmarkAgentAll-512	     546	 287707868 ns/op	         0 error_responses/sec	      1251 errors/sec	     20251 events/sec	       734.0 gc_cycles	       767.0 max_goroutines	1280634840 max_heap_alloc	   5435747 max_heap_objects	1730379776 max_rss	        17.04 mean_available_indexers	      9573 metrics/sec	      8258 spans/sec	 221350652 tbs_lsm_size	 134217728 tbs_vlog_size	      1168 txs/sec	451534371 B/op	 4432700 allocs/op

badgerv2: https://github.com/elastic/apm-server/actions/runs/12552635217

 BenchmarkAgentAll-512	     572	 267784800 ns/op	         0 error_responses/sec	      1344 errors/sec	     20869 events/sec	       952.0 gc_cycles	       753.0 max_goroutines	1207824032 max_heap_alloc	   4913131 max_heap_objects	1408143360 max_rss	        16.89 mean_available_indexers	     10282 metrics/sec	      8182 spans/sec	  37541860 tbs_lsm_size	 183345982 tbs_vlog_size	      1061 txs/sec	451715199 B/op	 4444368 allocs/op
BenchmarkAgentAll-512	     565	 269016709 ns/op	         0 error_responses/sec	      1338 errors/sec	     20776 events/sec	       933.0 gc_cycles	       709.0 max_goroutines	1240518520 max_heap_alloc	   5207492 max_heap_objects	1478086656 max_rss	        16.87 mean_available_indexers	     10238 metrics/sec	      8144 spans/sec	  53320401 tbs_lsm_size	 214692101 tbs_vlog_size	      1056 txs/sec	451312216 B/op	 4440713 allocs/op
BenchmarkAgentAll-512	     574	 272609873 ns/op	         0 error_responses/sec	      1321 errors/sec	     20495 events/sec	       962.0 gc_cycles	       725.0 max_goroutines	1182068488 max_heap_alloc	   5338714 max_heap_objects	1379885056 max_rss	        16.92 mean_available_indexers	     10095 metrics/sec	      8037 spans/sec	  43066330 tbs_lsm_size	 237577720 tbs_vlog_size	      1042 txs/sec	452156798 B/op	 4447120 allocs/op
BenchmarkAgentAll-512	     552	 275493291 ns/op	         0 error_responses/sec	      1307 errors/sec	     20291 events/sec	       881.0 gc_cycles	       708.0 max_goroutines	1273591408 max_heap_alloc	   4850038 max_heap_objects	1473712128 max_rss	        17.02 mean_available_indexers	     10000 metrics/sec	      7953 spans/sec	  58684852 tbs_lsm_size	 278168532 tbs_vlog_size	      1031 txs/sec	451450872 B/op	 4452021 allocs/op
BenchmarkAgentAll-512	     552	 273019779 ns/op	         0 error_responses/sec	      1319 errors/sec	     20466 events/sec	       884.0 gc_cycles	       818.0 max_goroutines	1230219136 max_heap_alloc	   4735989 max_heap_objects	1419505664 max_rss	        17.18 mean_available_indexers	     10082 metrics/sec	      8025 spans/sec	  21571369 tbs_lsm_size	 274756399 tbs_vlog_size	      1040 txs/sec	450856114 B/op	 4435581 allocs/op
BenchmarkAgentAll-512	     570	 269757461 ns/op	         0 error_responses/sec	      1335 errors/sec	     20716 events/sec	       948.0 gc_cycles	       717.0 max_goroutines	1237488400 max_heap_alloc	   4942850 max_heap_objects	1444413440 max_rss	        16.87 mean_available_indexers	     10207 metrics/sec	      8122 spans/sec	  53011431 tbs_lsm_size	 303782492 tbs_vlog_size	      1053 txs/sec	452664715 B/op	 4454979 allocs/op

Similar throughput, but badgerv4 has 20% higher RSS, way bigger LSM tree (300MB vs 50MB) but smaller vlog (100MB vs 300MB). The badgerv4 vlog size number is slightly suspicious though, as it didn't change throughout the bench.

edit: this is likely because ValueThreshold default changed (from v2's 1KB to v4's 1MB). Now running another benchmark with old ValueThreshold default https://github.com/elastic/apm-server/actions/runs/12553135045

 BenchmarkAgentAll-512	     558	 271184501 ns/op	         0 error_responses/sec	      1328 errors/sec	     20843 events/sec	       754.0 gc_cycles	       714.0 max_goroutines	1355780912 max_heap_alloc	   5241900 max_heap_objects	1931968512 max_rss	        16.79 mean_available_indexers	     10156 metrics/sec	      8323 spans/sec	 125635879 tbs_lsm_size	 402728967 tbs_vlog_size	      1036 txs/sec	447709215 B/op	 4405174 allocs/op
BenchmarkAgentAll-512	     549	 275683243 ns/op	         0 error_responses/sec	      1306 errors/sec	     20497 events/sec	       749.0 gc_cycles	       815.0 max_goroutines	1296749000 max_heap_alloc	   5149035 max_heap_objects	1940828160 max_rss	        16.96 mean_available_indexers	      9985 metrics/sec	      8187 spans/sec	 188212772 tbs_lsm_size	 402728967 tbs_vlog_size	      1019 txs/sec	451210498 B/op	 4409505 allocs/op
BenchmarkAgentAll-512	     571	 268621270 ns/op	         0 error_responses/sec	      1340 errors/sec	     21039 events/sec	       797.0 gc_cycles	       705.0 max_goroutines	1339757624 max_heap_alloc	   5194449 max_heap_objects	2094338048 max_rss	        16.81 mean_available_indexers	     10250 metrics/sec	      8402 spans/sec	 188212772 tbs_lsm_size	 469846844 tbs_vlog_size	      1046 txs/sec	449995468 B/op	 4407970 allocs/op
BenchmarkAgentAll-512	     576	 268146774 ns/op	         0 error_responses/sec	      1343 errors/sec	     21078 events/sec	       805.0 gc_cycles	       756.0 max_goroutines	1352914096 max_heap_alloc	   5137124 max_heap_objects	2158350336 max_rss	        16.63 mean_available_indexers	     10271 metrics/sec	      8417 spans/sec	 188212772 tbs_lsm_size	 536956875 tbs_vlog_size	      1048 txs/sec	449767174 B/op	 4408331 allocs/op
BenchmarkAgentAll-512	     573	 264331259 ns/op	         0 error_responses/sec	      1362 errors/sec	     21376 events/sec	       800.0 gc_cycles	       709.0 max_goroutines	1303660552 max_heap_alloc	   4948301 max_heap_objects	1952133120 max_rss	        16.60 mean_available_indexers	     10413 metrics/sec	      8539 spans/sec	 188212772 tbs_lsm_size	 536956875 tbs_vlog_size	      1063 txs/sec	449499964 B/op	 4417294 allocs/op
BenchmarkAgentAll-512	     570	 266934885 ns/op	         0 error_responses/sec	      1349 errors/sec	     21178 events/sec	       797.0 gc_cycles	       759.0 max_goroutines	1330989600 max_heap_alloc	   5402435 max_heap_objects	1624690688 max_rss	        16.68 mean_available_indexers	     10322 metrics/sec	      8455 spans/sec	   4630926 tbs_lsm_size	 536956875 tbs_vlog_size	      1053 txs/sec	450338920 B/op	 4421283 allocs/op

main baseline without TBS:

 BenchmarkAgentAll-512	     411	 383330033 ns/op	         0 error_responses/sec	       939.1 errors/sec	     47018 events/sec	       565.0 gc_cycles	       625.0 max_goroutines	1115142296 max_heap_alloc	   5050585 max_heap_objects	1262100480 max_rss	         4.266 mean_available_indexers	      7188 metrics/sec	     28177 spans/sec	         0 tbs_lsm_size	         0 tbs_vlog_size	     10714 txs/sec	453692574 B/op	 4664216 allocs/op
BenchmarkAgentAll-512	     343	 360774837 ns/op	         0 error_responses/sec	       997.9 errors/sec	     49953 events/sec	       516.0 gc_cycles	       576.0 max_goroutines	1020916920 max_heap_alloc	   4729407 max_heap_objects	1173356544 max_rss	         3.858 mean_available_indexers	      7633 metrics/sec	     29938 spans/sec	         0 tbs_lsm_size	         0 tbs_vlog_size	     11384 txs/sec	454873847 B/op	 4655226 allocs/op
BenchmarkAgentAll-512	     416	 384988941 ns/op	         0 error_responses/sec	       935.1 errors/sec	     46813 events/sec	       566.0 gc_cycles	       626.0 max_goroutines	1125141296 max_heap_alloc	   5002849 max_heap_objects	1278767104 max_rss	         3.705 mean_available_indexers	      7155 metrics/sec	     28055 spans/sec	         0 tbs_lsm_size	         0 tbs_vlog_size	     10668 txs/sec	453788543 B/op	 4665925 allocs/op
BenchmarkAgentAll-512	     416	 379195022 ns/op	         0 error_responses/sec	       949.4 errors/sec	     47527 events/sec	       567.0 gc_cycles	       630.0 max_goroutines	1127567184 max_heap_alloc	   4995752 max_heap_objects	1277587456 max_rss	         3.676 mean_available_indexers	      7263 metrics/sec	     28484 spans/sec	         0 tbs_lsm_size	         0 tbs_vlog_size	     10831 txs/sec	453486057 B/op	 4667522 allocs/op
BenchmarkAgentAll-512	     436	 398601452 ns/op	         0 error_responses/sec	       903.2 errors/sec	     45212 events/sec	       583.0 gc_cycles	       647.0 max_goroutines	1183717800 max_heap_alloc	   5322880 max_heap_objects	1332019200 max_rss	         3.264 mean_available_indexers	      6908 metrics/sec	     27097 spans/sec	         0 tbs_lsm_size	         0 tbs_vlog_size	     10304 txs/sec	453641078 B/op	 4671397 allocs/op
BenchmarkAgentAll-512	     421	 388431534 ns/op	         0 error_responses/sec	       926.8 errors/sec	     46397 events/sec	       565.0 gc_cycles	       635.0 max_goroutines	1158023296 max_heap_alloc	   5236454 max_heap_objects	1289850880 max_rss	         3.692 mean_available_indexers	      7090 metrics/sec	     27807 spans/sec	         0 tbs_lsm_size	         0 tbs_vlog_size	     10573 txs/sec	453109836 B/op	 4667545 allocs/op

@raultorrecilla
Copy link

marked as Critical but in Pending refinement, therefore moving this from it105 to it106

@simitt
Copy link
Contributor

simitt commented Jan 13, 2025

@raultorrecilla agree that this is important for 9.0 and should get picked up in this iteration. As of for Pending Refinement, IMO it is part of this task to define the best path forward, building on the already shared investigations.

@carsonip
Copy link
Member

As discussed, alternatively, we may adopt pebble instead of badger if #15246 goes well. The target is still 9.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants