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

请问graph如何利用pprof进行内存分析? #905

Open
JimmyTinsley opened this issue Oct 9, 2020 · 3 comments
Open

请问graph如何利用pprof进行内存分析? #905

JimmyTinsley opened this issue Oct 9, 2020 · 3 comments

Comments

@JimmyTinsley
Copy link
Contributor

现在遇到了graph内存缓慢持续上涨的情况, 想参照这篇文章 https://juejin.im/post/6844903855386263559 进行内存分析, 但是对graph的http端口加上 /debug/pprof 路径无法获得内存使用信息, 请问应该如何分析graph组件的内存找到故障原因?

@JimmyTinsley
Copy link
Contributor Author

我自己查了一下原因.
由于graph模块使用了gin当做http框架, 而不是直接使用的net/http. gin框架接管了路由, 所以导致直接引入net/http/pprof这种方式理应注册的/debug/pprof路由路径没有生效

_ "net/http/pprof"

同样的问题还出现在api和alarm组件里. 其他组件由于使用的是net/http, 所以pprof都是可以正常使用的.

gin框架如果想使用pprof, 需要手动添加/debug/pprof/*的路由, 或者是使用https://github.com/gin-contrib/pprof 这个包, 但是这个包目前需要gin v1.6.3及以上的版本, 即使是它的最初版本也需要gin v1.3.0及以上的版本

https://github.com/gin-contrib/pprof/blob/506e7fc714ea7f2dfd31745ca8430d006733f6ff/go.mod#L5

falcon-plus现在govendor中的gin版本还停留在v1.1.4, 请问能否提个PR升级一下?

@laiwei
Copy link
Member

laiwei commented Oct 16, 2020

可以升级gin:) 欢迎 PR @JimmyTinsley

@laiwei
Copy link
Member

laiwei commented Oct 23, 2020

PR #906

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

No branches or pull requests

2 participants