본문 바로가기

전체 글144

230403 TIL(Redis에 담을 주문 Logic 설계) 0. 만들고자 하는 기능 책 주문 log 를 Redis에 넣는다. 매일 2:00am에 어떤 책이 얼마나 팔렸는지 세어서 ranking을 메긴다. 하루 단위 일지 한 주 단위 일지는 바뀔 수 있음, 일단 구현이 잘 되었는지 확인하기 위해 하루 단위로 설계 매일 2:00am에 Redis에 저장되어 있던 주문들을 DB의 jumoon table로 넣어준다. 재고량이 부족한 책들은 다시 재고량을 채워준다. 이 작업이 완료되면 Redis를 초기화 시키고 많이 팔린 책 1위부터 8위 까지 Ranking 만 남긴다. 이 과정을 batch와 scheduler를 이용해 반복시킨다. 1. Redis에 주문을 어떻게 담을 것인가? 1) 주문에 필요한 정보들 책 id : Long 멤버 id : Long 주문 수량 quantit.. 2023. 4. 4.
230401 TIL 1. Docker 설치하기 1) 작업 관리자 > 성능 > CPU 가상화 : 사용 설정 확인 설정이 안되어 있다면 페이지 하단의 참조를 확인하거나 아래와 같이 설정 제어판 > 프로그램 설치 및 제거 > Window 기능 켜기/끄기 클릭 > Hyper-V 체크 확인 후 리부팅 2) Docker 설치 링크 접속 후 window des https://hub.docker.com/editions/community/docker-ce-desktop-windows/ 3) Docker 사용 설치 완료후 Redis image 생성 아래와 같이 Run 을 누른 후 이름을 지어주고 ports를 6379로 설정, 여기서는 testRedis로 명명했다. Redis 기본 포트는 6379이다. 별도로 지정하지 않으면 6379로 연결을.. 2023. 4. 3.
230401 TIL 1. Spring Scheduler 설정(배치와 엮어서) 1)Bulid.gradle에 dependency 추가 implementation 'org.springframework.boot:spring-boot-starter-batch' implementation 'org.springframework.boot:spring-boot-starter-quartz' testImplementation 'org.springframework.boot:spring-boot-batch-test' 2)application에 annotation 설정 @EnableScheduling @EnableBatchProcessing @SpringBootApplication public class GodoksApplication { publ.. 2023. 4. 1.
230330 TIL 1. Spring batch 설정 1)Bulid.gradle에 dependency 추가 implementation 'org.springframework.boot:spring-boot-starter-batch' 2)application.properties에 annotation 설정 @EnableBatchProcessing @SpringBootApplication public class SpringBatchApplication { public static void main(String[] args) { SpringApplication.run(SpringBatchApplication.class, args); } } 3)Simple Batch 코드 작성 @Slf4j @RequiredArgsConstructor .. 2023. 3. 31.