Multi-Site High Availability Architecture solution of Honor of Kings mall
Background
Honor of Kings, is a multiplayer online battle arena developed by TiMi Studio Group and published by Tencent Games for the iOS and Android mobile platforms for Mainland China. Released in 2015, it has become one of the most relevant MOBA games in mainland China.
This article is the Multi-Site High Availability Architecture solution of the game's mall where users can purchase game skins and tools.
The difference between this mall and a traditional online store is:
our game mall is all digital products
we don't need to worry about inventory and logistics.
Business Features
We have lots of features, but based on priority, our core features are:
Core features: login, recharge (top up), purchase
Users have to log in first for any other activities, eg: playing, purchasing a skin, etc. So login is the top priority.
For the online mall, top-up and purchasing are the other top priorities.
Data
RoleId: immutable and globally unique. Only need to link the user id to the server id.
Recharge transactionId: all the transactions are happening in WeChat pay or QQ pay. Honor of Kings (HoK) doesn't need to do anything with the transactions but only a record of the transaction associated with the user id and server id (the server which the user play). Also, this record is immutable.
Vouchers: HoK's currency. Linked with user id and server id.
Purchase records: this record will include information of: product id (globally unique), amount of product, server id, user id, transactionId (globally unique) and timestamp. The whole record is immutable.
Data Sync
RoleId: immutable and globally unique, associated with server id. Only need to sync new data.
Recharge transactions: immutable. Only need to sync new data.
Vouchers: need to guarantee strong consistency. Only need to sync the data.
Purchase records: immutable. Only need to sync new data.
Exception Cases
If QQ or WeChat is down, what should we do?
Post an update on our app/website: the top-up feature is temporarily down. And will give an update once QQ or WeChat is back alive.
If the server is down during the user's purchase, what should we do?
Involve our support tea,m and possibly make compensation, e.g. a gift card to the affected customers.
If the user didn't see the latest data due to the data sync latency, what should we do? eg, user can't see their vouchers.
Tell the user that there might be a little bit of latency and suggest they check later. If the situation doesn't improve after 5min, they could submit a help ticket, and our support team will contact them.
Architecture design diagram
版权声明: 本文为 InfoQ 作者【David】的原创文章。
原文链接:【http://xie.infoq.cn/article/7c735d4e2afb0e6ff3053ebee】。文章转载请联系作者。
评论