Skip to content

Commit 9b85f64

Browse files
authored
Update [DB] [NHN FORWARD 2021] 비동기 쿼리.md
1 parent 17bffdd commit 9b85f64

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

CS/[DB] [NHN FORWARD 2021] 비동기 쿼리.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
## 전통적인 동기 방식의 쿼리와 문제
77

88
* 쿼리 요청 (Thread) => 쿼리 작업 (DB) => 결과 응답
9-
* ![image-20211215233703478](C:\Users\ksb94\AppData\Roaming\Typora\typora-user-images\image-20211215233703478.png)
9+
* ![image](https://user-images.githubusercontent.com/19357410/146220631-226f52f8-b269-4f30-8d72-f22da4725fce.png)
1010
* 쿼리 작업 시 **응답이 올 때까지 대기**해야하는 문제 발생
1111
* 이를 위해서 `Connection Pool`, `Thread Pool`이 사용되었다.
1212

@@ -36,7 +36,7 @@
3636
### 비동기 처리?
3737

3838
* 응답을 대기하지 않고 계속적으로 처리
39-
* ![image-20211215233945745](C:\Users\ksb94\AppData\Roaming\Typora\typora-user-images\image-20211215233945745.png)
39+
* ![image](https://user-images.githubusercontent.com/19357410/146220663-9bddef47-cdd8-4c44-a0d7-8f2107f68fa2.png)
4040

4141
## MySQL 비동기 지원
4242

@@ -45,9 +45,10 @@
4545

4646
### X DevAPI
4747

48-
![image-20211216003211953](C:\Users\ksb94\AppData\Roaming\Typora\typora-user-images\image-20211216003211953.png)
48+
![image](https://user-images.githubusercontent.com/19357410/146220697-ad0e589b-38b3-4be4-bf18-3f83cdd95c4d.png)
4949

5050
* 새로 추가된 부분
51+
5152
* X Protocol
5253
* NoSQL을 몰라도 개발 가능
5354

@@ -78,8 +79,9 @@
7879
* getSession => CompletableFuture => executeAsync() => 로직 수행 => rowsFuture.get()
7980

8081
* **ISSUE**
82+
8183
* session이 많아질수록 성능이 떨어짐 (session이 1개일 경우 가장 성능이 좋음)
82-
* ![image-20211215234437651](C:\Users\ksb94\AppData\Roaming\Typora\typora-user-images\image-20211215234437651.png)
84+
* ![image](https://user-images.githubusercontent.com/19357410/146220732-85b1ad60-e425-43c2-bee3-f5db4246286b.png)
8385
* 원인 분석
8486
* executeAsync()를 요청할 때 마다 dispatchingThreadMonitor에 lock을 걸고있음
8587
* ListenerDispatcher => while문 마다 lock을 걸고있음
@@ -115,7 +117,7 @@
115117

116118
### X DevAPI vs. jasync-SQL
117119

118-
![image-20211215234934537](C:\Users\ksb94\AppData\Roaming\Typora\typora-user-images\image-20211215234934537.png)
120+
![image](https://user-images.githubusercontent.com/19357410/146220764-6057cd31-a4e4-4216-899d-ffe0efa35bbe.png)
119121

120122
* R2DBC 내부적으로 jasync-SQL 사용
121123

@@ -160,13 +162,13 @@ CompletableFuture<QueryResult> future = connection.sendPreparedStatement(sql)
160162

161163
#### 테스트
162164

163-
![image-20211215235500538](C:\Users\ksb94\AppData\Roaming\Typora\typora-user-images\image-20211215235500538.png)
165+
![image](https://user-images.githubusercontent.com/19357410/146220791-22504e0e-b25b-46e4-8054-62441031b125.png)
164166

165167
#### Stored Procedure
166168

167169
API방식으로 Transaction을 처리할 때 성능이 낮아지는 문제를 어느정도 줄일 수 있다.
168170

169-
![image-20211215235525361](C:\Users\ksb94\AppData\Roaming\Typora\typora-user-images\image-20211215235525361.png)
171+
![image](https://user-images.githubusercontent.com/19357410/146220812-12f5ac63-00ea-44ea-856f-744f8215f156.png)
170172

171173
## 정리
172174

@@ -187,4 +189,4 @@ API방식으로 Transaction을 처리할 때 성능이 낮아지는 문제를
187189
* Jedis, Lettuce
188190
* Zeko SQL
189191
* Stored Procedure
190-
* 200만 동접 게임을 위한 MySQL 샤딩 (NHN FORWARD 2019)
192+
* 200만 동접 게임을 위한 MySQL 샤딩 (NHN FORWARD 2019)

0 commit comments

Comments
 (0)