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
RedmineバージョンアップとともにDBMS変えてみた.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ryouma
September 02, 2019
3.7k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RedmineバージョンアップとともにDBMS変えてみた.pdf
ryouma
September 02, 2019
Featured
See All Featured
Designing Powerful Visuals for Engaging Learning
tmiket
1
440
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
380
Chasing Engaging Ingredients in Design
codingconduct
0
230
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
GraphQLとの向き合い方2022年版
quramy
50
15k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
Docker and Python
trallard
47
3.9k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
630
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
190
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Transcript
Redmineバージョンアップとともに DBMS変えてみた 2019/08/31 第20回 Redmine大阪 @ryouma_nagare
自己紹介 • @ryouma_nagare(りょうま) • 今はインフラ系エンジニア&マネージャ • Redmine/Ansible/ElasticStack/Zabbix/PostgreSQL • 好きなディストリビューションはVineLinux •
redmine歴:8年 • redmine.tokyo スタッフ • 趣味:技術的人柱、監視、昔のガジェット
質問!
Redmineのバージョンは? ①4.0 ②3.x ③2.6以前 ④trunk
RedmineのDBMSは? ①MySQL ②PostgreSQL ③上記以外
今回やったこと
Redmineバージョンアップ&DBMS変更 対象 以前 直前 今回 OS CentOS5→6→7 CentOS7 CentOS7 Redmine
1.3→2.0→2.2~ 3.3 3.4 4.0 DBMS MySQL5.1 →MariaDB5.5 →MariaDB10 MariaDB10 PostgreSQL11 Ruby 忘れた 2.4 2.5 Web/AP サーバ apache/passenger →nginx/unicorn nginx/unicorn nginx/unicorn
そもそも、なぜMariaDB? ここを参考に初めてRedmineをインストール。 そのまま惰性でMySQL→MariaDBとしていた…
ということで4.0に向けて試行錯誤 embulkではダメなことも… pgloaderでOK!
おれは人間 MariaDBをやめるぞ!
無事完了
環境を変更したので メトリックを確認
監視対象 ※サイジング/データ量 • 4コア/8GB • チケット数:5万強 • DBサイズ:1GB強 監視対象 監視方法
メトリック production.log logstash リクエストごとの処理時間 Rails ElasticAPM トランザクションごとの処理時間 サーバリソース Zabbix 一般的なサーバリソース access.log logstash 一般的なWebアクセス解析 DBMS Zabbix コネクション数、CacheHitRatioなど
監視サーバ (Zephyranthes) 監視構成 Amazon Elasticsearch Service production.log解析 パフォーマンスメトリック収集 ダッシュボード
可視化
production.log – active_record_time グラフの変化っぷりが 激しい
APM – max(duration) MariaDB10 PostgreSQL11 桁が変わった
APMで確認したSQLを投げてみる
実行計画(サブクエリ部のみ) PostgreSQL11 -> Index Scan using idx_113458_enabled_modules_project_id on enabled_modules em
(cost=0.28..1.31 rows=1 width=8) Index Cond: (project_id = wikis.project_id) Filter: ((name)::text = 'wiki'::text) MariaDB10 +------+--------------+-------------+--------+----------------------------+--------------+---------+------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +------+--------------+-------------+--------+----------------------------+--------------+---------+------+------+-------------+ | 1 | PRIMARY | <subquery2> | eq_ref | distinct_key | distinct_key | 4 | func | 1 | | | 2 | MATERIALIZED | em | ALL | enabled_modules_project_id | NULL | NULL | NULL | 3499 | Using where | +------+--------------+-------------+--------+----------------------------+--------------+---------+------+------+-------------+ キーを使用せず、行数がふくれる →MySQL8でも実行計画は変わらず メインテーブルのキーを使用
Durationを比較 Duration(msec) 16029 12333 5604 遅いクエリも出てきたが、あき らかに体感で速い ※3週間経過後
サーバリソース CPU使用率 空きメモリ CPU/メモリの使用率低下はDB変更により フルスキャンが減ったためと想定 ※定期的にCPUが跳ねてるのはDBバックアップ バージョンアップ
ちょっとだけ不具合
オブジェクト名の64byte制限 移行時のWarningだけなので 特に問題ない
UTF8のCOLLATEの問題 気づいたところだけ対応 すればいいんじゃね?
結論
の前に 対応いただいたプラグイン作者の みなさまに感謝です!
結論 • ユーザに優しい機能が多いので、Redmineは4.0にあげよう ➢アクティブに更新しているプラグインを選べばバージョンアップについていけるはず ➢動かないプラグインは捨てる勇気も必要 • DBはできればPostgreSQLを使おう ➢速度的なメリットは大きい ➢MySQLではRedmineの既知の問題とか、ギャップロックとか、古いバージョンのパラメータデフォルト値とか …
• 失敗の試行錯誤も、最新を突っ込みすぎたがゆえのバグを踏んだとしても、それはそれで ネタとしておいしい
APPENDIX
Qiita • Redmine4.0でプラグインの動作確認をした • Redmineのproduction.logを監視する • AmazonES、オンプレKibanaでRedmineのパフォーマンス監視を行う • RaspberryPi3のRedmine4.0.2のデータベースをMySQLからPostgreSQLに pgloaderで移行した
ふだんはこういう遊びをしています 石川さんありがとう @forenoonMありがとう
ご静聴ありがとう ございました