Containers vs Serverless: What is the nature difference is?

In cloud computing, container and non-server computing has occupied the forefront of the development.

 

Author | Emra Samdan

Translation | bocloudresearch

 

 

A little history

 

Until recently, application development, deployment and maintenance than it is now much more complex, time-consuming and more. In the first, maintaining not only need to fix the application code, you also need repair support for physical machines. Updates keep the server hardware and software is also very critical task.

The new model at the beginning of this century, called "Infrastructure as a Service (IaaS)" quickly became popular. IaaS offers the possibility to rent a remote server and virtual machines from third-party providers, these providers can be fully responsible for managing the hardware, network and subscription.

After IaaS appear, eliminate all non-coding the developer's responsibility to simplify the work of personnel development, this idea is to promote innovative new methods, models and services.

 

 

What containers are?

 

Docker's official website provides the following brief and elegant definition: "container is a standard unit of software that will code and all dependencies package, allowing applications to quickly and reliably between different computing environments change. words, through the use of containers, developers can ensure their applications can run on any cloud platform or a local server. in some respects, similar to the virtual machine container, for example, both resource isolation. However, the virtual machine simulation the physical device, and the container to create an application abstraction layer.

 

 

What non-server computing is?

 

In the non-server computing, the entire application or part of the application is decoupled into a plurality of functions, each function such as a response to the HTTP request, the message queue reaches a new message, or to save or modify the new object in the storage and other time-triggered . Platform can run these functions at a specific time or period, this (scheduled tasks) is helpful for cron jobs.

For this system to work, developers only need to write functional code and package it and its dependencies into a zip file, and then send the zip file to the server-end, by the provider responsible for the supply and expansion.

One of the key features is no server "pay" model, in this model, companies only pay for the actual execution time of the function. Today, AWS Lambda should be the most popular server-provider.

 

 

Containers and servers do have in common?

 

Yes. Now, no servers and containers are popular, they allow developers to focus on their own code rather than infrastructure, which greatly improves the speed of development. Container and serverless are well suited to micro-architecture-based services and components. When using them, deploy and extend generally than using traditional single architecture faster, more cost-effective, because it is a small part of the application you operate, rather than the entire application. While these containers and serverless have in common, but each technology has its own advantages, disadvantages and use cases.

 

 

The advantages of container

 

The first advantage is the portability of the container. Since the container already contains all the elements it needs to run, so just to place a container of engine installed to run the machine. Container and platform-independent, so they can run on Linux, Windows, macOS, Mesos, Docker, Swarm or Kubernetes. They can even run on another vessel.

In terms of computing resources, container and more efficient than the virtual machine. Although the containers and virtual machines are virtual, but virtual opportunity to use its own operating system to simulate the entire computer, and therefore consume more resources. On the other hand, the container can share the same operating system, so that the operating system is smaller, faster startup and shutdown.

Another benefit is that the container allows developers to fully control applications. While this means that you must manually configure the system settings, but it also means having real flexibility. This can not be achieved in a serverless, because all the content-free servers are managed by the cloud provider.

 

 

Container specific example

 

When we want to be some large-scale reconstruction of monolithic applications into smaller independent parts, in order to migrate to micro-services architecture and get better performance, testability and the pace of expansion, the container is really helpful . For example, the previous large-scale application is split into several separate services: one responsible for user management, and the other is responsible for converting media files. Each service can be easily extended to provide better performance while increasing its terms of reference load. But for a single application is not possible, in monolithic applications, the need to add new instances to the entire system, which is both expensive and time consuming.

Accordingly, the container is suitable for long-running applications, and a system application specific requirements, without complete control of the system, these applications difficult to provide.

 

 

Serverless advantage

 

Due to "pay" model mentioned above, the cost of server-hosted applications than any other method may be much lower. No need to pay idle time function, if there is no traffic, there would be no fee on monthly bills. Almost all non-server providers have a free layer, which includes a fixed number of requests and execution time per month. Typically, the amount provided is sufficient to make a small start-up company website or free run.

The container, to distribute the application service is a key member or micro steps. In serverless, which is distributing an application or portions thereof into a single function, each function is responsible for a particular logical segments. Engineers easier to understand and develop a single logical function, which greatly improves the development and deployment speed. Compared with the deployment of the entire application, the risk of deploying a small part smaller.

Another great advantage of no server is automatically extendable. No server function runs in a small, temporary container under the control of the provider of the stateless. Providers are fully responsible for the extended response to load peaks, and hundreds of instances can be started within a few seconds. Moreover, still only be charged for the total execution time of all functions.

 

 

When to use serverless better?

 

Serverless event-driven characteristics make it useful for applications that do not always need to run (or portion thereof).

Suppose you are developing media processing functionality to an existing application. The new module Although not often used, but still need enough computing power to complete its task. Placing it as the application may need to switch to a more powerful example - this is a risky move, because if you run some of the onerous tasks simultaneously may cause delays for all other users. In this case, you also need to pay more, and still faces some problems caused by the bottleneck.

Conversely, if you select serverless, then the media processing functions will be isolated from the rest of the application. When it is not being used, you do not need to pay for it, and you can always make sure that it does not affect other parts of the application.

 

 

Malpractice container

 

Even if no one is using the application, there are at least a virtual machine instance carrying container is always running. Thereby resulting in more expensive than a container without the server.

Even if the container can share in the rapidly expanding computer, but the computer itself needs to be extended, so other extensions are not fast. However, when used in conjunction with the business process vessel system (e.g. Kubernetes or AWS ECS) can make more intelligent spreading.

 

No server drawbacks

 

For most developers, the most frightening part of the serverless is vendor lock-in. When you commit to serverless, in fact, it is stacked on a single cloud provider. These non-server applications used in the function and architecture api due to different providers vary, so change provider or switch to in-house solutions cost may be high. Still, some experts do not agree with this view, claiming vendor lock-in is not really a problem.

Server-free method is not easy to achieve observability, monitoring and debugging. Because the application can be distributed to multiple sections, and each section has its own bug and error, control, and view the global become very important.

 

 

Containers and servers can operate with it?

 

Containers and servers can operate together, the answer is yes. The main application functions as a container of micro to run the service, while the server without using certain background operations or rarely used features (but take up CPU), can be very effective.

Another interesting combination is AWS Fargate provided. The service combines the advantages of free servers and containers that allow you to better control your applications, without having to worry about stretching problems.

 

 

in conclusion

 

Containers and servers are generally considered competing technologies. But a closer inspection reveals they are just different techniques, when used in the same project, they actually can make up for each other's deficiencies. It is important to remember that "old" does not mean "out of date", "new" does not mean "better." The effectiveness of the solution depends on the specific use cases, project requirements, team experience and team preference.

Guess you like

Origin www.cnblogs.com/bocloud/p/11896730.html