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

optimize: reduce memory usage by reading kallsyms only in the trace command #700

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

seiuneko
Copy link
Contributor

@seiuneko seiuneko commented Nov 18, 2024

Background

Currently, reading kallsyms during program loading causes unnecessary high memory usage, while kallsyms is only used in the trace command. Therefore, this patch changes it to initialize kallsyms before executing the trace command.

Checklist

Full Changelogs

  • read kallsyms only in the trace command

Test Result

Configuration

global{ pprof_port: 12333 }
routing{}

Use go tool pprof -http=:8080 http://localhost:12333/debug/pprof/heap to generate the flame graph.

Screenshot

Lowers RSS usage from 194 MiB to 75 MiB.

Before:
pprof_before
htop_before

After:
pprof_after
htop_after

…ommand

lowers RSS usage from 196 MiB to 77 MiB using a minimal bootable config
@jschwinger233
Copy link
Member

很喜欢这种以观测、profile来查找性能、内存问题的方式,谢谢!

@mzz2017
Copy link
Contributor

mzz2017 commented Nov 18, 2024

Nice catch

Copy link
Contributor

@dae-prow dae-prow bot left a comment

Choose a reason for hiding this comment

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

🧪 Since the PR has been fully tested, please consider merging it.

@mzz2017 mzz2017 merged commit 53b5fed into daeuniverse:main Nov 18, 2024
25 checks passed
@dae-prow dae-prow bot mentioned this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants