CN113220418B - Container-based resource management method and device - Google Patents

Container-based resource management method and device Download PDF

Info

Publication number
CN113220418B
CN113220418B CN202110496654.8A CN202110496654A CN113220418B CN 113220418 B CN113220418 B CN 113220418B CN 202110496654 A CN202110496654 A CN 202110496654A CN 113220418 B CN113220418 B CN 113220418B
Authority
CN
China
Prior art keywords
container
sub
service
management
agent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110496654.8A
Other languages
Chinese (zh)
Other versions
CN113220418A (en
Inventor
尹淇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN202110496654.8A priority Critical patent/CN113220418B/en
Publication of CN113220418A publication Critical patent/CN113220418A/en
Application granted granted Critical
Publication of CN113220418B publication Critical patent/CN113220418B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of containers, and provides a resource management method and device based on a container. Splitting the interior of the container into a plurality of sub-services, the method comprising: acquiring sub-service description information in a container to be newly built; determining whether the resources owned by the current operating environment support the operation of the container and one or more sub-services in the container according to the sub-service description information; if so, gradually starting the corresponding sub-services in the container according to a preset resource consumption sequence. The method comprises the steps of obtaining sub-service description information in a container by constructing the container, and determining whether resources required by the container are matched with resources of the current operating environment according to the sub-service description information.

Description

Container-based resource management method and device
Technical Field
The present invention relates to the field of containers, and in particular, to a method and an apparatus for resource management based on a container.
Background
With the continuous development of science and Technology, IT (Information Technology: information Technology) and CT (Communication Technology: communication Technology) are gradually converging. In the background of fusion of an IT information technology and a CT communication technology, the traditional CT equipment tends to explore tools and services for deploying some CT layers by using containers. However, there are certain differences in the IT and CT device environments, such as: the IT field usually uses a powerful CPU, and in order to ensure the normal operation of a specific service, a multi-server redundancy backup scheme is usually adopted, but is not suitable for application in a communication device.
The traditional communication equipment is hardware equipment based on hardware forwarding, a control (operation) system is not very strong, and locally available resources of the traditional communication equipment are limited, namely, the traditional communication equipment has limited operation capacity, limited operation memory and limited storage capacity, and the traditional communication equipment is not suitable for a scheme of multi-server redundancy backup.
Disclosure of Invention
In view of the above, there is a need to provide a reliable storage method without partition on a single memory.
Furthermore, the invention also solves the problem of realizing version switching based on the reliable storage method.
In a first aspect, the present invention provides a method for managing resources based on a container, which splits the inside of the container into a plurality of sub-services, where the method includes:
acquiring sub-service description information in a container to be newly built;
determining whether the resources owned by the current operating environment support the operation of the container and one or more sub-services in the container according to the sub-service description information;
and if so, gradually starting the corresponding sub-services in the container according to a preset resource consumption sequence.
Preferably, a management end for service management is operated in the current operation environment, wherein the management end is configured to manage sub-services included in each container, and the method further includes:
each container internally comprises a service management agent end which is used for interacting with the management end and returning the sub-service running state in each container to the management end;
and the management terminal manages each container which is responsible for the management terminal according to the sub-service operation state in each container acquired from the agent terminal.
Preferably, when the vessel to be newly built is a second vessel already operating in the replacement history, the method further comprises:
the management terminal receives a feedback message which is returned by the first agent terminal and contains the successful starting of the first sub-service; the first agent end is an agent end for service management running in the container to be newly built;
and the management terminal sends a control message to a second agent terminal in the second container so as to stop the sub-service which runs in the second container and corresponds to the first sub-service.
Preferably, the step of gradually starting the corresponding sub-services inside the container according to a preset resource consumption sequence includes:
gradually starting each sub-service in the container through the agent end according to the sequence of resource consumption from large to small;
after starting one sub-service in the first agent end each time, the management end sends a message for stopping the corresponding sub-service to the second agent end; and after confirming that the corresponding sub-service of the second agent end stops, sending a message for starting the next sub-service to the first agent end.
Preferably, the communication mode between the management terminal and the agent terminal in each container is as follows:
obtaining unique addressing addresses of all containers by allocating IP addresses to the containers according to the current operating environment and matching identifiers of all the containers;
and establishing an Ethernet used in the current operating environment through the unique addressing address so that the management terminal and each agent terminal complete message interaction.
Preferably, the management terminal maintains a port list, where the port list records ports for completing data interaction of agent terminals running between containers; and realizing message interaction between the management terminal and each agent terminal and among the agent terminals in the form of the unique addressing address and the port.
Preferably, the determining, according to the sub-service description information, whether the resources owned by the current operating environment support the operation of the container and one or more sub-services inside the container includes:
determining the sub-service with the maximum resource consumption in the current container according to the sub-service description information;
judging whether the sub-service with the largest resource consumption in the current container and the resource condition of the current electronic equipment are supported or not;
if so, gradually starting the corresponding sub-services in the container according to a preset resource consumption sequence.
Preferably, the method further comprises:
and if the sub-service with the maximum resource consumption in the container is not matched with the resource condition of the current electronic equipment, generating feedback information.
Compared with the prior art, the invention has the beneficial effects that:
different from the situation of the prior art, the resource management method and device based on the container in the embodiments of the present invention acquire the sub-service description information in the container by constructing the container, determine whether the resource required by the container matches the current operating environment resource according to the sub-service description information, and gradually pull up each sub-service in the container according to the resource consumption order if the resource required by the container matches the current operating environment resource.
Further, in a preferred implementation, when a sub-service inside the container needs to be updated, the sub-service is refreshed, and the resource check is performed on the sub-service description message inside the container before the container is deployed in the above manner, so as to determine a local resource condition, and thus, it can be determined whether the container can run on the electronic device. The operation requirement of the container is determined when the container is released, so that the reliable update of the service can be realized on the original resources of the electronic equipment.
Drawings
One or more embodiments are illustrated by corresponding figures in the drawings, which are not to be construed as limiting the embodiments, unless expressly stated otherwise, and the drawings are not to scale.
FIG. 1 is a flow diagram of a method for container-based resource management in one embodiment of the invention;
FIG. 2 is a flow diagram of a method for container-based resource management in one embodiment of the invention;
FIG. 3 is a schematic illustration of the interaction of container C0 and container C1 in one embodiment of the present invention;
FIG. 4 is a schematic flow diagram of a process for constructing a container in accordance with an embodiment of the present invention;
FIG. 5 is a flow diagram illustrating the process of determining whether the resource status of the sub-services and the devices match in one embodiment of the present invention;
fig. 6 is a schematic structural diagram of a container-based resource management apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that, if not conflicting, various features of the embodiments of the present invention may be combined with each other within the scope of the present invention. Additionally, while functional block divisions are performed in apparatus schematics, with logical sequences shown in flowcharts, in some cases, steps shown or described may be performed in sequences other than block divisions in apparatus or flowcharts. Furthermore, the terms "first," "second," and "third," as used herein, do not limit the order of data and execution, but merely distinguish between similar items or items that have substantially the same function or function.
Example 1:
an embodiment of the present invention provides a resource management method based on a container, which splits the inside of the container into a plurality of sub-services, as shown in fig. 1, where the method includes:
in step 101, the sub-service description information in the container to be newly created is obtained.
And counting and describing the plurality of sub-services to generate sub-service description information.
In step 102, it is determined whether the resources owned by the current operating environment support the operation of the container and one or more sub-services inside the container according to the sub-service description information.
In step 103, if supported, the corresponding sub-services inside the container are gradually started according to a preset resource consumption sequence.
The embodiment of the invention acquires the sub-service description information in the container by constructing the container, determines whether the resource required by the container is matched with the resource of the current operating environment according to the sub-service description information, and gradually pulls up each sub-service in the container according to the resource consumption sequence if the resource required by the container is matched with the resource of the current operating environment.
In this embodiment of the present invention, a management end for service management is run in a current running environment, where the management end is configured to manage sub-services included in each container, and the method further includes:
each container internally comprises a service management agent end which is used for interacting with the management end and returning the sub-service running state in each container to the management end;
and the management terminal manages each container which is responsible for the management terminal according to the sub-service operation state in each container acquired from the agent terminal. Wherein the agent side of the service management belongs to one of the sub-services.
In an embodiment of the present invention, when the container to be newly created is a second container that has been operated in the replacement history, the method further includes:
the management terminal receives a feedback message which is returned by the first agent terminal and contains the successful starting of the first sub-service; the first agent end is an agent end for service management running in the container to be newly built;
and the management terminal sends a control message to a second agent terminal in the second container so as to stop the sub-service which runs in the second container and corresponds to the first sub-service.
In this embodiment of the present invention, gradually starting the corresponding sub-services inside the container according to a preset resource consumption sequence includes:
gradually starting each sub-service in the container through the agent end according to the sequence of resource consumption from large to small;
after starting one sub-service in the first agent end each time, the management end sends a message for stopping the corresponding sub-service to the second agent end; and after confirming that the corresponding sub-service of the second agent end stops, sending a message for starting the next sub-service to the first agent end.
In the embodiment of the present invention, the communication mode between the management end and the agent end in each container specifically includes:
obtaining unique addressing addresses of all containers by allocating IP addresses to the current operating environment and combining the IP addresses with identifiers of all the containers;
and establishing an Ethernet used in the current operating environment through the unique addressing address so that the management terminal and each agent terminal complete message interaction.
In the embodiment of the present invention, a management end maintains a port list, where the port list records ports (for example, a mirrorport is used, which is different from a normal port in that it is temporary, and is deleted after data interaction is completed) that are suitable for respective operating agent ends among containers to complete data interaction; and realizing message interaction between the management terminal and each agent terminal and among the agent terminals in the form of the unique addressing address and the port.
In this embodiment of the present invention, the determining, according to the sub-service description information, whether the resources owned by the current execution environment support the execution of the container and one or more sub-services inside the container includes:
determining the sub-service with the maximum resource consumption in the current container according to the sub-service description information;
judging whether the sub-service with the largest resource consumption in the current container and the resource condition of the current electronic equipment support or not;
and if so, gradually starting the corresponding sub-services in the container according to a preset resource consumption sequence.
In an embodiment of the present invention, the method further comprises: and if the sub-service with the maximum resource consumption in the container is not matched with the resource condition of the current electronic equipment, generating feedback information.
Example 2:
as shown in fig. 2, an embodiment of the present invention provides a resource management method based on a container, and compared with embodiment 1, the embodiment of the present invention shows a technical solution of the present invention from another technical perspective. The method of the embodiment of the invention is executed by electronic equipment and comprises the following steps:
at step 202, a container is constructed.
In embodiments of the present invention where the container comprises a complete operating environment, the container first needs to be constructed.
And step 204, acquiring the sub-service description information in the container.
In the embodiment of the invention, the sub-service description information is determined according to the container header by acquiring the container header. Specifically, the container header is obtained through the main service management, the main service management obtains the information of the first 256 bytes in a segmented downloading mode, then obtains the specific size of the sub-service description information through the intercepted information of the first file, and then downloads the sub-service description information with the file length of 300 from 257 bytes in a segmented downloading mode.
And step 206, determining whether the resources required by the container are matched with the resources of the current operating environment according to the sub-service description information.
In the embodiment of the invention, after the sub-service description information in the container is acquired, the main service management analyzes the sub-service description information, and judges whether the resource required by the container is matched with the resource of the current operation environment or not according to the sub-service description information.
For example, taking the above example into account, the free memory of the current electronic device is 300M, the maximum memory of the service a is 150M, and the actual free memory of the electronic device is greater than the sub-service requirement with the maximum resource consumption in the container, so that it can be determined that the sub-service with the maximum resource consumption in the container matches the resource condition of the current electronic device, step 208 is executed.
And step 208, if the sub-services are matched, gradually pulling up each sub-service in the container according to the resource consumption sequence.
Specifically, the sub-service with the largest resource consumption in the current container is matched with the resource situation of the current electronic device, so that the remaining part of the container can be downloaded in a segmented downloading manner according to the sub-service description information, after the downloading is completed, the container is stored as a formal and operable container, and then each sub-service inside the container is gradually pulled up according to the resource consumption sequence.
In some embodiments, as an implementation of step 208, the method includes:
step loading the container to pull up a secondary service agent inside the container; and gradually pulling up each sub-service in the container through the secondary service agent according to the sequence of resource consumption from large to small.
In the embodiment of the invention, the loading process of the container is staged instead of one-time switching, so that the requirement on resource consumption is effectively reduced. Specifically, the primary service manager pulls up the secondary service agent inside the container, and the container uses an independent ethernet and configures different IP addresses, as shown in fig. 3, the container C0 uses an IP _ C0 address, the container C1 uses an IP _ C1 address, and configures an external iptables at the same time, and performs corresponding port forwarding, specifically, performs port forwarding through rpc _ port and mirror _ port. Wherein rpc _ port is a service port in a normal communication process, mirrorport is a temporary port required to be used in a service switching process, a secondary service agent of the container C0 can access a secondary service agent of the container C1 through the mirrorport, and a secondary service agent of the container C1 can access the secondary service agent of the container C0 through the rpc _ port.
Step 210, when the sub-service in the container needs to be updated, refreshing the sub-service.
In the embodiment of the invention, when the sub-service in the container needs to be updated, namely the sub-service needs to be replaced, the sub-service is refreshed. Specifically, for sub-services with access to an external network, the goal of mutual access is achieved through a consistent method, data between a new container and an old container can be backed up and restored, after data synchronization between a corresponding service and a substitute of the corresponding service is completed, a secondary service agent obtains the running state of the sub-service and feeds the running state back to a secondary service agent of an original container, and after the original container receives the feedback information, the corresponding service in the container is stopped. Illustratively, as shown in FIG. 3, assume that C1: the other _ svc1 is a sub-service with the largest resource consumption in the container, and the resource requirement of the other _ svc1 is verified, since the material resource allowance C1 of the electronic device is determined as follows: other _ svc1 runs directly, thus, based on the method described above with C0: the other _ svc1 is used for service delivery to achieve the purpose of complete replacement. When the other _ svc1 of the two containers completes the replacement, the service pull-up process of the other _ svc2 is entered, and the sub-service replacement of the containers is performed in the above manner, so that the influence on the service is small.
In the embodiment of the invention, a container is constructed, sub-service description information in the container is obtained, whether the resources required by the container are matched with the resources of the current operating environment is determined according to the sub-service description information, if the resources required by the container are matched with the resources of the current operating environment, each sub-service in the container is gradually pulled up according to a resource consumption sequence, and when the sub-services in the container need to be updated, the sub-services are refreshed, so that the reliable updating of the services can be realized on the original resources of the electronic equipment.
In some embodiments, as an implementation of step 202, as shown in fig. 4, the method includes:
step 302, obtain service.
Services based on resource usage requirements are obtained.
Step 304, splitting the service into a plurality of sub-services.
Specifically, the service can be split into a plurality of sub-services according to business requirements, each sub-service is an independent unit, certain dependency relationship or relevance may exist between the sub-services, and in the embodiment of the invention, coupling is removed in a form of inter-process communication.
And step 306, counting and describing a plurality of sub-services to obtain sub-service description information.
In the embodiment of the invention, the sub-service description information is used for describing the sub-service, and the sub-service description information of different sub-services is different. And processing the split sub-services to obtain the description information of each sub-service.
As an implementation of step 306, in some embodiments, the method includes: carrying out resource statistics on a plurality of sub-services; and describing a plurality of sub-services based on the resource statistical result to obtain sub-service description information.
In the embodiment of the invention, unlike a large server in which IT devices can use unlimited resources, the electronic device (CT device) has limited memory, but can still provide a relatively abundant resource environment in a development environment to actually evaluate resources required by all sub-services. Specifically, resource statistics are performed on a plurality of sub-services in an environment with abundant resources, and as shown in table 1, idle memory, idle time, full memory, full time, and storage consumption of the plurality of sub-services are counted.
Table 1:
Figure BDA0003054616670000091
further, after the resource statistics of all the sub-services is finished, the resource statistics result of each sub-service is obtained, and then a plurality of sub-services are described according to the resource statistics result based on the consistent description rule, so that the sub-service description information is obtained. In an exemplary manner, the first and second electrodes are,
Figure BDA0003054616670000092
Figure BDA0003054616670000101
Figure BDA0003054616670000111
it should be noted that, if there is external data interaction in each sub-service, when a network protocol with more than three layers is adopted, paired ports need to be used.
Step 308, constructing a service management, wherein the service management is used for managing a plurality of sub-services.
In the embodiment of the present invention, the service management is used for managing a plurality of sub-services, wherein the service management is divided into two parts, namely, a main service management in a native environment, and the main service management is used as a management end of the service management, wherein the native environment is an environment in an original operating system, and a sub-service agent in a container is used as an agent end of the service management. Specifically, the primary service management is mainly used for acquiring a new container, disassembling a container package, loading a container, and the like, and the secondary service agent is mainly used for interacting with external service management, pulling up each service inside the container, and the like. It should be noted that the service management itself is also a standard service, and also described by using the above method, but the resource of the service management itself is occupied in a controllable range as shown by the data given in table 1.
And 310, packaging a plurality of sub-services, the sub-service description information and the service management to form a container for releasing.
In the embodiment of the present invention, a container issue is formed by packaging a plurality of sub-services, the sub-service description information, and service management together, where as shown in table 2, the container body specifically includes a container header, the sub-service description information, and a container body.
Table 2:
container head TLV-form container packet description, fixed 256 bytes
Sub-service description information Sub-service description information given above
Container body The form of the container is not limited, and various issuing forms are used in the implementation process of the patent
Specifically, the container header adopts a binary description header in TLV (TYPE, LENGTH, VALUE) data format, and is used for describing the content of the file package. In an exemplary manner, the first and second electrodes are,
string,8, des.json; json for a string of length 8
char,2,244; // character-type number of length 2, value 244
string,9, contiiner; // a string of length 9, content "container"
int,8,222222222; // an integer number of length 8, value 222222222
It should be noted that string, char, and int are defined by a single byte enumeration type and a program hard code, where the actual length of the file is determined based on the actual content of the file, and the content after "/" is an annotation, and is finally converted into a binary fill.
In some embodiments, as an implementation of step 206, as shown in fig. 5, the method includes:
step 402, determining the sub-service with the largest resource consumption in the current container according to the sub-service description information.
In the embodiment of the present invention, the resource consumption may be understood as a resource demand, and since the sub-services have been subjected to resource statistics and description in advance, the sub-service with the largest resource consumption in the container may be determined according to the sub-service description information. For example, referring to table 1, service a is a sub-service with the largest resource consumption in a container, the minimum memory is 1M, and the maximum memory is 150M.
Step 404, determining whether the sub-service with the largest resource consumption in the container is matched with the resource condition of the current electronic device.
Specifically, after determining the sub-service with the largest resource consumption in the current container, the main service management calculates whether the material resources of the current electronic device meet the storage requirement of the container, and specifically, the main service management judges whether the sub-service with the largest resource consumption in the current container is matched with the resource condition of the current electronic device.
And step 406, if the sub-services are matched, gradually pulling up each sub-service in the container according to the resource consumption sequence.
Step 408, if the sub-service with the largest resource consumption in the container currently does not match the resource condition of the current electronic device, generating feedback information.
For example, taking the above example into consideration, the vacant memory of the current electronic device is 100M, the maximum memory of the service a is 150M, and the actual vacant memory of the electronic device is smaller than the sub-service requirement with the maximum resource consumption in the container, so that it can be determined that the sub-service with the maximum resource consumption in the container does not match the resource condition of the current electronic device, and therefore the main service management generates feedback information, and at this time, manual processing is required to find out why the resources do not match.
Example 3:
an embodiment of the present invention provides a resource management apparatus based on a container, please refer to fig. 6, where fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention, where the electronic device 500 may be any type of electronic device with computing capability, for example: computers, palm top computers, etc.
Specifically, as shown in FIG. 6, the electronic device 500 includes one or more processors 502 and memory 504. One processor 502 is illustrated in fig. 6. The processor 502 and the memory 504 may be connected by a bus or other means, such as by a bus in FIG. 6.
The memory 504, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as programs, instructions, and modules corresponding to the container-based resource management method in the embodiments of the present invention. The processor 502 executes various functional applications and data processing of the electronic device, that is, implements the container-based resource management methods in embodiments 1 and 2, by executing the nonvolatile software programs, instructions, and modules stored in the memory 504.
The memory 504 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the container-based resource management device, and the like. Further, the memory 504 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 504 may optionally include memory located remotely from processor 502, which may be connected to a container-based resource management device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
It should be noted that, the above-mentioned resource management device based on a container may execute the resource management method based on a container provided in the embodiment of the present invention, and has corresponding functional modules and beneficial effects of the execution method.
Embodiments of the present invention further provide a non-transitory computer-readable storage medium, where computer-executable instructions are stored, and when executed by one or more processors, may cause the one or more processors to perform the container-based resource management method in any of the above method embodiments.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. 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 related to instructions of a computer program, which can be stored in a computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and these modifications or substitutions do not depart from the spirit of the corresponding technical solutions of the embodiments of the present invention.

Claims (8)

1. A method for container-based resource management, wherein a container is internally split into a plurality of sub-services, the method comprising:
acquiring sub-service description information in a container to be newly built;
determining whether resources owned by a current operating environment support the operation of the container and one or more sub-services inside the container according to the sub-service description information;
if yes, gradually starting corresponding sub-services in the container according to a preset resource consumption sequence;
the determining whether the resources owned by the current operating environment support the operation of the container and one or more sub-services inside the container according to the sub-service description information includes:
determining the sub-service with the maximum resource consumption in the current container according to the sub-service description information;
judging whether the sub-service with the largest resource consumption in the current container and the resource condition of the current electronic equipment are supported or not;
if so, gradually starting corresponding sub-services in the container according to a preset resource consumption sequence;
and if the sub-service with the maximum resource consumption in the current container is not matched with the resource condition of the current electronic equipment, generating feedback information.
2. The method of claim 1, wherein a management side for service management is running in the current running environment, wherein the management side is used for managing the sub-services contained in each container, and the method further comprises:
each container internally comprises a service management agent end which is used for interacting with the management end and returning the sub-service running state in each container to the management end;
and the management terminal manages each container which is responsible for the management terminal according to the sub-service operation state in each container acquired from the agent terminal.
3. The method of claim 2, wherein when the vessel to be newly created is a second vessel that has been operated for replacement history, the method further comprises:
the management terminal receives a feedback message which is returned by the first agent terminal and contains the successful starting of the first sub-service; the first agent end is an agent end for service management running in the container to be newly built;
and the management terminal sends a control message to a second agent terminal in the second container so as to stop the sub-service which runs in the second container and corresponds to the first sub-service.
4. The method according to claim 3, wherein said step-by-step starting up the corresponding sub-services inside the container according to a preset resource consumption sequence comprises:
gradually starting each sub-service in the container through the agent end according to the sequence of resource consumption from large to small;
after starting one sub-service in the first agent end each time, the management end sends a message for stopping the corresponding sub-service to the second agent end; and after confirming that the corresponding sub-service of the second agent end stops, sending a message for starting the next sub-service to the first agent end.
5. The method according to any one of claims 1 to 4, wherein the communication mode between the management side and the agent side in each container is as follows:
obtaining unique addressing addresses of all containers by allocating IP addresses to the containers according to the current operating environment and matching identifiers of all the containers;
and establishing an Ethernet used in the current operating environment through the unique addressing address so that the management terminal and each agent terminal complete message interaction.
6. The method according to claim 5, wherein the management side maintains a port list recording ports for completing data interaction suitable for respective operated agent sides among the containers; and realizing message interaction between the management terminal and each agent terminal and among the agent terminals in the form of the unique addressing address and the port.
7. A container-based resource management apparatus, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method of any one of claims 1-6.
8. A non-transitory computer-readable storage medium having stored thereon computer-executable instructions that, when executed by an electronic device, cause the electronic device to perform the method of any of claims 1-6.
CN202110496654.8A 2021-05-07 2021-05-07 Container-based resource management method and device Active CN113220418B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110496654.8A CN113220418B (en) 2021-05-07 2021-05-07 Container-based resource management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110496654.8A CN113220418B (en) 2021-05-07 2021-05-07 Container-based resource management method and device

Publications (2)

Publication Number Publication Date
CN113220418A CN113220418A (en) 2021-08-06
CN113220418B true CN113220418B (en) 2022-11-08

Family

ID=77091671

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110496654.8A Active CN113220418B (en) 2021-05-07 2021-05-07 Container-based resource management method and device

Country Status (1)

Country Link
CN (1) CN113220418B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105045637A (en) * 2015-08-14 2015-11-11 深圳市金立通信设备有限公司 Application start method and terminal
US10244034B2 (en) * 2017-03-29 2019-03-26 Ca, Inc. Introspection driven monitoring of multi-container applications
CN110119377B (en) * 2019-04-24 2021-01-15 华中科技大学 Docker container-oriented online migration system implementation and optimization method
CN110806878B (en) * 2019-10-30 2023-07-04 中国联合网络通信集团有限公司 Service management method, system and storage medium
CN111966466A (en) * 2020-08-21 2020-11-20 苏州浪潮智能科技有限公司 Container management method, device and medium

Also Published As

Publication number Publication date
CN113220418A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
CN108683516A (en) A kind of upgrade method of application example, device and system
WO2022127504A1 (en) Network element management method and apparatus, and storage medium
CN114070822B (en) Kubernetes Overlay IP address management method
CN112583931A (en) Message processing method, message middleware, electronic device and storage medium
CN112947965B (en) Containerized service updating method and device
CN103346914A (en) Method and device for topological structure update of distributed file system
EP2871578A1 (en) Method for managing tree structure, information processing system, and program
CN109918203A (en) Access server memory management optimization method, access server and communication system
CN111064626A (en) Configuration updating method, device, server and readable storage medium
CN112698838A (en) Multi-cloud container deployment system and container deployment method thereof
CN114553693B (en) Gateway upgrading method and device
CN103457748A (en) Data transmission method, system and device
CN106911769B (en) Cloud platform routing data processing method and physical server of cloud platform
CN111261170A (en) Voiceprint recognition method based on voiceprint library, master control node and computing node
CN113220418B (en) Container-based resource management method and device
CN110851186B (en) Network equipment restarting method and device, electronic equipment and readable storage medium
US20230144294A1 (en) Method for data transmission of audio and video in end-to-end system
CN116820527A (en) Program upgrading method, device, computer equipment and storage medium
CN113541987A (en) Method and device for updating configuration data
CN116389454A (en) Data downloading system
CN109542841A (en) The method and terminal device of data snapshot are created in cluster
CN114020453A (en) Service bus message processing method, service bus system, electronic device, and medium
CN114338763A (en) Micro-service calling method, device, server and computer readable storage medium
CN109936672B (en) Online charging method and device
CN113760403A (en) State machine linkage method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant