WO2024002190A1 - Monitor-based container adjustment method and device, and storage medium - Google Patents

Monitor-based container adjustment method and device, and storage medium Download PDF

Info

Publication number
WO2024002190A1
WO2024002190A1 PCT/CN2023/103346 CN2023103346W WO2024002190A1 WO 2024002190 A1 WO2024002190 A1 WO 2024002190A1 CN 2023103346 W CN2023103346 W CN 2023103346W WO 2024002190 A1 WO2024002190 A1 WO 2024002190A1
Authority
WO
WIPO (PCT)
Prior art keywords
container
monitor
monitored
status
target resource
Prior art date
Application number
PCT/CN2023/103346
Other languages
French (fr)
Chinese (zh)
Inventor
赵辑肖
秦牧轩
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2024002190A1 publication Critical patent/WO2024002190A1/en

Links

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/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]
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present disclosure relates to the field of backend server technology, and in particular, to a monitor-based container adjustment method, device and storage medium.
  • K8S Korean-to-Semiconductor
  • PaaS Platform as a Service
  • K8S has high requirements on resources and has technical problems of low service efficiency.
  • Embodiments of the present disclosure provide a monitor-based container adjustment method, device, and storage medium.
  • embodiments of the present disclosure provide a monitor-based container adjustment method, which includes: obtaining the business status in the container information of the container to be monitored through the monitor; obtaining the target resource usage in the business status, and adjusting the container according to the preset The comparison result between the threshold and the target resource usage is used to determine the container status; based on the container status, the container to be monitored is adjusted.
  • inventions of the present disclosure also provide a monitor-based container adjustment device.
  • the monitor-based container adjustment device includes a processor, a memory, a computer program stored on the memory and executable by the processor, and a computer program for implementing A data bus is used for connection and communication between the processor and the memory.
  • any monitor-based container adjustment method provided in this disclosure is implemented.
  • embodiments of the present disclosure also provide a storage medium for computer-readable storage.
  • the storage medium stores One or more programs may be executed by one or more processors to implement any monitor-based container adjustment method as provided in this disclosure.
  • Figure 1 is a schematic flowchart of a monitor-based container adjustment method provided by an embodiment of the present disclosure
  • Figure 2 is a schematic flowchart of a sub-step of the monitor-based container adjustment method in Figure 1;
  • Figure 3 is a schematic flowchart of a sub-step of the monitor-based container adjustment method in Figure 1;
  • Figure 4 is a schematic structural block diagram of a monitor-based container adjustment device provided by an embodiment of the present disclosure.
  • K8S Kernetes, an open source Docker-orchestrated high-availability solution
  • PaaS PaaS
  • K8S uses Pod (Plain Old Data, data Structure) is the smallest management unit. All containers in the Pod are arranged and scheduled uniformly, and K8S monitors them through the controller. Control the public status of the cluster, manage and schedule Pods, and achieve high-availability performance of the service to a certain extent; at the same time, K8S provides a cluster strategy.
  • K8S has very high requirements on resources. Its normal operation alone occupies nearly 20% of the overall resources, occupying a large number of business resources. In some small offices, it cannot bear the high resource overhead. Therefore, how to solve the existing problem of low service efficiency caused by the inability of container systems to automatically scale up in limited resource scenarios has become an urgent technical issue that needs to be solved.
  • Embodiments of the present disclosure provide a monitor-based container adjustment method, a monitor-based container adjustment device, and a storage medium.
  • monitor-based container adjustment method provided by the embodiment of the present disclosure will be introduced in detail with reference to the scenario in Figure 1 .
  • scenario in Figure 1 is only used to explain the monitor-based container adjustment method provided by the embodiment of the present disclosure, but does not constitute a limitation on the application scenarios of the monitor-based container adjustment method provided by the embodiment of the present disclosure.
  • FIG. 1 is a schematic flowchart of a monitor-based container adjustment method provided by an embodiment of the present disclosure.
  • the monitor-based container adjustment method includes steps S101 to S103.
  • Step S101 Obtain the business status in the container information of the container to be monitored through the monitor.
  • step S101 includes: creating a monitoring thread, using the monitoring thread as a monitor, and monitoring the container status through the monitoring thread; if an abnormality in the container status is detected, controlling the waiting state through the monitoring thread. Monitor container restarts and re-monitor container status.
  • Step S101 further includes: determining the data serialization format YML file through the monitoring thread, and starting monitoring of the container to be monitored through the YML file, where the YML file is pre-stored in the service software.
  • Step S102 Obtain the target resource usage in the business status, and determine the container status based on the comparison result between the preset threshold and the target resource usage.
  • Step S103 Adjust the container to be monitored according to the container status.
  • the container state includes an expansion state and a shrinkage state
  • the adjustment of the container to be monitored further includes: expanding the container to be monitored according to the expansion state, or shrinking the container to be monitored according to the shrinkage state.
  • the monitor is a self-developed monitor
  • the target resource usage is the resource usage of the container to be monitored, including CPU usage, memory usage, etc.
  • Docker containers are an open source application container engine that allows developers to package their applications in a unified way. and dependency packages into a portable container, and then published to any server with the Docker engine installed (including popular Linux machines and Windows machines), and virtualization can also be achieved.
  • the containers completely use the sandbox mechanism and do not have any interfaces with each other (similar to IPhone apps). There is almost no performance overhead and can be easily run on machines and data centers. The most important thing is that they do not depend on any language, framework or system.
  • the selected operating system starts.
  • the OS In the world of Docker you have the choice of Linux, or newer versions of Windows where the kernel supports container primitives in the kernel.
  • the OS Like the virtual machine model, the OS also occupies all hardware resources.
  • a container engine (such as Docker) needs to be installed.
  • the container engine can obtain system resources, such as process trees, file systems, and network stacks, and then divide the resources into secure and mutually isolated resource structures, called containers.
  • Each container looks like a real operating system and can run applications inside it.
  • Docker containers have the following three characteristics: lightweight, open standards, and safe and reliable. Lightweight: Multiple Docker containers running on a host can share the host operating system kernel; they start quickly and require only a small amount of computing and memory resources; open standards: Docker containers are based on open standards and can run on all mainstream Linux versions , Microsoft Windows, and any infrastructure including VMs, bare metal servers, and clouds; safe and reliable: The isolation Docker gives applications is not limited to isolation from each other, but also independent of the underlying infrastructure. Docker provides the strongest isolation by default, so if there is an application problem, it is only a problem with a single container and will not affect the entire host.
  • This embodiment provides a container adjustment method, equipment and storage medium based on a monitor.
  • This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; the container status includes expansion status and contraction status, respectively based on the expansion status.
  • the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and based on the container status, the container to be monitored is Adjustments are made to improve the service efficiency of the containers to be monitored without being separated from the PaaS platform, and solve the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.
  • step S103 further includes: sub-step S1031.
  • Sub-step S1031 If the container status is in the shrinking state, the monitor deletes the container information of at least one copy of the container to be monitored to complete the shrinking of the container to be monitored.
  • step S1031 further includes: calling the application programming API interface of the container to be monitored through the monitor, matching the API interface with the API interface of the container copy to be monitored; based on the matching result, deleting the API interface related to the container through the monitor. Match the copy of the container to be monitored and delete the corresponding container information.
  • This embodiment provides a container adjustment method, equipment and storage medium based on a monitor.
  • This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; if the container status is in the expansion state, the container to be monitored is expanded.
  • the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and in the shrinking state, the container status of the container to be monitored is determined.
  • the monitoring container is scaled down, thereby improving the service efficiency of the container to be monitored without being separated from the PaaS platform, and solving the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.
  • step S102 further includes sub-steps S1021-S1022.
  • Sub-step S1021 Obtain the target resource usage in the container to be monitored through the monitor.
  • Sub-step S1022 Read the preset threshold in the data serialization format YML file, compare the preset threshold with the target resource usage, obtain the comparison result, and determine the container status based on the comparison result.
  • the container status is determined to be the expansion state; if the target resource usage is not greater than the preset threshold, the container status is determined to be the shrinkage state.
  • step S103 further includes: if the container status is in the expansion state, creating at least one copy of the container to be monitored, and controlling the startup of the copy of the container to be monitored through the YML file, and synchronizing the container information of the container to be monitored. To a copy of the container to be monitored, the capacity of the container to be monitored is expanded.
  • This embodiment provides a container adjustment method, equipment and storage medium based on a monitor.
  • This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; if the container status is in the expansion state, the container to be monitored is expanded.
  • the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and when the capacity is expanded, the container status of the container to be monitored is determined.
  • the container is expanded, thereby improving the service efficiency of the container to be monitored without being separated from the PaaS platform, and solving the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.
  • this embodiment also includes: monitoring resource usage through a monitor, and reading the preset threshold set in the data serialization format YML file at predetermined time intervals.
  • the monitor reads the threshold value at a predetermined time interval to update the container information in the container to be monitored, and adjusts the status of the container system according to the update of the container information, thereby ultimately realizing automatic container escalation. shrink.
  • the business module mainly includes: the service registration center component of MSB (GPaas). In this disclosure, it is transplanted to static Container), public services, and business components (otcp, apps) are all deployed in a microservice manner.
  • Service deployment based on the PaaS platform is based on blueprints, and the containers corresponding to the services are orchestrated according to the blueprint plan.
  • service deployment is centered on the configuration file default-config.yml, and the YML file is generated by parsing the blueprint file of each microservice; the configuration information of each service (service and microservice name, Basic image information, initialized container information, dependent public services, PG and PGcache instance information, image name and image package path, network information, environment variables, VOLUME, CPU/MEMORY restrictions, etc.).
  • the configuration file is parsed, and the Docker SDK is used to create images, create instances in PG and PGcache, create and start containers, and register with MSB to complete the deployment of MSB, public services, and business components.
  • Static containers monitor the container status through the main monitoring process created by the monitor module and its sub-threads.
  • the obtained container information is compared with the configuration threshold set in the yml file, and the corresponding container elasticity strategy is adopted.
  • the specific steps are as follows:
  • the static container starts the monitor process and creates the Docker monitoring thread DockerMonitorThread to monitor the Docker service status. If Docker runs abnormally, this thread will restart the Docker service to ensure that the container running environment is normal; the monitoring process will Initialize the service monitoring thread: SubMonitorFor[servtype]-[servname], obtain the deployed specified service type and microservice list of the service from the type attribute, obtain the total configuration information of the specified service from the persistent YML file, and monitor Service container status, including the status of the container itself and the business status; start the management thread (LifeManagerThread) to manage the life cycle of each sub-thread, and control the start and stop of the sub-monitoring thread in real time according to the status of the switch map; at the same time, start the SetActionHandlerThread thread, Process CLI client requests; after the service deployment is completed, the monitor module sub-thread regularly detects the container information to be monitored and writes the read container information to the specified file.
  • the container information includes: container status, CPU and
  • the scenario of container expansion copy is as follows:
  • the PaaS platform based on K8S uses Pod as the smallest running unit, and the container runs in the Pod.
  • a Pod can be composed of one or more containers, and K8S has its own Pod scheduling strategy.
  • HPA Horizontal Pod Autoscaler
  • compare it with the setting value of the scheduling policy through the following expression:
  • Expected number of running instances ceil [current number of running instances * (current indicator/expected indicator)];
  • K8S will add a new Pod to schedule new container instances to expand the container capacity.
  • the service is deployed directly in the environment as a container without Pod support.
  • the container's CPU and memory information is detected in real time through the service monitoring thread, and the threshold set in the persistent YML file is regularly read, and the real-time check Compare the measured container information.
  • the threshold set in the persistent YML file is regularly read, and the real-time check Compare the measured container information.
  • the CPU usage indicator when the container real-time data exceeds the threshold, according to the following expression:
  • CPU over-limit percentage CPU actual measured value/CPU threshold * 100% + floating percentage
  • the monitor finds the corresponding default_config.yml configuration file based on the service name and calls Docker's API. interface, execute the Docker run command to re-create a CONTAINER copy with the same configuration as the original container.
  • the service thread pulls up the newly created container copy through its own defined START method, monitors it in real time, and writes the container copy information into the container information file to be monitored to achieve container expansion. At this time, the two containers share the load of the service, reducing resource usage.
  • the monitor creates a new container again, and so on, until the number of container copies reaches the YML file setting. After reaching the maximum value, an alarm is generated and troubleshooting is carried out.
  • the monitor randomly deletes a container under the service by calling the Docker API interface, and deletes the information corresponding to the ID in the container information file to be monitored, releasing resources and realizing container shrinkage. Allow.
  • the data generated during the container expansion process is stored on the server through mounted volumes. In a dual-machine scenario, data can also be stored through a shared disk array to ensure data integrity and normal operation of services.
  • the container elasticity mechanism is the same in the dual-machine scenario and the single-machine scenario.
  • the difference is that the dual-machine environment supports disaster recovery management.
  • you need to install dual-machine software first create a dual-machine directory, upload the dual-machine software package and LICENSE file, and configure dual-machine related information in the setup_config.yml file to perform dual-machine installation.
  • the dual-machine software is a self-developed tool that can start the monitoring process, monitor the status of the container and server, and decide whether to perform dual-machine switching.
  • a disaster recovery system refers to the establishment of two or more sets of IT systems with the same functions in remote places that are far apart. They can perform health status monitoring and function switching between each other. When one system stops due to an accident (such as fire, earthquake, etc.) When working, the entire application system can be switched to another location so that the system functions can continue to work normally.
  • Disaster recovery technology is an integral part of the system's high availability technology. The disaster recovery system places more emphasis on dealing with the impact of the external environment on the system, especially the impact of catastrophic events on the entire IT node, and provides node-level system recovery functions.
  • This embodiment provides a container adjustment method, equipment and storage medium based on a monitor.
  • This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; if the container status is in the expansion state, the container to be monitored is expanded.
  • the container information of the container to be monitored is monitored through the monitor, and based on the content
  • the comparison result between the target resource usage in the server information and the preset threshold is determined to determine the container status of the container to be monitored, and the container to be monitored is adjusted according to the container status, thereby improving the efficiency of the container to be monitored without being separated from the PaaS platform.
  • Service efficiency solves the existing problem of low service efficiency caused by the inability of container systems to automatically scale in limited resource scenarios.
  • FIG. 4 is a schematic structural block diagram of a monitor-based container adjustment device provided by an embodiment of the present disclosure.
  • the monitor-based container adjustment device 300 includes a processor 301 and a memory 302.
  • the processor 301 and the memory 302 are connected through a bus 303, such as an I2C (Inter-integrated Circuit) bus.
  • I2C Inter-integrated Circuit
  • the processor 301 is used to provide computing and control capabilities to support the operation of the entire monitor-based container adjustment device.
  • the processor 301 can be a central processing unit (Central Processing Unit, CPU).
  • the processor 301 can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC). ), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general processor may be a microprocessor or the processor may be any conventional processor.
  • the memory 302 may be a Flash chip, a read-only memory (ROM, Read-Only Memory) disk, an optical disk, a USB disk, a mobile hard disk, or the like.
  • ROM read-only memory
  • the memory 302 may be a Flash chip, a read-only memory (ROM, Read-Only Memory) disk, an optical disk, a USB disk, a mobile hard disk, or the like.
  • FIG. 4 is only a block diagram of a partial structure related to the solution of the embodiment of the present disclosure, and does not constitute the adjustment of the monitor-based container to which the solution of the embodiment of the present disclosure is applied.
  • DETAILED DESCRIPTION OF THE EQUIPMENT A specific monitor-based container adjustment device may include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
  • the processor 301 is configured to run a computer program stored in the memory 302, and implement any one of the monitor-based container adjustment methods provided by the embodiments of the present disclosure when executing the computer program.
  • the processor 301 is used to run a computer program stored in the memory, and implement the following steps when executing the computer program: obtain the business status in the container information of the container to be monitored through the monitor; obtain the business status in the business status Target resource usage, and determine the container status based on the comparison between the preset threshold and the target resource usage; adjust the container to be monitored based on the container status.
  • the processor 301 is configured to implement: if the container status is in the shrinking state, delete the container information of at least one copy of the container to be monitored through the monitor to complete the shrinking of the container to be monitored.
  • the processor 301 is configured to implement: calling the application programming API of the container to be monitored through the monitor. Interface, match the API interface with the API interface of the container copy to be monitored; based on the matching results, delete the container copy to be monitored that matches the API interface through the monitor, and delete the corresponding container information.
  • the processor 301 is used to: create a monitoring thread, use the monitoring thread as a monitor, and monitor the container status through the monitoring thread; if an abnormality in the container status is detected, use the monitoring thread to control the container to be monitored to restart and Monitor container status again.
  • the processor 301 is configured to: determine the data serialization format YML file through the monitoring thread, and start monitoring the container to be monitored through the YML file, where the YML file is pre-stored in the service software.
  • the processor 301 is used to: obtain the target resource usage in the container to be monitored through the monitor; read the preset threshold in the data serialization format YML file, and compare the preset threshold with the target resource usage. The rate is compared, the comparison result is obtained, and the container status is determined based on the comparison result.
  • the processor 301 is configured to: if the container status is an expansion state, create at least one copy of the container to be monitored, and control the startup of the copy of the container to be monitored through a YML file, and synchronize the container information of the container to be monitored. To a copy of the container to be monitored, the capacity of the container to be monitored is expanded.
  • the processor 301 is configured to: if the target resource usage is greater than a preset threshold, determine that the container status is the expansion state; if the target resource usage is not greater than the preset threshold, determine the container status is the shrinkage state .
  • This embodiment provides a container adjustment method, equipment and storage medium based on a monitor.
  • This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; if the container status is in the expansion state, the container to be monitored is expanded.
  • the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and based on the container status, the container to be monitored is Adjustments were made to improve the service efficiency of the containers to be monitored without being separated from the PaaS platform, and to solve the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.
  • monitor-based container adjustment device can be referred to the aforementioned embodiment of the monitor-based container adjustment method. The corresponding process will not be described again here.
  • Embodiments of the present disclosure also provide a storage medium for computer-readable storage.
  • the storage medium stores one or more programs.
  • the one or more programs can be executed by one or more processors to implement the embodiments of the present disclosure. Any of the monitor-based container adjustment methods provided in this manual.
  • the storage medium may be an internal storage unit of the monitor-based container adjustment device of the aforementioned embodiment, for example Adjust the device's hard drive or memory in the monitor's container.
  • the storage medium may also be an external storage device of the monitor-based container adjustment device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), or a secure digital (Secure Digital) equipped on the monitor-based container adjustment device. SD) card, Flash Card, etc.
  • Such software may be distributed on computer-readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media).
  • computer storage media includes volatile and nonvolatile media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. removable, removable and non-removable media.
  • Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disk (DVD) or other optical disk storage, magnetic cassettes, tapes, disk storage or other magnetic storage devices, or may Any other medium used to store the desired information and that can be accessed by a computer.
  • communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media .
  • the embodiments of the present disclosure provide a monitor-based container adjustment method, equipment and storage medium, aiming to solve the existing service efficiency caused by the inability of the container system to achieve automatic elasticity in limited resource scenarios without the PaaS platform. Low question.
  • the present disclosure provides a container adjustment method, equipment and storage medium based on a monitor.
  • the embodiment of the present disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage rate in the business status, and based on the predetermined Set the comparison result between the threshold and the target resource usage to determine the container status; adjust the container to be monitored based on the container status.
  • the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and based on the container status, the container to be monitored is Adjustments are made to improve the service efficiency of the containers to be monitored without being separated from the PaaS platform, and solve the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The present disclosure relates to the field of back-end servers, and provides a monitor-based container adjustment method and device, and a storage medium. The method comprises: obtaining, by means of a monitor, a service state in container information of a container to be monitored; obtaining a target resource utilization rate in the service state, and determining a container state according to the comparison result of a preset threshold and the target resource utilization rate; and adjusting said container according to the container state. The container information of said container is monitored by the monitor, the container state of said container is determined according to the comparison result of the target resource utilization rate in the container information and the preset threshold, and said container is adjusted according to the container state.

