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
990
スケーラブル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
0
1k
Customer Identity Cloud powered by Auth0 を使ったマルチプロダクト構築の実践と総括
techouse
0
420
Techouse company profile
techouse
4
120k
Techouse Company Profile for Engineers
techouse
0
27k
オフィス風景.pdf
techouse
0
1.2k
Other Decks in Programming
See All in Programming
Ruby Pattern Matching
bkuhlmann
0
930
Fragment Composition of GraphQL
quramy
13
1.6k
Git Lint
bkuhlmann
4
760
Milestoner
bkuhlmann
1
420
PostmanでAPIの動作確認が楽になった話
h455h1
0
190
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
170
禅の心を手に入れよ
eltociear
1
420
AppRouter Panel Talk
yosuke_furukawa
PRO
1
490
2 週間で Twitter Bot を作ってみた
contour_gara
0
800
Go製Webアプリケーションのエラーとの向き合い方大全、あるいはやっぱりスタックトレース欲しいやん / Kyoto.go #50
utgwkk
6
1.9k
Polars入門
daikikatsuragawa
1
200
Git Rebase
bkuhlmann
11
1.6k
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Git: the NoSQL Database
bkeepers
PRO
423
63k
A Modern Web Designer's Workflow
chriscoyier
689
190k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
123
39k
Done Done
chrislema
178
15k
Automating Front-end Workflow
addyosmani
1357
200k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
358
22k
The Invisible Side of Design
smashingmag
294
49k
How to name files
jennybc
65
93k
GraphQLの誤解/rethinking-graphql
sonatard
56
9.3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
21
1.6k
A designer walks into a library…
pauljervisheath
201
23k
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 スポンサーブースで お待ちしております