분류 전체보기
-
8장 backpressureSpring/Webflux 2023. 4. 23. 18:30
8.1 Backpressure란? Subscriber 의 속도가 느린 경우 필요 8.2 Reactor에서의 Backpressure 처리 방식 8.2.1 데이터 개수 제어 Subscriber 가 적절히 처리할 수 있는 수준의 데이터 개수를 Publisher 에게 요청하는 것 public static void main(String[] args) { Flux.range(1, 5) .doOnRequest(data -> log.info("# doOnRequest: {}", data)) .subscribe(new BaseSubscriber() { @Override protected void hookOnSubscribe(Subscription subscription) { request(1); } @SneakyThro..
-
7장 Cold Sequence 와 Hot SequenceSpring/Webflux 2023. 4. 23. 16:13
7.1 Cold와 Hot의 의미 Hot swap : 컴퓨터 전원이 켜져 있는 상태에서 디스크등의 장치를 교체할 경우 Hot deploy : 서버를 재시작하지 않고서 응용 프로그램의 변경 사항을 적용할 수 있는 기능 Hot wallet : 인터넷에 연결되어 즉시 사용 가능하지만, 보안에 취약 -> Hot 무언가 처음부터 다시 시작하지 않고, 같은 작업이 반복되지 않는 느낌 Cold wallet : 인터넷에 단절되어 사용성은 떨어지지만 보안이 강화 -> Cold 처음부터 새로 시작해야 하고, 새로 시작하기 때문에 같은 작업이 반복 Cold 는 무언가를 새로 시작하고, Hot 은 무언가를 새로 시작하지 않는다 7.2 Cold Sequence Cold Sequece : Sequece 가 새로 시작한다 정도로 볼..
-
6장 마블 다이어그램Spring/Webflux 2023. 4. 22. 17:10
Marbel Diagram 사전학습 https://brunch.co.kr/@lonnie/20 RxJava, 마블 다이어그램 마블 다이어그램, Rx를 공부하면 필연적으로 마주하게 되는 도표다. 리액티브 세상에서 일어나는 모든 일들(비동기 데이터 흐름)은 마블 다이어그램으로 시각화된다. 따라서 이 도표를 익히는 brunch.co.kr 6.1 마블 다이어그램(Marble Diagram)이란? 2개의 Timeline + 1 operator 1~4 : Publisher 가 emit 하는 타임라인 5 : operator 6 ~ 9 : Downstream 에 가공된 데이터 6.2 마블 다이어그램으로 Reactor의 Publisher 이해하기 Mono Mono 는 위 그림처럼 하나의 데이터를 emit 합니다. publ..
-
5장 Reactor 개요Spring/Webflux 2023. 4. 22. 16:12
5.1 Reactor 란? Reactor 의 특징 01. Reactive Streams 02. Non-Blocking 03. Java's functional API 04. Flux[N] 2개의 Publisher 중 하나, N 개의 데이터를 emit 함, 무한대 가능 05. Mono[0|1] 2개의 Publisher 중 하나, 한 건도 emit 하지 않거나, 단 한건만 emit 하는 단발성 데이터 06. Well-suited for microservices 07. Backpressure - ready network Publisher 로 부터 전달 받은 데이터를 처리하는 데 있어 과부하 걸리지 않도록 제어하는 Backpressure 지원 5.2 Hello Reactor 코드로 보는 Reactor의 구성요소 ..
-
4장 리액티브 프로그래밍을 위한 사전 지식Spring/Webflux 2023. 4. 22. 13:13
1 함수형 인터페이스(Functional Interface) 함수형 인터페이스 역시 인터페이스 함수를 값으로 취급, 어떤 함수를 호출할 때 함수 자체를 파라미터로 전달할 수 있습니다 ?? 암호화 화폐를 unit 순서대로 sort 하는 예제 Collections.sort() 이용 Comparator 인터페이스 사용 public static void main(String[] args) { List cryptoCurrencies = SampleData.cryptoCurrencies; // unit 순서대로 sort Collections.sort(cryptoCurrencies, new Comparator() { @Override public int compare(CryptoCurrency cc1, CryptoC..
-
3장 Blocking I/O 와 Non-Blocking I/OSpring/Webflux 2023. 4. 21. 21:41
3.1 Blocking I/O 클라이언트 PC 본사 API : 지점 API 응답 기다리는 동안 blocking i/o 발생 지점 API 보완을 위해 멀티스레딩 기법 사용시 Context Switching 으로 인한 스레드 전환 비용 발생 PCB : Process Control Block 대기 중인 작업 저장소 Context Swithcing 01. 현재 실행되고 있는 프로세스 정보는 Cpu 의 레지스터에 저장되는데, 프로세스들이 번갈아가며 실행되는 과정에서 PCB 에 저장된 프로세스 정보가 레지스터에 지속적으로 저장되어, 그 값이 변경되는 것을 컨텍스트 스위칭 02. P1 끝나고 P2 가 바로 실행되는 것이 아니라 약간의 대기시간 존재 ; PCB에 정보 저장하거나 불러오는 시간 - 이 작업이 많을 수록 ..
-
2장 리액티브 스트림즈Spring/Webflux 2023. 4. 19. 09:01
스프링으로 시작하는 리액티브 프로그래밍 p39 2.1 리액티브 스트림즈란 데이터 스트림을 non-blocking 이면서 비동기적인 방식으로 처리하기 위한 리액티브 라이브러리의 표준 사양 p40 2.2 리액티브 스트림즈 구성요소 publisher : 데이터 생성 통지(발생,게시,방출) 역할 subscriber : 데이터를 받아서 처리하는 역할 subscription : publisher 에 요청할 데이터의 개수를 지정하고 구독을 취소하는 역할을 한다 processor : publisher 와 subscriber 의 기능을 모두 가지고 있다. 즉, subscriber 로서 다른 publisher 를 구독할 수 있고, publishe 로서 다른 subscriber 가 구독할 수 있다. p40 publisher..
-
Spring Webflux 공부하기 1Spring/Webflux 2023. 4. 18. 22:08
Official https://docs.spring.io/spring-framework/docs/5.2.6.RELEASE/spring-framework-reference/web-reactive.html#webflux Web on Reactive Stack The original web framework included in the Spring Framework, Spring Web MVC, was purpose-built for the Servlet API and Servlet containers. The reactive-stack web framework, Spring WebFlux, was added later in version 5.0. It is fully non-blocking, supports..