Description

基于监控器的容器调整方法、设备及存储介质Monitor-based container adjustment method, equipment and storage medium
相关申请的交叉引用Cross-references to related applications
本公开要求享有2022年06月30日提交的名称为“基于监控器的容器调整方法、设备及存储介质”的中国专利申请CN202210764077.0的优先权,其全部内容通过引用并入本公开中。This disclosure claims priority to Chinese patent application CN202210764077.0 titled "Monitor-based container adjustment method, equipment and storage medium" submitted on June 30, 2022, the entire content of which is incorporated into this disclosure by reference.
技术领域Technical field
本公开涉及后端服务端技术领域,尤其涉及一种基于监控器的容器调整方法、设备及存储介质。The present disclosure relates to the field of backend server technology, and in particular, to a monitor-based container adjustment method, device and storage medium.
背景技术Background technique
近些年来,随着服务端的业务越来越复杂,服务数量越来越多,业务极其庞大,对服务器资源的需求急剧增加。针对日益增长的业务需求,如何在资源有限的条件下自动弹缩容器,实现服务高可用,保证业务连续性,成为服务管理平台迫切需要解决的问题。In recent years, as the business on the server side has become more and more complex, the number of services has increased, and the business has become extremely large, the demand for server resources has increased sharply. In response to the growing business needs, how to automatically expand and shrink containers under limited resources, achieve high service availability, and ensure business continuity has become an urgent problem that the service management platform needs to solve.
一些情形下,基于K8S(Kubernetes,开源的Docker编排的高可用方案)自运维方案,通过PaaS(Platform as a Service,平台即服务)平台对服务进行容器化管理,保证业务的连续性。然而K8S对资源的要求很高,存在服务效率低的技术问题。In some cases, based on K8S (Kubernetes, an open source Docker orchestrated high-availability solution) self-operation and maintenance solution, services are containerized and managed through the PaaS (Platform as a Service, Platform as a Service) platform to ensure business continuity. However, K8S has high requirements on resources and has technical problems of low service efficiency.
发明内容Contents of the invention
本公开实施例提供了一种基于监控器的容器调整方法、设备及存储介质。Embodiments of the present disclosure provide a monitor-based container adjustment method, device, and storage medium.
第一方面,本公开实施例提供一种基于监控器的容器调整方法,包括:通过监控器获取待监控容器的容器信息中的业务状态;获取业务状态中的目标资源使用率,并根据预设阈值和目标资源使用率的比较结果,确定容器状态;根据容器状态,对待监控容器进行调整。In the first aspect, embodiments of the present disclosure provide a monitor-based container adjustment method, which includes: obtaining the business status in the container information of the container to be monitored through the monitor; obtaining the target resource usage in the business status, and adjusting the container according to the preset The comparison result between the threshold and the target resource usage is used to determine the container status; based on the container status, the container to be monitored is adjusted.
第二方面,本公开实施例还提供一种基于监控器的容器调整设备,基于监控器的容器调整设备包括处理器、存储器、存储在存储器上并可被处理器执行的计算机程序以及用于实现处理器和存储器之间的连接通信的数据总线,其中所述计算机程序被处理器执行时,实现如本公开说明书提供的任一项基于监控器的容器调整方法。In a second aspect, embodiments of the present disclosure also provide a monitor-based container adjustment device. The monitor-based container adjustment device includes a processor, a memory, a computer program stored on the memory and executable by the processor, and a computer program for implementing A data bus is used for connection and communication between the processor and the memory. When the computer program is executed by the processor, any monitor-based container adjustment method provided in this disclosure is implemented.
第三方面,本公开实施例还提供一种存储介质,用于计算机可读存储,存储介质存储有 一个或者多个程序,一个或者多个程序可被一个或者多个处理器执行,以实现如本公开说明书提供的任一项基于监控器的容器调整方法。In a third aspect, embodiments of the present disclosure also provide a storage medium for computer-readable storage. The storage medium stores One or more programs may be executed by one or more processors to implement any monitor-based container adjustment method as provided in this disclosure.
附图说明Description of drawings
为了更清楚地说明本公开实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present disclosure, which are of great significance to this field. Ordinary technicians can also obtain other drawings based on these drawings without exerting creative work.
图1为本公开实施例提供的一种基于监控器的容器调整方法的流程示意图;Figure 1 is a schematic flowchart of a monitor-based container adjustment method provided by an embodiment of the present disclosure;
图2为图1中的基于监控器的容器调整方法的一子步骤流程示意图;Figure 2 is a schematic flowchart of a sub-step of the monitor-based container adjustment method in Figure 1;
图3为图1中的基于监控器的容器调整方法的一子步骤流程示意图;以及Figure 3 is a schematic flowchart of a sub-step of the monitor-based container adjustment method in Figure 1; and
图4为本公开实施例提供的一种基于监控器的容器调整设备的结构示意框图。Figure 4 is a schematic structural block diagram of a monitor-based container adjustment device provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of this disclosure.
附图中所示的流程图仅是示例说明,不是必须包括所有的内容和操作/步骤,也不是必须按所描述的顺序执行。例如,有的操作/步骤还可以分解、组合或部分合并,因此实际执行的顺序有可能根据实际情况改变。The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all contents and operations/steps, nor are they necessarily performed in the order described. For example, some operations/steps can also be decomposed, combined or partially merged, so the actual order of execution may change according to actual conditions.
应当理解,在此本公开说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本公开。如在本公开说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should be understood that the terminology used in the description of the disclosure is for the purpose of describing particular embodiments only and is not intended to limit the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly dictates otherwise.
近些年来,随着服务端的业务越来越复杂,服务数量越来越多,业务极其庞大,对服务器资源的需求急剧增加。针对日益增长的业务需求,如何在资源有限的条件下自动弹缩容器,实现服务高可用,保证业务连续性,成为服务管理平台迫切需要解决的问题。In recent years, as the business on the server side has become more and more complex, the number of services has increased, and the business has become extremely large, the demand for server resources has increased sharply. In response to the growing business needs, how to automatically expand and shrink containers under limited resources, achieve high service availability, and ensure business continuity has become an urgent problem that the service management platform needs to solve.
业内目前基于K8S(Kubernetes,开源的Docker编排的高可用方案)自运维方案,通过PaaS(Platform as a Service,平台即服务)平台对服务进行容器化管理,K8S以Pod(Plain Old Data,数据结构)为最小管理单位,在Pod中所有容器被统一安排调度,K8S通过控制器监 控集群公共状态,管理和调度Pod,在一定程度上实现了服务的高可用性能;同时,K8S提供了集群策略,通过部署多节点PaaS环境,在单个节点出现异常时其他节点不受影响,实现容灾管理,保证业务的连续性。然而K8S对资源的要求很高,仅自身的正常运行就占用整体资源的近20%,挤占了大量业务的资源,在一些小型化局点,无法承受高额的资源开销。因此,如何解决现有的在有限资源场景下容器***无法实现自动弹缩导致服务效率低的问题成为了亟待解决的技术问题。The industry is currently based on K8S (Kubernetes, an open source Docker-orchestrated high-availability solution) self-operation and maintenance solution, and containerizes management of services through the PaaS (Platform as a Service, platform as a service) platform. K8S uses Pod (Plain Old Data, data Structure) is the smallest management unit. All containers in the Pod are arranged and scheduled uniformly, and K8S monitors them through the controller. Control the public status of the cluster, manage and schedule Pods, and achieve high-availability performance of the service to a certain extent; at the same time, K8S provides a cluster strategy. By deploying a multi-node PaaS environment, other nodes will not be affected when a single node is abnormal, achieving Disaster recovery management ensures business continuity. However, K8S has very high requirements on resources. Its normal operation alone occupies nearly 20% of the overall resources, occupying a large number of business resources. In some small offices, it cannot bear the high resource overhead. Therefore, how to solve the existing problem of low service efficiency caused by the inability of container systems to automatically scale up in limited resource scenarios has become an urgent technical issue that needs to be solved.
本公开实施例提供一种基于监控器的容器调整方法、基于监控器的容器调整设备及存储介质。Embodiments of the present disclosure provide a monitor-based container adjustment method, a monitor-based container adjustment device, and a storage medium.
下面结合附图,对本公开的一些实施例作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。Some embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. The following embodiments and features in the embodiments may be combined with each other without conflict.
以下,将结合图1中的场景对本公开的实施例提供的基于监控器的容器调整方法进行详细介绍。需知,图1中的场景仅用于解释本公开实施例提供的基于监控器的容器调整方法,但并不构成对本公开实施例提供的基于监控器的容器调整方法应用场景的限定。Below, the monitor-based container adjustment method provided by the embodiment of the present disclosure will be introduced in detail with reference to the scenario in Figure 1 . It should be noted that the scenario in Figure 1 is only used to explain the monitor-based container adjustment method provided by the embodiment of the present disclosure, but does not constitute a limitation on the application scenarios of the monitor-based container adjustment method provided by the embodiment of the present disclosure.
请参照图1,图1为本公开实施例提供的一种基于监控器的容器调整方法的流程示意图。Please refer to FIG. 1 , which is a schematic flowchart of a monitor-based container adjustment method provided by an embodiment of the present disclosure.
如图1所示,该基于监控器的容器调整方法包括步骤S101至步骤S103。As shown in Figure 1, the monitor-based container adjustment method includes steps S101 to S103.
步骤S101、通过监控器获取待监控容器的容器信息中的业务状态。Step S101: Obtain the business status in the container information of the container to be monitored through the monitor.
在一示例性实施例中,请参照图1,步骤S101之前包括:创建监控线程,将监控线程作为监控器,并通过监控线程监控容器状态;若检测到容器状态异常时,通过监控线程控制待监控容器重新启动并重新监控容器状态。In an exemplary embodiment, please refer to Figure 1. Before step S101, it includes: creating a monitoring thread, using the monitoring thread as a monitor, and monitoring the container status through the monitoring thread; if an abnormality in the container status is detected, controlling the waiting state through the monitoring thread. Monitor container restarts and re-monitor container status.
请参考图1,步骤S101进一步包括:通过监控线程确定数据序列化格式YML文件,并通过YML文件启动对待监控容器的监控,其中,YML文件预存于服务软件中。Please refer to Figure 1. Step S101 further includes: determining the data serialization format YML file through the monitoring thread, and starting monitoring of the container to be monitored through the YML file, where the YML file is pre-stored in the service software.
步骤S102、获取业务状态中的目标资源使用率,并根据预设阈值和目标资源使用率的比较结果,确定容器状态。Step S102: Obtain the target resource usage in the business status, and determine the container status based on the comparison result between the preset threshold and the target resource usage.
步骤S103、根据容器状态,对待监控容器进行调整。Step S103: Adjust the container to be monitored according to the container status.
在本实施例中,容器状态包括扩容状态和缩容状态,对待监控容器的调整进一步包括:根据扩容状态对待监控容器进行扩容,或根据缩容状态对待监控容器进行缩容。监控器为自研监控器,目标资源使用率为待监控容器的资源使用率,其中包括CPU使用率、内存使用率等。In this embodiment, the container state includes an expansion state and a shrinkage state, and the adjustment of the container to be monitored further includes: expanding the container to be monitored according to the expansion state, or shrinking the container to be monitored according to the shrinkage state. The monitor is a self-developed monitor, and the target resource usage is the resource usage of the container to be monitored, including CPU usage, memory usage, etc.
Docker容器是一个开源的应用容器引擎,让开发者可以以统一的方式打包他们的应用以 及依赖包到一个可移植的容器中,然后发布到任何安装了Docker引擎的服务器上(包括流行的Linux机器、Windows机器),也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口(类似IPhone的app)。几乎没有性能开销,可以很容易地在机器和数据中心中运行。最重要的是,他们不依赖于任何语言、框架包括***。Docker containers are an open source application container engine that allows developers to package their applications in a unified way. and dependency packages into a portable container, and then published to any server with the Docker engine installed (including popular Linux machines and Windows machines), and virtualization can also be achieved. The containers completely use the sandbox mechanism and do not have any interfaces with each other (similar to IPhone apps). There is almost no performance overhead and can be easily run on machines and data centers. The most important thing is that they do not depend on any language, framework or system.
服务器启动之后,所选择的操作***会启动。在Docker世界中可以选择Linux,或者内核支持内核中的容器原语的新版本Windows。与虚拟机模型相同,OS也占用了全部硬件资源。在OS层之上,需要安装容器引擎(如Docker)。容器引擎可以获取***资源,比如进程树、文件***以及网络栈,接着将资源分割为安全的互相隔离的资源结构,称之为容器。每个容器看起来就像一个真实的操作***,在其内部可以运行应用。After the server starts, the selected operating system starts. In the world of Docker you have the choice of Linux, or newer versions of Windows where the kernel supports container primitives in the kernel. Like the virtual machine model, the OS also occupies all hardware resources. Above the OS layer, a container engine (such as Docker) needs to be installed. The container engine can obtain system resources, such as process trees, file systems, and network stacks, and then divide the resources into secure and mutually isolated resource structures, called containers. Each container looks like a real operating system and can run applications inside it.
Docker容器具有以下三大特点:轻量化、标准开放、安全可靠。轻量化:一台主机上运行的多个Docker容器可以共享主机操作***内核;启动迅速,只需占用很少的计算和内存资源;标准开放:Docker容器基于开放式标准,能够在所有主流Linux版本、Microsoft Windows以及包括VM、裸机服务器和云在内的任何基础设施上运行;安全可靠:Docker赋予应用的隔离性不仅限于彼此隔离,还独立于底层的基础设施。Docker默认提供最强的隔离,因此应用出现问题,也只是单个容器的问题,而不会波及到整台主机。Docker containers have the following three characteristics: lightweight, open standards, and safe and reliable. Lightweight: Multiple Docker containers running on a host can share the host operating system kernel; they start quickly and require only a small amount of computing and memory resources; open standards: Docker containers are based on open standards and can run on all mainstream Linux versions , Microsoft Windows, and any infrastructure including VMs, bare metal servers, and clouds; safe and reliable: The isolation Docker gives applications is not limited to isolation from each other, but also independent of the underlying infrastructure. Docker provides the strongest isolation by default, so if there is an application problem, it is only a problem with a single container and will not affect the entire host.
本实施例提供一种基于监控器的容器调整方法、设备及存储介质,本公开实施例通过监控器获取待监控容器的容器信息中的业务状态;获取业务状态中的目标资源使用率,并根据预设阈值和目标资源使用率的比较结果,确定容器状态;容器状态包括扩容状态和缩容状态,分别根据扩容状态。通过上述方式,通过监控器对待监控容器的容器信息进行监控,并根据容器信息中的目标资源使用率和预设阈值的比较结果,确定待监控容器的容器状态,并根据容器状态,对待监控容器进行调整,从而在脱离PaaS平台的前提下,提高了待监控容器的服务效率,解决现有的在有限资源场景下容器***无法实现自动弹缩导致的服务效率低的问题。This embodiment provides a container adjustment method, equipment and storage medium based on a monitor. This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; the container status includes expansion status and contraction status, respectively based on the expansion status. Through the above method, the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and based on the container status, the container to be monitored is Adjustments are made to improve the service efficiency of the containers to be monitored without being separated from the PaaS platform, and solve the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.
请参照图2,步骤S103进一步包括:子步骤S1031。Referring to Figure 2, step S103 further includes: sub-step S1031.
子步骤S1031、若容器状态为缩容状态,则通过监控器删除至少一个待监控容器副本的容器信息,完成待监控容器的缩容。Sub-step S1031: If the container status is in the shrinking state, the monitor deletes the container information of at least one copy of the container to be monitored to complete the shrinking of the container to be monitored.
请参照图2,步骤S1031进一步包括:通过监控器调用待监控容器的应用程序编程API接口,将API接口与待监控容器副本的API接口进行匹配;基于匹配结果,通过监控器删除与API接口相匹配的待监控容器副本,并删除对应的容器信息。Referring to Figure 2, step S1031 further includes: calling the application programming API interface of the container to be monitored through the monitor, matching the API interface with the API interface of the container copy to be monitored; based on the matching result, deleting the API interface related to the container through the monitor. Match the copy of the container to be monitored and delete the corresponding container information.
本实施例提供一种基于监控器的容器调整方法、设备及存储介质,本公开实施例通过监控器获取待监控容器的容器信息中的业务状态;获取业务状态中的目标资源使用率,并根据 预设阈值和目标资源使用率的比较结果,确定容器状态;若容器状态为扩容状态,则将待监控容器进行扩容。通过上述方式,通过监控器对待监控容器的容器信息进行监控,并根据容器信息中的目标资源使用率和预设阈值的比较结果,确定待监控容器的容器状态,并在缩容状态时,对待监控容器进行缩容,从而在脱离PaaS平台的前提下,提高了待监控容器的服务效率,解决现有的在有限资源场景下容器***无法实现自动弹缩导致的服务效率低的问题。This embodiment provides a container adjustment method, equipment and storage medium based on a monitor. This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; if the container status is in the expansion state, the container to be monitored is expanded. Through the above method, the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and in the shrinking state, the container status of the container to be monitored is determined. The monitoring container is scaled down, thereby improving the service efficiency of the container to be monitored without being separated from the PaaS platform, and solving the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.
请参照图3,图3为实施本实施例提供的基于监控器的容器调整方法的流程示意图,如图3所示,步骤S102进一步包括子步骤S1021-S1022。Please refer to Figure 3, which is a schematic flow chart for implementing the monitor-based container adjustment method provided in this embodiment. As shown in Figure 3, step S102 further includes sub-steps S1021-S1022.
子步骤S1021、通过监控器获取待监控容器中的目标资源使用率。Sub-step S1021: Obtain the target resource usage in the container to be monitored through the monitor.
子步骤S1022、读取数据序列化格式YML文件中的预设阈值,并将预设阈值与目标资源使用率进行比较,得到比较结果,并基于比较结果确定容器状态。Sub-step S1022: Read the preset threshold in the data serialization format YML file, compare the preset threshold with the target resource usage, obtain the comparison result, and determine the container status based on the comparison result.
本实施例中,若目标资源使用率大于预设阈值,则确定容器状态为扩容状态;若目标资源使用率不大于预设阈值,则确定容器状态为缩容状态。In this embodiment, if the target resource usage is greater than the preset threshold, the container status is determined to be the expansion state; if the target resource usage is not greater than the preset threshold, the container status is determined to be the shrinkage state.
在一示例性实施例中,步骤S103进一步包括:若容器状态为扩容状态,则通过创建至少一个待监控容器副本,并通过YML文件控制待监控容器副本启动,通过将待监控容器的容器信息同步至待监控容器副本,实现待监控容器的扩容。In an exemplary embodiment, step S103 further includes: if the container status is in the expansion state, creating at least one copy of the container to be monitored, and controlling the startup of the copy of the container to be monitored through the YML file, and synchronizing the container information of the container to be monitored. To a copy of the container to be monitored, the capacity of the container to be monitored is expanded.
本实施例提供一种基于监控器的容器调整方法、设备及存储介质,本公开实施例通过监控器获取待监控容器的容器信息中的业务状态;获取业务状态中的目标资源使用率,并根据预设阈值和目标资源使用率的比较结果,确定容器状态;若容器状态为扩容状态,则将待监控容器进行扩容。通过上述方式,通过监控器对待监控容器的容器信息进行监控,并根据容器信息中的目标资源使用率和预设阈值的比较结果,确定待监控容器的容器状态,并在扩容状态时,对待监控容器进行扩容,从而在脱离PaaS平台的前提下,提高了待监控容器的服务效率,解决现有的在有限资源场景下容器***无法实现自动弹缩导致的服务效率低的问题。This embodiment provides a container adjustment method, equipment and storage medium based on a monitor. This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; if the container status is in the expansion state, the container to be monitored is expanded. Through the above method, the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and when the capacity is expanded, the container status of the container to be monitored is determined. The container is expanded, thereby improving the service efficiency of the container to be monitored without being separated from the PaaS platform, and solving the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.
基于上述全部实施例,本实施例还包括:通过监控器监控资源使用率,并按照预定时间间隔,读取数据序列化格式YML文件中设定的预设阈值。Based on all the above embodiments, this embodiment also includes: monitoring resource usage through a monitor, and reading the preset threshold set in the data serialization format YML file at predetermined time intervals.
具体实施例中,通过监控器按照预定的时间间隔进行阈值的读取,以实现对于待监控容器中,容器信息的更新,并根据容器信息的更新调整容器***的状态,从而最终实现容器自动弹缩。In a specific embodiment, the monitor reads the threshold value at a predetermined time interval to update the container information in the container to be monitored, and adjusts the status of the container system according to the update of the container information, thereby ultimately realizing automatic container escalation. shrink.
本公开主要通过监控进程实时监测容器状态来决定容器的弹缩,首先,需要先启动业务模块。业务模块主要包括:MSB(GPaas的服务注册中心组件,在本公开中,被移植到静态 容器中)、公共服务、业务组件(otcp、apps)三部分,均以微服务方式部署。This disclosure mainly determines the elasticity of the container by monitoring the container status in real time through the monitoring process. First, the business module needs to be started. The business module mainly includes: the service registration center component of MSB (GPaas). In this disclosure, it is transplanted to static Container), public services, and business components (otcp, apps) are all deployed in a microservice manner.
基于PaaS平台的服务部署以蓝图为基础,对服务对应的容器按照蓝图规划进行编排。本公开中,服务部署以配置文件default-config.yml为中心,YML文件由各个微服务的蓝图文件解析产生;在default-config.yml文件中配置各服务的配置信息(服务和微服务名称、基础镜像信息、初始化容器信息、依赖的公共服务、PG和PGcache实例信息、镜像名称和镜像包路径、网络信息、环境变量、VOLUME、CPU/MEMORY限制等)。Service deployment based on the PaaS platform is based on blueprints, and the containers corresponding to the services are orchestrated according to the blueprint plan. In this disclosure, service deployment is centered on the configuration file default-config.yml, and the YML file is generated by parsing the blueprint file of each microservice; the configuration information of each service (service and microservice name, Basic image information, initialized container information, dependent public services, PG and PGcache instance information, image name and image package path, network information, environment variables, VOLUME, CPU/MEMORY restrictions, etc.).
部署时解析配置文件,通过Docker SDK实现镜像的创建、在PG和PGcache中创建实例、容器的创建和启动、向MSB注册等操作,完成MSB、公共服务和业务组件等的部署。During deployment, the configuration file is parsed, and the Docker SDK is used to create images, create instances in PG and PGcache, create and start containers, and register with MSB to complete the deployment of MSB, public services, and business components.
静态容器通过监控器模块创建的主监控进程以及其子线程监控容器状态的方式,将获取的容器信息与yml文件所设定配置阈值对比,采取对应的容器弹缩策略,具体步骤如下:Static containers monitor the container status through the main monitoring process created by the monitor module and its sub-threads. The obtained container information is compared with the configuration threshold set in the yml file, and the corresponding container elasticity strategy is adopted. The specific steps are as follows:
在业务模块部署完成后,静态容器启动监控器进程,创建Docker监控线程DockerMonitorThread,用于监控Docker服务状态,如果Docker运行异常,该线程将重新拉起Docker服务,保证容器运行环境正常;监控进程将初始化拉起服务监控线程:SubMonitorFor[servtype]-[servname],从类型属性中获取已部署的指定服务类型、服务的微服务列表,从持久化YML文件中获取指定服务的总配置信息,并监控服务容器状态,包括容器本身的状态以及业务状态;开启管理线程(LifeManagerThread),对各个子线程的生命周期进行管理,根据开关地图的状态,实时控制子监控线程的启停;同时启动SetActionHandlerThread线程,处理CLI客户端请求;服务部署完成后,监控器模块子线程定时检测待监控容器信息,并将读取到的容器信息写入到指定的文件中,容器信息包括:容器状态、CPU和内存使用情况。After the business module is deployed, the static container starts the monitor process and creates the Docker monitoring thread DockerMonitorThread to monitor the Docker service status. If Docker runs abnormally, this thread will restart the Docker service to ensure that the container running environment is normal; the monitoring process will Initialize the service monitoring thread: SubMonitorFor[servtype]-[servname], obtain the deployed specified service type and microservice list of the service from the type attribute, obtain the total configuration information of the specified service from the persistent YML file, and monitor Service container status, including the status of the container itself and the business status; start the management thread (LifeManagerThread) to manage the life cycle of each sub-thread, and control the start and stop of the sub-monitoring thread in real time according to the status of the switch map; at the same time, start the SetActionHandlerThread thread, Process CLI client requests; after the service deployment is completed, the monitor module sub-thread regularly detects the container information to be monitored and writes the read container information to the specified file. The container information includes: container status, CPU and memory usage Condition.
容器扩充副本场景如下:在一些情形中,以K8S为基础的PaaS平台是以Pod为最小运行单位,容器在Pod中运行,一个Pod可以由一个或多个容器组成,K8S有自己的Pod调度策略,通过水平Pod自动伸缩器(HPA:Horizontal Pod Autoscaler)读取业务的CPU和内存等信息指标,并与调度策略的设定值进行对比,通过如下表达式:The scenario of container expansion copy is as follows: In some cases, the PaaS platform based on K8S uses Pod as the smallest running unit, and the container runs in the Pod. A Pod can be composed of one or more containers, and K8S has its own Pod scheduling strategy. , read the CPU and memory information indicators of the business through the Horizontal Pod Autoscaler (HPA: Horizontal Pod Autoscaler), and compare it with the setting value of the scheduling policy, through the following expression:
期望运行实例数=ceil[当前运行实例数*(当前指标/期望指标)];Expected number of running instances = ceil [current number of running instances * (current indicator/expected indicator)];
计算出所期望的容器运行实例数,实例数大于当前运行实例数时,K8S则新增Pod,用以调度新的容器实例,实现容器扩容。Calculate the expected number of running instances of the container. When the number of instances is greater than the current number of running instances, K8S will add a new Pod to schedule new container instances to expand the container capacity.
本公开中,服务直接以容器方式部署在环境上,没有Pod的支持,通过服务监控线程实时检测的容器的CPU和内存等信息,并定时读取持久化YML文件里设定的阈值,与实时检 测的容器信息进行对比,对于CPU使用情况指标,当容器实时数据超出阈值时,根据如下表达式:In this disclosure, the service is deployed directly in the environment as a container without Pod support. The container's CPU and memory information is detected in real time through the service monitoring thread, and the threshold set in the persistent YML file is regularly read, and the real-time check Compare the measured container information. For the CPU usage indicator, when the container real-time data exceeds the threshold, according to the following expression:
CPU超限百分比=CPU实测值/CPU阈值*100%+浮动百分比;CPU over-limit percentage = CPU actual measured value/CPU threshold * 100% + floating percentage;
计算CPU超限百分比,内存使用情况指标同理判定,当CPU和内存指标中的任一超限值超过85%时,监控器根据服务名称找到对应的default_config.yml配置文件,通过调用Docker的API接口,执行Docker run命令,重新创建一个与原容器配置相同的CONTAINER副本。服务线程通过自身定义的START方法,将新建的容器副本拉起,并实时监测,将该容器副本信息写入到待监控容器信息文件中,实现容器扩容。此时,由两个容器共同承担该服务的负载,降低资源使用率,当两个容器资源占用再次超限时,监控器再次创建新的容器,以此类推,直至容器副本数达到YML文件设定的最大值后,产生告警,进行问题排查。Calculate the CPU over-limit percentage and determine the memory usage indicator in the same way. When any over-limit value in the CPU and memory indicators exceeds 85%, the monitor finds the corresponding default_config.yml configuration file based on the service name and calls Docker's API. interface, execute the Docker run command to re-create a CONTAINER copy with the same configuration as the original container. The service thread pulls up the newly created container copy through its own defined START method, monitors it in real time, and writes the container copy information into the container information file to be monitored to achieve container expansion. At this time, the two containers share the load of the service, reducing resource usage. When the resource usage of the two containers exceeds the limit again, the monitor creates a new container again, and so on, until the number of container copies reaches the YML file setting. After reaching the maximum value, an alarm is generated and troubleshooting is carried out.
与PaaS不同,静态容器是直接新建一个相同配置的容器,而PaaS是新增一个Pod,当一个Pod中有多个容器运行时,相当于其他容器也新增了副本数,这将造成非必须弹缩的容器也一起扩容,导致资源浪费。Different from PaaS, static containers directly create a new container with the same configuration, while PaaS adds a Pod. When multiple containers are running in a Pod, it is equivalent to adding new copies to other containers, which will cause unnecessary The elasticized containers are also expanded together, resulting in a waste of resources.
当容器实时数据低于YML文件里设定的阈值,监控器通过调用Docker的API接口随机删除该服务下的一个容器,同时删除待监控容器信息文件中对应ID的信息,释放资源,实现容器缩容。容器弹缩过程中产生的数据,通过挂载卷存储于服务器,双机场景还可以通过共享磁阵进行数据存储,保证数据的完整性以及服务的正常运行。When the real-time data of the container is lower than the threshold set in the YML file, the monitor randomly deletes a container under the service by calling the Docker API interface, and deletes the information corresponding to the ID in the container information file to be monitored, releasing resources and realizing container shrinkage. Allow. The data generated during the container expansion process is stored on the server through mounted volumes. In a dual-machine scenario, data can also be stored through a shared disk array to ensure data integrity and normal operation of services.
静态容器还有双机场景,双机场景与单机场景在容器弹缩机制上是一样的,区别在于,双机环境支持容灾管理。双机环境需要先安装双机软件,创建双机目录,并上传双机软件包以及LICENSE文件,通过在setup_config.yml文件中配置双机相关信息,进行双机安装。双机软件为自研工具,可通过启动监控进程,监测容器及服务器状态,决定是否执行双机切换。There is also a dual-machine scenario for static containers. The container elasticity mechanism is the same in the dual-machine scenario and the single-machine scenario. The difference is that the dual-machine environment supports disaster recovery management. In a dual-machine environment, you need to install dual-machine software first, create a dual-machine directory, upload the dual-machine software package and LICENSE file, and configure dual-machine related information in the setup_config.yml file to perform dual-machine installation. The dual-machine software is a self-developed tool that can start the monitoring process, monitor the status of the container and server, and decide whether to perform dual-machine switching.
容灾***是指在相隔较远的异地,建立两套或多套功能相同的IT***,互相之间可以进行健康状态监视和功能切换,当一处***因意外(如火灾、地震等)停止工作时,整个应用***可以切换到另一处,使得该***功能可以继续正常工作。容灾技术是***的高可用性技术的一个组成部分,容灾***更加强调处理外界环境对***的影响,特别是灾难性事件对整个IT节点的影响,提供节点级别的***恢复功能。A disaster recovery system refers to the establishment of two or more sets of IT systems with the same functions in remote places that are far apart. They can perform health status monitoring and function switching between each other. When one system stops due to an accident (such as fire, earthquake, etc.) When working, the entire application system can be switched to another location so that the system functions can continue to work normally. Disaster recovery technology is an integral part of the system's high availability technology. The disaster recovery system places more emphasis on dealing with the impact of the external environment on the system, especially the impact of catastrophic events on the entire IT node, and provides node-level system recovery functions.
本实施例提供一种基于监控器的容器调整方法、设备及存储介质,本公开实施例通过监控器获取待监控容器的容器信息中的业务状态;获取业务状态中的目标资源使用率,并根据预设阈值和目标资源使用率的比较结果,确定容器状态;若容器状态为扩容状态,则将待监控容器进行扩容。通过上述方式,通过监控器对待监控容器的容器信息进行监控,并根据容 器信息中的目标资源使用率和预设阈值的比较结果,确定待监控容器的容器状态,并根据容器状态,对待监控容器进行调整,从而在脱离PaaS平台的前提下,提高了待监控容器的服务效率,解决现有的在有限资源场景下容器***无法实现自动弹缩导致的服务效率低的问题。This embodiment provides a container adjustment method, equipment and storage medium based on a monitor. This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; if the container status is in the expansion state, the container to be monitored is expanded. Through the above method, the container information of the container to be monitored is monitored through the monitor, and based on the content The comparison result between the target resource usage in the server information and the preset threshold is determined to determine the container status of the container to be monitored, and the container to be monitored is adjusted according to the container status, thereby improving the efficiency of the container to be monitored without being separated from the PaaS platform. Service efficiency solves the existing problem of low service efficiency caused by the inability of container systems to automatically scale in limited resource scenarios.
请参阅图4,图4为本公开实施例提供的一种基于监控器的容器调整设备的结构示意性框图。Please refer to FIG. 4 , which is a schematic structural block diagram of a monitor-based container adjustment device provided by an embodiment of the present disclosure.
如图4所示,基于监控器的容器调整设备300包括处理器301和存储器302,处理器301和存储器302通过总线303连接,该总线比如为I2C(Inter-integrated Circuit)总线。As shown in Figure 4, the monitor-based container adjustment device 300 includes a processor 301 and a memory 302. The processor 301 and the memory 302 are connected through a bus 303, such as an I2C (Inter-integrated Circuit) bus.
在一示例性实施例中,处理器301用于提供计算和控制能力,支撑整个基于监控器的容器调整设备的运行。处理器301可以是中央处理单元(Central Processing Unit,CPU),该处理器301还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。In an exemplary embodiment, the processor 301 is used to provide computing and control capabilities to support the operation of the entire monitor-based container adjustment device. The processor 301 can be a central processing unit (Central Processing Unit, CPU). The processor 301 can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC). ), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general processor may be a microprocessor or the processor may be any conventional processor.
在一示例性实施例中,存储器302可以是Flash芯片、只读存储器(ROM,Read-Only Memory)磁盘、光盘、U盘或移动硬盘等。In an exemplary embodiment, the memory 302 may be a Flash chip, a read-only memory (ROM, Read-Only Memory) disk, an optical disk, a USB disk, a mobile hard disk, or the like.
本领域技术人员可以理解,图4中示出的结构,仅仅是与本公开实施例方案相关的部分结构的框图,并不构成对本公开实施例方案所应用于其上的基于监控器的容器调整设备的限定,具体的基于监控器的容器调整设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 4 is only a block diagram of a partial structure related to the solution of the embodiment of the present disclosure, and does not constitute the adjustment of the monitor-based container to which the solution of the embodiment of the present disclosure is applied. DETAILED DESCRIPTION OF THE EQUIPMENT A specific monitor-based container adjustment device may include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
其中,处理器301用于运行存储在存储器302中的计算机程序,并在执行计算机程序时实现本公开实施例提供的任意一种所述的基于监控器的容器调整方法。The processor 301 is configured to run a computer program stored in the memory 302, and implement any one of the monitor-based container adjustment methods provided by the embodiments of the present disclosure when executing the computer program.
在一实施例中,处理器301用于运行存储在存储器中的计算机程序,并在执行计算机程序时实现如下步骤:通过监控器获取待监控容器的容器信息中的业务状态;获取业务状态中的目标资源使用率,并根据预设阈值和目标资源使用率的比较结果,确定容器状态;根据容器状态,对待监控容器进行调整。In one embodiment, the processor 301 is used to run a computer program stored in the memory, and implement the following steps when executing the computer program: obtain the business status in the container information of the container to be monitored through the monitor; obtain the business status in the business status Target resource usage, and determine the container status based on the comparison between the preset threshold and the target resource usage; adjust the container to be monitored based on the container status.
在一实施例中,处理器301用于实现:若容器状态为缩容状态,则通过监控器删除至少一个待监控容器副本的容器信息,完成待监控容器的缩容。In one embodiment, the processor 301 is configured to implement: if the container status is in the shrinking state, delete the container information of at least one copy of the container to be monitored through the monitor to complete the shrinking of the container to be monitored.
在一实施例中,处理器301用于实现:通过监控器调用待监控容器的应用程序编程API 接口,将API接口与待监控容器副本的API接口进行匹配;基于匹配结果,通过监控器删除与API接口相匹配的待监控容器副本,并删除对应的容器信息。In one embodiment, the processor 301 is configured to implement: calling the application programming API of the container to be monitored through the monitor. Interface, match the API interface with the API interface of the container copy to be monitored; based on the matching results, delete the container copy to be monitored that matches the API interface through the monitor, and delete the corresponding container information.
在一实施例中,处理器301用于实现:创建监控线程,将监控线程作为监控器,并通过监控线程监控容器状态;若检测到容器状态异常时,通过监控线程控制待监控容器重新启动并重新监控容器状态。In one embodiment, the processor 301 is used to: create a monitoring thread, use the monitoring thread as a monitor, and monitor the container status through the monitoring thread; if an abnormality in the container status is detected, use the monitoring thread to control the container to be monitored to restart and Monitor container status again.
在一实施例中,处理器301用于实现:通过监控线程确定数据序列化格式YML文件,并通过YML文件启动对待监控容器的监控,其中,YML文件预存于服务软件中。In one embodiment, the processor 301 is configured to: determine the data serialization format YML file through the monitoring thread, and start monitoring the container to be monitored through the YML file, where the YML file is pre-stored in the service software.
在一实施例中,处理器301用于实现:通过监控器获取待监控容器中的目标资源使用率;读取数据序列化格式YML文件中的预设阈值,并将预设阈值与目标资源使用率进行比较,得到比较结果,并基于比较结果确定容器状态。In one embodiment, the processor 301 is used to: obtain the target resource usage in the container to be monitored through the monitor; read the preset threshold in the data serialization format YML file, and compare the preset threshold with the target resource usage. The rate is compared, the comparison result is obtained, and the container status is determined based on the comparison result.
在一实施例中,处理器301用于实现:若容器状态为扩容状态,则通过创建至少一个待监控容器副本,并通过YML文件控制待监控容器副本启动,通过将待监控容器的容器信息同步至待监控容器副本,实现待监控容器的扩容。In one embodiment, the processor 301 is configured to: if the container status is an expansion state, create at least one copy of the container to be monitored, and control the startup of the copy of the container to be monitored through a YML file, and synchronize the container information of the container to be monitored. To a copy of the container to be monitored, the capacity of the container to be monitored is expanded.
在一实施例中,处理器301用于实现:若目标资源使用率大于预设阈值,则确定容器状态为扩容状态;若目标资源使用率不大于预设阈值,则确定容器状态为缩容状态。In one embodiment, the processor 301 is configured to: if the target resource usage is greater than a preset threshold, determine that the container status is the expansion state; if the target resource usage is not greater than the preset threshold, determine the container status is the shrinkage state .
本实施例提供一种基于监控器的容器调整方法、设备及存储介质,本公开实施例通过监控器获取待监控容器的容器信息中的业务状态;获取业务状态中的目标资源使用率,并根据预设阈值和目标资源使用率的比较结果,确定容器状态;若容器状态为扩容状态,则将待监控容器进行扩容。通过上述方式,通过监控器对待监控容器的容器信息进行监控,并根据容器信息中的目标资源使用率和预设阈值的比较结果,确定待监控容器的容器状态,并根据容器状态,对待监控容器进行调整,从而在脱离PaaS平台的前提下,提高了待监控容器的服务效率,解决现有的在有限资源场景下容器***无法实现自动弹缩导致的服务效率低的问题This embodiment provides a container adjustment method, equipment and storage medium based on a monitor. This embodiment of the disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage in the business status, and based on The comparison result between the preset threshold and the target resource usage determines the container status; if the container status is in the expansion state, the container to be monitored is expanded. Through the above method, the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and based on the container status, the container to be monitored is Adjustments were made to improve the service efficiency of the containers to be monitored without being separated from the PaaS platform, and to solve the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.
需要说明的是,所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的基于监控器的容器调整设备的具体工作过程,可以参考前述基于监控器的容器调整方法实施例中的对应过程,在此不再赘述。It should be noted that those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described monitor-based container adjustment device can be referred to the aforementioned embodiment of the monitor-based container adjustment method. The corresponding process will not be described again here.
本公开实施例还提供一种存储介质,用于计算机可读存储,存储介质存储有一个或者多个程序,一个或者多个程序可被一个或者多个处理器执行,以实现如本公开实施例说明书提供的任一项基于监控器的容器调整方法。Embodiments of the present disclosure also provide a storage medium for computer-readable storage. The storage medium stores one or more programs. The one or more programs can be executed by one or more processors to implement the embodiments of the present disclosure. Any of the monitor-based container adjustment methods provided in this manual.
其中,存储介质可以是前述实施例基于监控器的容器调整设备的内部存储单元,例如基 于监控器的容器调整设备的硬盘或内存。存储介质也可以是基于监控器的容器调整设备的外部存储设备,例如基于监控器的容器调整设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。The storage medium may be an internal storage unit of the monitor-based container adjustment device of the aforementioned embodiment, for example Adjust the device's hard drive or memory in the monitor's container. The storage medium may also be an external storage device of the monitor-based container adjustment device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), or a secure digital (Secure Digital) equipped on the monitor-based container adjustment device. SD) card, Flash Card, etc.
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、***、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施例中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。Those of ordinary skill in the art can understand that all or some steps, systems, and functional modules/units in the devices disclosed above can be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware embodiments, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be composed of several physical components. Components execute cooperatively. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit . Such software may be distributed on computer-readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). As is known to those of ordinary skill in the art, the term computer storage media includes volatile and nonvolatile media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. removable, removable and non-removable media. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disk (DVD) or other optical disk storage, magnetic cassettes, tapes, disk storage or other magnetic storage devices, or may Any other medium used to store the desired information and that can be accessed by a computer. Additionally, it is known to those of ordinary skill in the art that communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media .
本公开实施例提供了一种基于监控器的容器调整方法、设备及存储介质,旨在解决现有的在脱离PaaS平台的前提下,有限资源场景中容器***无法实现自动弹缩导致的服务效率低下的问题。本公开提供一种基于监控器的容器调整方法、设备及存储介质,本公开实施例通过监控器获取待监控容器的容器信息中的业务状态;获取业务状态中的目标资源使用率,并根据预设阈值和目标资源使用率的比较结果,确定容器状态;根据容器状态,对待监控容器进行调整。通过上述方式,通过监控器对待监控容器的容器信息进行监控,并根据容器信息中的目标资源使用率和预设阈值的比较结果,确定待监控容器的容器状态,并根据容器状态,对待监控容器进行调整,从而在脱离PaaS平台的前提下,提高了待监控容器的服务效率,解决现有的在有限资源场景下容器***无法实现自动弹缩导致的服务效率低的问题。The embodiments of the present disclosure provide a monitor-based container adjustment method, equipment and storage medium, aiming to solve the existing service efficiency caused by the inability of the container system to achieve automatic elasticity in limited resource scenarios without the PaaS platform. Low question. The present disclosure provides a container adjustment method, equipment and storage medium based on a monitor. The embodiment of the present disclosure obtains the business status in the container information of the container to be monitored through the monitor; obtains the target resource usage rate in the business status, and based on the predetermined Set the comparison result between the threshold and the target resource usage to determine the container status; adjust the container to be monitored based on the container status. Through the above method, the container information of the container to be monitored is monitored through the monitor, and the container status of the container to be monitored is determined based on the comparison result of the target resource usage in the container information and the preset threshold, and based on the container status, the container to be monitored is Adjustments are made to improve the service efficiency of the containers to be monitored without being separated from the PaaS platform, and solve the existing problem of low service efficiency caused by the inability of the container system to automatically scale in limited resource scenarios.
应当理解,在本公开说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一 系列要素的过程、方法、物品或者***不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者***所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者***中还存在另外的相同要素。It will be understood that the term "and/or" as used in this disclosure and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. It should be noted that in this document, the terms "include", "includes" or any other variations thereof are intended to cover a non-exclusive inclusion, such that a A process, method, article, or system with a set of elements includes not only those elements, but also other elements not expressly listed, or elements inherent to the process, method, article, or system. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
上述本公开实施例序号仅仅为了描述,不代表实施例的优劣。以上所述,仅为本公开的具体实施例,但本公开的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应以权利要求的保护范围为准。 The above serial numbers of the embodiments of the present disclosure are only for description and do not represent the advantages and disadvantages of the embodiments. The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person familiar with the technical field can easily think of various equivalent methods within the technical scope disclosed in the present disclosure. Modifications or substitutions, these modifications or substitutions should be covered by the protection scope of this disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims (10)

  1. 一种基于监控器的容器调整方法,包括:A monitor-based container tuning method, including:
    通过监控器获取待监控容器的容器信息中的业务状态;Obtain the business status in the container information of the container to be monitored through the monitor;
    获取所述业务状态中的目标资源使用率,并根据预设阈值和所述目标资源使用率的比较结果,确定所述容器状态;Obtain the target resource usage in the business status, and determine the container status based on the comparison result between the preset threshold and the target resource usage;
    根据所述容器状态,对所述待监控容器进行调整。Adjust the container to be monitored according to the container status.
  2. 根据权利要求1所述的基于监控器的容器调整方法,其中,所述根据所述容器状态,对所述待监控容器进行调整包括:The monitor-based container adjustment method according to claim 1, wherein adjusting the container to be monitored according to the container status includes:
    若所述容器状态为缩容状态,则通过所述监控器删除至少一个待监控容器副本的容器信息,完成所述待监控容器的缩容。If the container status is a shrinking state, the monitor deletes the container information of at least one copy of the container to be monitored, thereby completing the shrinking of the container to be monitored.
  3. 根据权利要求2所述的基于监控器的容器调整方法,其中,所述通过所述监控器删除至少一个待监控容器副本的容器信息,完成所述待监控容器的缩容,包括:The monitor-based container adjustment method according to claim 2, wherein the deleting the container information of at least one copy of the container to be monitored through the monitor to complete the shrinking of the container to be monitored includes:
    通过所述监控器调用所述待监控容器的应用程序编程API接口,将所述API接口与所述待监控容器副本的API接口进行匹配;The application programming API interface of the container to be monitored is called by the monitor, and the API interface is matched with the API interface of the container copy to be monitored;
    基于匹配结果,通过所述监控器删除与所述API接口相匹配的所述待监控容器副本,并删除对应的容器信息。Based on the matching result, the monitor is used to delete the copy of the container to be monitored that matches the API interface, and delete the corresponding container information.
  4. 根据权利要求1所述的基于监控器的容器调整方法,其中,所述根据所述容器状态,对所述待监控容器进行调整包括:The monitor-based container adjustment method according to claim 1, wherein adjusting the container to be monitored according to the container status includes:
    若所述容器状态为扩容状态,则通过创建至少一个待监控容器副本,并通过YML文件控制所述待监控容器副本启动,通过将所述待监控容器的所述容器信息同步至所述待监控容器副本,实现所述待监控容器的扩容。If the container status is in the expansion state, create at least one copy of the container to be monitored, control the startup of the copy of the container to be monitored through a YML file, and synchronize the container information of the container to be monitored to the container to be monitored. Container copy enables expansion of the container to be monitored.
  5. 根据权利要求1所述的基于监控器的容器调整方法,其中,所述通过监控器获取待监控容器的容器信息中的业务状态之前,包括:The monitor-based container adjustment method according to claim 1, wherein before obtaining the business status in the container information of the container to be monitored through the monitor, the method includes:
    创建监控线程,将所述监控线程作为所述监控器,并通过所述监控线程监控所述容器状态;Create a monitoring thread, use the monitoring thread as the monitor, and monitor the container status through the monitoring thread;
    若检测到所述容器状态异常时,通过所述监控线程控制所述待监控容器重新启动并重新监控所述容器状态。 If an abnormality in the container status is detected, the monitoring thread is used to control the container to be monitored to restart and monitor the container status again.
  6. 根据权利要求5所述的基于监控器的容器调整方法,其中,所述通过所述监控线程控制所述待监控容器重新启动并重新监控所述容器状态,还包括:The monitor-based container adjustment method according to claim 5, wherein the controlling the restart of the container to be monitored through the monitoring thread and re-monitoring the container status further includes:
    通过所述监控线程确定数据序列化格式YML文件,并通过所述YML文件启动对所述待监控容器的监控,其中,所述YML文件预存于服务软件中。The data serialization format YML file is determined through the monitoring thread, and monitoring of the container to be monitored is started through the YML file, where the YML file is pre-stored in the service software.
  7. 根据权利要求1所述的基于监控器的容器调整方法,其中,所述获取所述业务状态中的目标资源使用率,并根据预设阈值和所述目标资源使用率的比较结果,确定所述容器状态,包括:The monitor-based container adjustment method according to claim 1, wherein said obtaining the target resource usage in the business state, and determining the said target resource usage according to a comparison result between a preset threshold and the target resource usage. Container status, including:
    通过所述监控器获取所述待监控容器中的所述目标资源使用率;Obtain the target resource usage in the container to be monitored through the monitor;
    读取数据序列化格式YML文件中的所述预设阈值,并将所述预设阈值与所述目标资源使用率进行比较,得到比较结果,并基于所述比较结果确定所述容器状态。Read the preset threshold in the data serialization format YML file, compare the preset threshold with the target resource usage, obtain a comparison result, and determine the container status based on the comparison result.
  8. 根据权利要求1-7中任一项所述的基于监控器的容器调整方法,其中,所述根据预设阈值和所述目标资源使用率的比较结果,确定所述容器状态,包括:The monitor-based container adjustment method according to any one of claims 1 to 7, wherein determining the container status according to a comparison result between a preset threshold and the target resource usage includes:
    若所述目标资源使用率大于所述预设阈值,则确定所述容器状态为扩容状态;If the target resource usage is greater than the preset threshold, determine that the container status is an expansion status;
    若所述目标资源使用率不大于所述预设阈值,则确定所述容器状态为缩容状态。If the target resource usage is not greater than the preset threshold, it is determined that the container status is a shrinking status.
  9. 一种基于监控器的容器调整设备,包括处理器、存储器、存储在所述存储器上并可被所述处理器执行的计算机程序以及用于实现所述处理器和所述存储器之间的连接通信的数据总线,其中所述计算机程序被所述处理器执行时,实现如权利要求1-8中任一项所述的基于监控器的容器调整方法的步骤。A monitor-based container adjustment device, including a processor, a memory, a computer program stored on the memory and executable by the processor, and a connection communication between the processor and the memory. A data bus, wherein when the computer program is executed by the processor, the steps of the monitor-based container adjustment method according to any one of claims 1-8 are implemented.
  10. 一种存储介质,用于计算机可读存储,所述存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现权利要求1-8中任一项所述的基于监控器的容器调整的方法的步骤。 A storage medium for computer-readable storage. The storage medium stores one or more programs. The one or more programs can be executed by one or more processors to implement any of claims 1-8. A step of the method for monitor-based container adjustment.
