ztunnel icon indicating copy to clipboard operation
ztunnel copied to clipboard

Enhance ztunnel heap instrumentation

Open bleggett opened this issue 1 year ago • 5 comments

Right now ztunnel exposes gperftools endpoints for both profiles and heaps, as well as a standard pprof profile.

ATM the gperftools endpoints don't work very well, or at all.

We should probably consolidate on 1 profiler and one heap dumper, and make sure they both work - whether that's gperftools or something else (jemalloc was mentioned).

Whatever we DO pick needs to work equally well on arm64 and amd64, and needs to support remote analysis, ideally.

  • [x] Fix or replace gperftools to enable heap dumps: https://github.com/istio/ztunnel/pull/865
  • [ ] Investigate building with/enabling jemalloc by default, at least for non-release builds, possibly for release builds if it is not a perf hit (e.g. at one time Facebook left jemalloc on permanently in prod due to nonexistent perf hit: https://www.magiroux.com/rust-jemalloc-profiling/)

bleggett avatar Apr 02 '24 18:04 bleggett

https://github.com/polarsignals/rust-jemalloc-pprof or https://github.com/mkmik/heappy/ seem viable.

Prototype with heappy: https://github.com/howardjohn/ztunnel/pull/new/exp/heappy

howardjohn avatar Apr 02 '24 19:04 howardjohn

Yep, using https://github.com/polarsignals/rust-jemalloc-pprof, seems to work well enough.

bleggett avatar Apr 02 '24 23:04 bleggett

should https://github.com/istio/ztunnel/pull/865 close this one out?

ilrudie avatar Apr 03 '24 18:04 ilrudie

@ilrudie In https://github.com/istio/ztunnel/pull/865 we discussed using jemalloc as an always-on thing, or at least enabled by default for non-release builds.

I added that as another ticket item here, so we can keep this open for that.

bleggett avatar Apr 03 '24 18:04 bleggett

seems the second task has be completed, maybe we can close it.

daixiang0 avatar Apr 11 '24 04:04 daixiang0