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
スケーラブルActive Jobs with Sidekiq Enterprise (Kaig...
Search
Techouse
October 26, 2023
Programming
1
1.6k
スケーラブルActive Jobs with Sidekiq Enterprise (Kaigi on Rails 2023 Day 1 スポンサーLT2)
2023/10/27(Fri) Kaigi on Rails 2023 Day 1 スポンサーLT2
Techouse
October 26, 2023
Tweet
Share
More Decks by Techouse
See All by Techouse
デプロイを任されたので、教わった通りにデプロイしたら障害になった件 ~俺のやらかしを越えてゆけ~
techouse
60
46k
RubyKaigi 2024 にみんなで参加した Techouse のその後の進捗 with Ruby
techouse
0
270
リーンスタートアップのリーンな品質の話
techouse
1
1.6k
Customer Identity Cloud powered by Auth0 を使ったマルチプロダクト構築の実践と総括
techouse
0
940
Techouse company profile
techouse
4
170k
Techouse Company Profile for Engineers
techouse
0
64k
オフィス風景.pdf
techouse
0
2.3k
Other Decks in Programming
See All in Programming
サービスクラスのありがたみを発見したときの思い出 #phpcon_odawara
77web
4
670
AIコーディングの理想と現実
tomohisa
22
29k
The Nature of Complexity in John Ousterhout’s Philosophy of Software Design
philipschwarz
PRO
0
100
AI時代の開発者評価について
ayumuu
0
150
サービスレベルを管理してアジャイルを加速しよう!! / slm-accelerate-agility
tomoyakitaura
1
180
Sharing features among Android applications: experience feedback
jbvincey
0
110
Building a macOS screen saver with Kotlin (Android Makers 2025)
zsmb
1
150
Defying Front-End Inertia: Inertia.js on Rails
skryukov
0
490
Compose Hot Reload is here, stop re-launching your apps! (Android Makers 2025)
zsmb
1
510
プロダクト横断分析に役立つ、事前集計しないサマリーテーブル設計
hanon52_
2
440
趣味全開のAITuber開発
kokushin
0
200
AIコーディングエージェントを 「使いこなす」ための実践知と現在地 in ログラス / How to Use AI Coding Agent in Loglass
rkaga
0
140
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
19
1.1k
YesSQL, Process and Tooling at Scale
rocio
172
14k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.8k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
104
19k
Scaling GitHub
holman
459
140k
Building an army of robots
kneath
304
45k
How to train your dragon (web standard)
notwaldorf
90
6k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.2k
Into the Great Unknown - MozCon
thekraken
37
1.7k
Optimizing for Happiness
mojombo
377
70k
Transcript
スケーラブルActive Jobs with Sidekiq Enterprise Kaigi on Rails 2023 Day
1 <スポンサーLT2> 2023.10.27 Techouse ⼭崎良祐 ( @nappa )
©Techouse All Rights Reserved P2 今日も生み出そう。 世界にまだない価値を。 明日も伸び続けよう。 世界をより良くするために 。
はじめまして Techouse と申します
©Techouse All Rights Reserved P3 今日も生み出そう。 世界にまだない価値を。 明日も伸び続けよう。 世界をより良くするために 。
©Techouse All Rights Reserved P4 現在の主⼒事業 事業概要 ⼈事労務等の社内ワークフローの効率化・ペーパレス化を実現する、 セミオーダー型DXクラウドシステム ⼈材採⽤のためのサイト制作・集客・管理を
オールインワンで効率化する、フルオーダー型DXクラウドシステム ⼯場・製造業の領域に特化した、 求⼈数No.1の⼈材プラットフォーム クラウドサービス事業 ⼈材プラットフォーム事業 Rails とともに 創業11年 さまざまなプロダクトを ご提供しております
©Techouse All Rights Reserved P5 今日も生み出そう。 世界にまだない価値を。 明日も伸び続けよう。 世界をより良くするために 。
せっかくなので 技術で一本LT
©Techouse All Rights Reserved P6
©Techouse All Rights Reserved P7 Active Job の 主な⽤途
©Techouse All Rights Reserved P8 deliver_later で メール送信
©Techouse All Rights Reserved P9 perform_later で エクスポートとか インポートとか の
⻑時間かかる処理
©Techouse All Rights Reserved P10 Active Job は バックエンドが 選択できる
©Techouse All Rights Reserved P11 Sidekiq or Resque or Delayed::Job
©Techouse All Rights Reserved P12 Sidekiq or Resque or Delayed::Job
いろいろ 特徴があり チョイスが難しい
©Techouse All Rights Reserved P13 Sidekiq or Resque or Delayed::Job
わたしたちは…
©Techouse All Rights Reserved P14
©Techouse All Rights Reserved P15 Mike Perham さんありがとう
©Techouse All Rights Reserved P16 Sidekiq Enterprise
©Techouse All Rights Reserved P17 同時実⾏数制限 (Rate Limit) 重複実⾏防⽌ (Unique
Job) 信頼性 (Reliability) 定時実⾏ (Periodic Job) リーダー選出 (Leader Selection) Sidekiq Enterprise の機能たち
©Techouse All Rights Reserved P18 有料ですが 大変よいので オススメ
©Techouse All Rights Reserved P19 そして 時代は サーバレス
©Techouse All Rights Reserved P20 AWS Lambda AWS Fargate Google
Apps Engine Google Cloud Run
©Techouse All Rights Reserved P21 コンテナを デプロイするだけで 動く系
©Techouse All Rights Reserved P22 サーバの管理不要 OSの管理不要
©Techouse All Rights Reserved P23 エンジニアを サーバ管理から解放
©Techouse All Rights Reserved P24 サイコー↗
©Techouse All Rights Reserved P25 わたしたちは……
©Techouse All Rights Reserved P26 AWS Fargate
©Techouse All Rights Reserved P27 全⾯的に Fargate で サーバレス
©Techouse All Rights Reserved P28 通常稼働時
©Techouse All Rights Reserved P29 AWS Cloud Fargate
©Techouse All Rights Reserved P30 ⾼負荷時
©Techouse All Rights Reserved P31 AWS Cloud Fargate
©Techouse All Rights Reserved P32 AWS Cloud Fargate スケールアウト
©Techouse All Rights Reserved P33 AWS Cloud Fargate スケールアウト
©Techouse All Rights Reserved P34 同時実⾏数制限 (Rate Limit) 重複実⾏防⽌ (Unique
Job) Sidekiq Enterprise の機能たち スケールアウトに伴う問題を解消してくれる便利機能ズ
©Techouse All Rights Reserved P35 低負荷時
©Techouse All Rights Reserved P36 AWS Cloud Fargate
©Techouse All Rights Reserved P37 AWS Cloud Fargate スケールイン
©Techouse All Rights Reserved P38 AWS Cloud Fargate スケールイン
©Techouse All Rights Reserved P39 スケールインのとき 何が起きるのか
©Techouse All Rights Reserved P40 AWS Cloud Fargate
©Techouse All Rights Reserved P41 AWS Cloud Fargate SIGTERM
©Techouse All Rights Reserved P42 AWS Cloud Fargate 新規Job 受付停⽌
©Techouse All Rights Reserved P43 AWS Cloud Fargate 終了
©Techouse All Rights Reserved P44 AWS Cloud Fargate
©Techouse All Rights Reserved P45 もしも 処理中の Job が あったら…
©Techouse All Rights Reserved P46 AWS Cloud Fargate
©Techouse All Rights Reserved P47 AWS Cloud Fargate SIGTERM
©Techouse All Rights Reserved P48 AWS Cloud Fargate 新規Job 受付停⽌
©Techouse All Rights Reserved P49 AWS Cloud Fargate でもまだ 処理中💪
©Techouse All Rights Reserved P50 AWS Cloud Fargate 30秒後
©Techouse All Rights Reserved P51 AWS Cloud Fargate 30秒後 SIGKILL
(強制終了)
©Techouse All Rights Reserved P52 AWS Cloud Fargate 30秒後 あああー
処理終わって ないのに……
©Techouse All Rights Reserved P53 AWS Cloud Fargate 30秒後
©Techouse All Rights Reserved P54 30秒経っても exitしなかったら 強制終了される
©Techouse All Rights Reserved P55 処理中のジョブは 途中のまま 強制終了
©Techouse All Rights Reserved P56 リトライ可能な ものなら リトライしてくれる
©Techouse All Rights Reserved P57 リトライできない 性質の Job を どうするか
©Techouse All Rights Reserved P58 Amazon ECS Scale-in Protection
©Techouse All Rights Reserved P59 AWS Cloud Fargate
©Techouse All Rights Reserved P60 AWS Cloud Fargate お願いです 今から300秒間は
KILL しないでください
©Techouse All Rights Reserved P61 AWS Cloud Fargate わかった お願いです
今から300秒間は KILL しないでください
©Techouse All Rights Reserved P62 AWS Cloud Fargate
©Techouse All Rights Reserved P63 AWS Cloud Fargate
©Techouse All Rights Reserved P64 AWS Cloud Fargate
©Techouse All Rights Reserved P65 ただし AWS 固有の APIをコールする 必要がある
©Techouse All Rights Reserved P66 Sidekiq Middleware で実装
©Techouse All Rights Reserved P67 Sidekiq.configure_server do |config| config.server_middleware do
|chain| chain.add ScaleInProtectionMiddleware end end
©Techouse All Rights Reserved P68 うまくいってる模様
©Techouse All Rights Reserved P69 これぞ スケーラブル Sidekiq
©Techouse All Rights Reserved P70 さて
©Techouse All Rights Reserved P71 本⽇ ブース出展 してます
©Techouse All Rights Reserved P72
©Techouse All Rights Reserved P73
©Techouse All Rights Reserved P74 Techouse謹製 Ruby/Rails リファレンスつき ノートなど進呈
©Techouse All Rights Reserved P75 スポンサーブースで お待ちしております