PCT/CN2023/103346 2022-06-30 2023-06-28 Monitor-based container adjustment method and device, and storage medium WO2024002190A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210764077.0A CN117369981A (en) 2022-06-30 2022-06-30 Container adjusting method, device and storage medium based on monitor
CN202210764077.0 2022-06-30

Publications (1)

Publication Number Publication Date
WO2024002190A1 true WO2024002190A1 (en) 2024-01-04

Family

ID=89383111

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/103346 WO2024002190A1 (en) 2022-06-30 2023-06-28 Monitor-based container adjustment method and device, and storage medium

Country Status (2)

Country Link
CN (1) CN117369981A (en)
WO (1) WO2024002190A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108920153A (en) * 2018-05-29 2018-11-30 华南理工大学 A kind of Docker container dynamic dispatching method based on load estimation
CN109669758A (en) * 2018-09-11 2019-04-23 深圳平安财富宝投资咨询有限公司 Concocting method, device, equipment and the storage medium of server resource
CN111464355A (en) * 2020-03-31 2020-07-28 北京金山云网络技术有限公司 Method and device for controlling expansion capacity of Kubernetes container cluster and network equipment
WO2020248507A1 (en) * 2019-06-14 2020-12-17 平安科技(深圳)有限公司 Container cloud-based system resource monitoring method and related device
CN112199150A (en) * 2020-08-13 2021-01-08 北京航空航天大学 Online application dynamic capacity expansion and contraction method based on micro-service calling dependency perception
CN112511339A (en) * 2020-11-09 2021-03-16 宝付网络科技(上海)有限公司 Container monitoring alarm method, system, equipment and storage medium based on multiple clusters

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108920153A (en) * 2018-05-29 2018-11-30 华南理工大学 A kind of Docker container dynamic dispatching method based on load estimation
CN109669758A (en) * 2018-09-11 2019-04-23 深圳平安财富宝投资咨询有限公司 Concocting method, device, equipment and the storage medium of server resource
WO2020248507A1 (en) * 2019-06-14 2020-12-17 平安科技(深圳)有限公司 Container cloud-based system resource monitoring method and related device
CN111464355A (en) * 2020-03-31 2020-07-28 北京金山云网络技术有限公司 Method and device for controlling expansion capacity of Kubernetes container cluster and network equipment
CN112199150A (en) * 2020-08-13 2021-01-08 北京航空航天大学 Online application dynamic capacity expansion and contraction method based on micro-service calling dependency perception
CN112511339A (en) * 2020-11-09 2021-03-16 宝付网络科技(上海)有限公司 Container monitoring alarm method, system, equipment and storage medium based on multiple clusters

