Skip to content

Commit 770fa83

Browse files
author
๊น€ํ˜„์ˆ˜
committed
first commit
0 parents  commit 770fa83

File tree

243 files changed

+11936
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+11936
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# [์Šคํ”„๋ง์บ ํ”„ 2019] ๋ฌด์—‡์„ ํ…Œ์ŠคํŠธํ•  ๊ฒƒ์ธ๊ฐ€? ์–ด๋–ป๊ฒŒ ํ…Œ์ŠคํŠธํ•  ๊ฒƒ์ธ๊ฐ€? (by ๊ถŒ์šฉ๊ทผ)
2+
3+
## ํ…Œ์ŠคํŠธ๋กœ ๋ถ€ํ„ฐ ์–ป์„ ์ˆ˜ ์žˆ๋Š”๊ฒƒ
4+
5+
- ์•ˆ์ •๊ฐ๊ณผ ์ž์‹ ๊ฐ
6+
- ๋Œ€์ƒ์€? ํ˜„์žฌ์™€ ๋ฏธ๋ž˜์˜ ๋‚˜, ๋™๋ฃŒ
7+
8+
# ๋ฌด์—‡์„ ํ…Œ์ŠคํŠธํ•  ๊ฒƒ์ธ๊ฐ€?
9+
10+
## ๋กœ๋˜ ๊ตฌํ˜„ ์˜ˆ์‹œ
11+
12+
- ์š”๊ตฌ์‚ฌํ•ญ
13+
- 6๊ฐœ์˜ ์ˆซ์ž๋ฅผ ๋ฐ˜ํ™˜, ์ค‘๋ณต๋˜์ง€ ์•Š๋Š” ์ˆซ์ž, ๋žœ๋คํ•˜๊ฒŒ ๋ฐ˜ํ™˜
14+
15+
![image-20230122161810706](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122161810706.png)
16+
17+
- ์งˆ๋ฌธ) ์ค‘๋ณต์— ๋Œ€ํ•ด์„œ๋„ ํ…Œ์ŠคํŠธ ๋˜์–ด์•ผ ํ•˜์ง€ ์•Š์„๊นŒ์š”?
18+
- ๋Œ€๋‹ต) ์ €๋Š” Set ์œผ๋กœ ๊ตฌํ˜„ํ•ด์„œ ์ค‘๋ณต์ด ๋‚˜์˜ฌ ์ˆ˜ ๊ฐ€ ์—†์–ด์š”
19+
- ์œ„๋Š” ์ž˜๋ชป๋๋‹ค. ์™œ๋ƒ๋ฉด **๊ตฌํ˜„์€ ์–ธ์  ๊ฐ€ ์–ด๋–ป๊ฒŒ๋“  ๋ณ€ํ•  ์ˆ˜** ์žˆ๊ธฐ๋•Œ๋ฌธ์ด๋‹ค. (๋ฏธ๋ž˜์˜ ๋‚ด๊ฐ€ ๋ง๊ฐํ•  ์ˆ˜๋„, ๋ฏธ๋ž˜ ๋™๋ฃŒ๊ฐ€ ๋ฐ”๊ฟ€์ˆ˜๋„) -> ๊ตฌํ˜„์ด ์•„๋‹Œ **๋น„์ฆˆ๋‹ˆ์Šค ์„ค๊ณ„์‚ฌํ•ญ์„ ํ…Œ์ŠคํŠธํ•ด์•ผ์ง€ ์•ˆ์ •๊ฐ, ์ž์‹ ๊ฐ**์„ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค
20+
21+
## ๊ตฌํ˜„ํ…Œ์ŠคํŠธ
22+
23+
- ๋งŒ์•ฝ private ๋ฉ”์„œ๋“œ๋ฅผ public ๋ฉ”์„œ๋“œ๋กœ ๋ฐ”๊ฟ”์„œ ํ…Œ์ŠคํŠธํ•˜๊ณ ์žํ•˜๋ฉด ๊ตฌํ˜„ํ…Œ์ŠคํŠธ๋ฅผ ํ•˜๊ณ  ์žˆ์„ ๊ฐ€๋Šฅ์„ฑ์ด ๋งค์šฐ ํผ
24+
- ์ด๋Ÿด๊ฒฝ์šฐ์—๋Š” ๊ทธ ํ–‰์œ„๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์•ˆ์ชฝ์˜ ๋น„์ฆˆ๋‹ˆ์Šค ํ…Œ์ŠคํŠธ๋งŒ ๋”ํ•ด์งˆ ์•ˆ์ชฝ์„ ๋“ค์—ฌ๋‹ค๋ณผ ํ•„์š”๋Š”์—†๋‹ค. ๋งŒ์•ฝ ์ถ”๊ฐ€ํ•˜๋Š”๊ฒŒ ์–ด์ƒ‰ํ•˜๋‹ค๋ฉด private ๋ฉ”์„œ๋“œ๊ฐ€ ์•ˆ์ชฝ์— ์žˆ๋Š”๊ฒŒ ์ด์ƒํ•œ๊ฑธ์ˆ˜๋„ ..
25+
- ![image-20230122163314932](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122163314932.png)
26+
27+
์ฆ‰ ์š”์•ฝํ•˜๋ฉด, ์šฐ๋ฆฌ๊ฐ€ **๊ตฌํ˜„์ด ์•„๋‹ˆ๋ผ,** **์„ค๊ณ„๋ฅผ ํ…Œ์ŠคํŠธ**ํ•ด์•ผํ•œ๋‹ค.
28+
29+
30+
31+
## Non Testable
32+
33+
- "์ œ์–ดํ•  ์ˆ˜ ์—†๋Š” ์˜์—ญ"
34+
- ์˜ˆ์‹œ
35+
- Radndom, Shuffle, LocalDate.now()
36+
- ์™ธ๋ถ€ ์„ธ๊ณ„
37+
- HTTP
38+
- ์™ธ๋ถ€ ์ €์žฅ์†Œ
39+
40+
- ์™œ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ํž˜๋“ ์ง€?
41+
- ํ…Œ์ŠคํŠธ๋Š” ๊ณ ์ •๋˜์–ด์žˆ๋Š”๋ฐ ๊ทธ์‚ฌ์ด์— ์™ธ๋ถ€์„ธ๊ณ„๋Š” ๋ณ€ํ™”๋  ์ˆ˜ ์žˆ๋‹ค. ๊ทธ๋Ÿด๋•Œ ํ…Œ์ŠคํŠธ๊ฐ€ ์‹คํŒจํ•˜๊ฒŒ๋œ๋‹ค.
42+
- **์ œ์–ดํ•  ์ˆ˜ ์—†๋Š” ์˜์—ญ์€ ๋ฉฑ๋“ฑํ•œ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์žฅํ•  ์ˆ˜ ์—†๋‹ค**.
43+
- ๋กœ๋˜ ์˜ˆ์ œ
44+
- ์œ„ ์š”๊ตฌ์‚ฌํ•ญ ์ค‘ "๋žœ๋คํ•˜๊ฒŒ ๋ฐ˜ํ™˜"์ค‘ ๋žœ๋ค์€ ์ œ์–ดํ•  ์ˆ˜ ์—†์œผ๋ฏ€๋กœ ํ…Œ์ŠคํŠธ ๋ถˆ๊ฐ€๋Šฅํ•œ๊ฒƒ์ด๋‹ค.
45+
- ์š”๊ตฌ์‚ฌํ•ญ์„ ์ž˜๋ชป ๋„์ถœํ–ˆ์„ ๊ฐ€๋Šฅ์„ฑ์žˆ์Œ.
46+
๋”ฐ๋ผ์„œ "๋žœ๋คํ•˜๊ฒŒ ๋ฐ˜ํ™˜"์„ "์˜๋„ํ•œ ์ „๋žต๋Œ€๋กœ ๋ฐ˜ํ™˜"์œผ๋กœ ๋ณ€๋“ฑ ๋‹ค๋ฅด๊ฒŒ ํ’€์–ด์„œ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์‰ฝ๊ฒŒ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.
47+
- ์•„๋ž˜๋Š” ์ „๋žตํŒจํ„ด์œผ๋กœ ๋ฆฌํŒฉํ„ฐ๋งํ•จ (ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅํ•˜๊ฒŒ๋จ)
48+
- ![image-20230122165141750](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122165141750.png)
49+
50+
**"ํ•ญ์ƒ ์„ฑ๊ณตํ•  ์ˆ˜ ์žˆ๋Š”๊ฒƒ ํ•ญ์ƒ ๋™์ผํ•œ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ฌ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์„ ํ…Œ์ŠคํŠธ"**
51+
52+
## ์—ฌ๊ธฐ๊นŒ์ง€ ์š”์•ฝ
53+
54+
- ๋ฌด์—‡์„ ํ…Œ์ŠคํŠธํ• ๊ฒƒ์ธ๊ฐ€?
55+
- **์„ค๊ณ„๋ฅผ ํ…Œ์ŠคํŠธํ•˜์ž.**
56+
- **ํ•ญ์ƒ ๋™์ผํ•œ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ฌ ์ˆ˜ ์žˆ๋Š”๊ฒƒ์„ ํ…Œ์ŠคํŠธํ•˜์ž.**
57+
58+
# ์–ด๋–ป๊ฒŒ ํ…Œ์ŠคํŠธํ•  ๊ฒƒ์ธ๊ฐ€?
59+
60+
## 1. ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅํ•œ ๊ฒƒ, ๋ถˆ๊ฐ€๋Šฅํ•œ ๊ฒƒ
61+
62+
> ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์—†๋Š” ๋ฉ”์„œ๋“œ๋Š” ํ…ŒํŠธํ•  ์ˆ˜ ์žˆ๋Š” ๋ฉ”์„œ๋“œ๊นŒ์ง€ ์˜ค์—ผ์„ ์‹œํ‚จ๋‹ค.
63+
64+
## ๋ฐฐ๋‹ฌํŒ ๊ณ„์‚ฐ ์˜ˆ์ œ
65+
66+
![image-20230122170934084](../../../Library/Application Support/typora-user-images/image-20230122170934084.png)
67+
68+
![image-20230122170955938](../../../Library/Application Support/typora-user-images/image-20230122170955938.png)
69+
70+
![image-20230122171412500](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122171412500.png)
71+
72+
- ์—ฌ๊ธฐ์„œ ๊ฐ€์žฅ ์•ˆ์ชฝ ์žˆ๋Š” ๋ฉ”์„œ๋“œ์— LocalDateTime.now()๋Š” ์ œ์–ดํ•  ์ˆ˜ ์—†๋Š” ์˜์—ญ์ด ์žˆ๋‹ค. -> ๊ฒฐ๊ตญ ์ „์ฒด๊ฐ€ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์—†๋Š” ์ฝ”๋“œ๋กœ ์˜ค์—ผ์ด๋œ๋‹ค.
73+
74+
![image-20230122171716069](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122171716069.png)
75+
76+
![image-20230122171840720](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122171840720.png)
77+
78+
- isValid๋ฅผ ์ธ์ˆ˜๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ๊ฒŒ ๋ณ€๊ฒฝํ•œ๋‹ค. ๋„˜๊ฒจ์ง„ ์‹œ๊ฐ„์— ์˜ํ•ด ์ œ์–ด๊ฐ€ ๋˜๋ฏ€๋กœ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์žˆ๊ฒŒ๋œ๋‹ค.
79+
80+
![image-20230122172936719](../../../Library/Application Support/typora-user-images/image-20230122172936719.png)
81+
82+
- ๊ณ„์† ์˜ฌ๋ฆฐ๋‹ค. ์–ด๋””๊นŒ์ง€ ์˜ฌ๋ฆด๊ฒƒ์ธ๊ฐ€?
83+
- ์—ฌ๊ธฐ์„œ Boundary Layer๋ž€? ํ•œ ๋ชจ๋“ˆ๋กœ์„œ์˜ ์˜๋ฏธ๋ฅผ ์ง€๋‹ˆ๋Š” ๊ฐ€์žฅ ๋ฐ”๊นฅ ์ชฝ (์ด๊ฑด ์„ค๊ณ„์— ๋”ฐ๋ผ ๋”ฑ ์ •์˜ํ•˜๊ธฐ ํž˜๋“  ๋ถ€๋ถ„)
84+
- ![image-20230122173144723](../../../Library/Application Support/typora-user-images/image-20230122173144723.png)
85+
86+
์ฆ‰ **"ํ…Œ์ŠคํŠธ ๋ถˆ๊ฐ€๋Šฅํ•œ ์˜์—ญ์„ Boundary Layer๋กœ ์˜ฌ๋ ค์„œ ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅํ•˜๋„๋ก ๋ณ€๊ฒฝ"**
87+
88+
## 2. Java, Spring Framework
89+
90+
- `@SpringBootTest`
91+
- ![image-20230122221549355](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122221549355.png)
92+
- Spring Context๊ฐ€ ๋Š๋ฆฌ๊ธฐ ๋•Œ๋ฌธ์— ํ•„์š”์—†๋‹ค.
93+
- ๋น ๋ฅธ ํ”ผ๋“œ๋ฐฑ์„ ๋ฐ›์„ ์ˆ˜ ์—†๋‹ค.
94+
- Spring Context๋Š” ์–ธ์–ด์˜ ๋ณธ์งˆ์„ ๋ง๊ฐ์„ ์‹œํ‚ค๊ฒŒํ•  ์ˆ˜ ์žˆ๋‹ค.
95+
96+
**"Context, Framework ์ข…์†์ ์ด์ง€ ์•Š์€ ํ…Œ์ŠคํŠธ ์šฐ์„ "**
97+
98+
99+
100+
## 3. Test Double
101+
102+
> Test Double์€ ํ…Œ์ŠคํŠธ ํ•  ์ˆ˜ ์—†๋Š” ์˜์—ญ์— ๋Œ€ํ•œ ์™ธ๋ถ€ ์š”์ธ์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์คŒ
103+
104+
- ๋ฌด์—‡์„ Test Double๋กœ ์ฒ˜๋ฆฌํ•ด์•ผํ• ๊นŒ?
105+
106+
- ![image-20230122223436601](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122223436601.png)
107+
108+
> ์œ„๊ฐ€ call stack ์ตœ์ƒ๋‹จ์ด๋ฉฐ 1, 2, 3, 4๋ฒˆ ์ฝ”๋“œ๋ฅผ ์ˆœ์ฐจ์ ์œผ๋กœ ์‹คํ–‰ (4๋ฒˆ์ด ํ…Œ์ŠคํŠธ ํ•˜๊ณ ์‹ถ์€ ์˜์—ญ)
109+
110+
- ![image-20230122223543041](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122223543041.png)
111+
112+
- 4๋ฒˆ๋งŒ ํ…Œ์ŠคํŠธ ํ• ๊บผ๋‹ˆ ์ œ์™ธํ•œ ์˜์—ญ์„ Test Double๋กœ?
113+
114+
- **Test Double์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์€ ํ…Œ์ŠคํŠธ๊ฐ€ ๊ตฌํ˜„์„ ์•Œ์•„์•ผ ํ•œ๋‹ค๋Š”๊ฒƒ**
115+
116+
- ex) ๋ฐ˜ํ™˜ ํƒ€์ž… or ์ž…๋ ฅ๊ฐ’ ๋ณ€๊ฒฝํ•˜๋ฉด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.
117+
118+
- **Test Double์˜ ๋‚จ์šฉ์€ ๊ตฌํ˜„ ํ…Œ์ŠคํŠธ๋กœ ์œ ๋„ํ•  ์ˆ˜ ์žˆ๋‹ค.**
119+
120+
- **๊ทธ๋Ÿผ Test Double์„ ์–ด๋–ป๊ฒŒ ์“ฐ์ง€?**
121+
122+
- **Boundary Context ๊นŒ์ง€ ๋Œ์–ด์˜ฌ๋ ธ๋Š”๋ฐ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์—†๋Š” ์˜์—ญ์ด ์กด์žฌํ• ๋•Œ**
123+
- ํŽธ๋ฆฌํ•˜์ง€๋งŒ ์‚ฌ์šฉ์„ ์˜์‹ํ•˜์—ฌ ์ตœ์†Œํ™”
124+
- ์ˆœ์ˆ˜ ์ž๋ฐ” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์œผ๋กœ๋Š” ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์—†๋Š” ๊ฒƒ
125+
- -> ๋Œ€๋ถ€๋ถ„ Embedded๋กœ ๊ฐ€๋Šฅ
126+
- ex) ์ €์žฅ์†Œ ์ž…์ถœ๋ ฅ๊ฒ€์ฆ(์ฟผ๋ฆฌ ์ž˜๋‚˜๊ฐ€๋Š”์ง€), SPEC ๊ฒ€์ฆ(๋‚ด๋ถ€ controller, ์™ธ๋ถ€ API)
127+
128+
129+
## 4. Embedded
130+
131+
- ์ข…๋ฅ˜
132+
133+
![image-20230122225913990](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122225913990.png)
134+
135+
- ํ…Œ์ŠคํŠธ์™€ Embedded ์‹œ์Šคํ…œ์€ ๋™์ผํ•œ ๋ผ์ดํ”„ ์‚ฌ์ดํด์„ ๊ฐ–๋„๋ก ๊ตฌ์„ฑ
136+
- ![image-20230122230255490](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122230255490.png)
137+
138+
![image-20230122230321361](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122230321361.png)
139+
140+
141+
142+
## 5. EndPoint Test
143+
144+
- Spring Framework Support
145+
- MockMvc, REST Assured, WebTestClient
146+
- **ํ…Œ์ŠคํŠธ์˜ ๋ชฉ์ ์€ ์š”์ฒญ๊ณผ ์‘๋‹ต ์ŠคํŒฉ ๊ฒ€์ฆ๋งŒ์œผ๋กœ ์ œํ•œํ•˜๋Š”๊ฒŒ ์ •์‹  ๊ฑด๊ฐ•์— ์ข‹์„๊ฒƒ์ด๋ผ๊ณ  ์ƒ๊ฐ** (๋’ค๋ฅผ ์•„์˜ˆ ๋ชจ๋ฅด๊ฒŒ)
147+
- ![image-20230122230943413](https://raw.githubusercontent.com/hscom96/ImageStore/main/images/2023/01/22/image-20230122230943413.png)
148+
- ๋’ค์— ๋กœ์ง์„ ๋‹ค ์•Œ์•„์•ผ๋˜๊ณ , ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅํ•œ ์˜์—ญ์ด์—ฌ์•ผํ•˜๊ณ , case by case๋„ ๋„ˆ๋ฌด ๋งŽ๊ธฐ์—
149+
150+
# TIP & RULE
151+
152+
1. **ํ…Œ์ŠคํŠธ๊ฐ„ ์„œ๋กœ ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š๋„๋ก ์ƒํ˜ธ ๋…๋ฆฝ์ ์œผ๋กœ ์ž‘์„ฑ**
153+
1. ๋ชจ๋“  ํ…Œ์ŠคํŠธ์˜ ์ˆœ์„œ์™€ ๊ด€๊ณ„๋ฅผ ์ƒ๊ฐํ•˜์—ฌ ํ…Œ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜๊ธฐ ์–ด๋ ค์›€
154+
2. ๊ณต์œ ๋˜๋Š” ์ž์›์€ ์ดˆ๊ธฐํ™”ํ•˜์—ฌ ๋‹ค๋ฅธ ํ…Œ์ŠคํŠธ์— ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š๋„๋ก
155+
3. ๋‹จ๊ณ„๊ฐ€ ํ•„์š”ํ•˜๋‹ค๋ฉด JUnit5 ์˜ Dynamic Testfใ…กใ„น ์ถ”์ฒœ
156+
2. ํ…Œ์ŠคํŠธ ์•ˆ์— ์˜๋„์™€ ๋ชฉ์ ์ด ๋“ค์–ด๋‚˜๋„๋ก ์ž‘์„ฑ
157+
1. ์–ด๋–ค ์กฐ๊ฑด์—์„œ, ๋ฌด์—‡์„ ์ˆ˜ํ–‰ํ–ˆ์„๋•Œ, ์–ด๋–ค ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ฌ์ง€ ์•Œ ์ˆ˜ ์žˆ์–ด์•ผํ•œ๋‹ค. (๊ฐœ์ธ์ ์œผ๋กœ @Before์— ์ ์œผ๋ฉด ํŒŒ์•…ํ•˜๊ธฐ ํž˜๋“ฌ)
158+
2. ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์—ญ์‹œ ๊ฐ€๋…์ด ์ค‘์š”
159+
3. ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋„ ๋ฆฌํŒฉํ† ๋ง ๋Œ€์ƒ
160+
1. ์ฝ”๋“œ์–‘์— ๋Œ€ํ•œ ์ด์•ผ๊ธฐ๊ฐ€ ์•„๋‹Œ ๊ฐ€ ์•ˆ์ •์„ฑ, ์š”๊ตฌ์‚ฌํ•ญ ์ •๋ฆฌ๋“ฑ ๋น„์ฆˆ๋‹ˆ์Šค ์ฝ”๋“œ์™€ ๋™์ผํ•œ ์ˆ˜์ค€์˜ ๋ฆฌํŒฉํ† ๋ง์ด ํ•จ๊ป˜ ์ด๋ฃจ์–ด์ ธ์•ผ ํ•œ๋‹ค.
161+
162+
# Reference
163+
164+
- https://www.youtube.com/watch?v=YdtknE_yPk4
165+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# [210120] [์šฐ์•„์ฝ˜2020] ๋ฐฐ๋‹ฌ์˜๋ฏผ์กฑ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ์—ฌํ–‰๊ธฐ
2+
3+
4+
5+
> ๊ธฐ์–ตํ•˜๊ณ  ์‹ถ์€ ๋ถ€๋ถ„๋งŒ ๋ฉ”๋ชจ
6+
7+
## ์—ญ์‚ฌ ์š”์•ฝ
8+
9+
- ์—ฐ๋งˆ๋‹ค ๋ฐฉ๋ฌธ์ž์ˆ˜ 2.5๋ฐฐ์”ฉ ์ฆ๊ฐ€ํ•จ
10+
- ๋ชจ๋†€๋ฆฌ์‹ & ๋ฃจ๋น„DB ์žฅ์• ์‹œ ์ „์ฒด ์„œ๋น„์Šค์žฅ์•  -> ๋Œ€์žฅ์• ์‹œ๋Œ€
11+
- ์ƒ์กด์˜ ๋ฌธ์ œ๋กœ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ์ „ํ™˜ ์‹œ์ž‘
12+
13+
14+
15+
## Zero-Payload
16+
17+
- ์ด๋ฒคํŠธ๋ฅผ ๋ฐœํ–‰ํ• ๋•Œ ๋ฉ”์„ธ์ง€์— ๋ชจ๋“  ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ์ง€ ์•Š์Œ
18+
- ์ด๋ฒคํŠธ์— ์‹๋ณ„์ž(ex ๊ฐ€๊ฒŒ ID)์™€ ์ตœ์†Œํ•œ์˜ ์ •๋ณด๋งŒ ๋ฐœํ–‰
19+
- ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›์€ ์‹œ์ ์— ์กฐํšŒ API๋กœ ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•ด์„œ ์ €์žฅ
20+
21+
<img src="https://raw.githubusercontent.com/hscom96/TIL/main/images/2022/11/07/image-20221107015415138.png" alt="image-20221107015415138" style="width:70%;" />
22+
23+
- ํƒ„์ƒ ๋ฐฐ๊ฒฝ
24+
- ๋ณ€๊ฒฝ๋œ ๋ฐ์ดํ„ฐ๋งŒ ๋ณด๋‚ด๊ฒŒ๋˜๋ฉด ๋‹จ์ ์€?
25+
- ์ด๋ฒคํŠธ ์ˆœ์„œ์— ๋Œ€ํ•ด ๋งŽ์€ ๊ณ ๋ฏผ์„ ํ•ด์•ผํ•œ๋‹ค.
26+
- ex) ๊ฐ€๊ฒŒ ์ด๋ฆ„์„ A, B ์ˆœ์„œ๋กœ ๋ฐ”๊พธ๋ฉด ์ด๋ฒคํŠธ๋Š” B, A ์ˆœ์„œ๋กœ ์˜ฌ์ˆ˜์žˆ๋‹ค.
27+
- ๋ชจ๋“  ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค ๋ณด๋‚ด๋ฉด ๋‹จ์ ์€?
28+
- ํ…Œ์ด๋ธ”์ด ์ˆ˜์‹ญ๊ฐœ์—ฌ์„œ ํ˜„์‹ค์ ์ด์ง€ ์•Š๋‹ค.
29+
30+
31+
32+
## ์ตœ์†Œ ๋ฐ์ดํ„ฐ ๋ณด๊ด€ ์›์น™
33+
34+
<img src="https://raw.githubusercontent.com/hscom96/TIL/main/images/2022/11/07/image-20221107020207435.png" alt="image-20221107020207435" style="width:65%;" />
35+
36+
- ์ •์˜
37+
- ๊ฐ ์‹œ์Šคํ…œ๋“ค์€ ๋ชจ๋“  ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๊ด€ํ•˜๋ฉด ์•ˆ๋˜๊ณ , ๋ณธ์ธ์—๊ฒŒ ๊ผญ ํ•„์š”ํ•œ ์ตœ์†Œ ๋ฐ์ดํ„ฐ๋งŒ ๋ณด๊ด€ํ•œ๋‹ค.
38+
39+
- ํƒ„์ƒ๋ฐฐ๊ฒฝ
40+
- ๋ฌผ๋ฆฌ์ ์ธ ์˜์กด ๊ด€๊ณ„๋Š” ์—†์ง€๋งŒ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฉด์„œ ๋…ผ๋ฆฌ์ ์ธ ์˜์กด๊ด€๊ณ„๊ฐ€ ์ƒ๊น€
41+
- ๊ทธ๋ž˜์„œ ๊ฐ€๊ฒŒ/์—…์ฃผ์—์„œ ์–ด๋–ค๊ฒƒ์„ ๋ฐ”๊ฟ€๋•Œ ๋ชจ๋“ ๊ฒƒ์„ ๋‹ค ์กฐํšŒํ•ด์•ผ๋จ
42+
43+
44+
45+
## Polyglot ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค
46+
47+
<img src="https://raw.githubusercontent.com/hscom96/TIL/main/images/2022/11/07/image-20221107020540237.png" alt="image-20221107020540237" style="zoom:60%;" />
48+
49+
- ๊ฐ ์‹œ์Šคํ…œ์€ ์ตœ๋Œ€ํ•œ ์ตœ์ ํ™”ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Œ
50+
51+
<img src="https://raw.githubusercontent.com/hscom96/TIL/main/images/2022/11/07/image-20221107020921198.png" alt="image-20221107020921198" style="width:60%;" />
52+
53+
## ์ฟผ๋ฆฌ๋ชจ๋ธ
54+
55+
<img src="https://raw.githubusercontent.com/hscom96/TIL/main/images/2022/11/07/image-20221107021027316.png" alt="image-20221107021027316" style="width:70%;" />
56+
57+
- ๊ฐ€๊ฒŒ ์ƒ์„ธํ™”๋ฉด์—๋Š” ์ด๋ฒคํŠธ, ๋ฆฌ๋ทฐ ๋“ฑ๋“ฑ ๋งŽ๋‹ค.
58+
- ์ด๋Ÿฌํ•œ ๊ฒƒ๋“ค์„ ๋น ๋ฅด๊ฒŒ ์กฐํšŒํ•ด์•ผํ•œ๋‹ค๋ฉด?
59+
- ์—ฌ๋Ÿฌ ์‹œ์Šคํ…œ๋“ค์—์„œ ์ด๋ฒคํŠธ๋“ค์ด ์˜ค๋ฉด
60+
- ๊ฐ€๊ฒŒ ๋…ธ์ถœ ์‹œ์Šคํ…œ์—์„œ key๋ฅผ ๊ฐ€๊ฒŒ id, value๋ฅผ ์œ„ ๋ฐ์ดํ„ฐ๋กœ ํ•ด์„œ ํ•œ์ค„๋กœ ๋„ฃ์Œ
61+
- ๊ทธ๋ž˜์„œ ๊ฐ€๊ฒŒ id๋งŒ ์žˆ์œผ๋ฉด ํ™”๋ฉด์— ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ์— ์ตœ๋Œ€ํ•œ ๋งž์ถ”๊ณ , ์ „์†กํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋ฐ์ดํ„ฐ๋ฅผ ํ”Œ๋žซํ•˜๊ฒŒ ๋งŒ๋“ค์–ด ๋†“์Œ
62+
- ์žฅ์ ?
63+
- <img src="https://raw.githubusercontent.com/hscom96/TIL/main/images/2022/11/07/image-20221107022059645.png" alt="image-20221107022059645" style="width:70%;" />
64+
- ๊ด‘๊ณ ๋ฅผ ๋ณด๊ฑฐ๋‚˜ ๊ฒ€์ƒ‰์„ ํ•˜๋Š” ๋’ท๋‹จ ์„œ๋น„์Šค๋Š” ๋‹จ์ˆœํžˆ ๊ฐ€๊ฒŒ id ๋“ค๋งŒ ๋ฐ˜ํ™˜ํ•ด์ฃผ๋ฉด๋œ๋‹ค.
65+
- ๊ทธ๋Ÿผ ๊ทธ id๋“ค๋กœ ๊ฐ€๊ฒŒ ๋…ธ์ถœ ์‹œ์Šคํ…œ์€ ๋ณธ์ธ์˜ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋ชจ๋‘ ์กฐํšŒํ•ด๋ด„
66+
- ํ”Œ๋žซํ•˜๊ฒŒ key-value๋กœ ๋ผ์žˆ์–ด ๊ต‰์žฅํžˆ ๋น ๋ฅด๊ฒŒ ์กฐํšŒ๊ฐ€๋Šฅํ•˜๋‹ค.
67+
- ๊ฐ€๊ฒŒ ์ƒ์„ธ์—์„œ๋Š” ๋น„๋™๊ธฐ-๋…ผ๋ธ”๋กํ‚น์œผ๋กœ ๋˜์–ด์žˆ๋Š” ์‹œ์Šคํ…œ
68+
- <img src="https://raw.githubusercontent.com/hscom96/TIL/main/images/2022/11/07/image-20221107022139593.png" alt="image-20221107022139593" style="width:67%;" />
69+
70+
<img src="https://raw.githubusercontent.com/hscom96/TIL/main/images/2022/11/07/image-20221107022240149.png" alt="image-20221107022240149" style="width:50%;" />
71+
72+
- ์ฟผ๋ฆฌ์™€ ๊ด€๋ จ๋œ ์‹œ์Šคํ…œ๋“ค๋งŒ ์ด ํŠธ๋ž˜ํ”ฝ์„ ๋ฐ›๊ฒŒ๋œ๋‹ค.
73+
74+
<img src="https://raw.githubusercontent.com/hscom96/TIL/main/images/2022/11/07/image-20221107023410909.png" alt="image-20221107023410909" style="width:67%;" />
75+
76+
- ๊ทธ๋ž˜์„œ ๋ช…๋ น ์‹œ์Šคํ…œ์ด ์ฃฝ์–ด๋„ ์žฅ์•  ๊ฒฉ๋ฆฌ ๊ฐ€๋Šฅํ•˜๋‹ค.
77+
78+
## ์žฅ์• ๊ฒฉ๋ฆฌ
79+
80+
- ๊ฐ ์‹œ์Šคํ…œ์ด ๋‚ด๋ถ€์— ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ ๋ณด๊ด€
81+
82+
- ๋‚ด๋ถ€ ์„œ๋น„์Šค(๊ด‘๊ณ , ๊ฒ€์ƒ‰)์˜ ๋ชจ๋“  ๋ณ€๊ฒฝ ๋‚ด์—ญ์ด ์ด๋ฒคํŠธ๋กœ ์ „๋‹ฌ
83+
84+
- ์žฅ์• ์‹œ ๋ฐ์ดํ„ฐ ์‹ฑํฌ๊ฐ€ ๋Šฆ์–ด์ ธ๋„ ๊ณ ๊ฐ ์„œ๋น„์Šค ๊ฐ€๋Šฅ
85+
86+
87+
88+
- ๋ฐ์ดํ„ฐ ์‹ฑํฌ ์žฅ์• ๋Œ€์‘
89+
90+
- ์ด๋ฒคํŠธ ์žฌ๋ฐœํ–‰
91+
- ํ ์žฅ์•  ๋ฐœ์ƒ์‹œ
92+
- ์ „์ฒด IMPORT API ์ œ๊ณต
93+
- ๋ถ€๋ถ„ IMPORT API ์ œ๊ณต
94+
- ์ตœ๊ทผ ์—…๋ฐ์ดํŠธ ๋ฐ์ดํ„ฐ ๋ถ„๋‹จ์œ„๋กœ ๋ถ€๋ถ„ ์ œ๊ณต
95+
96+
- ๊ธฐํƒ€
97+
98+
- ์ ๊ทน์ ์ธ ์บ์‹œ์‚ฌ์šฉ
99+
100+
- ์„œํ‚ท ๋ธŒ๋ ˆ์ด์ปค
101+
102+
- ๋น„๋™๊ธฐ Non-Blocking ์‹œ์Šคํ…œ ์ ์šฉ
103+
104+
105+
106+
## ์ •๋ฆฌ
107+
108+
- ๋ฐฐ๋‹ฌ์˜ ๋ฏผ์กฑ์€ ๊ฑฐ๋Œ€ํ•œ CQRS
109+
- ์„ฑ๋Šฅ์ด ์ค‘์š”ํ•œ ์™ธ๋ถ€ ์‹œ์Šคํ…œ๊ณผ ๋น„์ฆˆ๋‹ˆ์Šค ๋ช…๋ น์ด ๋งŽ์€ ๋‚ด๋ถ€ ์‹œ์Šคํ…œ์œผ๋กœ ๋ถ„๋ฆฌ
110+
- ์ด๋ฒคํŠธ ๋ฐœํ–‰์„ ํ†ตํ•œ Eventually Consistency (์ตœ์ข…์  ์ผ๊ด€์„ฑ)
111+
- ๊ฐ ์‹œ์Šคํ…œ์€ API ๋˜๋Š” ์ด๋ฒคํŠธ ๋ฐฉ์‹์œผ๋กœ ์—ฐ๋™

0 commit comments

Comments
ย (0)