Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Goのパフォーマンス改善

koya fukushi
August 04, 2017
910

 Goのパフォーマンス改善

koya fukushi

August 04, 2017
Tweet

Transcript

  1. 下記のプロファイリングが可能 1. goroutine 2. heap 3. threadcreate 4. block 5.

    mutex 6. cpu pprofについて heapのGC・アロケーション
  2. pprofについて 下記のプロファイリングが可能 1. goroutine 2. heap 3. threadcreate 4. block

    5. mutex 6. cpu wait状態のgoroutine(mutexのみ)(go1.8から追加)
  3. 下記のプロファイリングが可能 1. goroutine 2. heap 3. threadcreate 4. block 5.

    mutex 6. cpu pprofについて この2つについて話します
  4. pprofを使う できたプロファイルを - CPU % go tool pprof slice.test cpu.out

    - Heap % go tool pprof slice.test --alloc_space mem.out
  5. pprofを使う または - CPU % go tool pprof http://localhost:6060/debug/pprof/profile -

    Heap % go tool pprof http://localhost:6060/debug/pprof/heap
  6. まとめ - 地道 - 正しく 計測することが大切 - ローカルでプロファイル作るなら、ちゃんと偏らないように Benchmark書く -

    実行するたびに数字が微妙に増減するので、何度もやってみる - Goの知識が必要 - ボトルネックがわかっても、改善する方法を知らないと、、 - https://github.com/golang/go/wiki/Performance - https://github.com/golang/go/wiki/CompilerOptimizations - https://blog.golang.org/profiling-go-programs - などなど