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
59
44k
RubyKaigi 2024 にみんなで参加した Techouse のその後の進捗 with Ruby
techouse
0
240
リーンスタートアップのリーンな品質の話
techouse
1
1.5k
Customer Identity Cloud powered by Auth0 を使ったマルチプロダクト構築の実践と総括
techouse
0
870
Techouse company profile
techouse
4
160k
Techouse Company Profile for Engineers
techouse
0
57k
オフィス風景.pdf
techouse
0
2k
Other Decks in Programming
See All in Programming
Rails アプリ地図考 Flush Cut
makicamel
1
120
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.3k
Ruby on cygwin 2025-02
fd0
0
140
Immutable ActiveRecord
megane42
0
140
Amazon Bedrock Multi Agentsを試してきた
tm2
1
290
第3回 Snowflake 中部ユーザ会- dbt × Snowflake ハンズオン
hoto17296
4
370
Rubyで始める関数型ドメインモデリング
shogo_tksk
0
110
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
150
ファインディLT_ポケモン対戦の定量的分析
fufufukakaka
0
710
一休.com のログイン体験を支える技術 〜Web Components x Vue.js 活用事例と最適化について〜
atsumim
0
470
データの整合性を保つ非同期処理アーキテクチャパターン / Async Architecture Patterns
mokuo
47
17k
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
1
560
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
193
16k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Navigating Team Friction
lara
183
15k
Designing for Performance
lara
604
68k
Docker and Python
trallard
44
3.3k
Into the Great Unknown - MozCon
thekraken
35
1.6k
Music & Morning Musume
bryan
46
6.3k
For a Future-Friendly Web
brad_frost
176
9.5k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
A Modern Web Designer's Workflow
chriscoyier
693
190k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
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 スポンサーブースで お待ちしております