Solution Overview¶
This chapter provides CCE best practices to walk you through the application containerization.
What Is a Container?¶
A container is a lightweight high-performance resource isolation mechanism implemented based on the Linux kernel. It is a built-in capability of the operating system (OS) kernel.
CCE is an enterprise-class container service based on open-source Kubernetes. It is a high-performance and high-reliability service through which enterprises can manage containerized applications. CCE supports native Kubernetes applications and tools, allowing you to easily set up a container runtime in the cloud.
Why Is a Container Preferred?¶
More efficient use of system resources
A container does not require extra costs such as fees for hardware virtualization and those for running a complete OS. Therefore, a container has higher resource usage. Compared with a VM with the same configurations, a container can run more applications.
Faster startup
A container directly runs on the host kernel and does not need to start a complete OS. Therefore, a container can be started within seconds or even milliseconds, greatly saving the development, testing, and deployment time.
Consistent runtime environment
A container image provides a complete runtime environment to ensure environment consistency. In this case, problems (for example, some code runs properly on machine A but fails to run on machine B) will not occur.
Easier application migration, maintenance, and scaling
A consistent runtime environment makes application migration easier. In addition, the in-use storage and image technologies facilitate the reuse of repeated applications and simplifies the expansion of images based on base images.
Containerization Modes¶
The following modes are available for containerizing applications:
Mode 1: Containerize a single application as a whole. Application code and architecture remain unchanged.
Mode 2: Separate the components that are frequently upgraded or have high requirements on auto scaling from an application, and then containerize these components.
Mode 3: Transform an application to microservices and then containerize the microservices one by one.
Table 1 lists the advantages and disadvantages of the three modes.
Containerization Mode | Advantage | Disadvantage |
---|---|---|
Method 1: Containerize a single application as a whole. |
|
|
Method 2: Containerize first the application components that are frequently updated or have high requirements on auto scaling. |
| Need to decouple some services. |
Method 3: Transform an application to microservices and then containerize the microservices one by one. |
| Need to transform the application to microservices, which involves a large number of changes. |
Mode 1 is used as an example in this tutorial to illustrate how to containerize an enterprise resource planning (ERP) system.