This repository was archived by the owner on Oct 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
[#46] 비동기적인 Push 알람 서비스 구현 #48
Open
tjdrnr0557
wants to merge
14
commits into
develop
Choose a base branch
from
feature/46
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8108c9c
푸쉬 알람 서비스 초기 환결설정
tjdrnr0557 f91e91e
라이더 토큰 추가
tjdrnr0557 6252939
Async를 위한 스레드 풀 초기 설정
tjdrnr0557 63e9b35
주문 승인 시 대기중인 라이더들에게 푸쉬 알람 전송 기능 추가
tjdrnr0557 4451c96
git ignore 추가
tjdrnr0557 dd0fcde
캐시 삭제
tjdrnr0557 f45050a
[#47] 리뷰 반영
tjdrnr0557 631569a
[#47] 리뷰 반영
tjdrnr0557 6e14c40
[#47] 리뷰 반영
tjdrnr0557 c6280de
[#47] 리뷰 반영
tjdrnr0557 1c5b247
[#47] 리뷰 반영
tjdrnr0557 3ece9d5
[#47] 리뷰 반영
tjdrnr0557 a1d3104
[#47] 리뷰 반영
tjdrnr0557 71c41a2
어플리케이션 레벨에서 비동기를 구현하여 푸쉬메세지 전송
tjdrnr0557 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,10 +21,10 @@ | |
| @EnableAsync | ||
| public class SpringAsyncConfig { | ||
|
|
||
| private static final int CORE_POOL_SIZE = 3; | ||
| private static final int MAX_POOL_SIZE = 100; | ||
| private static final int QUEUE_CAPACITY = 3; | ||
| private static final int KEEP_ALIVE_SECONDS = 30; | ||
| private static final int CORE_POOL_SIZE = 5; | ||
| private static final int MAX_POOL_SIZE = 500; | ||
| private static final int QUEUE_CAPACITY = 0; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. queue capacity가 양수이면 LinkedBlockingQueue로 지정되고 0이하라면 SynchronousQueue를 이용합니다. LinkedBlockingQueue는 큐의 크기가 제한되지 않는 큐입니다. 크기를 수동으로 설정을 할 수도 있습니다. 하지만 큐에 작업이 계속 쌓이게 되면 푸쉬 알람에 병목이 생길 수 있습니다. SynchronousQueue는 큐라기보다는 작업이 들어오면 그것을 스레드에 넘겨주는 역할을 합니다. 큐에 쌓지 않고 바로 프로듀서에서 생성한 작업을 컨슈머인 스레드에게 직접 전달합니다. 쉬고 있는 스레드에게 처리할 작업을 직접 넘겨주므로 효율적입니다. 또한 대기중인 스레드가 없는 상태에서 스레드의 개수가 max pool size보다 작다면 새로운 스레드를 생성해 동작시킵니다. 따라서 푸쉬알람이 폭증해도 대비할 수 있습니다. 하지만 정해둔 max pool size보다 커진다면 abort policy를 이용해 푸쉬 알람 보내는 것을 거부하고 exception을 던집니다. |
||
| private static final int KEEP_ALIVE_SECONDS = 60; | ||
| private static final String NAME_PREFIX = "springAsyncTask-"; | ||
|
|
||
| @Bean(name = "springAsyncTask") | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거는 이렇게 높혀주신 이유가 있으실까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
라이더들에게 지역별로 푸쉬 알람을 보내긴 하지만 갑자기 푸쉬 알람이 폭증할 가능성이 있기 때문에 max_pool_size를 늘려서 푸쉬 알람 보내는 기능에 병목이 일어날 확률이 적어지도록 만들었습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런 값은 성능테스트하면서 조절하는게 일반적인데요~ 추후에 한번 테스트해보시면서 조절해봐도 좋을 것 같네요