Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
定時実行の設定が難しいから、 仕組みで解決をしている話
Search
Hayato Nakamura
September 11, 2024
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
定時実行の設定が難しいから、 仕組みで解決をしている話
CRMシステムで利用している定時実行。
cronの設定についてお話しました。
Hayato Nakamura
September 11, 2024
Transcript
15 slides
© Cake.jp Co.Ltd. All Right Reserved.|Confidential 2024/09/11 定時実行の設定が難しいから、 仕組みで解決をしている話
2 © Cake.jp Co.Ltd. All Right Reserved.|Confidential 自己紹介 • 名前
◦ 中村 隼人 • 業務 ◦ バックエンドエンジニア(PHP/Kotlin/TypeScript) • おすすめ🍰 ◦ 子どもが野菜を食べてくれる ◦ 大人が食べてもおいしい
3 © Cake.jp Co.Ltd. All Right Reserved.|Confidential CRM(Customer Relationship Management) 顧客関係管理のこと。
Cake.jpでの代表例 一度購入いただいた会員様に再度ご購入いただけるように働きかけること Cake.jpのCRMを支える環境について紹介
4 © Cake.jp Co.Ltd. All Right Reserved.|Confidential Cake.jpでは主に2つの方法で、お客様に連絡を実施。 • 24/365で動くEC2のcron
• ECSタスクスケジューラ Cake.jpのCRMを支える環境について紹介
5 © Cake.jp Co.Ltd. All Right Reserved.|Confidential cronとは・・・Unix系OSのジョブ管理ツール cronの書式 ※AWSのcron式は「年」も必須
定期実行に cronを利用
6 © Cake.jp Co.Ltd. All Right Reserved.|Confidential 数値は固定値の他、ワイルドカードなどを利用できる。 定期実行に cronを利用
7 © Cake.jp Co.Ltd. All Right Reserved.|Confidential ※AWSのcron式は日と曜日の両方がワイルドカードの場合、片方を? にしなければなら ない。
定期実行に cronを利用
8 © Cake.jp Co.Ltd. All Right Reserved.|Confidential 毎月10日16:00に実行するcronの設定を実施 実際におきた事例
9 © Cake.jp Co.Ltd. All Right Reserved.|Confidential 毎月10日16:00に実行するcronの設定を実施 実際におきた事例 ↑
分の設定をワイルドカードで指定してしまった
10 © Cake.jp Co.Ltd. All Right Reserved.|Confidential 毎月10日16:00に実行するcronの設定を実施 実際におきた事例 ↑
分の設定をワイルドカードで指定してしまった 10日の16時台に毎分バッチが実行。 バッチの特性上、1分毎に同じメールが同じ会員様に発送された。
11 © Cake.jp Co.Ltd. All Right Reserved.|Confidential • レビューがcronの書式のみで、最終的にどういうふうに設定されているかを確認し ていなかった。
◦ 検証環境が用意されていたが、使われていなかった。 失敗からの学び
12 © Cake.jp Co.Ltd. All Right Reserved.|Confidential 1. 外部ツールを使って、cron式を視覚的に確認している。 https://crontab.guru/#5_0/2_*_8_*
を使ってます。 AWSの?の書式に対応していないので、そこだけ書き換えが必要。 cron式が正しく動作していることを検証しているためしていること
13 © Cake.jp Co.Ltd. All Right Reserved.|Confidential 2. AWS EventBridge
> ルールから設定内容を確認 ローカルタイムゾーンで確認できるので安心 cron式が正しく動作していることを検証しているためしていること
14 © Cake.jp Co.Ltd. All Right Reserved.|Confidential 1. Cake.jpではインフラ専従者でないものがcron式を触る必要がある。 a.
確認方法をチームで共有し、ルール化した。 まとめ
15 © Cake.jp Co.Ltd. All Right Reserved.|Confidential ご清聴ありがとうございました。 アイコンは https://icons8.jp/
のものを使用しました。
More Decks by Hayato Nakamura
See All by Hayato Nakamura
呼び出し順で、 売上金額を回収できなくした話
chikin14niwa
0
120
N+1はダメなのか? システムを落としたあの日より
chikin14niwa
0
81
重要だけど、 よく忘れる仕様との付き合い方
chikin14niwa
0
140
Sessionの衝突から学んだPHPのSession作成方法 @CakeJP 2023/12/13 エンジニア小話会 PHPを語り合おう
chikin14niwa
0
480
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Everyday Curiosity
cassininazir
0
400
New Earth Scene 8
popppiees
5
2.8k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.4k
Agile that works and the tools we love
rasmusluckow
331
22k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
770
Building the Perfect Custom Keyboard
takai
2
960
Skip the Path - Find Your Career Trail
mkilby
1
290
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
880
Designing for Performance
lara
612
70k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k