Overview
This document provides best practices for CCE to guide you through containerizing game applications.
The features of the gaming industry, especially mobile games that are popular nowadays, are short, flat, and fast.
- Short: Games, especially mobile games, feature a short lifecycle, which generally lasts for only one year.
- Flat: Game development relies on a flat background architecture. For most games, one server is deployed for one region. One machine and one database can serve multiple game servers.
- Fast: Game players generally increase in an explosive way. However, a game server supports only a limited number of users. A new server must be deployed if the number of users reaches the upper limit. Due to a short lifecycle, it is necessary that a game can be developed and rolled out in a short time.
What Is a Container?
A container is a lightweight OS-layer virtualization technology. It allows user space in an OS to be divided into several independent units running in the kernel, each of which is independent from each other. Such independent space is called a container.
With the development of virtualization technologies, one physical machine can be virtualized into multiple VMs, but virtualizing an independent OS incurs system loss, limiting the number of target VMs. In contrast, one machine can run dozens or even hundreds of containers with basically no performance loss. In addition, starting a container is as simple as starting a process, which can be completed in seconds. In gaming scenarios, the container technology is extremely advantageous.
Why Is a Container Preferred?
- A traditional game background architecture has the following disadvantages: One machine runs a large number of game servers at the same time. When the machine breaks down, users are widely affected.
Container solution: One of the most important advantages of the container technology lies in its lightweight, which supports virtualization of an independent system operating environment with a fine granularity. This enables a physical server, or a cloud server, to run hundreds of thousands of independent containers at the same time. Each kind of service logic in a game, such as marching, fighting, and chatting control logic, can run in an independent container. This series of containers constitutes an independent game world.
In addition, the resource usage of these containers can be properly planned based on service types, so that the resources are isolated for different containers.
Moreover, after containerization, a machine failure may affect only some service logic in some game servers. For example, when the machine running the container that controls marching tasks is faulty, frame freezing occurs instantaneously but the marching tasks recover immediately. Using monitoring methods, some important service logic can be run on multiple backup containers at the same time, and the service logic can be quickly switched to the backup containers in case of unavailability.
- Games feature a short lifecycle and require quick development and rollout.
Container solution: The core concepts of Docker containers are Build, Ship, and Run, covering the entire process from development to deployment. After the development is complete, containers are packaged into container images and stored in a repository before testing. After the testing is complete, the container images are stored in the repository again and finally deployed in the production environment. The three phases are smoothly connected, avoiding the workload of setting up a complex running environment. In this way, games can be quickly developed and rolled out.
- The number of game players dramatically fluctuates, requiring auto scaling of game applications in a short time.
Container solution: A container can be started in seconds. When the number of game players dramatically increases, containers can be started in seconds to ensure service stability.
Core Advantages of CCE
- Advanced bare-metal container service, improving the gaming service performance by more than 200%
The gaming industry places stringent requirements on network performance and computing capabilities of servers. CCE supports a bare-metal container service, as shown in Figure 1. Games can be deployed based on Bare Metal Server (BMS), and containers can directly run on physical machines. By using containers, excellent performance can be achieved without any performance loss caused by virtualization, thereby improving the gaming service performance by more than 200%.
- Auto scaling of containers in seconds, saving a lot of resource costs
Traffic unpredictability has become a "New Normal" of game applications. CCE supports auto scaling in seconds to ensure high service stability and improve user experience. In addition, reserved resources are reduced, saving investments by millions of dollars. Based on features of games, CCE provides flexible auto scaling policies, which can be selected and combined for use as required.
Table 1 Flexible auto scaling policies Recommended Auto Scaling Policy
Description
- The number of game players dramatically fluctuates every day, so the Periodic Policy is recommended.
For example, the number of players of a game reaches the peak in the afternoon and evening on a given day.
You are advised to use the Periodic Policy. For example, 100 pods are added at 13:00 every day from January 1, 2018 to January 1, 2019.
- For new games, the Metric-based Policy is recommended.
After a new game is released, it is uncertain whether how many players will play this game. It is difficult to reserve a proper number of machines based on existing experience.
You are advised to use the Metric-based Policy. For example, if the CPU or memory usage exceeds 70%, one pod is added. If the CPU or memory usage is less than 40%, one pod is reduced.
- For various in-game events, the Scheduled Policy is recommended.
In-game events are frequently held. You are advised to configure the Scheduled Policy before an event begins. For example, 100 pods are added at 12:00 on August 8.
- Rolling upgrade policy, causing no service interruption and ensuring lag-free experience of game players
Game requirements grow rapidly and versions change frequently. The upgrade efficiency and user experience during the upgrade are crucial for gaming services.
CCE provides a rolling upgrade policy to separately update pods one by one instead of updating all pods at the same time. This ensures that services are not interrupted during the upgrade.
- Support for stateful applications, solving the problem of containerizing game applications
Game servers constitute an independent game world. In this world, data of players needs to be continuously updated and stored. The prerequisite for containerizing game applications is to ensure data storage. CCE supports stateful containerized applications (applications that store data or statuses during the running), and leverages high-availability volumes by means of storage capabilities such as Elastic Volume Service (EVS) and Scalable File Service (SFS) of HUAWEI CLOUD. This solves the problem of containerizing game applications.
Last Article: Containerizing a Game Application (WOW)
Next Article: Deployment Process

Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.