Home ๐ŸŒ [Network] Load Balancing & Proxy ๐ŸŒ
Post
Cancel

๐ŸŒ [Network] Load Balancing & Proxy ๐ŸŒ

๐ŸŒ Load Balancing

๋กœ๋“œ ๋ฐธ๋Ÿฐ์‹ฑ(Load Balancing)์€ Load Balancer์— ์˜ํ•ด ํŠธ๋ž˜ํ”ฝ์„ ๊ณ ๋ฅด๊ฒŒ ๋ถ„๋ฐฐํ•˜๋Š” ๊ธฐ์ˆ ์ž…๋‹ˆ๋‹ค.

Load Balancing์€ L4 Switch, L7 Switch๋ผ ๋ถˆ๋ฆฌ๋Š” ๋„คํŠธ์›Œํฌ ์žฅ๋น„(Load Balancer)๋กœ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ Load Balancing ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” S/W๋ฅผ ์„ค์น˜ํ•˜๋ฉด ์ผ๋ฐ˜ Host๋ฅผ Load Balancer๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋Œ€ํ‘œ์ ์œผ๋กœ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒƒ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.

HAProxy / Envoy / Nginx

์ผ๋ฐ˜์ ์œผ๋กœ Load Balancer๋Š” ๋‹ค์ค‘ํ™”๋œ Server์™€ Client ์‚ฌ์ด์— ์œ„์น˜ํ•˜์—ฌ Client๋“ค์€ Load Balancer์— ์š”์ฒญ์„ ๋ณด๋‚ด๊ณ , Load Balancer๋Š” ํ•ด๋‹น ์š”์ฒญ์„ ๊ฐ ์„œ๋ฒ„์— ๊ท ๋“ฑํ•˜๊ฒŒ ๋ถ„๋ฐฐํ•ฉ๋‹ˆ๋‹ค.

Load Balancing Algorithm์—๋Š” ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์ด ์žˆ์œผ๋ฉฐ Load Balancer๋งˆ๋‹ค ์ดํ•ดํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์—๋Š” ์ฐจ์ด๊ฐ€ ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋Œ€ํ‘œ์ ์ธ ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Round Robin๋‹จ์ˆœํžˆ Server๋ฅผ ๋Œ์•„๊ฐ€๋ฉฐ ํŠธ๋ž˜ํ”ฝ์„ ์ „๋‹ฌ
Weighted Round RobinServer๋งˆ๋‹ค ๊ฐ€์ค‘์น˜๋ฅผ ๋ถ€์—ฌํ•ด ๊ฐ€์ค‘์น˜๊ฐ€ ๋†’์€ Server๊ฐ€ ๋” ๋งŽ์ด ์„ ํƒ๋˜๋„๋ก ํ•˜๋Š” Round Robin Algorithm
Least Connection์—ฐ๊ฒฐ์ด ์ ์€ Server๋ถ€ํ„ฐ ์šฐ์„ ์ ์œผ๋กœ ํŠธ๋ž˜ํ”ฝ๋ฅผ ์ „๋‹ฌ
Weighted Least ConnectionServer๋งˆ๋‹ค ๊ฐ€์ค‘์น˜๋ฅผ ๋ถ€์—ฌํ•ด ๊ฐ€์ค‘์น˜๊ฐ€ ๋†’์€ Server๊ฐ€ ๋” ๋งŽ์ด ์„ ํƒ๋˜๋„๋ก ํ•˜๋Š” Least Connection Algorithm

๐ŸŒ Proxy

Client์™€ Server ์‚ฌ์ด์—๋Š” ์ˆ˜๋งŽ์€ Server๋“ค์ด ์กด์žฌํ•˜๋ฉฐ Client๊ฐ€ ์ตœ์ข…์ ์œผ๋กœ ๋ฉ”์„ธ์ง€๋ฅผ ์ฃผ๊ณ ๋ฐ›๋Š” Server๋ฅผ Origin Server๋ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋•Œ, Origin Server๋ฅผ ํ–ฅํ•˜๋Š” ๋ฉ”์„ธ์ง€๋ฅผ Inbound, Client๋ฅผ ํ–ฅํ•˜๋Š” ๋ฉ”์„ธ์ง€๋ฅผ Outbound๋ผ ํ•ฉ๋‹ˆ๋‹ค.

Client์™€ Origin Server ์‚ฌ์ด์— ์žˆ๋Š” ๋Œ€ํ‘œ์ ์ธ ์ค‘๊ฐ„ Server์˜ ์œ ํ˜•์œผ๋กœ Proxy์™€ Gateway๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. Proxy๋Š” Forward Proxy, Gateway๋Š” Reverse Proxy๋ผ๊ณ ๋„ ๋ถ€๋ฆ…๋‹ˆ๋‹ค.

ย Proxy(Forward Proxy)Gateway(Reverse Proxy)
์—ญํ• Client๊ฐ€ ์„ ํƒํ•œ ๋ฉ”์„ธ์ง€ ์ „๋‹ฌ ๋Œ€๋ฆฌ์žโ€ข ์ผ๋ฐ˜์ ์œผ๋กœ ๋„คํŠธ์›Œํฌ ๊ฐ„์˜ ํ†ต์‹ ์„ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•˜๋Š” ์ž…๊ตฌ ์—ญํ• ์„ ํ•˜๋Š” H/W ํ˜น์€ S/W๋ฅผ ์˜๋ฏธ
โ€ข Outbound ์—ฐ๊ฒฐ์— ๋Œ€ํ•ด Origin Server ์—ญํ• ์„ ํ•˜์ง€๋งŒ, ์ˆ˜์‹ ๋œ ์š”์ฒญ์„ ๋ณ€ํ™˜ํ•˜์—ฌ ๋‹ค๋ฅธ Inbound Server๋“ค๋กœ ์ „๋‹ฌํ•˜๋Š” ์ค‘์žฌ์ž ์—ญํ• 
์œ„์น˜Client์— ๋” ๊ฐ€๊นŒ์ด ์œ„์น˜Origin Server์— ๋” ๊ฐ€๊นŒ์ด ์œ„์น˜
๊ธฐ๋Šฅ์ฃผ๋กœ Cache ์ €์žฅ, Client ์•”ํ˜ธํ™” ๋ฐ ์ ‘๊ทผ ์ œํ•œ ๋“ฑ์˜ ๊ธฐ๋Šฅ์„ ์ œ๊ณตCache ์ €์žฅ, Loadbalancer๋กœ ๋™์ž‘
This post is licensed under CC BY 4.0 by the author.

๐ŸŒ [Network] Encryption ๐ŸŒ

โ˜ธ๏ธ [Kubernetes] About Kubernetes โ˜ธ๏ธ