Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
加速你的Ansible
Search
Eric
April 28, 2018
Technology
1.6k
5
Share
加速你的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
用恐龍書剖析 AWS Legacy Infra 的效能瓶頸
eric8230
0
60
伸長自如的磁碟空間
eric8230
0
440
Other Decks in Technology
See All in Technology
20260410 - CNTUG meetup #72 - DiskImage Builder 介紹:以 Kubespray CI 打造 RockyLinux 10 Cloud Image 為例
tico88612
0
110
Cortex Codeでデータの仕事を全部Agenticにやりきろう!
gappy50
0
350
インフラを Excel 管理していた組織が 3 ヶ月で IaC 化されるまで
geekplus_tech
3
170
Babylon.js を使って試した色々な内容 / Various things I tried using Babylon.js / Babylon.js 勉強会 vol.5
you
PRO
0
270
推し活エージェント
yuntan_t
1
900
Discordでリモートポケカしてたら、なぜかDOを25分間動かせるようになった話
umireon
0
120
BIツール「Omni」の紹介 @Snowflake中部UG
sagara
0
260
システムは「動く」だけでは 足りない - 非機能要件・分散システム・トレードオフの基礎
nwiizo
25
7.9k
新規サービス開発におけるReact Nativeのリアル〜技術選定の裏側と実践的OSS活用〜
grandbig
2
180
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
1.4k
ログ基盤・プラグイン・ダッシュボード、全部整えた。でも最後は人だった。
makikub
5
1.3k
プロダクトを育てるように生成AIによる開発プロセスを育てよう
kakehashi
PRO
1
920
Featured
See All Featured
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
100
The Language of Interfaces
destraynor
162
26k
How to train your dragon (web standard)
notwaldorf
97
6.6k
Into the Great Unknown - MozCon
thekraken
40
2.3k
4 Signs Your Business is Dying
shpigford
187
22k
Code Review Best Practice
trishagee
74
20k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.3k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Done Done
chrislema
186
16k
Writing Fast Ruby
sferik
630
63k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
290
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 歡迎大家回饋建議