3. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
話者紹介
赤羽根 州晴(@akahane92)
島津製作所 業務系システム子会社
・ソフトウェア開発技術者
↓障害対策専任
↓内部統制
・基盤技術標準化 (現在)
3
参加団体
・Redmine大阪
・AFFORDD 関西部会
4. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
お話しすること
4
1)200万チケットでもサクサク動くRedmineの全レシピ*
2)Redmine2.6 を 3.4 へUpdateすると平均で○○%速くなる
3)Ruby2.0 を 2.4 へUpdateすると平均で○○%速くなる
4)HDDをSSDに変更すると平均で○○%速くなる
5)非索引型の全文検索は○○万チケットで性能限界に到達するが、
FTS-Pluginの導入によって○○倍速くなり、
200万チケットの環境で平均○○~○○秒で全文検索できる
6) Redmineチューニング事例 9種
*全レシピ: 設定値の一括ダウンロードはこちら (GitHub Gist)
Download: Setting_paramaters_for_Redmine_Performance_Tuning.txt
https://gist.github.com/akahane92/771f9a52d81af9864dd8
5. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
お話ししないこと
5
1)大規模な並列トランザクション
2)DBMSチューニングの秘境探索
6. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ご注意
6
本発表の内容には様々な設定が含まれていますが、
ご利用は自己責任でお願い致します。
参考になさった場合に生じたいかなる損害も補償できません。
あらかじめご了承下さい。
10. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
Redmine使用状況 (アンケート結果)
10
Redmineの環境と構築方法は?
有効回答数 62件、複数回答 (2017/8/26 Redmine大阪 #17)
ソース入手
(Linux), 21%
使用していない,
19%
Bitnami(Window
s), 15%
Bitnami(Linux),
11%
ソース入手
(Win), 11%
11%
6%
4%
0% ソース入手(Linux)
使用していない
Bitnami(Windows)
Bitnami(Linux)
ソース入手(Win)
その他
クラウドサービス
VMイメージ
RPM等パッケージ
ソース入手(MacOS)
ソース入手(JRuby)
ALMinium
UNIX Like :48%
Windows :32%
その他 :20%
11. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
Redmine使用状況 (アンケート結果)
11
Redmineの使用年数は?
有効回答数 69件、複数回答 (2017/8/26 Redmine大阪 #17)
3年以上
47%
使用していない
15%
使い始めたばかり
12%
1~3年ぐらい
15%
1年ぐらい
11%
3年以上
使用していない
使い始めたばかり
1~3年ぐらい
1年ぐらい
12. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
Redmine使用状況 (アンケート結果)
12
Redmineの使用年数は?
有効回答数 69件、複数回答 (2017/8/26 Redmine大阪 #17)
3年以上
47%
使用していない
15%
使い始めたばかり
12%
1~3年ぐらい
15%
1年ぐらい
11%
3年以上
使用していない
使い始めたばかり
1~3年ぐらい
1年ぐらい
使用者 85%
13. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
教えて下さい
13
Redmine
・遅いと感じている方は?
・性能チューニング経験は?
・使用しているDBMSは?
(Postgresql、MySQL、SQLite、他)
Eric Peacock
https://www.flickr.com/photos/evilpeacock/6365513881/
14. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
14
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 14
15. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
15
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 15
16. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
株式会社 島津製作所
2017年3月31日現在
創 業|
設 立|
資 本 金|
従 業 員 数 |
3,422億円 (2017年3月期)グループ売上高|
社 是|科学技術で社会に貢献する
経営理念|「人と地球の健康」への願いを実現する
16
11,528名 (連結)
明治8(1875)年
大正6(1917)年
266億円
17. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事業領域
産業機器
航空機器医用機器
分析・計測機器
17
18. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要
18
島津製作所グループ
業務システム
情報系
子会社委託
IT全般統制
ISO
内部統制
省庁監査
19. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要
19
島津製作所グループ
業務システム
情報系
子会社委託
IT全般統制
ISO 他
内部統制
省庁監査
複数の統制・認証に対応
大量の記録が必要
20. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|背景モデル
20
要 件 結 果
業務用ITシステムの全般的な管理記録は
内部統制や各種認証(ISO,ISMS,省庁監査)の
要求に答えなければならない
•記録と整合
•精査と承認
•追跡可能性
•目的合理性
•品質管理
•セキュリティー
21. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|背景モデル
21
課題 3 課題・要望
問合せ受付
調査と確認
状況報告
方針決定
対処と確認
結果報告
時
間課題 2 変更
問合せ受付
調査と確認
状況報告
方針決定
対処と確認
結果報告
時
間課題 1 トラブル
問合せ受付
調査と確認
状況報告
方針決定
対処と確認
結果報告
時
間複数
ユーザー複数
ユーザー
複数
ユーザー
複数
ユーザー複数
ユーザー
複数
担当者
C事業部
B事業部
A事業部 X System
Y System
Z System
関係者増加 / 事案多様化/システム増加・分散
N : N : N
22. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|業務システムの運営状況
22
業務システム
100種
利用者
7000人
事案
36000件
改版(コミット)
20000回
1700
KLOC
開発運用
200人
/年
/年
/年
自動生成コード含む7~20年超
23. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|問題要約
23
1. 人の記憶が頼り「生き字引き」
2. システム毎の管理台帳で 情報お蔵入り
3. 経緯は 担当者のMail-Box に蓄積
4. システムと組織の壁が情報流通を阻害
5. パートナー契約、引継ぎ不足
6. 横断検索できない
7. ツールが現実を表現できない
8. 統制・監査・査察への対応負担増
24. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|解決策
24
統合管理
全面導入
Issue
Tracking
System
25. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|事案関係モデル
3.6万件/年
2万コミット/年
/年
関係性
25
記憶の消滅
×
二次元 Excel 表現できる…何か
26. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|事案関係モデル
3.6万件/年
2万コミット/年
/年
関係性
26
記憶の消滅
×
二次元 Excel ITS
OSS
27. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|ITS導入の全体像
27
Project A
問合せ
要望・課題
障害・バグ
タスク
Project B
問合せ
要望・課題
障害・バグ
タスク
課題管理システム
(ITS)
版数管理ツール
■日常業務に浸透
•トータルで負担減少
•状態の掌握が容易
•コミュニケーション促進
■トレーサビリティー
一意性
永続的な 連鎖性
履歴追跡性
■変化への適応
状況変化を記録し追従
後々の参照が容易に
SVN
28. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|放置チケット対策の定着
28
週次ミーティングで、
積極的にチケット完了
ITSを使った会議
37. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|監査手続の定性評価
37
【例示】「全てのIT統制対象システムにおいて、任意の
6ヶ月間に発生した全ての変更事案の中から、設計書と
プログラムの両方、或いはいずれかを変更し、かつ、
データ強制変更を伴う事案の一覧を提出。ここから25
件をサンプリングし承認行為を示す証憑・証跡を提出」
3時間以内
複数人がかりで
2〜3日
38. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|まとめ
38
統制実現
コスト低減
属人性軽減
品質, CS向上
業績貢献
【経営要求】
【現場要求】
現業務を表現可能
入力コストに見合う
いつでもどこでも
素早く見つかる
休みやすい
【管理手法】
【統制要求】
IT全般統制
ISO
省庁監査
一意識別
↓
関連維持
↓
追跡可能
↓
信頼可能
現場の利益を動機とする
部分最適型の行動規範
が、結果として経営要求
を満たす統合情報基盤と
して、全体最適型の均衡
を得た
39. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
概要|まとめ
39
1)100種の業務システムを200人が運用する現場
2)IT統制に対応するため高水準の管理品質を維持
網羅性は必達(全員が全情報を入力し続ける)
3)文房具:常にサクサクの応答性能と盤石な安定性
4)運営のための余力は皆無。省力化の徹底と、
安定性・信頼性の同時成立が不可欠(さもないと帰れない)
40. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
40
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 40
41. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
41
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 41
42. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
42図引用元: http://ja.wikipedia.org/wiki/ボトルネック概念図.png
43. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
43図引用元: http://ja.wikipedia.org/wiki/ボトルネック概念図.png
電子計算機
ネットワークシステム
ボトルネックの
発見と解消
44. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
ボトルネックはどこか?
44
# 対 象 対 策 例
1 通信 狭帯域を回避 Ethernet
2 情報量 圧縮 HTML, Text
3 電子計算 再処理を回避 多段キャッシュ
4 永続化 高速装置へ置換 HDD
5 アルゴリズム
算法選択による
計算量削減
Sort, Index, GC
45. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
対策1 狭帯域通信を避ける
45
Ethernet等の
低速通信
2M, 10M, 100Mbit / 秒
経路上の最も狭い帯域
46. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
Local Loopback adapter
同一OS内のTCP/UDP/Socket通信
チューニングの基本
対策1 狭帯域通信を避ける
46
狭帯域
6→3
47. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
対策2 情報量の圧縮
47
HTTP/1.1 Compression
情報量 1/4 ~ 1/10
最大10倍速
48. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
対策3 再処理回避
48
Server
Pass
enge
r
RAID
OS FS NW
Ruby
Rails
Redmine
DBMS
HTTP
Reverse
Proxy
Client
Browser
JavaScript / DOM
OS FS NW
49. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
対策3 再処理回避
49
Server
Pass
enge
r
RAID
OS FS NW
Ruby
Rails
Redmine
DBMS
HTTP
Reverse
Proxy
Client
Browser
JavaScript / DOM
OS FS NW
㋖㋖
㋖㋖
㋖
㋖
㋖
㋖
㋖
㋖
㋖ ㋖
・潤沢なメモリ
・多段キャッシュ
50. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
対策4 永続化
50* 情報の永続化 「電源をOFFにしてもデータが消えないようにすること」
Server
Pass
enge
r
RAID
OS FS NW
Ruby
Rails
Redmine
DBMS
HTTP
Reverse
Proxy
情報の永続化*
SSDの登場
劇的な速度向上
51. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
対策5 算法選択による計算量削減
51
算法の選択による
速度向上*
Sort, GC, Index
* 算法の変更によって計算処理量を減らし、より少ない時間で同一の処理を実施する
Server
Pass
enge
r
RAID
OS FS NW
Ruby
Rails
Redmine
DBMS
HTTP
Reverse
Proxy
52. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
チューニング要点
52
Passenger5.1
OS CentOS7 (64bit)
Ruby 2.4
Rails4.2
Redmine 3.4
DBMS
MySQL
5.6
HTTP
Apache
2.4
Memory 4〜16GBCPU 4〜6 Cores
VMware (可用性、信頼性)
VCS
Subversion
1.8
HTTP
Reverse
Proxy
---
:8 Key Points
Network
53. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
チューニングの基本
チューニング要点
53
Passenger5.1
OS CentOS7 (64bit)
Ruby 2.4
Rails4.2
Redmine 3.4
DBMS
MySQL
5.6
HTTP
Apache
2.4
Memory 4〜16GBCPU 4〜6 Cores
VMware (可用性、信頼性)
VCS
Subversion
1.8
HTTP
Reverse
Proxy
---
:8 Key Points
Network
Redmine本体は変更しない
安定、安全、信頼
54. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
54
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 54
55. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
55
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 55
56. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク
56
【背景】
・年間36,000チケットを起票
・業務の中心にITS(Redmine)
・処理遅延や障害停止の回避は必須
【2012年10月】
・ITSの業務活用が急拡大(10万チケット越)
・200万チケットまでの動作を先行して確認
・問題を洗い出して対策
【2015年5月、2016年3月、2017年7月】
・2012年の予測値と、今までの実績値を比較
・Redmine, Ruby, Rails, H/Wの変化
・再度、性能ベンチマークを計測して最適解を選ぶ
57. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク
57
“サクサク”の
基準
58. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク
58
画面応答時間の基準*とは?
100ms 直接操作している一体感
1000ms 遅延を感じつつも軽快
10000ms 集中限界、進捗表示必須
* 参考文献
Jakob Nielsen (1993). Response Times: The 3 Important Limits
http://www.useit.com/papers/responsetime.html
Miller, R. B. (1968). Response time in man-computer conversational transactions.
http://theixdlibrary.com/pdf/Miller1968.pdf
59. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク
59
画面応答時間の基準*とは?
100ms 直接操作している一体感
1000ms 遅延を感じつつも軽快
10000ms 集中限界、進捗表示必須
* 参考文献
Jakob Nielsen (1993). Response Times: The 3 Important Limits
http://www.useit.com/papers/responsetime.html
Miller, R. B. (1968). Response time in man-computer conversational transactions.
http://theixdlibrary.com/pdf/Miller1968.pdf
Redmineは文房具
86. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
0
1,000
2,000
3,000
4,000
5,000
6,000
7,000
8,000
9,000
Redmine1.4
最
速
Redmine2.0
最
速
Redmine2.1
最
速
Redmine2.3
最
速
Redmine2.6
最
速
Redmine3.0
最
速
Redmine3.1
最
速
Redmine3.2
最
速
Redmine3.3
最
速
Redmine3.4
最
速
10万 20万 30万 50万 70万 100万 150万 200万
ベンチマーク|計測結果4
86
過去のRedmineと比較
ms
機能増加
Redmine
2.3, 2.4, 2.5, 2.6, 3.0, 3.1, 3.2, 3.3, 3,4
Spent time
2013-03 ~ 2017-07
Includes
306 Features implemented
495 Patches applied
561 Defects fixed
Still very fast and
reliable!
調査日 2017/7
87. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
0
1,000
2,000
3,000
4,000
5,000
6,000
7,000
8,000
9,000
Redmine1.4
最
速
Redmine2.0
最
速
Redmine2.1
最
速
Redmine2.3
最
速
Redmine2.6
最
速
Redmine3.0
最
速
Redmine3.1
最
速
Redmine3.2
最
速
Redmine3.3
最
速
Redmine3.4
最
速
10万 20万 30万 50万 70万 100万 150万 200万
ベンチマーク|計測結果4
87
過去のRedmineと比較
ms
機能増加
Redmine
2.3, 2.4, 2.5, 2.6, 3.0, 3.1, 3.2, 3.3, 3,4
Spent time
2013-03 ~ 2017-07
Includes
192 Features
294 Patches
406 Defects repaired
Still so fast and reliable!
・Redmine2.3を3.4へUpdateすると5.9%性能が
低下する
・多くの有益な機能が追加されている。
コア開発チームの努力と技術の進歩により、
応答性能の低下は最小限にとどまった。
調査日 2017/7
88. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|小まとめ
88
Redmine3.4の性能が大幅に改善した主な理由
理由1:Ruby2.3, 2.4の処理性能向上
Ex. Towards Faster Ruby Hash Tables Vladimir Makarov
理由2:Redmine core パフォーマンス改善11種
Issue# Subject
25022 Add an index on attachments.disk_filename
24865 Load associations of query results more efficiently
24839 Minor performance improvement - Replace count by exists?
24787 Don't preload all filter values when displaying issues/time entries
24587 Improve custom fields list performance
24433 The changeset display is slow when changeset_issues has very many
records
23987 Add an index on issues.parent_id
23743 Add index to workflows.tracker_id
23519 Don't preload projects and roles on Principal#memberships association
22850 Speedup remove_inherited_roles
21608 Project#allowed_to_condition performance
89. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果5
89
今回のベンチマークはSSD主体で行った。
HDDとSSDの性能差はどの程度か?
90. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
0
2000
4000
6000
8000
10000
12000
Redmine2.3 HDD Redmine2.6 HDD Redmine3.4 HDD Redmine3.4 SSD
10万 20万 30万 50万 70万 100万 150万 200万
ms
ベンチマーク|計測結果5
90
HDDをSSDに置換する効果
調査日 2017/7
91. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
0
2000
4000
6000
8000
10000
12000
Redmine2.3 HDD Redmine2.6 HDD Redmine3.4 HDD Redmine3.4 SSD
10万 20万 30万 50万 70万 100万 150万 200万
ms
ベンチマーク|計測結果5
91
HDDをSSDに置換する効果
Redmine3.4
HDD → SSD
平均18.6%の性能向上
【参考】2015年5月の調査
平均25.7%の性能向上
(今回の調査でSSDの性能を生
かし切れていない可能性)
調査日 2017/7
92. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
0
2000
4000
6000
8000
10000
12000
Redmine2.3 HDD Redmine2.6 HDD Redmine3.4 HDD Redmine3.4 SSD
10万 20万 30万 50万 70万 100万 150万 200万
ms
ベンチマーク|計測結果5
92
HDDをSSDに置換する効果
【参考】2015年5月の調査
平均25.7%の性能向上
(今回の調査でSSDの性能を生
かし切れていない可能性)
HDDをSSDに交換すると、環境によって
平均18.6%~25.7%の性能向上が得られる
Redmine3.4
HDD → SSD
平均18.6%の性能向上
調査日 2017/7
93. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果6
93
複数プラグイン導入の性能への影響
Redmineの性能に、プラグインがどの程度
の影響を与えるのか?
94. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果6
94
複数プラグイン導入の性能への影響
Redmine Pluginの多くはHook
によって各処理に割り込みをか
けている。性能が十分に考慮さ
れていないコードが呼び出され
た場合、応答性能に影響する。
選出した16種のうち8種は
Redmine3.0に未対応だった。
プラグインを追加して応答時間
を計測した結果、平均4%の性能
低下が計測された。
0
2000
4000
6000
8000
10000
12000
Redmine3.0 Redmine3.0 -
With Plugins
10万 20万 30万 50万 70万 100万 150万 200万
ms
調査日 2015/5
95. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果6
95
複数プラグイン導入の性能への影響
0
2000
4000
6000
8000
10000
12000
Redmine3.0 Redmine3.0 - With
Plugins
10万 20万 30万 50万 70万 100万 150万 200万
ms
Redmine Pluginの多くはHook
によって各処理に割り込みをか
けている。性能が十分に考慮さ
れていないコードが呼び出され
た場合、応答性能に影響する。
選出した16種のうち8種は
Redmine3.0に未対応だった。
プラグインを追加して応答時間
を計測した結果、平均4%の性能
低下が計測された。
不要なPluginを除去することで、
応答性能が平均4%向上するケースがある
調査日 2015/5
96. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果7
96
FTS* 応答性能の計測
* FTS; Full Text Search 全文検索(索引型/非索引型)
Redmineの全文検索性能は改善されたのか?
FullTextSearchプラグインの導入によって、
どの程度の高速化されるのか?
97. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
No
Cash
BP
Save &
Load
Full
Cash
No
Cash
BP
Save &
Load
Full
Cash
No
Cash
BP
Save &
Load
Full
Cash
Redmine3.0 非索引型 Redmine3.3 非索引型 Redmine3.3 索引型
全
文
検
索
所
用
時
間
積
算
(
秒
)
10万 20万 30万 50万 70万 100万 150万 200万
ベンチマーク|計測結果7
97
FTS* 応答性能の計測
秒
調査日 2017/7
* FTS; Full Text Search 全文検索(索引型/非索引型)
* BP; データベースのBuffer Pool メモリ。一度読込んだらメモリ上に貯蔵してDisk I/Oを削減
非索引型 索引型
Redmineの全文検索処理
・非索引型
・索引型(プラグイン導入)
Redmine Full Text Search V0.4.0
98. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
No
Cash
BP
Save &
Load
Full
Cash
No
Cash
BP
Save &
Load
Full
Cash
No
Cash
BP
Save &
Load
Full
Cash
Redmine3.0 非索引型 Redmine3.3 非索引型 Redmine3.3 索引型
全
文
検
索
所
用
時
間
積
算
(
秒
)
10万 20万 30万 50万 70万 100万 150万 200万
ベンチマーク|計測結果7
98
FTS* 応答性能の計測
秒
調査日 2017/7
* FTS; Full Text Search 全文検索(索引型/非索引型)
* BP; データベースのBuffer Pool メモリ。一度読込んだらメモリ上に貯蔵してDisk I/Oを削減
非索引型 索引型
Redmineの全文検索処理
・非索引型
・索引型(プラグイン導入)
Redmine Full Text Search V0.4.0
計測時のDBキャッシュ状態3種
・No Cash
・BP* Save & Load(実用検索)
・Full Cashed
計測対象
1) /its33/search?q=ATO
2) /its33/search?q=WIP
3) /its33/search?q=sSCOPE
※ 実行条件、回数等は共通
99. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
* FTS; Full Text Search 全文検索(索引型/非索引型)
* BP; データベースのBuffer Pool メモリ。一度読込んだらメモリ上に貯蔵してDisk I/Oを削減
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
No
Cash
BP
Save &
Load
Full
Cash
No
Cash
BP
Save &
Load
Full
Cash
No
Cash
BP
Save &
Load
Full
Cash
Redmine3.0 非索引型 Redmine3.3 非索引型 Redmine3.3 索引型
全
文
検
索
所
用
時
間
積
算
(
秒
)
10万 20万 30万 50万 70万 100万 150万 200万
ベンチマーク|計測結果7
99
FTS* 応答性能の計測
秒
調査日 2017/7
Redmine3.0の全文検索処理
【非索引型】
・No Cash: 12,193秒
10万チケット 24秒
100万チケット 207秒
200万チケット 6204秒
・BP Save & Load: 9,415秒
10万チケット 17秒
100万チケット 162秒
200万チケット 3601秒
・Full Cashed: 13秒
10万チケット 0.3秒
100万チケット 2.2秒
200万チケット 2.7秒
非索引型 索引型
100. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
* FTS; Full Text Search 全文検索(索引型/非索引型)
* BP; データベースのBuffer Pool メモリ。一度読込んだらメモリ上に貯蔵してDisk I/Oを削減
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
No
Cash
BP
Save &
Load
Full
Cash
No
Cash
BP
Save &
Load
Full
Cash
No
Cash
BP
Save &
Load
Full
Cash
Redmine3.0 非索引型 Redmine3.3 非索引型 Redmine3.3 索引型
全
文
検
索
所
用
時
間
積
算
(
秒
)
10万 20万 30万 50万 70万 100万 150万 200万
ベンチマーク|計測結果7
100
FTS* 応答性能の計測
調査日 2017/7
秒
非索引型 索引型
Redmine3.3の全文検索処理
【非索引型】
・No Cash: 555秒
10万チケット 2秒
100万チケット 12秒
200万チケット 295秒
・BP* Save & Load: 421秒
10万チケット 1秒
100万チケット 12秒
200万チケット 222秒
・Full Cashed: 26秒
10万チケット 0.5秒
100万チケット 5秒
200万チケット 8秒
101. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果7
101
FTS 応答性能の計測
調査日 2017/7
Redmine3.3の全文検索処理
【非索引型】
・No Cash: 555秒
10万チケット 2秒
100万チケット 12秒
200万チケット 295秒
・BP Save & Load: 421秒
10万チケット 1秒
100万チケット 12秒
200万チケット 222秒
・Full Cashed: 26秒
10万チケット 0.5秒
100万チケット 5秒
200万チケット 8秒
0
100
200
300
400
500
600
No
Cash
BP Save
& Load
Full
Cash
No
Cash
BP Save
& Load
Full
Cash
Redmine3.3 非索引型 Redmine3.3 索引型
検
索
所
用
時
間
積
算
(
秒
)
10万
20万
30万
50万
70万
100万
150万
200万
秒
非索引型 索引型
102. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
0
100
200
300
400
500
600
No
Cash
BP Save
& Load
Full
Cash
No
Cash
BP Save
& Load
Full
Cash
Redmine3.3 非索引型 Redmine3.3 索引型
検
索
所
用
時
間
積
算
(
秒
)
10万
20万
30万
50万
70万
100万
150万
200万
ベンチマーク|計測結果7
102
FTS 応答性能の計測
調査日 2017/7
非索引型 索引型
Redmine3.3の全文検索処理
【索引型】
・No Cash: 25秒
10万チケット 0.5秒
100万チケット 4秒
200万チケット 8秒
・BP Save & Load: 19秒
10万チケット 0.4秒
100万チケット 3秒
200万チケット 6秒 (実用検索)
・Full Cashed: 16秒
10万チケット 0.4秒
100万チケット 2秒
200万チケット 5秒
秒
103. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
10万
0.1M
20万
0.2M
30万
0.3M
50万
0.5M
70万
0.7M
100万
1M
150万
1.5M
200万
2M
平均
AVG
Redmine 3.0
非索引型
No Index
No Cash 23.5 39.6 61.4 100.4 143.2 206.9 5,415.2 6,203.4 1,524
BP Save & Load 17.1 32.5 52.7 80.6 112.6 162.6 5,355.9 3,601.6 1,177
Full Cash 0.4 0.6 0.8 1.2 1.6 2.3 2.7 3.3 2
Redmine 3.3
非索引型
No Index
No Cash 1.6 3.0 4.6 7.5 8.1 11.9 224.0 295.7 70
BP Save & Load 1.1 1.9 2.9 4.7 8.0 11.8 169.4 222.0 53
Full Cash 0.5 0.9 1.2 2.1 2.9 4.5 6.1 8.3 3
Redmine 3.3
索引型
FTS Indices
No Cash 0.5 0.9 1.2 2.0 2.7 3.8 6.0 8.0 3
BP Save & Load 0.4 0.7 0.9 1.5 2.1 2.9 4.5 6.0 2
Full Cash 0.4 0.6 0.8 1.2 1.7 2.4 3.8 4.9 2
ベンチマーク|計測結果7
103
FTS 応答性能の計測
調査日 2017/7
全文検索 所用時間(秒 sec)
104. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
10万
0.1M
20万
0.2M
30万
0.3M
50万
0.5M
70万
0.7M
100万
1M
150万
1.5M
200万
2M
平均
AVG
Redmine 3.0
非索引型
No Index
No Cash 23.5 39.6 61.4 100.4 143.2 206.9 5,415.2 6,203.4 1,524
BP Save & Load 17.1 32.5 52.7 80.6 112.6 162.6 5,355.9 3,601.6 1,177
Full Cash 0.4 0.6 0.8 1.2 1.6 2.3 2.7 3.3 2
Redmine 3.3
非索引型
No Index
No Cash 1.6 3.0 4.6 7.5 8.1 11.9 224.0 295.7 70
BP Save & Load 1.1 1.9 2.9 4.7 8.0 11.8 169.4 222.0 53
Full Cash 0.5 0.9 1.2 2.1 2.9 4.5 6.1 8.3 3
Redmine 3.3
索引型
FTS Indices
No Cash 0.5 0.9 1.2 2.0 2.7 3.8 6.0 8.0 3
BP Save & Load 0.4 0.7 0.9 1.5 2.1 2.9 4.5 6.0 2
Full Cash 0.4 0.6 0.8 1.2 1.7 2.4 3.8 4.9 2
ベンチマーク|計測結果7
104
FTS 応答性能の計測
調査日 2017/7
全文検索 所用時間(秒 sec)
非索引型の全文検索は10~20万チケットで性能限界に到達する。
105. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
10万
0.1M
20万
0.2M
30万
0.3M
50万
0.5M
70万
0.7M
100万
1M
150万
1.5M
200万
2M
平均
AVG
Redmine 3.0
非索引型
No Index
No Cash 23.5 39.6 61.4 100.4 143.2 206.9 5,415.2 6,203.4 1,524
BP Save & Load 17.1 32.5 52.7 80.6 112.6 162.6 5,355.9 3,601.6 1,177
Full Cash 0.4 0.6 0.8 1.2 1.6 2.3 2.7 3.3 2
Redmine 3.3
非索引型
No Index
No Cash 1.6 3.0 4.6 7.5 8.1 11.9 224.0 295.7 70
BP Save & Load 1.1 1.9 2.9 4.7 8.0 11.8 169.4 222.0 53
Full Cash 0.5 0.9 1.2 2.1 2.9 4.5 6.1 8.3 3
Redmine 3.3
索引型
FTS Indices
No Cash 0.5 0.9 1.2 2.0 2.7 3.8 6.0 8.0 3
BP Save & Load 0.4 0.7 0.9 1.5 2.1 2.9 4.5 6.0 2
Full Cash 0.4 0.6 0.8 1.2 1.7 2.4 3.8 4.9 2
ベンチマーク|計測結果7
105
FTS 応答性能の計測
調査日 2017/7
全文検索 所用時間(秒 sec)
非索引型の全文検索は10~20万チケットで性能限界に到達する。
Redmine3.3に索引型の全文検索Pluginを導入すると、実用的な検索
速度は3.0に比べて平均で約490倍速くなり、
106. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
10万
0.1M
20万
0.2M
30万
0.3M
50万
0.5M
70万
0.7M
100万
1M
150万
1.5M
200万
2M
平均
AVG
Redmine 3.0
非索引型
No Index
No Cash 23.5 39.6 61.4 100.4 143.2 206.9 5,415.2 6,203.4 1,524
BP Save & Load 17.1 32.5 52.7 80.6 112.6 162.6 5,355.9 3,601.6 1,177
Full Cash 0.4 0.6 0.8 1.2 1.6 2.3 2.7 3.3 2
Redmine 3.3
非索引型
No Index
No Cash 1.6 3.0 4.6 7.5 8.1 11.9 224.0 295.7 70
BP Save & Load 1.1 1.9 2.9 4.7 8.0 11.8 169.4 222.0 53
Full Cash 0.5 0.9 1.2 2.1 2.9 4.5 6.1 8.3 3
Redmine 3.3
索引型
FTS Indices
No Cash 0.5 0.9 1.2 2.0 2.7 3.8 6.0 8.0 3
BP Save & Load 0.4 0.7 0.9 1.5 2.1 2.9 4.5 6.0 2
Full Cash 0.4 0.6 0.8 1.2 1.7 2.4 3.8 4.9 2
ベンチマーク|計測結果7
106
FTS 応答性能の計測
調査日 2017/7
全文検索 所用時間(秒 sec)
非索引型の全文検索は10~20万チケットで性能限界に到達する。
Redmine3.3に索引型の全文検索Pluginを導入すると、実用的な検索
速度は3.0に比べて平均で約490倍速くなり、10万チケットを平均0.4
秒、200万チケット(≒15億文字)を平均6秒で検索可能になる。
2 million tickets include approximately 1.5 billion multibyte characters. Indexed FTS takes 6 sec.
107. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果8
107
Redmine3.4は200万チケットでも
“サクサク”なのか?
0
100
200
300
400
500
600
700
800
900
1000
10万 20万 30万 50万 70万 100万 150万 200万
チケット表示(小)
チケット表示(大)
チケット表示(中)
チケット一覧
プロジェクトTop
プロジェクト一覧
ログイン画面
Redmine Top
ms
調査日 2017/7
108. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果8
108
Redmine3.4は200万チケットでも
“サクサク”なのか?
0
100
200
300
400
500
600
700
800
900
1000
10万 20万 30万 50万 70万 100万 150万 200万
チケット表示(小)
チケット表示(大)
チケット表示(中)
チケット一覧
プロジェクトTop
プロジェクト一覧
ログイン画面
Redmine Top
ms
チューニングの結果、Redmine3.4の
主要画面8種の平均応答時間は100ms
調査日 2017/7
109. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果8
109
Redmine3.4は200万チケットでも
“サクサク”なのか?
0
100
200
300
400
500
600
700
800
900
1000
10万 20万 30万 50万 70万 100万 150万 200万
チケット表示(小)
チケット表示(大)
チケット表示(中)
チケット一覧
プロジェクトTop
プロジェクト一覧
ログイン画面
Redmine Top
ms
①全文検索 20秒
Full_Text_Search Plugin
②DB始動時の暖機運転5分
MySQL5.6, Postgres9.4に対策有り
(BufferPool dump/Restore)
調査日 2017/7
③BufferPool
8GB以上必須
110. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
ベンチマーク|計測結果8
110
Redmine3.4は200万チケットでも
“サクサク”なのか?
0
100
200
300
400
500
600
700
800
900
1000
10万 20万 30万 50万 70万 100万 150万 200万
チケット表示(小)
チケット表示(大)
チケット表示(中)
チケット一覧
プロジェクトTop
プロジェクト一覧
ログイン画面
Redmine Top
ms
調査日 2017/7
③BufferPool
8GB以上必須
①全文検索 20秒
Full_Text_Search Plugin
②DB始動時の暖機運転5分
MySQL5.6, Postgres9.4に対策有り
(BufferPool dump/Restore)
3点対策して環境を整備すれば
200万チケットまで大丈夫
111. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
111
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 111
112. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
112
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 112
113. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
性能改善事例集
113
1. 8年間に渡るRedmineの運用におい
て、どのような問題が発生し、どう
やって解消したのか
2. 信頼性と安定性を維持する取組みの
「実際と限界」に焦点
3. 各種設定、チューニング方法、性能計
測方法を全て紹介する
114. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
計測 - 定量化手法
「測定できないものは制御できない」*
1.テスト実行時間 (Redmine Built-in Test Code)
2.負荷ベンチマーク
・httpref http://www.hpl.hp.com/research/linux/httperf/
・wrk https://github.com/wg/wrk
・apache bench http://httpd.apache.org/docs/2.2/programs/ab.html
3.時間計測
・MySQL Slow-query ログ
・Redmineログ (Production.log, Development.log)
4.分析
・SQL実行計画(MySQL Workbench) https://www-jp.mysql.com/products/workbench/
・Chrome開発者ツール https://developer.chrome.com/devtools
・ネットワークスループット調査 iperf https://iperf.fr/ (Win版は× : ブルースクリーン死亡)
114* DeMarco, Tom., 1982, “You can’t control what you can't measure.”
120. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例2)【性能】リポジトリタブが遅い
120
【チューニング要素】
・H/W: HDD, Memory, CPU
・S/W: DBMS, Ruby, WebAppServer, Subversion Server
・N/W: 通信帯域, Switching-Hub
1)Subversionリポジトリの同期トリガを変更
SubversionとRedmine間のリポジトリ同期は、画面上のリポジトリタブをクリッ
クすると実施されるのが既定の動作。リビジョン数が増えてくると表示されるまで
に1分以上待たされる。
Redmine全体管理画面の「コミットを自動取得する」をOFFにして、Subversion
リポジトリ側のPost-Commit-Hookに同期スクリプトを組み込むことで、同期ト
リガが“コミット時”へ変更され、画面上のリポジトリタブは直ちに表示されるよう
になる。
2)Subversionリポジトリの同期対象を指定する
前述のPost-Commit-Hookは全プロジェクトを対象にするため、リポジトリ数が多
い場合5分以上かかる場合がある。ほぼ同時に5人が5回ずつコミットすると同期が
25並列で実行されてしまい、処理輻輳によりRedmineが応答しなくなる。
特定のProjectのみ同期を実施するよう、スクリプトに追記する。
121. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例2)【性能】リポジトリタブが遅い
121
【チューニング要素】
・H/W: HDD, Memory, CPU
・S/W: DBMS, Ruby, WebAppServer, Subversion Server
・N/W: 通信帯域, Switching-Hub
3)Subversionセッションキャッシュ
セッション毎にキャッシュメモリを付与 (Subversion 1.7 以上)
4)Subversion通信圧縮機能
通信内容の圧縮レベル指定(Subversion 1.7 以上)
5)同一サーバーに置き、通信帯域を広くする
Local loopback, TCP/UDP/Socket通信は高速
6)MySQL テーブル更新が遅い
DBMSメモリ設定
SSD採用
122. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例3)【性能】検索が遅い
122
1)MySQLメモリチューニング
・メモリをできるだけ積み込む
・全インデックス、全データをオンメモリにする
2)カスタムフィールドの設定
「検索対象」の数が多いと極端に性能が落ちる
【チューニング要素】
・H/W: Memory, CPU
・S/W: DBMS, Redmine
123. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例4)【性能】画面応答が遅い
123
1)Rubyのバージョン 処理性能
1.9 < 2.0 < < < 2.1 < 2.2 < 2.3 << 2.4
2)MySQLメモリチューニング
全インデックスと主要データをメモリに乗せる
3)初回アクセスが極端に遅い
MySQL 5.6 – Bufferpool save and load
PostgreSQL 9.4 - pg_prewarm
4)CPUコア数と同時並行処理数
処理要求が集中した時の待ち行列
CPUコアやHTスレッド数に合わせて並行度を上げ、最大待ち時間を低く抑える
- Passenger:自動調整 (指定も可能)
- Thin:起動サーバー数を増減
【チューニング要素】
・H/W: HDD, Memory, CPU
・S/W: OS, DBMS, Http Server, Ruby, WebAppServer
・N/W: 通信帯域, Switching-Hub
124. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例4)【性能】画面応答が遅い
124
5)メール非同期送信(Async)
通知先が多い / メールサーバー(MTA)が遅い
6)Plugin導入数
導入数が多いと遅くなる。
大量データの応答性能まで考慮されているPluginはそう多くない。
7)通信データの圧縮
HTTP1.1/Compression (最大10倍速)
【チューニング要素】
・H/W: HDD, Memory, CPU
・S/W: OS, DBMS, Http Server, Ruby, WebAppServer
・N/W: 通信帯域, Switching-Hub
125. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例5)【性能】特定プラグインが遅い
125
【チューニング要素】
・H/W: Memory, CPU
・S/W: DBMS, Ruby, WebAppServer
- 多くのプラグインは大量のデータ処理を想定していない。
極端に遅い場合はチューニングを施し、作者にパッチを送付できる。
処理遅延の原因は、SQL/コード実装/データ設計の3系統に大別できる。
SQLとコード実装は何とか対処もできるが、データ設計は大がかりな変更を
伴うので、テストコードが無ければ諦める。
- 例)Work Time 10倍速(画面応答 12秒 → 1秒)
プルリク https://bitbucket.org/tkusukawa/redmine_work_time/pull-request/17
・SQL調査手順
SlowクエリやSQL実行計画の調査方法はDBMS製品毎に異なるが、
類似機能は必ず存在する。
参考資料)Yahoo Japan社内向けDBチューニングセミナー
http://www.slideshare.net/techblogyahoo/mysql-58540246
・アプリコード調査手順(今回は実施せず)
・データ設計調査手順 (今回は実施せず)
126. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例6)【信頼性】不安定で手間がかかる
126
1)3歩遅れの「枯れた技術」
末尾が3になったら導入 例)Redmine 3.4.3
2)Windows <<< Linux OS
両方面倒を見てきたが、Ruby, Rails はWindowsで制限が多い(印象)
3)RedmineUpdateの工夫
新旧の環境を並立させて動作を確認し、準備が整ったら切り替える
4)OSS パッチの取込み
(Redmineに限って言えば)性能が改善され、問題は解消している。
Gitの追跡ブランチモードで git cloneしてLocal変更との共存を確保しつつ、
git pull だけでパッチを取りこめる。
例)mkdir /var/lib/its/rm34_its
cd /var/lib/its/rm34_its
git clone https://github.com/redmine/redmine.git .
git checkout -b 3.4-stable-local origin/3.4-stable
【チューニング要素】
・H/W: Memory, CPU
・S/W: DBMS, Ruby, WebAppServer
127. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例6)【信頼性】不安定で手間がかかる
127
5)Exception発生をMail 通知し、不具合を確実に検出
Redmine本体のExceptionは8年間でもほんの僅か
6)Redmine本体やRailsに手を入れない
Redmine本体の品質は極めて高い
テストコードのカバレッジ率がとても高い
http://www.redmine.org/builds/coverage/
7)Pluginは魅力的だが、あまり採用していない
Redmine本体のUpdateの足枷になる
テストコードが無く、DBテーブル構造を壊す例もある
【参考】
MTBF 8,820時間、MTTR 17時間、稼働率 99.8%
【チューニング要素】
・H/W: Memory, CPU
・S/W: DBMS, Ruby, WebAppServer
128. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例6)【信頼性】不安定で手間がかかる
128
8)完全なクローン環境を常設
・ゴミデータ、評価用データを本番に持ち込ませない
・要望を受けてから手動で同期
・誤入力の事故を防止するため、画面の色を変えている
【チューニング要素】
・H/W: Memory, CPU
・S/W: DBMS, Ruby, WebAppServer
Dump and Restore
129. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
Munin: Average latencyMunin: Average latency
事例7)【性能】電算機のH/W資源不足
129
1)1VMに集約し、狭帯域通信を回避
2)CPU キャッシュの大きなものを複数コア用意
同時接続の処理数に合わせる
3)メモリ できるだけ積み込む
4)SSD導入: SSD(OS, DBMS, Redmine)、HDD(その他データ)
↓ SSD切替点↓ SSD切替点
【HDD】突出ピークが無くなった。【SSD】ピークが無くなりI/O waitが小さくなった。
振れ幅が小さく、余力が見てとれる。
130. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例8)【性能】電算機通信網の帯域不足
130
<Network>
1)主要通信経路は1G/bpsに統一
10M/bps, 100M/bps のボトルネックを排除
2)Normal Hub → Switching Hub
コリジョン発生率の低減
3)Local Loopback通信
サーバー統合による通信の高速化
131. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
事例9)【性能】起動が遅い
131
<DBMSの起動・再起動直後、初回アクセスだけが極端に遅い>
1)DBMSサーバーの起動、再起動時は「暖機運転」が必要
「暖機運転」とは、DBMS再起動後にデータやインデックスを
メモリ上へ読み込む一連の処理。対象となるデータが増えると、
長時間かかるようになる
MySQL5.6系warm up 、Postgresql 9.4系pg_prewarmとして
実装されたBufferPool、Workloadの保存・読込機能によって
待ち時間が大幅に短縮される
MySQL
innodb_buffer_pool_dump_at_shutdown = ON
innodb_buffer_pool_load_at_startup = ON
132. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
設定例1)基本S/W
132
OS, File-System
1)OS CentOS 6 / 7
プロセス、パッケージは必要最低限に削ぎ落とす。
(パッチ適用、最少の停止頻度、セキュリティー、メモリ)
2)File-System
Ext4 nobarrier チューン http://goo.gl/LYwfA0
3)Kernel設定
・[SSD] Disk I/O スケジューラーを cfq から deadline へ変更
・[SSD] SWAP抑制 vm.swappiness=1
※ 性能への影響は未確認
133. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
設定例2)ミドルウェア
133
DBMS, WebServer, Web Application Server
<DBMS>
1)チューニング設定
・MySQL 5.6
2)SSDによるI/O改善
・DBMS設定
MySQL innodb_flush_neighbors = 0
・配置構成
DBデータだけでなく、OS全体をSSDに乗せると効果大
・結果例
200万チケット分のDBデータをダンプ/リストア
HDD → SSDにより33%向上(5分早く終わる)
134. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
設定例2)ミドルウェア
134
DBMS, WebServer, Web Application Server
<WebServer>
3)通信圧縮 Compress, Gzip, Deflate 圧縮
<Web Application Server>
4)選択
WEBLick は性能 ×
運用の容易さは Unicorn < Passenger
5)Phusion Passenger 4 → 5 で 0.6%向上(計測の誤差範囲)
6)Passenger と OOBGC
Passenger4, Ruby2.1, OOBGC(gctools)で安定稼働(実績1年)
Passenger5, Ruby2.2, OOBGC(gctools)で安定稼働(実績6ヶ月)
Passenger5, Ruby2.3, OOBGC(gctools)で安定稼働(実績1年)
7)Passenger Enterprise
Multi Threadモードで○○% 向上 (未調査)
利用料金は 5000円/月程度
135. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
設定例3)応用S/W
135
Ruby, OOBGC, Redmine, Subversion
<Ruby>
・GCの大幅改善によりRuby2.4が最速のバージョン
・2位は Ruby2.3+OOBGC(調査時点 2017/07 )
<OOBGC for Ruby2.1, 2.2, 2.3>
・Unicorn
GitHubのAman gupta-san(@tmm1)が作ったgctools original.
https://github.com/tmm1/gctools
・Passenger4/5
Ruby2.1は、Shirosaki-san(@shirosaki)のFork版
https://github.com/shirosaki/gctools
Ruby2.1/2.2/2.3は、@akahane92 のFork版
https://github.com/akahane92/gctools
This fork is based on Shirosaki-san(@shirosaki)’s gctools, and patched
Ruby2.2+ modifications from Charlie Somerville(@charliesome)’s pull-request.
https://github.com/tmm1/gctools/pull/14
→ Ruby2.3, 2.4(Normal)が総合的に見て最適選択。
OOBGC有は最大性能への向上を必要とする方向け(ちょいムズ)
136. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
設定例3)応用S/W
136
Ruby, OOBGC, Redmine, Subversion
<Redmine>
・カスタムフィールドの設定値「検索条件」の数を減らす。
例「14万チケットだと30種 ○○秒 → 5種 〇秒」
(未計測だが効果は絶大)
・メール非同期送信(Async)
config/configuration.yml
production:
email_delivery:
delivery_method: :async_smtp
async_smtp_settings:
137. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
設定例3)応用S/W
137
Ruby, OOBGC, Redmine, Subversion
<VCS>
・Subversion Server 1.7以降のセッションキャッシュ付与機能
セッションキャッシュにより、通信応答速度が向上する。
・Subversion Server 1.7以降の通信圧縮機能
セッションデータ通信内容の多くはテキストデータ。
高い圧縮によって通信効率と応答性が向上する。
138. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
138
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 138
139. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
139
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 139
140. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
お話ししたこと
140
1)200万チケットでもサクサク動くRedmineの全レシピ*
2)Redmine2.6 を 3.4 へUpdateすると平均で24.9%速くなる
3)Ruby2.0 を 2.4 へUpdateすると平均で26.9%速くなる
4)HDDをSSDに変更すると平均で18. 5%~25. 7%速くなる
5)非索引型の全文検索は10万チケットで性能限界に到達するが、
FTS-Pluginの導入によって約490倍速くなり、
200万チケットの環境で平均0.4~6秒で全文検索できる
6) Redmineチューニング事例 9種
*全レシピ: 設定値の一括ダウンロードはこちら (GitHub Gist)
Download: Setting_paramaters_for_Redmine_Performance_Tuning.txt
https://gist.github.com/akahane92/771f9a52d81af9864dd8
141. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
まとめ|実際
141
・初期値のままでは、1万チケットまで
・最低限のチューニングで、5万チケットまで(Windows Bitnami)
・最低限のチューニングで、10万チケットまで(Linux,MySQL,Windowsスクラッチ)
・ある程度のチューニングで、200万チケットまで(Linux,MySQL)
・最大限のチューニング (必要としてないので今はやっていない)
処理並行度を上げる、高IOPsのDisk採用、DBMSのI/O最適化
例)Linux, MySQL:
Nginx + Unicorn
ロードバランサ + WebAppServerクラスタリング
+ DBMSクラスタリングと、R/W、R/Oの分離、SSD PCIe
142. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
まとめ|限界
143
RedmineのFTS (非索引型)
(Redmineは悪くないが)10万チケットを超えた時点で検索が遅くなる。例
えばCPU4コアで稼働している時に、全プロジェクト横断の検索が4回ク
リックされ、並行で実行されるとCPUが占有されてRedmineが無応答になっ
てしまう。
→ 今回、 Full Text Search Plugin による対処策が得られた。
十分な性能を確認できたことから、検索に関する懸念要素が払拭さ
れた。
数十億文字を記録・蓄積している。何らかの索引型FTSをRedmine
コアに標準機能として組み込んで欲しい。
検索できなくて困っているのは添付ファイル。先頃、良策がPlanioさ
んから提供された。とても期待している。
( Feature #306 Full Text Search of files )
143. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
144
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 144
144. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
目次
145
第1部 背景と要求
第2部 チューニングの基本
第3部 ベンチマーク
第4部 性能改善事例集
第5部 まとめ
第6部 付録 145
145. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
付録|性能関連設定の一覧
146
本稿で扱った性能ベンチ-マークは下記設定による。
1. 計測プログラム
2. Apache2.2, 2.4 HTTP/1.1 通信圧縮
3. Passenger
4. MySQL 5.6 Linux, Bitnami
5. Subversion キャッシュ設定, 通信圧縮
6. Redmine Subversion同期 ProjectID指定
7. Redmine OOBGC for Unicorn and Passenger
8. OS File System
設定値の一括ダウンロードはこちら (GitHub Gist)
Download: Setting_paramaters_for_Redmine_Performance_Tuning.txt
https://gist.github.com/akahane92/771f9a52d81af9864dd8
150. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
付録|MySQL 5.6 for Bitnami
151
MySQL 5.6 my.cnf for Bitnami
# The MySQL server
[mysqld]
# set basedir to your installation path
basedir=C:/Bitnami/REDMIN~1.0-2/mysql
# set datadir to the location of your data directory
datadir=C:/Bitnami/REDMIN~1.0-2/mysql/data
port=3306
character-set-server=UTF8
collation-server=utf8_general_ci
max_allowed_packet=16M
bind-address=127.0.0.1
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
#================================================================
# InnoDB Paramaters
# http://dev.mysql.com/doc/refman/5.6/en/innodb-parameters.html
innodb_buffer_pool_size = 2G
innodb_log_file_size = 512M
innodb_thread_concurrency = 8
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_dump_at_shutdown = ON
innodb_buffer_pool_load_at_startup = ON
# MySQL Server System Variables
# http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html
join_buffer_size = 128M
sort_buffer_size = 1M
query_cache_type = 1
query_cache_size = 64M
query_cache_limit = 2M
tmp_table_size = 64M
max_heap_table_size = 64M
#================================================================
151. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
付録|Subversion キャッシュ&通信圧縮
152
Apache2.2, 2.4 /etc/httpd/conf.d/subversion.conf
<IfModule dav_svn_module>
SVNCompressionLevel 1
SVNInMemoryCacheSize 128000
SVNCacheFullTexts on
SVNCacheTextDeltas on
</IfModule>
152. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
付録| Redmine Subversion同期
153
Subversion Post-Commit-Hook - post-commit
#!/bin/sh
# Redmine のプロジェクト名とSubversionリポジトリ名が一致している条件下でのスクリプト
# 名称不一致の場合、本スクリプト中に名称を指定すればよい。(数が多いと面倒なのでお勧めしません)
export LANG="ja_JP.UTF8"
REPOS="$1"
REV="$2"
# Send E-Mail
${REPOS}/hooks/commit-email.rb "$REPOS" "$REV"
# Sync SVN Repo with ITS
REPOSHOME=`/usr/bin/dirname $REPOS`
APIKEY=`/bin/cat $REPOSHOME/common/APIKEY`
PJNAME=`/bin/basename $REPOS`
URL="http://localhost/its/sys/fetch_changesets?id=$PJNAME&key=$APIKEY"
/usr/bin/wget -q --no-proxy $URL -O /dev/null
153. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
付録| Redmine OOBGC for Unicorn
154
Unicornへのgctools導入
(参考)
http://tmm1.net/ruby21-oobgc/
http://qiita.com/jemiam/items/5c6e4595f3565f3c5562
Cookpad さんでは2016年1月末からgctoolsの利用を止める模様
http://k0kubun.hatenablog.com/entry/2016/01/23/231213
一方で、GitHub StaffのCharlie Somerville (@chariesome)
は gctoolsのruby2.2+パッチを作ってプルリクを通し、
gctoolsは2016/2/11に0.2.4へアップデートされた。
Aman Gupta @tmm1 gctools for Ruby 2.1 (GitHub)
https://github.com/tmm1/gctools # For Unicorn Ruby2.1, 2.2+
154. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
付録| Redmine OOBGC for Passenger
155
Passengerへの gctools導入
■About gctools
Aman Gupta @tmm1 gctools for Ruby 2.1 (GitHub)
http://tmm1.net/ruby21-oobgc/
Passenger (Hongli Lai on)
http://old.blog.phusion.nl/2014/01/31/phusion-passenger-now-supports-the-new-ruby-2-1-out-of-band-gc/
■ gctool gemのローカルビルド&インストール (For Passenger)
cd /usr/local/src
git clone https://github.com/shirosaki/gctools # For Ruby2.1
# または
git clone https://github.com/akahane92/gctools # For Ruby2.1, 2.2, 2.3
gem build gctools.gemspec
gem install gctools-0.2.3.gem
■Passengerとgctools を Gemfile.localに追記
gem 'passenger'
gem "gctools", '0.2.3'
155. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
付録| Redmine OOBGC for Passenger
156
■config.ru パッチ
diff --git config.ru config.ru
index 2a89752..e3f49e6 100644
--- config.ru
+++ config.ru
@@ -1,4 +1,28 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
-run RedmineApp::Application
+
+# ==================================================
+if defined?(PhusionPassenger)
+ require "gctools/oobgc"
+ GC::OOB.setup
+ PhusionPassenger.require_passenger_lib 'rack/out_of_band_gc'
+ use PhusionPassenger::Rack::OutOfBandGc, :strategy => :gctools_oobgc, frequency: 5
+
+ PhusionPassenger.on_event(:oob_work) do
+ # Phusion Passenger has told us that we're ready to perform OOB work.
+ t0 = Time.now
+ GC.start
+ Rails.logger.info "Out-Of-Bound GC finished in #{Time.now - t0} sec"
+ end
+end
+# ==================================================
+
+#if ENV['RAILS_RELATIVE_URL_ROOT']
+# map ENV['RAILS_RELATIVE_URL_ROOT'] do
+# run RedmineApp::Application
+# end
+#else
+ run RedmineApp::Application
+#end
156. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
付録| Redmine OOBGC for Passenger
157
Passengerへの gctools導入
■ /etc/httpd/conf.d/passenger.conf にOOBGC用の設定値を指定
# For OOBGC < Experimental >
PassengerSpawnMethod direct
157. Copyright (C) Shimadzu Business Systems Corporation. All Rights Reserved
付録|OS File System
158
■/etc/fstab
/dev/mapper/vg_sms01-lv_root / ext4 defaults,nobarrier,noatime,discard 1 1
UUID=f94716b2-52d4-4e81-9a82-xxxxxxxxxxxx /boot ext4 defaults,discard 1 2
/dev/mapper/vg_sms01ex-lv_opt /opt xfs defaults,nobarrier,noatime 1 2
/dev/mapper/vg_sms01-lv_swap swap swap defaults,nobarrier,discard 0 0
注意:ディスクにアクセスできなくなったり、システム・アプリケーションが正しく動作しなくなる危険性があります。
バックアップを確保したうえで、理解できる方だけ自己責任でチャレンジしてください。
危険性が高いわりに、性能向上は体感しにくいので、専門家以外には推奨しません。