SlideShare a Scribd company logo
1 of 37
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Perl と Perl 以外の運用について
吉祥寺.pm #4
July 10, 2015
Kiyoshi Yasutake
DeNA Co., Ltd.
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
自己紹介
 安武 貴世志
 @key_amb (きいあむ)
 DeNA でインフラやってます。
2
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Perl と
Perl 以外
の運用について
3
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Web
アプリケーション
の「運用」って?
4
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
データセンター
イメージ
5
データ
ストア
Webサーバ
OS・ミドル
ウェア
物理筐体
WebApp Query
Network
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
データセンター
イメージ
6
データ
ストア
Webサーバ
OS・ミドル
ウェア
物理筐体
WebApp Query
Network
アプリケーションエンジニア
の守備範囲
インフラエンジニア
の守備範囲
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Web アプリケーションの運用で考えるべきこと
 Web アプリケーションレイヤ
⁃ 性能, 応答速度
⁃ 安定性, セキュリティ
⁃ デプロイ, メンテナンス
⁃ ロギング
⁃ ライブラリ管理
 サーバレイヤ
⁃ リソースを使いすぎていないか
 データストアに対して
⁃ よくない使い方をしてないか
• 例) クソクエリ, ループ内でのクエリ発行, etc.
7
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
本題
8
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
本日の参考資料: Perl
 Mobageを支える技術~ソーシャ
ルゲームの舞台裏~ (2012)
 Perl や大規模インフラ運用のノ
ウハウが詰まっています。
9
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
本日の参考資料: Ruby
 Mobageを支えるRubyの技術〜
複数DB編〜 @sonots (2014)
 この資料はDB中心ですが、DB以
外も整備されています。
 参考:
⁃ 運用を楽にするためのアプリケー
ションコードを書くということ -
sonots:blog
10
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
今日話す項目
 ホットデプロイ
 Max Requests Per Worker
 社内 module/gem リポジトリ
 DNS ルックアップ
 プロファイラ
 バックトレース
 サーバ情報の取得
 ロギング
11
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
ホットデプロイ
12
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Server::Starter
13
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Daemontools w/ Server::Starter
 https://github.com/kazuho/p5-Server-Starter
 Server::Starterから学ぶhot deployの仕組み - $shibayu36->blog;
 Ruby でも Server::Starter
⁃ Server::Starterに対応するとはどういうことか - Limitの日記
⁃ 「Server::Starterに対応するとはどういうことか」の補足 - sonots:blog
14
start_server
plackup(親)
plackup(子)
plackup(親) plackup(子)
SIGHUP
current
new
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Max Requests
Per Worker
15
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Max Requests Per Worker
 一定リクエスト受け付けた後、ワーカープロセスが exit し、ワーカーを
再生成する
 メモリリーク対策
 Perl
⁃ Starlet の場合
⁃ --max-reqs-per-child, --min-reqs-per-child オプション
 Ruby
⁃ kzk/unicorn-worker-killer for Unicorn
⁃ use Unicorn::WorkerKiller::MaxRequests, <min>, <max>
16
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
社内
module/gem
リポジトリ
17
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
社内 module/gem リポジトリ
Perl Modules Ruby Gems
社内サイト DeNAPAN RubyGems ミラー
GitHub:e Baran Organization Dino Organization
18
 GitHub:e => Webhook で社内サイトに配置
図: 割り箸・名入れ箸袋・業務用資材なら
いい割り箸どっとこむ-バラン(両山型)
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Dino の由来
19
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
DNS ルックアップ
20
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
MyDNS + Unbound
21
MyDNS
WebApp
unbound
127.0.0.1
db_user_s.xxx.local:
- (xxd01, 100)
- (xxd02, 50)
- (xxd03, 0)
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
問題点
 Unbound 経由だと…
⁃ 重みの情報が失われる
⁃ DNSレコードのTTLの間、名前解決したIPの順番が固定になる
• さっきの例だと (xxd01, xxd02) という順番
⁃ 重み 0 のレコードが取れない
• スタンバイサーバを重み 0 で入れている
• 例えば slave が全滅したときのために master を重み 0 で入れる
22
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
DNS ルックアップのためのライブラリ
 Perl
⁃ Baran::Net::DNS::ResolveKetama
⁃ Mobage::Memcached
 Ruby
⁃ dino/resolver_mydns
 仕組み
⁃ Unbound を介さない
• 独自のキャッシュ機構(例:ファイルキャッシュ)
⁃ MyDNS DB から直接 SELECT する
⁃ Weighted Round-robin 対応
⁃ 重み 0 へのフォールバック
⁃ Consistent Hashing (Mobage::Memcached)
23
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
プロファイラ
24
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Devel::NYTProf for Perl
 https://metacpan.org/pod/Devel::NYTProf
