24. 두 대 일때의 문제점!!!
DBMS 1
API Server 1
Web Browser
Mobile Apps
DBMS 2
API Server 2
User #1
Friends
User #2
Friends
User #3
Friends
25. User #1은 어디로 가야하나요?
DBMS 1
API Server 1
Web Browser
Mobile Apps
DBMS 2
API Server 2
User #1
User #1
Friends
User #2
Friends
User #3
Friends
26. API Server 1로 가면?
- 찾을 수 있습니다.
DBMS 1
API Server 1
Web Browser
Mobile Apps
DBMS 2
API Server 2
User #1
User #1
Friends
User #2
Friends
User #3
Friends
27. API Server 2로 가면
- 못찾습니다.
DBMS 1
API Server 1
Web Browser
Mobile Apps
DBMS 2
API Server 2
User #1
User #1
Friends
User #2
Friends
User #3
Friends
30. DB가 하나면…
어디로 가든 데이터를
찾을 수 있습니다.
Web Browser
Mobile Apps
User #1
API Server 1
API Server 2
DBMS
User #1
User #1
Friends
User #2
Friends
User #3
Friends
31. 장애가 나도 다른 서버가 서비스가 가능합니다.
Web Browser
Mobile Apps
User #1
API Server 1
API Server 2
DBMS
User #1
User #1
Friends
User #2
Friends
User #3
Friends
32. 장애가 나도 다른 서버가 서비스가 가능합니다.
Web Browser
Mobile Apps
User #1
API Server 1
API Server 2
DBMS
User #1
User #1
Friends
User #2
Friends
User #3
Friends
35. 가설 1 : 사용자가 우리 서버의 주소와 상태를 항상 알
고 있다.
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
지금 서비스 서버는 2대고 주소는
API Server 1 과 API Server 2
모두 정상이야!!!
43. DNS를 이용하면 apiserver.com 을 접속하면 두 서버
중에 하나로 접속이 가능합니다.
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
DNS
Request
apiserver.com
Response
apiserver is
1.1.1.3 and 1.1.1.4
45. 친구 목록을 여러번 호출한다고 합시다. 그 때마다 DNS
를 호출한다면?
getFriends()
API Server 1
1.1.1.3
DNS
Request: apiserver.com
Response: 1.1.1.3
getFriends()
Request: apiserver.com
Response: 1.1.1.3
47. DNS TTL
● Facebook 을 하루에 12억명이 사용합니다. 매번 기능을 호출 할 때 마다
DNS를 호출한다면, DNS 서버는 얼마나 커야 할까요?
48. 이미 apiserver.com 은 1.1.1.3이라는 걸 알고 있으므로
30초간 그냥 1.1.1.3을 사용한다.
getFriends()
API Server 1
1.1.1.3
DNS
Request: apiserver.com
Response: 1.1.1.3 TTL: 30
getFriends()
이미 알고 있으므로 바로 1.1.1.3
으로 접속
50. 장애가 나도 응답은 여전히 1.1.1.3 과 1.1.1.4 입니다.
1.1.1.4를 받으면 어떻게 될까요?
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
DNS
Request
apiserver.com
Response
apiserver is
1.1.1.3 and 1.1.1.4
52. 이미 apiserver.com 은 1.1.1.3이라는 걸 받았으므로
1.1.1.5로 바뀐걸 TTL 이내에는 알 수 없다.
getFriends()
API Server 1
1.1.1.3
DNS
Request: apiserver.com
Response: 1.1.1.3 TTL: 30
getFriends()
이미 알고 있으므로 바로 1.1.1.3
으로 접속 시도
API Server 1
1.1.1.5
54. Load Balancer(LB) 의 동작
Request 를 연결된 서버들에게 나누어 줍니다.
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
DNS
Request
apiserver.com
Response
apiserver is
1.1.1.2
LB
1.1.1.2
REQ #1
REQ #2
REQ #3
55. Load Balancer(LB) 의 동작
Request 를 연결된 서버들에게 나누어 줍니다.
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
DNS
Request
apiserver.com
Response
apiserver is
1.1.1.2
LB
1.1.1.2
REQ #1
REQ #2
REQ #3
56. Load Balancer(LB) 의 동작
Request 를 연결된 서버들에게 나누어 줍니다.
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
DNS
Request
apiserver.com
Response
apiserver is
1.1.1.2
LB
1.1.1.2
REQ #1
REQ #2REQ #3
57. Load Balancer(LB) 의 동작
Request 를 연결된 서버들에게 나누어 줍니다.
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
DNS
Request
apiserver.com
Response
apiserver is
1.1.1.2
LB
1.1.1.2
REQ #1
REQ #2
REQ #3
59. Load Balancer(LB) 의 동작
Request 를 연결된 서버들에게 나누어 줍니다.
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
DNS
Request
apiserver.com
Response
apiserver is
1.1.1.2
LB
1.1.1.10
Active
REQ #1
REQ #2
REQ #3
LB
1.1.1.11
StandBy
1.1.1.2
60. LB가 장애가 나면? 해당 LB에게 할당된 IP를 다른 LB
에게 넘겨줍니다.
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
DNS
Request
apiserver.com
Response
apiserver is
1.1.1.2
LB
1.1.1.10
Active
REQ #1
REQ #2
REQ #3
LB
1.1.1.11
Active
1.1.1.2
61. Cloud 서비스 제공자(AWS, GCP, AZURE) 등의 Load
Balancer 는 하나로 보이지만 내부적으로 장애시 위와
같이 동작합니다.
Web Browser
Mobile Apps
API Server 1
1.1.1.3
API Server 2
1.1.1.4
DNS
Request
apiserver.com
Response
apiserver is
1.1.1.2
ELB
1.1.1.2
REQ #1
REQ #2
REQ #3
69. Data Replication
● 한 대의 서버의 내용을 지속적으로 다른 서버로 복제해주는 작업
○ Primay(서비스를 하고 있는 DB)의 내용을 자동으로 Secondary(백
업용 DB) 에 데이터를 복제해줍니다.
● 두 대가 같은 내용을 가지므로, 한 대에 문제가 생기더라도 다른 서버로
서비스가 가능합니다.
70. 데이터 복제
Web Browser
Mobile Apps
API Server 1
API Server 2
DBMS
Primary
DBMS
Secondary
Name Email Password
Name Email Password
109. 이런 식으로...
Web Browser
Mobile Apps
API Server 1
API Server 2
DBMS
primary
DBMS
secondary
Object
Storage
Service
abcdefg1
abcdefg2
abcdefg3
abcdefg1
abcdefg2
abcdefg3
doc1
doc2
doc3