More Related Content Similar to [2B5]nBase-ARC Redis Cluster (20) [2B5]nBase-ARC Redis Cluster5. Scale-out ํด๋ฌ์คํฐ
๋น์ฉ ํจ์จ์ฑ
์๋น์ค ์ฐ์์ฑ
ํ์ฅ/์ถ์
์ผ๋ฐ ์ปดํจํฐ๋ฅผ ์ด์ฉํด ์์คํ
๊ตฌ์ถ
์๊ฒ ์์ํด์ ํฌ๊ฒ ์ฑ๊ณตํ ์ ์์ด์ผ โฆ
์ด์ ์์
์ด ์๋น์ค์ ์ํฅ์ ์ฃผ์ด์ ์๋จ
์ธํฐ๋ท ์ค์ผ์ผ ์๋น์ค์ ํ์ํ ๋ถ์ฐ ์ ์ฅ ์์คํ
6. nBase-ARC๋
Autonomous
Redis
Cluster
nBase- Labs์์ ๋ง๋๋ Scale-out ํด๋ฌ์คํฐ ์๋ฆฌ์ฆ
์ด์์์ ๊ฐ์
์์ด ๋์ํ๋ (์ฅ์ ํ์ง, ์ฅ์ ์ฒ๋ฆฌ)
๊ณ ์์ In-Memory ์ฐ์ฐ์ด ๊ฐ๋ฅํ
Scale-out ํด๋ฌ์คํฐ 7. ํ์ ๋ฐฐ๊ฒฝ (1/2)
In-memory ๊ธฐ๋ฐ์ ๊ณ ์ฑ๋ฅ, ๊ณ ๊ฐ์ฉ scale-out ํด๋ฌ์คํฐ DB๊ฐ ํ์ํด์ง
โข์ธ์
์ ์ฅ์๋ก ๋์คํฌ ๊ธฐ๋ฐ์ ํด๋ฌ์คํฐ๋ฅผ ์ฌ์ฉ
โข๋ง์ ์ฐ๊ธฐ ๋ถํ๋ฅผ ์ผ์ ํ ์๋ต ์๋๋ก ์ฒ๋ฆฌํด์ผ ํ๋ ์๊ตฌ์ฌํญ
โข๋น์ฉ ํจ์จ์ ์ผ๋ก ํด๊ฒฐ ํด์ผ ๋จ
โขCaching์ด ๋์์ด ๋์ง ์์ 8. ํ์ ๋ฐฐ๊ฒฝ (2/2)
โขSimple
โขFast
โขPersistent
โขAvailable
์ ๋ถ ๊ณผ์ : ํํ๋ฐ์ดํธ๊ธ ๋์ฉ๋ ์ด๊ธฐ์ข
ํด๋ฌ์คํฐ๋ DBMS SW ๊ฐ๋ฐ
๋ณต์
Configuration Master 9. Required Features
์ฅ์ ์ฒ๋ฆฌ
โข์ฅ์ ๋ฅผ ๊ฐ์งํด ์๋์ผ๋ก fail-over ํด์ผ ํ๋ค
Scale-out
โข์ฅ๋น๋ฅผ ํฌ์
ํด rebalancing ํ ์ ์๋ค
API
โข๊ธฐ์กด Redis ํด๋ผ์ด์ธํธ๋ฅผ ๊ทธ๋๋ก ์ฌ์ฉ
๋ถ์ฐ ๋ฐฉ์
โข์ฌ๋ฌ ์ฅ๋น์ ๋ฐ์ดํฐ๋ฅผ ๋๋์ด ์ฒ๋ฆฌํด์ผ ํ๋ค
๊ฐ์ฉ์ฑ
โข๋ฐ์ดํฐ durability, ์๋น์ค availability
โข์ฅ์ , ์ด์ ์์
๋ฑ์ ์ํด ์๋น์ค๊ฐ ์ํฅ์ ๋ฐ์ง ์์์ผ ํ๋ค
์๋น์ค ์ฐ์์ฑ 10. ๋ถ์ฐ ๋ฐฉ์
0
1
2
8191
PG 0
PG 1
PG N
PGS 1
PGS 2
PGS 3
PGS 4
PGS 5
CRC16(key) % 8192
๋ณต์ ๊ทธ๋ฃน
Partition Group
Partition Number
Key์ ๋ํ hash ๊ฐ์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ ๋ถํ ๋ฐฉ์ ์ฑํ 11. ๊ฐ์ฉ์ฑ โ Redis ๋ณต์
โขRedis ๋ณต์ ๋ ๋น ๋๊ธฐ ๋ณต์ ๋ก master ์ฅ์ ๋ฐ์ํ๋ฉด ๋ฐ์ดํฐ ์ ์ค
โขSlave์ ์ฝ๊ธฐ๋ฅผ ํ๋ฉด ์ด์ ๋ฐ์ดํฐ๋ฅผ ์ฝ์ ์ ์์
โข๋ณต์ ๋๊ธฐํ๋ sync ๋ฐฉ์๊ณผ (RDB + replication buffer), psync (์ผ์์ ๋จ์ ๋๋น ๋ฒํผ ์ ์ง) ๋ฐฉ์์ ์ง์ ๏จ ์ค์ ์ด ์ด๋ ค์
Client
Master
Slave
request
response
request
๋ณต์ ๋ฅผ ํตํด ์๋น์ค ๋ฐ ๋ฐ์ดํฐ ๊ฐ์ฉ์ฑ ํ๋ณด. ํ์ง๋ง Redis ๋ณต์ ๋ ๋ฌธ์ 12. ๊ฐ์ฉ์ฑ โ ๋ณต์
โขConsensus ๊ธฐ๋ฐ์ ๋ณต์ ๋ฐฉ์ ๊ตฌํ (State Machine Replicator)
๏Master๊ฐ ๋ช
๋ น์ด, commit ๋ฉ์์ง๋ก ๊ตฌ์ฑ๋ ๋ณต์ ๋ก๊ทธ ์์ฑ
โข๋ช
๋ น์ด ๋ณต์ ์ ์คํ์ ๋ถ๋ฆฌ. ๋ช
๋ น์ด์ ๊ฐ์ฉ์ฑ์ด ํ๋ณด๋ ๊ฒฝ์ฐ ์คํ
โข์ด๋ค Redis์ ์ฝ๊ธฐ๋ฅผ ํด๋ consistentํ ๊ฒฐ๊ณผ (read offloading)
Client
Redis
Redis
request
response
Master SMR
Slave SMR
replicate
commit
commit
LOG (MMAP)
LOG (MMAP) 13. ๊ฐ์ฉ์ฑ โ ๋ณต์ (๊ณ์)
โข๋ช
๋ น์ด์ ๊ฐ์ฉ์ฑ์ ์คํ๋๊ธฐ ์ ์ ์ ์ฅ๋๋ ๋ก๊ทธ์ ๊ฐ์๋ก ๋ณด์ฅ๋จ
๏์๋ฅผ ๋ค์ด 2์ธ ๊ฒฝ์ฐ, ๋ ์ฅ๋น์ ๋ก๊ทธ์ ์ ์ฅ๋ ์ดํ์ ์คํ
๏์๋๋ฅผ ์ํด ๋ก๊ทธ ํ์ผ์ ๋ํ ์ฐ์ฐ์ OS buffer ๊น์ง ์ฐ๊ณ ๋ฆฌํด
๏๋ก๊ทธ ํ์ผ์ 1์ด (๋๋ 10M) ์ฃผ๊ธฐ๋ก ๋์คํฌ๋ก sync ๋จ 14. ๊ฐ์ฉ์ฑ โ ๋ณต์ ๋๊ธฐํ
โข๋ก๊ทธ์ ๊ฒฐํฉ๋ checkpoint (RDB)๋ฅผ ์ด์ฉํด ๋ก์ปฌ ๋ฐ์ดํฐ๋ฅผ ๋ณต๊ตฌํจ
Checkpoint (RDB + log seq.)
Log
+
โข ๋ค๋ฅธ ๋ณต์ node๋ก ๋ถํฐ ๋ณต๊ตฌ๋ ๋ถ๋ถ ์ดํ์ log๋ฅผ ๋ฐ์์ ๋ณต์ ๋๊ธฐํ ๊ฐ๋ฅ
Master
Slave
Redis
Checkpoint ๋ณต๊ตฌ
LOGSEQ
LOGSEQโ 15. ์ฅ์ ์ฒ๋ฆฌ โ Failure detection
Failure Detection
Fail over
+
โขHeartbeat module(HB)์ด ์์ฉ ๋ ๋ฒจ (L7) ping ๋ฉ์์ง ์ ์ก
โข๋ค์์ HB ์ด์
โข๋์ ์ํ์ ๋ํ ๊ฒฐ์ ์ Zookeeper ์ฌ์ฉ
๏๋์์ ์ํ ๏จ z-node
๏๋์์ ์ํ์ ๋ํ ์๊ฒฌ ๏จ z-node ํ์์ ephemeral z-node 16. ์ฅ์ ์ฒ๋ฆฌ โ Fail over
Failure Detection
Fail over
+
โขCluster controller์ ์ํด ์ํ
๏๋ณต์์ instance๋ฅผ ๋๋ฉฐ, ์ฅ์ ์ leader election์ ํตํด ์๋ก์ด cluster controller๊ฐ ๋์
โข๊ฐ์ ๋์ z-node๋ฅผ watch
โข์ํ ๋ณ๊ฒฝ ๋ฐ์์ (child event) ํด๋ฌ์คํฐ์ ์ํ๋ฅผ ๊ฒฐ์ ํ๊ณ fail- over ์์
์งํ 19. ์๋น์ค ์ฐ์์ฑ
โข์ฅ๋น ์ถ๊ฐ, ์ ๊ฑฐ, scale-out, ์ํํธ์จ์ด ์
๊ทธ๋ ์ด๋
๏๋ณต์ ์ถ๊ฐ, ์ ๊ฑฐ, migration์ผ๋ก ํด๊ฒฐ๋จ
โขGateway ์
๊ทธ๋ ์ด๋, ์ถ๊ฐ ์ญ์ ?
๏Gateway์ ๋ํ L4 ์ค์์น ๊ตฌ์ฑ?
๏Gateway lookup ์๋น์ค 20. nBase-ARC ๊ตฌ์กฐ
HB
HB
HB
Cluster Controller
Leader
Follower
Follower
Configuration Master
Cluster
Gateway
Gateway
๋ณต์
Zookeeper Ensemble
Redis
Redis
Zone 22. Redis Cluster
Redis ๊ฐ๋ฐ์๊ฐ ๋ง๋ค๊ณ ์๋ ์ ํ๊ณผ์ ์ฐจ์ด์ ์ ๋ํด ์ค๋ช
๏ARC: nBase-ARC
๏RC: Redis Cluster 23. ์ ๋ฆฌ
RC
ARC
ํค ๋ถ์ฐ
๋์ผ
๋ณต์
Asynchronous
Consensus
Node ๋ณต๊ตฌ
RDB or AOF
RDB + LOG
ํด๋ผ์ด์ธํธ ์ฐ๊ฒฐ
REDIS
Gateway
Migration
Key ๋จ์
Key ์์ญ ๋จ์
Fault detection
Node๊ฐ์ gossip
๋ณต์์ HB
CAP ์ธก๋ฉด
CP
โขRC: ๊ณ ์ฑ๋ฅ+, ์ฅ์ /๋จ์ ๋ฐ์ ์ ๋ฐ์ดํฐ ์ ์ค
โขARC: ๊ณ ์ฑ๋ฅ, DB 24. ํด๋ผ์ด์ธํธ ์ฐ๊ฒฐ
R
R
R
R
R
Gateway
Gateway
Gateway
R
R
R
R
R
Client
Client
Client
Client
RC
ARC
โขRedis์ ์ง์ ์ฐ๊ฒฐ
โขSmart client
๏ํค ๋ถ์ฐ ์ ๋ณด
๏Master/slave ์ฌ๋ถ
โขํ์ ๋ณ๊ฒฝ ๋ณต์ก
โขGateway๋ก ์ฐ๊ฒฐ
๏Hop์ด ํ๋ ์ถ๊ฐ
โขDummy client
โขํ์ ๋ณ๊ฒฝ ์ฌ์ 25. Partition ๋ฐ์์ ๋์
RC
ARC
โขMajority ์์ญ์ slave๋ master๋ก promote ๋จ
โขNODE_TIMEOUT ๊ธฐ๋ฐ์ผ๋ก ๋์ํ๊ธฐ ๋๋ฌธ์ ํน์ ์๊ฐ์ ๋ ๊ฐ์ master ์กด์ฌ ๊ฐ๋ฅ
โข๋ณต์ ์์ commit์ด ์ผ์ด๋๊ธฐ ์ํ quorum ์กด์ฌ. Master๊ฐ ๋จ์ ๋ ๊ฒฝ์ฐ ๋์ ์ค์ง
โขConfiguration master์ ์ํด fail-over ๋จ
M
S
M
S
Client
Client 26. Migration
RC
ARC
MIGRATING SLOT
IMPORTING SLOT
SOURCE SLOT
TARGET SLOT
Dump Load Log Catch-up 2PC
WHILE true IF GETKEYSINSLOT MIGRATE key ELSE break
โขKey ๋จ์๋ก ์ํ
โข๋๋ฆผ
โขSlot ์์ญ ๋จ์๋ก ์ํ
โข๋น ๋ฆ 27. CAP Perspective
A
โขPartition์ด ๋ฐ์ํ์ง ์๋๋ก ์ํํธ์จ์ด๋ฅผ ๋ง๋ค ์ ์์
โขCP
๏๋ถํ ๋ฐ์์ consistency ์ ์ง
โขAP
๏๋ถํ ๋ฐ์์ availability ์ ์ง
๏์ดํ merge ํด์ผ ํจ
C
P
RC
ARC
โขNot AP Major partition๋ง ์ด์ ๋จ์
โขNot CP Write ์ ๋ํ consensus๊ฐ ์์
โขCP 28. ์ฑ๋ฅ
โขARC๋ latency๊ฐ ๋ ํฌ๋ค
๏Gateway์ ์ํ hop
๏๋ณต์ layer
โขARC์ ๊ฒฝ์ฐ CPU๋ฅผ ๋ ์ฌ์ฉํ๋ค
๏Gateway
๏Replicator
โข์ฑ๋ฅ์์ ๋ณ๋ชฉ์ ๋คํธ์ํฌ์์ ์๊น
๏๋คํธ์ํฌ๋ก ์ ์ก๋๋ ๋ฐ์ดํฐ์ ์
๏๋คํธ์ํฌ๋ก ์ ์ก๋๋ packet์ ๊ฐ์ (interrupt ์ฒ๋ฆฌ ๋ฅ๋ ฅ)
๏RPS (Receive Packet Steering)/RFS (Receive Flow Steering)๋ฑ์ ๋คํธ์ํฌ ์ต์ ํ ์ค์ ์ด ํ์ํจ 29. ์ฑ๋ฅ - ARC Gateway Affinity
PG 1 Master PGS
PG 2 Slave PGS
PG 3 Slave PGS
PG 1 Slave PGS
PG 2 Master PGS
PG 3 Master PGS
Gateway
Gateway
PG 4 Master PGS
PG 5 Slave PGS
PG 6 Slave PGS
PG 4 Slave PGS
PG 5 Master PGS
PG 6 Master PGS
Gateway
Gateway
Client (affinity)
Client (no affinity)
๏ํด๋ฌ์คํฐ์ key mapping ์ ๋ณด๋ฅผ ํํธ๋ก ํด์ ์ต์ ์ gateway๋ฅผ ์ ํํ๋๋ก ํจ (๊ฐ๋ฐ ๋ฒ์ )
๏๋คํธ์ํฌ ์ฌ์ฉ๋์ ์ต์ ํ 30. ์ฑ๋ฅ ํ
์คํธ ํ๊ฒฝ
Gateway
Gateway
Gateway
Gateway
Gateway
Gateway
M S
S M
M S
S M
M S
S M
M S
S M
M S
S M
M S
S M
YCSB
YCSB
YCSB
YCSB
YCSB
YCSB
โขLoad generator 6์ฅ๋น, ํด๋ฌ์คํฐ 6๋
โข24๊ฐ์ Redis instance (master 12, slave 12)
โขYCSB
๏Scan ๋ช
๋ น ์ ์ธ (๋จ์ผ ํค sorted set ์ฌ์ฉ)
๏Driver๋ Jedis ๊ธฐ๋ฐ (nBase-ARC java client, Jedis Client) 31. ์ํ ๊ฒฐ๊ณผ - 1K 100% Write
0
50000
100000
150000
200000
250000
0
200
400
600
OPS (RC)
OPS(ARC)
0
0.5
1
1.5
2
2.5
0
200
400
600
Latency (RC)
(ms)
Latency(ARC)(m
s)
โขClient ๊ฐ์๋ฅผ ๋ง์ด ๋๋ฆด ์ ์๋ ๋ฌธ์ ๊ฐ ์์์ (RC์ฉ Jedis)
โขCPU ์ฌ์ฉ๋์ RC (10%), ARC (20%)
โขRC๋ ํด๋ผ์ด์ธํธ ๊ฐ์๊ฐ ๋์ด๋๋ฉด ์ฑ๋ฅ์ด ์ ํ ๋๋ค
๏๊ฐ client๊ฐ Redis์ ์ง์ ์ฐ๊ฒฐํ๊ธฐ ๋๋ฌธ์ connection ๊ฐ์๊ฐ ์ฆ๊ฐ
โขARC์ ์ฑ๋ฅ ์ต๋์น๊ฐ RC์ ์ฑ๋ฅ ์ต๋์น์ ๋ฏธ์น์ง ๋ชปํ๋ ์ด์
๏๋ณต์ layer์ ์ํด์ ์์ ํฌ๊ธฐ์ packet ์ ์ก์ด ์ถ๊ฐ๋จ
85 % 32. ์ํ ๊ฒฐ๊ณผ - 1K 100% Read
โขCPU ์ฌ์ฉ๋์ RC (10%), ARC (20%)
โขARC์ ๊ฒฝ์ฐ Consistent read ๋ฅผ ์ํ ๋ณต์ ์์ overhead
๏Operation ์์ฒด๋ ๋ณต์ ๋ก ์ ์ก๋์ง ์์ง๋ง ์์๋ฅผ ๋ง์ถ๊ธฐ ์ํ reference data๋ ์ ์ก
โขRead offloading
0
100000
200000
300000
400000
500000
0
200
400
600
OPS (RC)
OPS(ARC)
0
0.2
0.4
0.6
0.8
1
1.2
0
200
400
600
Latency (RC)
(ms)
Latency(ARC)(
ms)
93 % 33. ์ํ โ ๊ฒฐ๋ก
โขRC: ๊ณ ์ฑ๋ฅ+, ์ฅ์ /๋จ์ ๋ฐ์ ์ ๋ฐ์ดํฐ ์ ์ค
โขARC: ๊ณ ์ฑ๋ฅ, DB 35. More Autonomous Cluster
โข๊ณ ์์ผ๋ก ๋์ํ๋ ์์คํ
์ด๊ธฐ ๋๋ฌธ์ ์ฌ๋์ด ์ด์์ ๊ฐ์
ํด์ผ ํ๋ ์ํฉ์ด๋ฉด ์ด๋ฏธ ๋ํ ์ฅ์ ์ํฉ
โขํ์ฌ๋ ์ฅ์ ๊ฐ์ง ๋ฐ ์ฒ๋ฆฌ๋ง ์๋ํ๋จ. ๋์ฑ ํ์
โข์ฅ๋น ๊ด๋ฆฌ์ (ARC0)
๏ผLocal repository management
๏ผProcess management
๏ผHeartbeat aggregation 36. Resource Efficiency
โข์ฅ๋น์ ํจ์จ์ ์ธ ์ฌ์ฉ์ ์ํด ํ ์ฅ๋น์ ์ฌ๋ฌ process ๊ตฌ๋
โข์๋ก ๋ค๋ฅธ ํด๋ฌ์คํฐ์ ํ๋ก์ธ์ค๊ฐ ๋ ์ ์์
โขProcess (ํด๋ฌ์คํฐ) ์ฌ์ด์ ๊ฐ์ญ์ด ์๋๋ก ์์คํ
์์ ๊ด๋ฆฌ
๏๋คํธ์ํฌ, ๋์คํฌ, CPU, ๋ฉ๋ชจ๋ฆฌ
โข์ฅ๋น ๊ด๋ฆฌ์ (ARC0)
๏ผSystem resource management
๏ผSystem resource monitoring 37. Global Management
โขGlobal ํ๊ฒฝ์ ์ฌ๋ฌ zone ์ด ๊ตฌ์ถ๋จ์ ๋ฐ๋ผ ์ฒด๊ณ์ ์ด๊ณ ์๋ํ๋ ์ด์ ๋ฐฉ์์ด ํ์ํ๋ค
HUB
-Zone registry
-Resource (e.g. binary) repository
-User account
-Global management
ZONE