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 (Kaigi on Rails 2023 Day 1 スポンサーLT2)
Search
Techouse
October 26, 2023
Programming
0
1.2k
スケーラブル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
1
1.2k
Customer Identity Cloud powered by Auth0 を使ったマルチプロダクト構築の実践と総括
techouse
0
560
Techouse company profile
techouse
4
130k
Techouse Company Profile for Engineers
techouse
0
36k
オフィス風景.pdf
techouse
0
1.5k
Other Decks in Programming
See All in Programming
Introduction to GitOps
hwchiu
0
110
入社1ヶ月でここまでやった!Findy Toolsインフラ支援の最適化
rvirus0817
6
1.4k
GraphQL はいいぞ! ~Laravel で学ぶ GraphQL 入門~
azuki
1
160
はしめてのプログラミングとロボット制御
watawatavoltage
0
290
CSC307 Lecture 08
javiergs
PRO
0
330
Rust.Nagoya #1
codemountains
0
170
Play Billing Library 7.0.0 変更点まとめ@potatotips#88
kako351
0
160
Namespace on read
tagomoris
2
370
DDDを志して3年経ったら「DDDの皮を被ったクリーンアーキテクチャ」になった話【デブサミ2024夏】
texmeijin
1
620
Ruby メモリ管理 プログラミング
megmogmog1965
0
130
日付と正規化
megmogmog1965
0
140
Android開発者のための Kotlin Multiplatform入門
ntaro
0
190
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
79
5.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
357
18k
How to Think Like a Performance Engineer
csswizardry
4
590
In The Pink: A Labor of Love
frogandcode
139
22k
Leading Effective Engineering Teams 2024
addyosmani
3
300
KATA
mclloyd
20
13k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
149
45k
Statistics for Hackers
jakevdp
792
220k
Into the Great Unknown - MozCon
thekraken
20
1.3k
A Philosophy of Restraint
colly
200
16k
The Language of Interfaces
destraynor
151
23k
Producing Creativity
orderedlist
PRO
340
39k
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 スポンサーブースで お待ちしております