You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
단점 : 다중 서버 환경에서 여러 서버에서 스케줄러가 실행되므로 데이터 처리가 중복으로 발생할 것 같음
@EnableScheduling@ServicepublicclassDealServiceScheduler {
@Scheduled(cron = "0 0 10 * * ?") // 매일 오전 10시에 실행publicvoidopenTimeDeal() {
// Redis에 저장된 딜 상품 상태 : 오픈 전 -> 오픈
}
@Scheduled(cron = "0 0 11 * * ?") // 매일 오전 11시에 실행publicvoidcloseTimeDeal() {
// Redis에 저장된 딜 상품 상태 : 오픈 -> 마감// 다음날 오픈 될 딜 상품 MySQL -> Redis로 쓰기 : 딜 상품 상태 추가해야 됨
}
}
방법 3. batch 서버 구축
단점 : 간단한 스케줄링 작업 때문에 필요한대, 24시간 동안 돌아가는건 경제적 비용 낭비라고 생각함.
Why
How
요구사항
구현
방법 1. AWS CloudWatch Events + AWS Lambda
CloudWatch Events
에 대해 공부해봐야겠지만, 가장 최선의 방법이라고 생각방법 2. @scheduled 활용하기
방법 3. batch 서버 구축
Reference
The text was updated successfully, but these errors were encountered: