전체 글
-
Spring Event 동작 원리 - 4Spring Framework 2023. 9. 16. 00:01
[1] Spring Event 동작 원리 - 1 [2] Spring Event 동작 원리 - 2 [3] Spring Event 동작 원리 - 3 이전 포스팅에 이어 EventListener에서 @Async는 어떻게 동작하는지 알아보고자 합니다. Spring Boot @Async @EnableASync, @Async 어노테이션을 활용하여 비동기 메서드로 동작을 수행할 수 있습니다. @Async는 AOP에 의해 동작하며 최종적으로는 AsyncExecutionAspectSupport클래스의 doSubmit 메서드를 통해 이루어집니다. AsyncExecutionAspectSupport 클래스 protected Object doSubmit(Callable task, AsyncTaskExecutor executor..
-
토스 - SLASH 22 - 토스뱅크의 완전히 새로운 대출 시스템세미나, 영상 요약정리 2023. 9. 15. 00:01
https://www.youtube.com/watch?v=SLamxuykpnw 토스뱅크에서 대출서버 Server Developer 민재슬님의 발표를 듣고 정리해보고자 합니다. 전통 금융 회사의 아키텍처 전통금융회사는 비즈니스 로직이 계정계라 불리는 모놀리식 코어뱅킹에서 구현됩니다. 채널계라 불리는 서비스 서버의 역할을 사용자와 연계하여 제품을 사용하는 게 필요한 요청과 응답을 코어 뱅킹 시스템의 전문 규격에 맞추어 변환하고 전달하는데 중점을 두고 있습니다. 모놀리식서버의 단점으로 신규 제품 개발에 더 많은 시간이 소요되게 됩니다 (분석을 위해..) 토스 뱅크의 아키텍처 마이크로서비스의 장점을 가져와서 서비스서버와 코어뱅킹서버를 각각 독립된 API 서비스로 정의하여 독립된 서비스가 비즈니스 로직을 처리할 ..
-
Spring Boot가 다중요청을 처리하는 방법Spring Framework 2023. 9. 14. 00:01
개요 Tomcat의 Thread에 대해 알아보다가 accept-count (작업큐의 사이즈)를 1로 설정했는데도 여러 개의 요청을 처리하는 모습을 보고 내부가 어떻게 동작하길래 이런 일이 가능한 건지 궁금해져서 알아보고자 합니다. accept-count란? max-connections 개수만큼 Tomcat 커넥터가 TCP 커넥션을 가지고 있을 때, 추가적인 요청이 오면 accept-count의 개수만큼 백로그에 저장함. (커넥션이 늘어나지는 않음) 스레드풀을 활용하여 요청을 처리한다! Queue에 Task를 담아두고 놀고 있는 스레드가 존재하면 해당 작업을 수행합니다. 여기서 accept-count는 Queue의 크기에 해당합니다. 이때 Queue에 크기를 1으로 설정하고, Thread의 크기를 1로 설..
-
Spring Event 동작 원리 -3Spring Framework 2023. 9. 13. 00:01
[1] Spring Event 동작 원리 - 1 [2] Spring Event 동작 원리 - 2 이전 포스팅에 이어 Spring EventListener의 등록과정에 대해 알아보고자 합니다. AbstractApplicationEventMulticaster protected Collection sourceType = (source != null ? source.getClass() : null); ListenerCacheKey cacheKey = new ListenerCacheKey(eventType, sourceType); // Potential new retriever to populate CachedListenerRetriever newRetriever = null; // Quick check for ..
-
Spring Event 동작 원리 - 2Spring Framework 2023. 9. 12. 00:01
[1] Spring Event 동작 원리 - 1 이전 포스팅에 이어 invokeListener에 대해 알아보고자 합니다. InvokeListener 메서드 private void doInvokeListener(ApplicationListener listener, ApplicationEvent event) { try { listener.onApplicationEvent(event); } } publishEvent가 발생한 후 메서드를 타고 들어가면 doInvokeListener 메서드가 호출되고 해당 메서드는 onApplicationEvent 메서드를 호출합니다. 어떻게 수많은 Entity 중 특정 Entity를 Consume 할 때만 실행될까? onApplicationEvent 메서드를 타고들어가보면 A..
-
Spring Event 동작 원리 - 1Spring Framework 2023. 9. 11. 00:01
개요 Spring이 제공하는 EventListener를 사용하다가 문득 Spring Event는 어떻게 동작하는 건지 궁금했었습니다. 추후에 비동기를 위해서는 @Async를 활용하는 대신에 ApplicationEventMulticaster를 사용할수도 있다는 이야기를 듣고 찾아보다가 Spring Event의 동작원리를 다룬 글을 보고 이 기회에 이해해 보고자 정리해보려 합니다. Application Context public interface ApplicationContext extends EnvironmentCapable, ListableBeanFactory, HierarchicalBeanFactory,MessageSource, ApplicationEventPublisher, ResourcePatter..
-
알림 서비스로 시작하는 서버 개발세미나, 영상 요약정리 2023. 9. 10. 00:01
https://www.youtube.com/watch?v=CmTO68I2HSc 개요 if(kakao) 2022 발표에서 카카오뱅크의 김민수 님의 발표인 알림 서비스로 시작하는 서버 개발을 요약해보고자 합니다. 카카오뱅크의 알림 이체, 카드 사용, 광고 등의 이벤트 발생 시 알림을 생성하였습니다. 카카오뱅크에서는 알림 시스템을 어떻게 만들었을까요? 카카오뱅크의 알림 시스템 V1 현재 아키텍처는 알림 생성과 조회를 담당하는 알림 서버의 구조입니다. 하지만 이체나 카드 사용량이 많아져 알림 생성에 부하가 걸린다면 어떻게 될까요? 알림 서버의 CPU 사용량이 100%에 가까워지거나 스레드가 고갈될 수 있습니다. 이렇게 되면 알림생성으로 발생한 장애가 알림 조회까지 전파가 됩니다. 카카오뱅크의 알림 시스템 V2 ..
-
JVM Warm-up 이란Java/자바를 더 깊게 2023. 9. 9. 00:01
JVM Warm-up 이란?warm-up은 흔히 워밍업으로 우리가 알고 있으며 몸풀기 준비운동이라는 뜻입니다. 그렇다면 JVM의 준비운동은 어떤것을 의미할까요? 이를 이해하기 위해서는 자바언어의 컴파일 과정을 알아볼 필요가 있습니다. 자바 언어의 컴파일 과정JVM 실행 전1) 소스 코드인 .java 파일을 바이트 코드인 .class 파일로 변환합니다. JVM 실행 후2) 클래스를 사용하는 시점에 클래스 로더가 lazy loading을 수행합니다.3) 로딩된 클래스를 OS가 이해할 수 있는 기계어로 변환합니다. 즉, 클래스가 실제로 사용되는 시점에 기계어로 변환됩니다. 새로운 버전의 애플리케이션을 배포한 직후에는 대부분의 클래스들이 사용되지 않았기 때문에 메모리에 적재되지 않은 상태이며 응답지연이 발생하..