The birth of container comes from the evolution of software architecture, from the single architecture at the beginning, to SOA architecture, and finally to the microservice architecture now, in such an architecture evolution, container technology plays an important role.
Container technology has a lot in common with virtualization technology. Both are used to isolate resources, but more detailed analysis shows that virtualization is more about isolating hardware from the operating system, while container technology is more about isolating applications from each other.
The project architecture
Single architecture:
Traditional projects have a lot of functionality, and these function modules are combined into one big project and then deployed to the server. With the growth of the business, the complexity of the business will become higher and higher, and the corresponding development, compilation, deployment, maintenance, and extension will inevitably be limited.
SOA architecture:
So how do you solve these problems with single architecture? In one word: disassembly.
The huge single application is divided into multiple service modules, and then these service modules are connected in series according to business logic to provide external services. These service modules are generally loose, but each component can perform a complete piece of business logic.
One of the main characteristics of SOA architecture is that even though the service modules are separated, a bus ESB (such as RPC technology) is needed as a bridge to communicate, but the ESB is difficult to manage in a unified manner.
Microservices Architecture:
In the transformation based on SOA, the idea is still to break large projects into small projects, but the difference with SOA is that microservices no longer emphasize the heavy ESB enterprise Service Bus in SOA architecture, and truly realize service self-consistency and true componentization
Docker container
The container technology is a process isolation technology that allows applications to run in isolated containers. However, different from VMS, applications share the same Kernel. The container technology greatly improves the utilization of system resources and application deployment and migration efficiency.
Linux Namespace provides a method to isolate system resources at the kernel level. The global resources of the system are put into different namespaces to achieve resource isolation. Different Namespace programs can enjoy an independent system resource. (There are other process isolation techniques, of course)
Namespace | Quarantined content |
---|---|
UTS | Host name and domain name |
IPC | Semaphores, message queues, shared content |
PID | Process number |
Network | Network device, network line, port |
Mount | The file system |
User | Users and user groups |
Namespace can be used to build a relatively isolated container. Cgrous can be used to set system resource quotas for the container, including CPU, content, and I/O.