25
図: http://aplawrence.com/Unix/nytprof.html
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
NewRelic for Ruby
 http://newrelic.com/
26
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
バックトレース
27
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
gdbperl.pl と gdbruby.rb
 プロセスや core のバックトレースを出力する
 固まった時やクラッシュするときに使える
 https://github.com/ahiguti/gdbperl
⁃ http://www.slideshare.net/akirahiguchi/gdbperl
 https://github.com/gunyarakun/gdbruby
⁃ http://blog.wktk.co.jp/ja/entry/2013/10/30/gdbruby
28
$ gdbperl.pl <pid>
$ gdbperl.pl <corefilepath> <path of perl>
$ gdbruby.rb <pid>
$ gdbruby.rb <corefilepath> <path of ruby>
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Admintool
クライアント
29
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Admintool
30
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
Admintool
 DeNA のサーバ情報を一元管理しているツール
 クライアントライブラリ:
⁃ Perl
• Admin::Host
• Global Infra
⁃ get-hosts … CLI
⁃ Ruby
• dino/dino-host
31
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
ロギング
32
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
ロギング
 ログ監視の都合上、ファイルパスやフォーマットをある程度決めたい
 エラーログ系
⁃ xxx.err.log.YYYYMMDD など
⁃ Perl: MLog (Mobage), etc.
⁃ Ruby: dino/m_log
 パフォーマンスログ
⁃ アプリケーションの処理で費やされた時間を記録
⁃ Ruby: dino/rack-performance_log
33
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
まとめ
34
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
まとめ
 DeNA では Mobage / ソーシャルゲームの成長を通して Perl アプリケ
ーションの運用ノウハウをたくさん蓄積してきました。
 Ruby アプリケーションにおいても、ほぼ同水準の運用を達成しつつあ
ります。
 新しい言語の運用を整えるのはそれなりに大変です。
 アプリケーション  インフラのプロトコル部分を整えるだけなら、そ
れほどでもないと思います。
35
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
〜 We Are Hiring!! 〜
36
 http://dena.com/jp/recruit/career/engineer/
 http://denagames-tokyo.jp/
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
37
Thank You!!

More Related Content

Recently uploaded

論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfクラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfFumieNakayama
 
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...博三 太田
 
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案sugiuralab
 
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfAWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfFumieNakayama
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)UEHARA, Tetsutaro
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 

Recently uploaded (12)

論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfクラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
 
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
 
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
 
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfAWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

