Go Game
Topic: Go Game
Interviewer: FLAAG engineer
Interviewee: FLAAG engineer
Level: L4 (Experienced Individual Contributor)
Requirements
Multi-player game for Go
Each game is between 2 persons
Total 10k people at the same time
Web-based game frontend->backend
Matching pair - similar level
System design
7:05
User journey
Click start game -> request -> matching system
System sending request to another playerB
Game start
Inside game
Player A with black
In turn
Winning condition
System and game, grant score for winner for level up
7:20
API design:
putPeace(user_id, piece_type, ) -> return ACK(ok/error)
heartBeat(user_id)
resumeGame(user_id)
7:42
Diagram
Interviewer: What technology do you want to use?
Interviewee:
Lambda
Explain lambda
What database to use?
NonSQL: Cassandra, DynamoDB
What key and value for database?
Eventual consistency
What’s the cost? QPS
Max throughput:
10k QPS strong reads
3000 QPS per partition
Need 4 partitions
1 user N games
Database design:
7:57
API:
PutPiece(user_id, piece_type, coordinate_x, coordinate_y)
IsSecure(user_id) return error
Pseudo code
How to implement put piece function?
getLatestBoardFromDB(GameID)
Interviewer Comments
Soft skills
Requirement gathering
Make decisions - no need to be optimal, justified rationale
Describe the solution
System design
Vague requirement -
Improve: critical journey
Twitter - system scalability
Architecture diagram
Pseudo code, at right level - L4
Lambda: excellent, general solution, scaling, deployment
To Improve:
Action time - cannot trust client side, people cheat
Try not to fight the interviewer when the interviewer suggested something
Make decision and tradeoff
Heart beat
Javascript - websocket, push notification
Make decision to stick to it, make progress, design around
Key is to get to working design
Websocket: pipe, message type
Client ->server
Server -> client, define client
10k QPS
L4 lambda
L5-L6 under the hood
E.g. kubernetes, pod, application server, instance type, handle how many QPS
2-3, what kind of instance in AWS
1 instance, how many QPS
Order of 1000 times
Project life cycle. 3 methods.
How to handle this extension? How do you push?
How to rollback?
Feedback/comments from the audience
Not official rubrics
Feature flag - widely used in the industry
Justify, when to use, how to use
Audience:
题目 - candidate
Audience
How many server, hardware setting
L5 - how many core, handle simple logic, how many QPS
Audience
DynamoDB - consistency model
Eventual consistency. L5 - need candidate to tell me
Strong consistent
L5 - eventual consistent
Read and write,
Read your own writes
Write - mysql correctness
L5 - candidate - correct solution
Audience:
API call - server calling client