Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
加速你的Ansible
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Eric
April 28, 2018
Technology
1.7k
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
加速你的Ansible
2018/04/28@DevOps Taiwan Meetup
https://devops.kktix.cc/events/meetup13-0428
Eric
April 28, 2018
More Decks by Eric
See All by Eric
30座EKS, 180次升級淬煉的EKS Upgrade Skill 的歷程
eric8230
0
240
用恐龍書剖析 AWS Legacy Infra 的效能瓶頸
eric8230
0
88
伸長自如的磁碟空間
eric8230
0
460
Other Decks in Technology
See All in Technology
DevelopersIO 2026 知識の地図を描く ─ オントロジーとは何か?
ishikawa_satoru
1
320
go-sqletch
moznion
0
110
Deep Data Security 機能解説
oracle4engineer
PRO
2
720
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
3
4.8k
あなたの知らないAmazon VPC Route Server/Amazon VPC Route Server you don't know about
masakiokuda
2
230
ファミコンでPHPを動かす / PHP on the Famicom side b
tomzoh
0
140
UniFi(ユニファイ)AIカメラの現場活用
ludicmind
1
210
並行性の問題を防げ!実践トランザクション入門
occhi
0
280
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
290
継続的なAIコスト最適化
bgpat
1
230
メルペイ 会計システム概要と歴史
mewuto
0
190
分析AIエージェントを育てる、動く環境を育てる
codatum
1
360
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
The Invisible Side of Design
smashingmag
301
52k
Ethics towards AI in product and experience design
skipperchong
2
420
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
340
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
470
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
WENDY [Excerpt]
tessaabrams
14
40k
Claude Code のすすめ
schroneko
67
230k
The browser strikes back
jonoalderson
0
1.8k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Transcript
加速你的Ansible 王仁宏 aka Eric 2018/04/28 @ DevOps Taiwan
Hi , I’m Eric
Ansible新手 (請大家鞭小力一點)
Agenda 1. 故事起源 2. Ansible加速 3. Q&A
故事起源 1. Ansible新手上路第一個月 2. 剛推坑同事使用 3. 該次部署主機群數量約150台 4. 新增一個檔案、刪除一個檔案
同事說... 雖然比以前土炮部署舒服, 但Ansible執行速度好慢...
http://i.imgur.com/CrMWH0h.jpg
於是開始思考,到底慢在哪裡。
收集執行時間數據 ansible-profile vim /etc/ansible/ansible.cfg callback_whitelist = profile_tasks :wq
None
150台的佈署時間 (調整前) 1. gathering facts時間約530秒 2. 新增一個檔案時間約18秒 3. 刪除一個檔案時間約17秒
565 秒
幾個小調整 1. Disable gathering facts (視情況) 2. Fork Process (ansible-playbook
-f n)
150台的佈署時間 (調整後-1) 1. gathering facts時間約530秒 -> 0秒 2. 新增一個檔案時間約18秒 ->
11秒 3. 刪除一個檔案時間約17秒 -> 10秒
21 秒
https://i.ytimg.com/vi/nYQyy7ZyOA8/hqdefault.jpg
沒有最快,只有更快。
Ansible ssh + python
那就從ssh開始動手腳吧。
SSH 連線再利用 1. SSH PIPELINING (視情況) 2. SSH Control Persist
SSH PIPELINING vim /etc/ansible/ansible.cfg pipelining=True :wq
SSH Control Persist OpenSSH 5.6 或更高 vim ~/.ssh/config Host *
ControlPersist 1h Compression yes ControlMaster auto ControlPath ~/.ssh/sockets/%r@%h-%p :wq // 連線持久化保留1小時 // 啟用壓縮 // ssh連線共用 //socket保存路徑
http://7.share.photo.xuite.net/leonchen01/176b299/8118575/320468842_m.jpg
150台的佈署時間 (調整後-2) 1. gathering facts 花費時間約0秒 2. 新增一個檔案的時間約11秒 -> 11秒
3. 刪除一個檔案的時間約10秒 -> 4秒
15 秒
150台的佈署時間 (調整後-2) 1. gathering facts 花費時間約0秒 2. 新增一個檔案的時間約11秒 -> 4秒
3. 刪除一個檔案的時間約4秒
8秒 以後部署不用一首歌的時間,8秒就足夠 XD
同事說... 這速度跑起來好爽阿...
總結 1. Ansible-profile 收集數據 2. Disable gathering facts (視情況) 3.
Fork Process (ansible-playbook -f n) 4. SSH PIPELINING (視情況) 5. SSH Control Persist (OpenSSH 5.6 或更高)
Thanks. ericwang8230 [at] gmail.com
Q&A 歡迎大家回饋建議