Also Published As

Publication number Publication date
CN117369981A (en) 2024-01-09

Similar Documents

Publication Publication Date Title
US11743116B2 (en) Methods and apparatus to scale application deployments in cloud computing environments
US10275270B2 (en) Method and apparatus to scale application deployments in cloud computing environments using virtual machine pools
WO2019179453A1 (en) Virtual machine creation method and apparatus
WO2016165304A1 (en) Method for managing instance node and management device
CN110888743B (en) GPU resource using method, device and storage medium
CN111522628A (en) Kubernets cluster building and deploying method, architecture and storage medium based on OpenStack
WO2021129733A1 (en) Cloud operating system management method and apparatus, server, management system, and medium
CN112995267B (en) Data subscription service method and equipment based on Kubernetes cluster
EP3584998A1 (en) Method for virtual machine capacity expansion and reduction and virtual management device
US11354150B1 (en) Utilizing maintenance event windows to determine placement of instances
WO2017067616A1 (en) Allocating hosts for instances with anti affinity rule
CN113204353B (en) Big data platform assembly deployment method and device
EP3879875A1 (en) Resource change method and device, apparatus, and storage medium
CN112463290A (en) Method, system, apparatus and storage medium for dynamically adjusting the number of computing containers
WO2020211362A1 (en) Method and apparatus for improving availability of trunking system, and computer device
JPWO2011114476A1 (en) Multi-core processor system, notification program, and notification method
WO2017107483A1 (en) Load balancing method for virtualized network management file downloading, and network management server
US20240054054A1 (en) Data Backup Method and System, and Related Device
CN107547277B (en) Method for realizing virtualization control board and network communication equipment
WO2023125482A1 (en) Cluster management method and device, and computing system
WO2024002190A1 (en) Monitor-based container adjustment method and device, and storage medium
CN111338763A (en) Method for allowing system volume to be unloaded and mounted based on nova
CN112241293A (en) Application management method, device, equipment and medium for industrial internet cloud platform
US11843548B1 (en) Resource scaling of microservice containers
US11797287B1 (en) Automatically terminating deployment of containerized applications

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23830361

Country of ref document: EP

Kind code of ref document: A1