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
61
46k
RubyKaigi 2024 にみんなで参加した Techouse のその後の進捗 with Ruby
techouse
0
280
リーンスタートアップのリーンな品質の話
techouse
1
1.6k
Customer Identity Cloud powered by Auth0 を使ったマルチプロダクト構築の実践と総括
techouse
0
970
Techouse company profile
techouse
4
170k
Techouse Company Profile for Engineers
techouse
0
66k
オフィス風景.pdf
techouse
0
2.3k
Other Decks in Programming
See All in Programming
KANNA Android の技術的課題と取り組み
watabee
1
480
Storybookの情報をMCPサーバー化する
shota_tech
2
1k
今話題のMCPサーバーをFastAPIでサッと作ってみた
yuukis
0
130
Flutterでllama.cppをつかってローカルLLMを試してみた
sakuraidayo
0
140
大LLM時代にこの先生きのこるには-ITエンジニア編
fumiyakume
8
3.4k
note の Elasticsearch 更新系を支える技術
tchov
9
3.6k
知識0からカンファレンスやってみたらこうなった!
syossan27
4
220
The Missing Link in Angular’s Signal Story: Resource API and httpResource
manfredsteyer
PRO
0
140
ASP.NETアプリケーションのモダナイゼーションについて
tomokusaba
0
260
eBPF超入門「o11yに使える」とは (20250424_eBPF_o11y)
thousanda
1
120
VibeCoding時代のエンジニアリング
daisuketakeda
0
170
Jakarta EE Meets AI
ivargrimstad
0
880
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
268
20k
Building Adaptive Systems
keathley
41
2.5k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
The Cult of Friendly URLs
andyhume
78
6.3k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
34
2.2k
A better future with KSS
kneath
239
17k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
790
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
105
19k
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 スポンサーブースで お待ちしております