PerlとPerl以外の運用 #kichijojipm

  • 1. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Perl と Perl 以外の運用について 吉祥寺.pm #4 July 10, 2015 Kiyoshi Yasutake DeNA Co., Ltd.
  • 2. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 自己紹介  安武 貴世志  @key_amb (きいあむ)  DeNA でインフラやってます。 2
  • 3. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Perl と Perl 以外 の運用について 3
  • 4. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Web アプリケーション の「運用」って? 4
  • 5. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. データセンター イメージ 5 データ ストア Webサーバ OS・ミドル ウェア 物理筐体 WebApp Query Network
  • 6. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. データセンター イメージ 6 データ ストア Webサーバ OS・ミドル ウェア 物理筐体 WebApp Query Network アプリケーションエンジニア の守備範囲 インフラエンジニア の守備範囲
  • 7. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Web アプリケーションの運用で考えるべきこと  Web アプリケーションレイヤ ⁃ 性能, 応答速度 ⁃ 安定性, セキュリティ ⁃ デプロイ, メンテナンス ⁃ ロギング ⁃ ライブラリ管理  サーバレイヤ ⁃ リソースを使いすぎていないか  データストアに対して ⁃ よくない使い方をしてないか • 例) クソクエリ, ループ内でのクエリ発行, etc. 7
  • 8. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 本題 8
  • 9. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 本日の参考資料: Perl  Mobageを支える技術~ソーシャ ルゲームの舞台裏~ (2012)  Perl や大規模インフラ運用のノ ウハウが詰まっています。 9
  • 10. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 本日の参考資料: Ruby  Mobageを支えるRubyの技術〜 複数DB編〜 @sonots (2014)  この資料はDB中心ですが、DB以 外も整備されています。  参考: ⁃ 運用を楽にするためのアプリケー ションコードを書くということ - sonots:blog 10
  • 11. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 今日話す項目  ホットデプロイ  Max Requests Per Worker  社内 module/gem リポジトリ  DNS ルックアップ  プロファイラ  バックトレース  サーバ情報の取得  ロギング 11
  • 12. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ホットデプロイ 12
  • 13. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Server::Starter 13
  • 14. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Daemontools w/ Server::Starter  https://github.com/kazuho/p5-Server-Starter  Server::Starterから学ぶhot deployの仕組み - $shibayu36->blog;  Ruby でも Server::Starter ⁃ Server::Starterに対応するとはどういうことか - Limitの日記 ⁃ 「Server::Starterに対応するとはどういうことか」の補足 - sonots:blog 14 start_server plackup(親) plackup(子) plackup(親) plackup(子) SIGHUP current new
  • 15. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Max Requests Per Worker 15
  • 16. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Max Requests Per Worker  一定リクエスト受け付けた後、ワーカープロセスが exit し、ワーカーを 再生成する  メモリリーク対策  Perl ⁃ Starlet の場合 ⁃ --max-reqs-per-child, --min-reqs-per-child オプション  Ruby ⁃ kzk/unicorn-worker-killer for Unicorn ⁃ use Unicorn::WorkerKiller::MaxRequests, <min>, <max> 16
  • 17. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 社内 module/gem リポジトリ 17
  • 18. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 社内 module/gem リポジトリ Perl Modules Ruby Gems 社内サイト DeNAPAN RubyGems ミラー GitHub:e Baran Organization Dino Organization 18  GitHub:e => Webhook で社内サイトに配置 図: 割り箸・名入れ箸袋・業務用資材なら いい割り箸どっとこむ-バラン(両山型)
  • 19. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Dino の由来 19
  • 20. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. DNS ルックアップ 20
  • 21. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. MyDNS + Unbound 21 MyDNS WebApp unbound 127.0.0.1 db_user_s.xxx.local: - (xxd01, 100) - (xxd02, 50) - (xxd03, 0)
  • 22. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 問題点  Unbound 経由だと… ⁃ 重みの情報が失われる ⁃ DNSレコードのTTLの間、名前解決したIPの順番が固定になる • さっきの例だと (xxd01, xxd02) という順番 ⁃ 重み 0 のレコードが取れない • スタンバイサーバを重み 0 で入れている • 例えば slave が全滅したときのために master を重み 0 で入れる 22
  • 23. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. DNS ルックアップのためのライブラリ  Perl ⁃ Baran::Net::DNS::ResolveKetama ⁃ Mobage::Memcached  Ruby ⁃ dino/resolver_mydns  仕組み ⁃ Unbound を介さない • 独自のキャッシュ機構(例:ファイルキャッシュ) ⁃ MyDNS DB から直接 SELECT する ⁃ Weighted Round-robin 対応 ⁃ 重み 0 へのフォールバック ⁃ Consistent Hashing (Mobage::Memcached) 23
  • 24. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. プロファイラ 24
  • 25. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Devel::NYTProf for Perl  https://metacpan.org/pod/Devel::NYTProf 25 図: http://aplawrence.com/Unix/nytprof.html
  • 26. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. NewRelic for Ruby  http://newrelic.com/ 26
  • 27. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. バックトレース 27
  • 28. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. gdbperl.pl と gdbruby.rb  プロセスや core のバックトレースを出力する  固まった時やクラッシュするときに使える  https://github.com/ahiguti/gdbperl ⁃ http://www.slideshare.net/akirahiguchi/gdbperl  https://github.com/gunyarakun/gdbruby ⁃ http://blog.wktk.co.jp/ja/entry/2013/10/30/gdbruby 28 $ gdbperl.pl <pid> $ gdbperl.pl <corefilepath> <path of perl> $ gdbruby.rb <pid> $ gdbruby.rb <corefilepath> <path of ruby>
  • 29. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Admintool クライアント 29
  • 30. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Admintool 30
  • 31. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Admintool  DeNA のサーバ情報を一元管理しているツール  クライアントライブラリ: ⁃ Perl • Admin::Host • Global Infra ⁃ get-hosts … CLI ⁃ Ruby • dino/dino-host 31
  • 32. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ロギング 32
  • 33. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ロギング  ログ監視の都合上、ファイルパスやフォーマットをある程度決めたい  エラーログ系 ⁃ xxx.err.log.YYYYMMDD など ⁃ Perl: MLog (Mobage), etc. ⁃ Ruby: dino/m_log  パフォーマンスログ ⁃ アプリケーションの処理で費やされた時間を記録 ⁃ Ruby: dino/rack-performance_log 33
  • 34. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. まとめ 34
  • 35. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. まとめ  DeNA では Mobage / ソーシャルゲームの成長を通して Perl アプリケ ーションの運用ノウハウをたくさん蓄積してきました。  Ruby アプリケーションにおいても、ほぼ同水準の運用を達成しつつあ ります。  新しい言語の運用を整えるのはそれなりに大変です。  アプリケーション  インフラのプロトコル部分を整えるだけなら、そ れほどでもないと思います。 35
  • 36. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 〜 We Are Hiring!! 〜 36  http://dena.com/jp/recruit/career/engineer/  http://denagames-tokyo.jp/
  • 37. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 37 Thank You!!