Slide 1

Slide 1 text

Jagu'e'r Observability-SRE分科会 Meetup#7 Cloud Profilerで探る
 見えなかったボトルネックの解消法


Slide 2

Slide 2 text

AGENDA 1. Cloud Profilerとは? 2. Cloud Profilerを使ったパフォーマンス改善例 3. Cloud Profilerで困っているところ

Slide 3

Slide 3 text

©Commune Inc. All rights reserved 3 川岡 潤
 コミューン株式会社 開発部 SREチーム
 XX
 XX
 
 XX
 Jun Kawaoka
 インフラエンジニアや管理職を経てコミューンへの転職を機にSREsへジョブ チェンジ。あらゆる組織とひとが融け合うためのプロダクトを開発しています。 プライベートではBacklogユーザー会JBUGの運営、CloudNative Days実 行委員、町内会のデジタル担当など、公私共に
 コミュニティを中心に生活しています。
 自己紹介


Slide 4

Slide 4 text

Cloud Profilerとは? 1

Slide 5

Slide 5 text

©Commune Inc. All rights reserved 5 Cloud Profilerとは?
 本番環境アプリケーションから CPU 使用率とメモリ割り当てに関 する情報を継続的に収集する、オーバーヘッドの少ないプロファイ ラです。
 https://cloud.google.com/profiler/docs?hl=ja


Slide 6

Slide 6 text

©Commune Inc. All rights reserved 6 継続的プロファイリング
 https://cloud.google.com/profiler/docs/concepts-profiling?hl=ja
 本番環境で実行中のアプリケーションをプロファイリングすること です。


Slide 7

Slide 7 text

©Commune Inc. All rights reserved 7 O11yの4本目の柱と紹介している記事がある 
 継続的プロファイリング
 https://pyroscope.io/blog/profiling-go-apps-with-pyroscope/#future-roadmap
 Continuous profiling has become an increasingly popular tool for the monitoring and debugging of performance issues (arguably the fourth pillar of observability).


Slide 8

Slide 8 text

©Commune Inc. All rights reserved 8 Cloud ProfilerのUI
 https://cloud.google.com/profiler/docs/about-profiler?hl=ja


Slide 9

Slide 9 text

©Commune Inc. All rights reserved 9 のアーキテクチャー


Slide 10

Slide 10 text

©Commune Inc. All rights reserved 10 Cloud Profilerのサポート環境
 https://cloud.google.com/profiler/docs/about-profiler?hl=ja#types_of_profiling_available


Slide 11

Slide 11 text

Cloud Runは サポートされていない🥺

Slide 12

Slide 12 text

©Commune Inc. All rights reserved 12 問題があればすぐに切り戻す予定でしたが問題なく動いてます(導入は自己責任で) 
 山口さんのセッションを見て勇気をもらった
 https://cloudnativedays.jp/cndf2023/talks/1840


Slide 13

Slide 13 text

©Commune Inc. All rights reserved 13 TypeScriptの場合わずかこれだけ!
 ということで導入しました
 import { start as startProfiler } from '@google-cloud/profiler'
 
 const shortSha = process.env.SHORT_SHA || 'unknown'
 startProfiler({
 serviceContext: {
 service: SERVICE_NAME,
 version: shortSha,
 },
 }).catch(error => {
 // This error does not directly affect the operation of the application
 logger.warning(`[startProfiler] Google Cloud Profiler - ${error}`)
 })


Slide 14

Slide 14 text

Cloud Profilerを使った パフォーマンス改善例 2

Slide 15

Slide 15 text

©Commune Inc. All rights reserved 15 30秒以上かかる処理を見つけた


Slide 16

Slide 16 text

©Commune Inc. All rights reserved 16 Cloud Traceを見てもよくわからない


Slide 17

Slide 17 text

©Commune Inc. All rights reserved 17 プロファイルをよく見てみる


Slide 18

Slide 18 text

©Commune Inc. All rights reserved 18 日時のフォーマットをやめてみると


Slide 19

Slide 19 text

©Commune Inc. All rights reserved 19 ここまでわかると打ち手を考えられる
 1. フォーマットの実行場所や方法を変更
 2. フォーマットに使うライブラリを変更


Slide 20

Slide 20 text

©Commune Inc. All rights reserved 20 時間が約1/3になった!


Slide 21

Slide 21 text

Cloud Profilerのおかげで パフォーマンス改善できた🎉

Slide 22

Slide 22 text

Cloud Profilerで 困っているところ 3

Slide 23

Slide 23 text

©Commune Inc. All rights reserved 23 プロファイル数が少ない場合は探りやすい


Slide 24

Slide 24 text

©Commune Inc. All rights reserved 24 多いと何が問題なのかわかりづらい


Slide 25

Slide 25 text

Cloud Profilerを もっと有効活⽤するには?🤔

Slide 26

Slide 26 text

最後に宣伝です📢

Slide 27

Slide 27 text

©Commune Inc. All rights reserved 27 CloudNative Days Summer 2024 開催します!
 2024/6/15(土)
 札幌コンベンションセンター
 ハイブリッド開催
 
 6月の北海道は最高なのでぜひ
 梅雨がないので爽やか!!
 ウニが美味しい!!!


Slide 28

Slide 28 text

©Commune Inc. All rights reserved 28 コミューンはあなたのキャリアを実現するビークルです!


Slide 29

Slide 29 text

29 ©Commune Inc. All rights reserved