Skip to content

Commit a1bb481

Browse files
authored
docs: README 시스템 구조 및 시퀀스 다이어그램 간략화 (#246)
1 parent a998413 commit a1bb481

3 files changed

Lines changed: 100 additions & 36 deletions

File tree

README.md

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Swagger 설정이 포함되어 있어 실행 환경에서 API 문서를 확인
163163

164164
## 시스템 구조
165165

166-
![TrainUs Architecture](./docs/architecture/trainus-architecture.png)
166+
![TrainUs Architecture](./docs/architecture/trainus-architecture-simplified.png)
167167

168168
운영 환경에서는 API 서버와 Consumer 서버를 역할별 profile로 분리합니다.
169169

@@ -189,64 +189,62 @@ config:
189189
theme: redux-color
190190
themeCSS: |
191191
text.actor {
192-
font-size: 17px !important;
193-
}
194-
.messageText {
195192
font-size: 19px !important;
193+
font-weight: 600 !important;
196194
}
197-
.note {
198-
fill: #f1f5f9 !important;
199-
stroke: #cbd5e1 !important;
195+
.messageText {
196+
font-size: 20px !important;
200197
}
201198
.noteText {
202-
font-size: 17px !important;
199+
font-size: 18px !important;
200+
font-weight: 600 !important;
203201
}
204202
.labelText {
205-
font-size: 17px !important;
203+
font-size: 18px !important;
204+
font-weight: 600 !important;
206205
}
207206
.loopText {
208-
font-size: 17px !important;
207+
font-size: 18px !important;
208+
font-weight: 600 !important;
209+
}
210+
.note {
211+
fill: #f8fafc !important;
212+
stroke: #cbd5e1 !important;
209213
}
210214
---
211215
sequenceDiagram
212216
autonumber
213217
actor User
214-
participant API as API Server
215-
participant Core as Redis Core<br/>(Sorted Set)
216-
participant Consumer as Consumer Server
217-
participant Stream as Redis Stream
218-
participant DB as PostgreSQL / PostGIS
219-
220-
activate API
221-
User->>API: POST /lesson/apply
218+
participant API as API<br/>Server
219+
participant Core as Redis Core<br/>(Stock / Waiting / Status)
220+
participant Consumer as Consumer<br/>Server
221+
participant Stream as Redis<br/>Stream
222+
participant DB as DB
223+
224+
User->>API: 신청 요청
222225
API->>Core: 재고 선점 / 중복 확인 / 대기열 등록
223-
Note over API,Core: requestId는 Sorted Set Waiting Room에서 대기
224226
API-->>User: requestId 반환
225-
deactivate API
226227
227-
activate Consumer
228+
Note over User,Core: 사용자는 응답 대기 대신 requestId로 처리 상태 확인
229+
228230
rect rgb(255, 242, 242)
229-
Note over Core,Stream: Admission 단계
230-
Consumer->>Core: 대기열 requestId dequeue
231-
Consumer->>Core: 상태변경: PROCESSING
232-
Consumer->>Stream: XADD 신청 메시지
231+
Note over Core,Stream: Admission - 접수 요청을 처리 메시지로 전환
232+
Consumer->>Core: 대기열 조회
233+
Consumer->>Stream: 신청 메시지 적재
233234
end
234-
Note over Consumer,Stream: 신청 메시지는 Redis Stream에 적재
235+
235236
rect rgb(239, 246, 255)
236-
Note over Core,DB: Consumer 처리 단계
237-
Stream-->>Consumer: XREADGROUP
238-
Consumer->>DB: DB 반영
239-
Consumer->>Core: 상태변경: SUCCESS / FAIL
237+
Note over Core,DB: Async Processing - 신청 내역 DB 반영
238+
Consumer->>Stream: 메시지 읽기
239+
Consumer->>DB: 신청 내역 일괄 반영
240+
Consumer->>Core: SUCCESS / FAIL 저장
240241
end
241-
deactivate Consumer
242242
243-
loop requestId polling
244-
activate API
245-
User->>API: GET /lesson/apply/{requestId}
243+
loop requestId 기반 상태 조회
244+
User->>API: requestId 상태 조회
246245
API->>Core: 상태 조회
247246
Core-->>API: WAITING / PROCESSING / SUCCESS / FAIL
248-
API-->>User: 현재 상태 응답
249-
deactivate API
247+
API-->>User: 현재 상태 반환
250248
end
251249
```
252250

9.55 MB
Loading
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# TrainUs Async Processing Sequence
2+
3+
```mermaid
4+
---
5+
config:
6+
theme: redux-color
7+
themeCSS: |
8+
text.actor {
9+
font-size: 19px !important;
10+
font-weight: 600 !important;
11+
}
12+
.messageText {
13+
font-size: 20px !important;
14+
}
15+
.noteText {
16+
font-size: 18px !important;
17+
font-weight: 600 !important;
18+
}
19+
.labelText {
20+
font-size: 18px !important;
21+
font-weight: 600 !important;
22+
}
23+
.loopText {
24+
font-size: 18px !important;
25+
font-weight: 600 !important;
26+
}
27+
.note {
28+
fill: #f8fafc !important;
29+
stroke: #cbd5e1 !important;
30+
}
31+
---
32+
sequenceDiagram
33+
autonumber
34+
actor User
35+
participant API as API<br/>Server
36+
participant Core as Redis Core<br/>(Stock / Waiting / Status)
37+
participant Consumer as Consumer<br/>Server
38+
participant Stream as Redis<br/>Stream
39+
participant DB as DB
40+
41+
User->>API: 신청 요청
42+
API->>Core: 재고 선점 / 중복 확인 / 대기열 등록
43+
API-->>User: requestId 반환
44+
45+
Note over User,Core: 사용자는 응답 대기 대신 requestId로 처리 상태 확인
46+
47+
rect rgb(255, 242, 242)
48+
Note over Core,Stream: Admission - 접수 요청을 처리 메시지로 전환
49+
Consumer->>Core: 대기열 조회
50+
Consumer->>Stream: 신청 메시지 적재
51+
end
52+
53+
rect rgb(239, 246, 255)
54+
Note over Core,DB: Async Processing - 신청 내역 DB 반영
55+
Consumer->>Stream: 메시지 읽기
56+
Consumer->>DB: 신청 내역 일괄 반영
57+
Consumer->>Core: SUCCESS / FAIL 저장
58+
end
59+
60+
loop requestId 기반 상태 조회
61+
User->>API: requestId 상태 조회
62+
API->>Core: 상태 조회
63+
Core-->>API: WAITING / PROCESSING / SUCCESS / FAIL
64+
API-->>User: 현재 상태 반환
65+
end
66+
```

0 commit comments

Comments
 (0)