Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The service processing method based on the container technology can be applied to the application environment shown in fig. 1. Wherein the user terminal 110 communicates with the server 120 through a network. The user terminal 110 responds to the triggering operation of the user, generates a service request, and sends the service request to the server 120, where the service request carries the resource demand information. The server 120 constructs a container corresponding to the resource demand information as a container matched with the user terminal 110; a control container for processing the service request; and if the container is detected to finish processing the service request, deleting the container. The user terminal 110 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 120 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, a method for processing a service based on container technology is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:
step S201, receiving a service request sent by a user terminal; the service request carries resource requirement information.
In this step, the service request refers to a user-triggered request corresponding to the user terminal, and includes a resource configuration request, a distributed storage request, a system upgrade request, and the like. The resource refers to resources such as a Central Processing Unit (CPU), a memory, a network, and storage of the server, and the resource demand information refers to server resources required for processing the service request; for example, if the data volume of the service request is low, the required server resources are less; if the data volume of the service request is high, more server resources are required.
Specifically, the user terminal responds to the trigger operation of the user, generates a service request, and sends the service request to the server. For example, a user clicks a "resource application" on a service interface provided by a user terminal, and the user terminal is triggered to generate a corresponding service request, and the service request is sent to a corresponding server through the user terminal.
And step S202, constructing a container corresponding to the resource demand information as a container matched with the user terminal.
In this step, the container technology is a lightweight, portable, self-contained software packaging technology, and packaged applications can run in the same manner almost anywhere.
The container is a container which runs on the server and is virtualized through a Docker technology, and can also be regarded as an independent code unit running on a kernel; the container can load a file system of the container by using a kernel of a host (such as a server), and does not need to occupy the kernel independently, so that the container has the advantages of high starting speed, small resource occupation and good portability; wherein Docker is an open source application container engine.
Specifically, the server analyzes the resource demand information and determines the server resources required for executing the service request; constructing a container corresponding to the required server resource as a container matched with the user terminal; therefore, the server resources used by the constructed container can be limited by constructing the container matched with the user terminal, the server resources are prevented from being occupied in large quantity to influence the execution of other service requests, and the resource utilization rate of the server is improved. In addition, under the condition of receiving a service request sent by a user terminal, a matched container is constructed, so that server resources are more effectively utilized, and the resource utilization rate of the server is further improved.
In step S203, the control container processes the service request.
Specifically, the server generates a service instruction according to the service request, and sends the generated service instruction to a container matched with the user terminal; the container is used for processing the service request according to the received service instruction and generating a corresponding processing result; for example, the container responds to a resource allocation request sent by the user terminal to generate a corresponding resource allocation result. Therefore, the service request is processed through the control container, the defect that resources of the server are occupied in a large amount due to the fact that the service request is executed through the virtual machine is overcome, the resources of the server are saved, and the resource utilization rate of the server is further improved.
Furthermore, the server can also verify the service request sent by the user terminal to confirm whether the service request is tampered or not, and if the service request is confirmed to pass the verification, the control container processes the service request.
For example, the server obtains a network IP address carried by the service request; and matching the network IP address carried by the service request with a preset network IP address, if the matching is successful, confirming that the service request passes the verification, and controlling the container to process the service request.
In step S204, if it is detected that the processing of the service request by the container is completed, the container is deleted.
Specifically, the server monitors the progress of the container in real time to determine whether the container finishes processing the service request; and if the container is detected to be in an idle state after the service request is processed, deleting the container. Therefore, the server resources occupied by the container are released, the defect that the server resources are occupied because the container does not execute the service request is avoided, and the resource utilization rate of the server is improved.
In the service processing method based on the container technology, according to the service request sent by the user terminal, a container corresponding to the resource demand information carried in the service request is constructed and used as a container matched with the user terminal, the container is further controlled to process the service request, and the container is deleted when the container is detected to finish processing the service request; the purpose of constructing a matched container in real time to execute the service request according to the service request sent by the user terminal is realized; in the process of executing the service request, the container shares the kernel system of the server without occupying the kernel system independently, so that the defect that the resource of the server is greatly occupied due to the fact that the service request is executed through the virtual machine is overcome, the resource of the server is saved, and the resource utilization rate of the server is further improved; meanwhile, under the condition that the container is detected to finish processing the service request, the container is deleted, so that the server resources occupied by the container are released, the waste of the server resources is avoided, and the resource utilization rate of the server is further improved. In addition, the container responds to the service request of the user terminal, thereby avoiding the defect that the service request cannot be smoothly executed due to resource preemption, and improving the stability of service execution.
In an embodiment, the step S202 of constructing a container corresponding to the resource requirement information as a container matched with the user terminal includes: determining a container mirror image identifier corresponding to the resource demand information; acquiring a container mirror image file corresponding to the container mirror image identifier from a preset database; and constructing a corresponding container according to the container image file, wherein the container is used as a container matched with the user terminal.
The container mirror image identifier refers to unique identification information of the container mirror image, and may be a container name, a container code, and the like. The container mirror image comprises a binary file of the application program and a dependent item thereof; the container image file is an image made by a Docker technology, the creation of the container needs to depend on one container image file, and the container image file can be regarded as all the operating environments of the container.
Specifically, the server queries a preset corresponding relationship between the resource demand information and the container mirror image identifier according to the resource demand information to obtain a container mirror image identifier corresponding to the resource demand information; inquiring a preset database storing container mirror images corresponding to a plurality of container mirror images according to the container mirror image identifiers to obtain container mirror images corresponding to the container mirror image identifiers; and constructing a container corresponding to the container image file as a container matched with the user terminal.
In this embodiment, by constructing the container matched with the user terminal, the server resources used by the constructed container can be limited, thereby avoiding the server resources from being occupied in a large amount to affect the execution of other service requests, and simultaneously improving the resource utilization rate of the server. In addition, under the condition of receiving a service request sent by a user terminal, a matched container is constructed, so that server resources are more effectively utilized, and the resource utilization rate of the server is further improved.
In an embodiment, in step S201, the service request is a resource allocation request; then, in step S203, the controlling container processes the service request, including: determining target resources of the user terminal according to the resource configuration request; and the control container is used for configuring target resources for the user terminal.
The target resource refers to a server resource required by the user terminal.
Specifically, the server analyzes the resource configuration request to obtain server resources required by the application terminal, and the server resources are used as target resources of the user terminal; generating a configuration instruction according to the target resource of the user terminal, sending the generated configuration instruction to a container, and triggering the container to configure the target resource for the user terminal according to the configuration instruction; the server resources used by the user corresponding to the user terminal are guaranteed to be within the quota range, and the influence of server resource preemption on the stability of application programs of other users is prevented.
In this embodiment, the service request is processed by the control container, so that a defect that resources of the server are occupied in a large amount due to the fact that the service request is executed by the virtual machine is overcome, resources of the server are saved, and resource utilization rate of the server is further improved.
In an embodiment, the step S203, after the controlling the container processes the service request, further includes: receiving a processing result returned by the container; extracting private data and public data from the processing result; and storing the private data in a private storage block corresponding to the user terminal, and storing the public data in a preset public storage block.
The private data refers to information related to personal privacy, such as user name, user identity, and the like; public data generally refers to data that can be shared.
The private data is stored in the private storage block corresponding to the user terminal and is separated from the operating system file, so that the data security and the system security can be guaranteed.
The method has the advantages that the preset public storage block is built, the users are managed to access the public data in an authorization or permission recovery mode, the data are rapidly shared, the defects that data are required to be carried due to the data requirements of different users, excessive resources and time are occupied are overcome, and the purpose of sharing the data by multiple people is achieved.
Specifically, the container processes the service request, generates a corresponding processing result, and sends the processing result to the server. The server acquires the identification information of the private data and the identification information of the public data, and extracts data corresponding to the identification information of the private data from the processing result as the private data extracted from the processing result; extracting data corresponding to the identification information of the public data from the processing result as the public data extracted from the processing result; and storing the private data in a private storage block corresponding to the user terminal, and storing the public data in a preset public storage block.
In this embodiment, the private data is stored in the private storage block corresponding to the user terminal, and the public data is stored in the preset public storage block, which is beneficial to improving the security of the data and simultaneously realizes the sharing of the data.
In an embodiment, the step S203, after the controlling the container processes the service request, further includes: acquiring a preset process monitoring file; and monitoring the process in the container according to a preset process monitoring file.
The preset process monitoring file is an algorithm file capable of automatically monitoring the process in the container.
Specifically, the server collects the process in the container and acquires a preset process monitoring file; monitoring the process in the container according to a preset process monitoring file; if the process of the container is abnormal, triggering alarm information, and repairing the process of the container to recover the normal operation of the container.
In this embodiment, the process in the container is monitored according to the preset process monitoring file, so that the purpose of monitoring the container is achieved, the defect that the service request cannot be smoothly executed due to the abnormal container is avoided, and the stability of service execution is further improved.
In one embodiment, after monitoring the process in the container according to the preset process monitoring file, the method further includes: if the process of the container is monitored to be abnormal, determining the process abnormal type of the container; acquiring a container repair file corresponding to the process exception type; and repairing the container according to the container repairing file.
The process exception type is used for identifying the exception type of the process of the container; the container repair file is a file capable of automatically repairing the container, and the corresponding container repair files are different in different process exception types.
Specifically, if the server monitors that the process of the container is abnormal, analyzing the abnormal condition of the process of the container to determine the process abnormal type of the container; inquiring a preset database storing container repair files corresponding to a plurality of process exception types according to the process exception types to obtain the container repair files corresponding to the process exception types; and sending the container repair file to the container to repair the container correspondingly so as to restore the container to be normal.
In this embodiment, when the process of the container is abnormal, the container is repaired correspondingly according to the container repair file corresponding to the process abnormal type of the container, so that the defect that the service request cannot be executed smoothly due to the abnormal container is avoided, and the stability of service execution is further improved.
In another embodiment, after monitoring the process in the container according to the preset process monitoring file, the method further includes: if the process of the container is monitored to be abnormal, reconstructing the container corresponding to the resource demand information; the reconstructed container is used for processing the service request.
Specifically, if the server monitors that the progress of the container is abnormal, the server reconstructs the container corresponding to the resource demand information as a container matched with the user terminal; the control container processes the service request; and if the container is detected to finish processing the service request, deleting the container.
In this embodiment, when the progress of the container is abnormal, the container corresponding to the resource demand information is reconstructed, and the service request is processed through the reconstructed container, so that the defect that the service request cannot be smoothly executed due to the abnormal container is avoided, and the stability of service execution is further improved.
In another embodiment, after monitoring the process in the container according to the preset process monitoring file, the method further includes: if the process of the container is monitored to be abnormal, the service request is sent to the container which meets the resource demand information and is in an idle state; the container is used for processing the service request.
Specifically, if the server monitors that the progress of the container is abnormal, the server searches for a container which meets the resource demand information and is in an idle state from the constructed container, and uses the container as a target container, and sends the service request to the target container to trigger the target container to process the service request.
In this embodiment, when a process of the container is abnormal, the service request is sent to the container which satisfies the resource requirement information and is in an idle state, so that the service request is processed through the container, thereby avoiding a defect that the service request cannot be smoothly executed due to the abnormal container, and further improving the stability of service execution.
In an embodiment, as shown in fig. 3, another service processing method based on a container technology is provided, which specifically includes the following steps:
step S301, receiving a service request sent by a user terminal; the service request carries resource requirement information.
And step S302, constructing a container corresponding to the resource demand information as a container matched with the user terminal.
In step S303, the control container processes the service request.
Step S304, acquiring a preset process monitoring file; and monitoring the process in the container according to a preset process monitoring file.
Step S305, if the process of the container is monitored to be abnormal, determining the process abnormal type of the container; acquiring a container repair file corresponding to the process exception type; and repairing the container according to the container repairing file.
Step S306, the repaired container is controlled to perform reprocessing on the service request.
Step S307, receiving a processing result returned by the container; extracting private data and public data from the processing result; and storing the private data in a private storage block corresponding to the user terminal, and storing the public data in a preset public storage block.
In step S308, if it is detected that the processing of the service request by the container is completed, the container is deleted.
According to the service processing method based on the container technology, a container corresponding to resource demand information carried in a service request is constructed according to the service request sent by a user terminal and serves as a container matched with the user terminal, the container is further controlled to process the service request, and the container is deleted when the container is detected to finish processing the service request; the purpose of constructing a matched container in real time to execute the service request according to the service request sent by the user terminal is realized; in the process of executing the service request, the container shares the kernel system of the server without occupying the kernel system independently, so that the defect that the resource of the server is greatly occupied due to the fact that the service request is executed through the virtual machine is overcome, the resource of the server is saved, and the resource utilization rate of the server is further improved; meanwhile, under the condition that the container is detected to finish processing the service request, the container is deleted, so that the server resources occupied by the container are released, the waste of the server resources is avoided, and the resource utilization rate of the server is further improved. In addition, the container responds to the service request of the user terminal, thereby avoiding the defect that the service request cannot be smoothly executed due to resource preemption, and improving the stability of service execution.
In one embodiment, a container technology based service processing system is provided, which is specifically constructed by:
(1) the bottom layer builds the infrastructure based on server hosts, network resources, etc.
(2) By adopting Kubernetes container arrangement management technology and Docker container technology and based on virtualization technology of an operating system kernel, a Kubernetes cluster environment is built, and network management, storage management, CPU (Central processing Unit), memory and other computing resources of the container are managed.
Kubernets is an open-source application for managing containerization on multiple hosts (e.g., servers) in a cloud platform.
(3) According to application requirements, creating tenants and distributing corresponding server resources to the tenants; and the tenant deploys the service application according to the allocated account and the tenant information.
(4) According to the resource condition of the host cluster and the available resource condition of the tenant, the Kubernets reasonably allocate storage and computing resources, bind the service application with the storage computing resources, and start the service application.
In one embodiment, the service processing system based on container technology specifically includes: the system comprises a container arrangement management module, a tenant application module, a service management module, a security management module, a multi-tenant management module, a platform operation and maintenance management module and a resource monitoring, managing and scheduling module; wherein:
and the container arrangement management module is used for realizing resource management of hardware basic equipment such as a host server and network equipment through kubernets, integrating resources such as a CPU (central processing unit), a memory, a network and storage of the management server and distributing the resources to the application of each tenant through a resource distribution management technology.
The tenant application module is used for allocating resources (such as a CPU, a memory, a network and storage) by taking a user as a unit, and the user can perform installation configuration and operation management of application software within allocated resource quota; the tenant application refers to an upper layer application constructed by the basic underlying service.
And the service management module is used for monitoring and managing the application service of the tenant and ensuring high availability of the service.
The security management module is used for providing user security authentication login, user authority, role distribution management and service application start and stop based on the platform side; and providing fine-grained authority management control based on the user side, such as authority management and control of the user (whether the user has service configuration in a tenant, start and stop authority, and the like), whether the user is allowed to access a certain application, and the like.
And the multi-tenant management module is used for providing application, creation and management of a new tenant and configuration setting and deletion of an old tenant.
And the platform operation and maintenance management module is used for providing start-stop, log retrieval, platform overall resource monitoring, each host node resource monitoring, addition and off-shelf related nodes of the platform basic operation service.
The resource monitoring, managing and scheduling platform is used for providing real-time resource use condition and historical resource use condition monitoring of the whole platform side and use condition monitoring based on each application resource in a tenant; providing resource management service for a container arrangement management tool, and rescheduling and running services with problems in the running process by combining resource use conditions and the resource management service, so as to ensure high availability of the services at any time; for example, when a node in the distributed application service fails, the application service can be migrated and run on an available node in time to ensure high availability of the service.
Through the service processing system based on the container technology, the following technical effects can be achieved:
(1) the application service based on containerization is started quickly and has good portability.
The container mirror image comprises a file system and parameters required by container operation, and only the mirror image needs to be migrated when the container mirror image is transplanted. Containers on the same machine share a host kernel, and a service start only needs a few seconds based on an LXC (Linux Containers, a virtualization technology based on an operating system level of the container) virtualization environment of an operating system level.
(2) Calico network isolation technology is used among different applications of multiple users, and illegal users are prevented from accessing other tenant applications by freely controlling access control strategies.
Calico is a pure 3-layer network isolation scheme, virtual switching is performed by using virtual routing agents, each virtual routing transmits reachable information through a BGP (Border Gateway Protocol) Protocol, and different users are distributed in different subnet areas to realize isolation.
(3) The public data sharing area is provided, users are managed to access public data in an authorization/recovery authority mode, data are shared quickly, the situation that data are required to be carried based on data requirements of different users, excessive resources and time are occupied is avoided, and the purpose of sharing one data by multiple people is achieved.
(4) The private data of the multi-user platform is stored in the user private storage block and is separated from the operating system file, so that the safety of the data and the system can be guaranteed.
(5) The computing resources are distributed according to the application of the user, and a resource packaging technology is used, so that the computing resources used by the user are ensured to be in a quota range, and the influence of system-level resource contention on the stability of other user application programs is prevented.
The resource monitoring, managing and scheduling platform distributes calculation and storage resources according to the application requirements of the multi-tenant management system, binds the calculation and storage resources to corresponding application services, and then starts the application services to be responsible for monitoring, managing and scheduling the application services.
(6) Adopting mirror image management, and finally realizing non-stop degradation or upgrading of the application service by a gradual replacement strategy, namely continuously increasing the number of copies of the old/new version instances; the whole process is transparent to the user, and the use of the user is not influenced.
The rolling upgrade can be realized by executing a kubeclcectrolling-update command, which creates a new Replication Controller, and then automatically controls the number of Pod copies in the old Replication Controller to gradually decrease to 0, and simultaneously, the number of Pod copies in the new Replication Controller gradually increases from 0 to a target value, and finally, the upgrade of the Pod is realized.
(7) Dynamic expansion and flexible expansion of application resources; when the application service has performance bottleneck, the number of copies of the Pod is automatically adjusted according to the configured strategy based on the resource use condition of the Pod through the Replication Controller, so that the second-level expansion of the application service performance is realized.
The resource monitoring, managing and scheduling platform increases or decreases the number of copies of the Pod according to the relevant monitoring index data of the user application service and the application configuration strategy, and the increase and decrease of the Pod are completed in second level.
(8) And monitoring and managing the cluster host, and performing fine-grained monitoring on the use condition of the whole resources of the platform and the use condition of the resources of a single user.
The resource monitoring function is integrated into a management page of the service processing system, so that the overall monitoring of resources and the resource monitoring of a single user can be realized.
It should be understood that although the various steps in the flow charts of fig. 2-3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-3 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 4, there is provided a service processing apparatus based on container technology, including: a request receiving module 410, a container construction module 420, a request processing module 430, and a container deletion module 440, wherein:
a request receiving module 410, configured to receive a service request sent by a user terminal; the service request carries resource requirement information.
And the container constructing module 420 is configured to construct a container corresponding to the resource requirement information as a container matched with the user terminal.
And a request processing module 430, configured to control the container and process the service request.
The container deleting module 440 is configured to delete the container if it is detected that the service request is processed by the container.
In one embodiment, the container construction module 420 is further configured to determine a container mirror identifier corresponding to the resource requirement information; acquiring a container mirror image file corresponding to the container mirror image identifier from a preset database; and constructing a corresponding container according to the container image file, wherein the container is used as a container matched with the user terminal.
In one embodiment, the service request is a resource configuration request; the request processing module 430 is further configured to determine a target resource of the user terminal according to the resource configuration request; and the control container is used for configuring target resources for the user terminal.
In one embodiment, the service processing apparatus based on container technology of the present application further includes a data storage module, configured to receive a processing result returned by the container; extracting private data and public data from the processing result; and storing the private data in a private storage block corresponding to the user terminal, and storing the public data in a preset public storage block.
In one embodiment, the service processing apparatus based on container technology further includes a container monitoring module, configured to obtain a preset process monitoring file; and monitoring the process in the container according to a preset process monitoring file.
In an embodiment, the service processing apparatus based on container technology further includes a container repairing module, configured to determine a process exception type of the container if it is monitored that a process of the container is abnormal; acquiring a container repair file corresponding to the process exception type; and repairing the container according to the container repairing file.
In an embodiment, the service processing apparatus based on a container technology further includes a container reconstruction module, configured to reconstruct a container corresponding to the resource demand information if it is monitored that a process of the container is abnormal; the reconstructed container is used for processing the service request.
In an embodiment, the service processing apparatus based on a container technology further includes a request sending module, configured to send a service request to a container that meets the resource requirement information and is in an idle state if it is monitored that a process of the container is abnormal; the container is used for processing the service request.
In each of the above embodiments, the service processing apparatus based on the container technology constructs, according to the service request sent by the user terminal, a container corresponding to the resource demand information carried in the service request, as a container matched with the user terminal, and further controls the container to process the service request, and deletes the container when it is detected that the container has completed processing the service request; the purpose of constructing a matched container in real time to execute the service request according to the service request sent by the user terminal is realized; in the process of executing the service request, the container shares the kernel system of the server without occupying the kernel system independently, so that the defect that the resource of the server is greatly occupied due to the fact that the service request is executed through the virtual machine is overcome, the resource of the server is saved, and the resource utilization rate of the server is further improved; meanwhile, under the condition that the container is detected to finish processing the service request, the container is deleted, so that the server resources occupied by the container are released, the waste of the server resources is avoided, and the resource utilization rate of the server is further improved. In addition, the container responds to the service request of the user terminal, thereby avoiding the defect that the service request cannot be smoothly executed due to resource preemption, and improving the stability of service execution.
For specific limitations of the service processing apparatus based on the container technology, reference may be made to the above limitations of the service processing method based on the container technology, which are not described herein again. The respective modules in the above-described container technology-based service processing apparatus may be wholly or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data such as resource demand information. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of service handling based on container technology.
Those skilled in the art will appreciate that the architecture shown in fig. 5 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, there is provided a computer device comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program:
receiving a service request sent by a user terminal; the service request carries resource demand information;
constructing a container corresponding to the resource demand information as a container matched with the user terminal;
a control container for processing the service request;
and if the container is detected to finish processing the service request, deleting the container.
In one embodiment, the processor, when executing the computer program, further performs the steps of: determining a container mirror image identifier corresponding to the resource demand information; acquiring a container mirror image file corresponding to the container mirror image identifier from a preset database; and constructing a corresponding container according to the container image file, wherein the container is used as a container matched with the user terminal.
In one embodiment, the processor, when executing the computer program, further performs the steps of: determining target resources of the user terminal according to the resource configuration request; and the control container is used for configuring target resources for the user terminal.
In one embodiment, the processor, when executing the computer program, further performs the steps of: receiving a processing result returned by the container; extracting private data and public data from the processing result; and storing the private data in a private storage block corresponding to the user terminal, and storing the public data in a preset public storage block.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring a preset process monitoring file; and monitoring the process in the container according to a preset process monitoring file.
In one embodiment, the processor, when executing the computer program, further performs the steps of: if the process of the container is monitored to be abnormal, determining the process abnormal type of the container; acquiring a container repair file corresponding to the process exception type; and repairing the container according to the container repairing file.
In one embodiment, the processor, when executing the computer program, further performs the steps of: if the process of the container is monitored to be abnormal, reconstructing the container corresponding to the resource demand information; the reconstructed container is used for processing the service request.
In one embodiment, the processor, when executing the computer program, further performs the steps of: if the process of the container is monitored to be abnormal, the service request is sent to the container which meets the resource demand information and is in an idle state; the container is used for processing the service request.
In the embodiments, the computer device implements, through a computer program running on the processor, the purpose of constructing a matched container in real time to execute a service request according to the service request sent by the user terminal; in the process of executing the service request, the container shares the kernel system of the server without occupying the kernel system independently, so that the defect that the resource of the server is greatly occupied due to the fact that the service request is executed through the virtual machine is overcome, the resource of the server is saved, and the resource utilization rate of the server is further improved; meanwhile, under the condition that the container is detected to finish processing the service request, the container is deleted, so that the server resources occupied by the container are released, the waste of the server resources is avoided, and the resource utilization rate of the server is further improved. In addition, the container responds to the service request of the user terminal, thereby avoiding the defect that the service request cannot be smoothly executed due to resource preemption, and improving the stability of service execution.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving a service request sent by a user terminal; the service request carries resource demand information;
constructing a container corresponding to the resource demand information as a container matched with the user terminal;
a control container for processing the service request;
and if the container is detected to finish processing the service request, deleting the container.
In one embodiment, the computer program when executed by the processor further performs the steps of: determining a container mirror image identifier corresponding to the resource demand information; acquiring a container mirror image file corresponding to the container mirror image identifier from a preset database; and constructing a corresponding container according to the container image file, wherein the container is used as a container matched with the user terminal.
In one embodiment, the computer program when executed by the processor further performs the steps of: determining target resources of the user terminal according to the resource configuration request; and the control container is used for configuring target resources for the user terminal.
In one embodiment, the computer program when executed by the processor further performs the steps of: receiving a processing result returned by the container; extracting private data and public data from the processing result; and storing the private data in a private storage block corresponding to the user terminal, and storing the public data in a preset public storage block.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a preset process monitoring file; and monitoring the process in the container according to a preset process monitoring file.
In one embodiment, the computer program when executed by the processor further performs the steps of: if the process of the container is monitored to be abnormal, determining the process abnormal type of the container; acquiring a container repair file corresponding to the process exception type; and repairing the container according to the container repairing file.
In one embodiment, the computer program when executed by the processor further performs the steps of: if the process of the container is monitored to be abnormal, reconstructing the container corresponding to the resource demand information; the reconstructed container is used for processing the service request.
In one embodiment, the computer program when executed by the processor further performs the steps of: if the process of the container is monitored to be abnormal, the service request is sent to the container which meets the resource demand information and is in an idle state; the container is used for processing the service request.
In the embodiments, the computer-readable storage medium implements, through the computer program stored in the computer-readable storage medium, the purpose of constructing a matched container in real time to execute a service request according to the service request sent by a user terminal; in the process of executing the service request, the container shares the kernel system of the server without occupying the kernel system independently, so that the defect that the resource of the server is greatly occupied due to the fact that the service request is executed through the virtual machine is overcome, the resource of the server is saved, and the resource utilization rate of the server is further improved; meanwhile, under the condition that the container is detected to finish processing the service request, the container is deleted, so that the server resources occupied by the container are released, the waste of the server resources is avoided, and the resource utilization rate of the server is further improved. In addition, the container responds to the service request of the user terminal, thereby avoiding the defect that the service request cannot be smoothly executed due to resource preemption, and improving the stability of service execution.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.