Network Framework Node js DB Redis Cloud Platform
기술 스택 Network Framework : Node. js DB : Redis Cloud Platform : AWS Cluster Manager : Zookeeper
Node. js에 대한 기대 • • • Evented, non-blocking I/O Serverside Javascript Usuful Base Module http, https o cluster o net o os o • Usuful Thirdparty Module express : webframework o socket. io : web socket o piber : coroutine o
Node. js에 대한 실망 • • Evented, non-blocking I/O o Serverside Javascript o • • 이거 IOCP잖아. 게임 서버는 예전부터 이거 썻는대 클라에서 자바스크립트 안 쓰는대 C#이나 C++ 쓰는 대 Usuful Base Module Usuful Thirdparty Module
Redis에 대한 기대 • • • Memory DB Powerful Datatype o Strings, List, Sets, Hashes, Sorted sets Persistence RDB o AOF o Replication o
Redis 그래도 좋다 • Memory DB 로그 DB를 제외하면 생각보다 게임 DB 용량 많이 안 먹는다. 성능을 위해서 돈 좀 더 쓰자. o Scale Out 하면 된다 o • Powerful Datatype o 익숙하지 않아서 그렇지 모든 자료구조 key, value로 표현은 가능하다. var chat = { user. ID : 'jane', text : 'hello' }; var chat. Room = { room. ID : 1, chats : [] }; chat. Room: 1: room. ID = 1; chat. Room: 1: chats: count = 500; chat. Room: 1: chats: chat: 500: user. ID = 'jane'; chat. Room: 1: chats: chat: 500: text = 'hello';
Zookeeper 초간단 개념 정리 • • • Memory DB, Disk Backup Distributed DB Read : Write = 10 : 1 Node Change Event Session Based Node Delete Cluster State Dashboard + Cluster State Notifier
Zookeeper 초간단 개념 정리 • http: //youngdeok-k. com/entry/7%EC%A 3%BC%ED%82%A 4%ED%8 D%BC -zookeeper-%ED%99%9 C%EC%9 A%A 9 ndash%EB%B 6%84%EC%82%B 0%EC%84%9 C %EB%B 2%84 -%EA%B 5%AC%ED%98%842%ED%8 E%B 8
Node. js Scaleout • • Multiple Core : Cluster Module 사용 Machine Scaleout : EC 2 인스턴스의 CPU와 RAM 사용량이 일정 조건을 넘으면 AWS Auto. Scaling이 작동
Redis Fail. Over • 복제셋 구성 Master : 쓰기 o Slave 1 : 읽기 o Slave 2 : 백업 § AOF : 초단위로 op로그 저장 § RDB : 시간단위로 snapshot 저장 § RDB Backup : 시간단위로 RDB를 S 3에 백업 o • Sentinel o http: //charsyam. wordpress. com/2012/07/2 4/%EC%9 E%85%EA%B 0%9 C%EB%B 0%9 C-redis-
서버 구조 Client Client Elastic Load Balancer EC 2 Instance Zoo. Keeper Node. js Sentinel Redis Master AID: 0~100 Redis Slave(Read) AID: 100~200 Redis Slave(Backup) AID: 200~300 Zoo. Keeper Node. js Sentinel Redis Master AID: 100~200 Redis Slave(Read) AID: 200~300 Redis Slave(Backup) AID: 0~100 Zoo. Keeper Node. js Sentinel Redis Master AID: 200~300 Redis Slave(Read) AID: 0~100 Redis Slave(Backup) AID: 200~300 • • • • • . . .
- Slides: 22