Processor time scheduling and container creating method and device, medium and program product

By extending the virtual processor core of the secure container, the problem that the secure container cannot use elastic CPU bandwidth control is solved, and the service quality improvement under high load conditions is achieved to meet the burst load needs.

CN119045955AActive Publication Date: 2024-11-29ALIBABA CLOUD COMPUTING CO LTD

Patent Information

Application Number
CN202411545067.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2024-11-29
Estimated Expiration
2044-10-31

AI Technical Summary

Technical Problem

Existing secure containers cannot use elastic CPU bandwidth control technology under high load conditions, resulting in limited service quality and ineffective meeting burst load requirements.

Method used

By expanding the virtual processor core allocated to traditional secure containers, the limitation of the usage time limit in traditional secure containers is broken, and the expansion of virtual processor cores consumes the accumulated period of historical scheduling cycles. Time-consuming to achieve elastic processor bandwidth control.

Benefits of technology

Under high load conditions, the secure container can effectively utilize the extended virtual processor core to meet burst load needs, improve service quality, and enhance the processing capacity of CPU burst loads.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119045955A_ABST
    Figure CN119045955A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a processor time scheduling and container creating method and device, a medium and a program product. In the embodiment of the invention, in order to realize the elastic processor bandwidth control in the security container, the virtual processor core allocated to the traditional security container is expanded, so that the limitation that the ratio of the limited use duration (Quota) to the virtual processor core in the traditional security container is 1: 1 is broken through, and the security container can realize the elastic processor bandwidth control when the load is high. And the expanded virtual processor core is utilized to consume the unconsumed duration accumulated in the historical scheduling period, so that the elastic processor bandwidth control is realized, the burst type load requirement is favorably met, and the service quality of the security container is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a processor time scheduling and container creation method, device, medium and program product. Background Art

[0002] With the development of cloud computing technology, container technology plays an important role in realizing multi-tenant environment. Container technology allows running multiple isolated application instances on the same host, thereby improving resource utilization and deployment efficiency.

[0003] When processing CPU (central processing unit) burst tasks, traditional shared containers can provide better service quality through elastic CPU bandwidth control technology, but there are major security risks. In order to continue to provide high-quality services while ensuring security, secure containers are widely used. However, existing secure containers cannot use elastic CPU bandwidth control technology. Summary of the invention

[0004] Multiple aspects of the present application provide a processor time scheduling and container creation method, device, medium and program product to implement elastic processor bandwidth control in a secure container.

[0005] The present application embodiment provides a processor time scheduling method, including: When the load of the virtual processor of the secure container meets the high load condition, obtaining the first unconsumed time length accumulated by the virtual processor of the secure container in the historical scheduling cycle; the virtual processor has a target number of virtual processor cores; the target number is obtained by expanding the first number; the first number is determined according to the resource request amount and resource limit amount of the secure container; The first time period is consumed by using the target number of virtual processor cores to use physical processors to execute the task.

[0006] The present application also provides a container creation method, including: Obtain a container creation request, where the container creation request is used to request the creation of a secure container, and the container creation request includes a resource request amount and the resource limit amount; Determine, according to the resource request amount and the resource limit amount, the number of virtual processor cores of the secure container as a first number; Expanding the first quantity to obtain a target quantity; Creating a virtual machine instance on the host machine according to the target number of virtual processor cores; The secure container is created on the virtual machine instance to utilize the target number of virtual processor cores to consume the previously accumulated unconsumed processor time of the secure container to execute tasks when the load of the virtual processor of the secure container meets the high load condition.

[0007] The embodiment of the present application further provides an electronic device, comprising: a memory and a processor; wherein the memory is used to store a computer program; The processor is coupled to the memory and configured to execute the computer program to perform the steps in the aforementioned processor time scheduling method and / or container creation method.

[0008] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the aforementioned processor time scheduling method and / or container creation method.

[0009] An embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by one or more processors, the one or more processors are caused to execute the steps in the aforementioned processor time scheduling method and / or container creation method.

[0010] In an embodiment of the present application, in order to implement elastic processor bandwidth control within a secure container, the virtual processor cores allocated to a traditional secure container are expanded, thereby breaking the one-to-one restriction on the usage time (Quota) and the virtual processor cores required in the traditional secure container. When the load is high, the secure container can utilize the expanded virtual processor cores to consume the unconsumed time accumulated in historical scheduling cycles, thereby implementing elastic processor bandwidth control, helping to meet burst load requirements and improving the service quality of the secure container. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1a and Figure 1b A schematic diagram of a process for creating a container provided in an embodiment of the present application; Figure 2 A flowchart of a processor time scheduling method provided in an embodiment of the present application; Figure 3 An architectural diagram of a secure container provided in an embodiment of the present application; Figure 4 A schematic diagram of a hiding mechanism of an extended virtual processor core provided in an embodiment of the present application; Figure 5 A schematic diagram of a mapping mechanism for an extended virtual processor core provided in an embodiment of the present application; Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0012] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0013] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0014] The following is an explanation of the terms or concepts involved in the embodiments of the present application.

[0015] Traditional container: A container that uses resource control groups (Cgrou) and namespace technologies to achieve runtime isolation. The characteristic is that the container shares the kernel with the host. Among them, Cgroup is a mechanism provided by the kernel of the operating system (OS) for resource management and control of process groups, which can limit, record and isolate the physical resources used by process groups. Physical resources may include processor resources, memory resources, and disk input / output (I / O) resources. It allows system administrators or process schedulers to assign processes to different resource control groups (Cgroups), and then set resource limits, priorities or accounting for these resource control groups. Cgroup is one of the core components of container technology. Cgroup can improve resource utilization and isolation in server and container environments, and is one of the foundations for implementing lightweight virtualization technology.

[0016] Secure container: Secure container is an enhanced container technology that provides a higher level of security isolation than traditional containers. Compared with traditional containers, secure containers provide stronger security and isolation by introducing a virtualization layer. Secure containers usually completely isolate the container's operating environment from the host's kernel by introducing an isolation mechanism of lightweight virtualization technology. This isolation ensures that the application within the container does not directly affect the operation of the host and other containers, reducing the risk of security vulnerabilities. Secure containers use a separate virtualized kernel instead of sharing the kernel with the host, thereby preventing potential kernel-level attacks. Each container has its own virtualized kernel instance, so that even if a security incident occurs inside the container, it will not affect the host and other containers.

[0017] Shared secure container: adopts the non-binding CPU scheduling mode. Each virtual CPU (VirtualCPU, vCPU) is randomly assigned to any idle physical CPU. Different vCPUs will compete for physical CPU resources.

[0018] Elastic CPU bandwidth control: By accumulating the unused CPU time in each scheduling cycle when the CPU is relatively idle, the accumulated time is used during the period of high CPU load, thereby breaking through the originally set processor quota limit and improving service quality. This method is effective when dealing with CPU burst tasks with low average CPU utilization but high CPU utilization in certain time periods.

[0019] CPU Quota: Processor quotas, such as the CPU Quota policy, are used to limit the total amount of time a container can use a processor (such as a CPU) within a certain period. When a container's Limit sets processor resources, a processor quota policy (such as CPU Quota) can be set in a resource control group (Cgroup) to limit the container's processor resource usage. Specifically, a container's Limit can be converted to a processor quota policy (such as CPU Quota) in a resource control group (Cgroup), thereby limiting the amount of time a container can use a processor within a certain period.

[0020] The following explains why secure containers cannot use elastic bandwidth control technology.

[0021] Traditional containers perform well in resource management and scheduling, but because traditional containers share the kernel with the host, once they are maliciously compromised, the attacker can directly escape to the host kernel, thereby affecting all containers on the host, causing serious security risks. Therefore, for services with higher security requirements, the current mainstream trend is to migrate to secure containers. Secure containers isolate the container kernel from the host kernel by introducing a lightweight virtualization layer, achieving mutual non-interference between the container and the host. This isolation mechanism significantly improves security, but it also brings new challenges.

[0022] In a secure container, each core of a virtual processor corresponds to a process on the host machine, so the tasks running in the container are limited by the number of virtual processor cores. This means that the container specification not only indicates the upper limit of the processor resources that can be used by the container, but also the number of virtual processor cores of the container. The core of a virtual processor refers to a logical core. A physical core can be virtualized into one or more logical cores. Multiple refers to more than 2 (including 2).

[0023] Some container cluster management systems, such as Kubernetes (K8s), use processor (e.g., CPU) request (request.cpu) and limit (limit.cpu) parameters to allocate and control the CPU resources of containers. Request (request.cpu) represents the weight value of the time slice allocated to this container and is the minimum processor resource guarantee for the container. Request (request.cpu) refers to the minimum amount of CPU resources that the container expects to obtain. Limit (limit.cpu) represents the hard upper limit of the CPU time that the container can use. For example, request.cpu=1, limit.cpu=4 means that when there is more than 1 idle CPU time on the host, the container can be scheduled, but the upper limit of the CPU time available to the container does not exceed 4 CPU times. When creating a secure container, the two parameters of request (request.cpu) and limit (limit.cpu) are used to determine the number of cores of the virtual processor (vCPU), also known as the number of virtual processors. The calculation method is as follows: nr_vcpu = max(request.cpu, limit.cpu)(1).

[0024] Among them, nr_vcpu indicates the number of cores of the virtual processor; max(request.cpu, limit.cpu) indicates the maximum value of the request (request.cpu) and the limit (limit.cpu).

[0025] Furthermore, the control plane of the secure container, such as the runtime component, can create a virtual machine based on the calculation result. The number of cores of the processor in the virtual machine is equal to nr_vcpu, and each core of the virtual processor corresponds to a process on the host machine. Among them, the runtime component is responsible for managing the life cycle of the container, including creating, starting, stopping and destroying the container. The container is an independent operating environment created by the container runtime based on the container image.

[0026] Then, the secure container control plane sets a processor quota for the secure container to limit the upper limit of the processor (such as CPU) time it can use. The calculation method is as follows: cpu.quota = nr_vcpu * cpu.period(2).

[0027] cpu.quota indicates the upper limit of the processor time that can be used by the container; cpu.period indicates the CPU scheduling period (Period), which is equal to one CPU time.

[0028] Combining the above two formulas, it can be concluded that when creating a secure container, the secure container control plane (such as the runtime component) directly maps the processor quota (Quota) to the core of the virtual processor in a one-to-one manner. This directly limits the unused CPU time accumulated when the CPU of the secure container is relatively idle, and cannot be consumed when the CPU is busy. Because there are no extra virtual processor cores to consume the previously accumulated unused CPU time when the CPU of the secure container is busy, the elastic CPU bandwidth control technology cannot take effect in the secure container. However, the average CPU utilization of the secure container is not high, and CPU burst loads with high CPU utilization in certain time periods are common. Therefore, in order to improve the service quality of CPU burst loads in the secure container, the secure container needs to support elastic CPU bandwidth control technology.

[0029] In some embodiments of the present application, in order to implement elastic processor bandwidth control within a secure container, the virtual processor cores allocated to a traditional secure container are expanded, thereby breaking the one-to-one restriction on the usage time (Quota) and the virtual processor core requirement in a traditional secure container. When the load is high, the secure container can utilize the expanded virtual processor cores to consume the unconsumed time accumulated in historical scheduling cycles to implement elastic processor bandwidth control, which helps to meet burst load demands and improve the service quality of the secure container.

[0030] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0031] It should be noted that the same reference numerals denote the same objects in the following drawings and embodiments, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in the subsequent drawings and embodiments.

[0032] Figure 1a The following is a flow chart of a container creation method provided in an embodiment of the present application. Figure 1a As shown, the method mainly includes: 101. Obtain a container creation request, where the container creation request is used to request the creation of a secure container, and the container creation request includes a resource request amount and a resource limit amount.

[0033] 102. Determine the number of virtual processor cores of the secure container as a first number based on the resource request amount and the resource limit amount.

[0034] 103. Expand the first quantity to obtain a target quantity.

[0035] 104. Create a virtual machine instance on the host machine according to the target number of virtual processor cores.

[0036] 105. Create a secure container on the virtual machine instance to utilize the target number of virtual processor cores to consume the previously accumulated unconsumed processor time of the secure container to execute tasks when the load of the virtual processor of the secure container meets the high load condition.

[0037] In an embodiment of the present application, a container creation request is used to request the creation of a secure container, including: a resource request amount (Request) and a resource limit amount (Limit). Among them, the resource request amount (Request) is the minimum amount of resources that the secure container can obtain, and is the minimum resource guarantee for the secure container. The resource request amount (Request) refers to the minimum amount of resources that the container expects to obtain. The scheduler will allocate sufficient resources to the secure container based on the resource request amount (Request) of the secure container. The maximum resource information that can be used by the secure container can be determined using the resource limit amount (Limit) of the secure container. The resource limit amount (Limit) of the container refers to the maximum amount of resources that the container can use. The resource usage of the container must not exceed this upper limit. The resource request amount includes the aforementioned processor request (request.cpu); the resource limit amount includes the processor limit (such as limit.cpu).

[0038] In some embodiments, the container creation request may include a configuration file of the security container to be created, such as a yaml file. The yaml file includes the aforementioned resource request amount and resource limit amount. Among them, the yaml file provides a concise way to describe the configuration data structure of the security container, which is very suitable for configuring and managing containers.

[0039] After obtaining the container creation request in step 101, in step 102, the number of virtual processor cores of the secure container may be determined according to the resource request amount and the resource limit amount. Specifically, the maximum value may be selected from the processor request and the processor limit as the number of virtual processor cores of the secure container, that is, nr_vcpu = max(request.cpu, limit.cpu). The number of virtual processor cores of the secure container here may be referred to as the standard number of virtual processor cores of the secure container.

[0040] In this embodiment, in order to enable the secure container to support processor elasticity control technology, the standard number of virtual processor cores of the secure container can be expanded, and the expanded number of virtual processor cores can be used to consume the processor time accumulated by the processor of the secure container relative to the idle time when the secure container is under high load. Therefore, in step 103, the number of virtual processor cores of the secure container can be expanded to obtain a target number. Among them, the target number refers to the number of virtual processor cores after expansion. In the embodiment of the present application, for the convenience of description and distinction, the standard number of virtual processor cores of the secure container determined in step 102 is defined as the first number; the number of virtual processor cores expanded from the standard number of virtual processor cores is defined as the second number, and the target number is equal to the first number plus the second number.

[0041] In an embodiment of the present application, the specific implementation method for expanding the first quantity is not limited. In some embodiments, the user of the secure container can specify an expansion multiple (burst_vcpu_factor). Accordingly, the container creation request may include an expansion multiple. Among them, the expansion multiple may also be located in the configuration file of the secure container, such as a yaml file. That is, a parameter corresponding to the expansion multiple is added to the configuration file, and the user can specify the expansion multiple by assigning a value to the parameter. Among them, the expansion multiple is greater than or equal to 1. Generally, the expansion multiple is an integer. Since when the expansion multiple is equal to 1, the secure container is an ordinary secure container and the elastic processor bandwidth control technology cannot be used. Therefore, the embodiment of the present application focuses on the expansion multiple greater than 1. Based on the expansion multiple, step 103 can be implemented as: expanding the first quantity according to the expansion multiple to obtain the target quantity. Specifically, the product of the first quantity and the expansion multiple can be used as the target quantity. Accordingly, the target quantity can be expressed as: nr_burst_vcpu = nr_vcpu * burst_vcpu_factor, burst_vcpu_factor≥1 (3).

[0042] Wherein, nr_burst_vcpu indicates the target number of virtual processor cores; burst_vcpu_factor indicates the expansion multiple.

[0043] In this embodiment, whether to use the container creation method provided in the embodiment of the present application to create a secure container can be determined based on whether the configuration file of the secure container carries a parameter corresponding to the expansion multiple (such as burst_vcpu_factor).

[0044] In other embodiments, a set number may be added to the first number to obtain a target number. Alternatively, the first number may be multiplied by a set multiple to obtain a target number. The set multiple is greater than 1. In these embodiments, a parameter may be added to the configuration file of the secure container to indicate whether to use the container creation method provided in the embodiment of the present application to create a secure container. If the value of the parameter indicates that a secure container is created using the container creation method provided in the embodiment of the present application, the secure container is created using the container creation method provided in the embodiment of the present application; if the value of the parameter indicates that a secure container is not created using the container creation method provided in the embodiment of the present application, the secure container is created using the traditional secure container creation method provided in the aforementioned embodiment.

[0045] Further, in step 104, a virtual machine instance can be created on the host machine according to the target number of virtual processor cores. Specifically, a virtual machine can be created on the host machine using the kernel-based virtual machine technology (KVM) technology, and the target number of virtual processor cores and other resources can be configured for the virtual machine to obtain a virtual machine instance. Among them, other resources include: memory resources, persistent storage resources and network resources, etc., but are not limited to these. Among them, KVM is a virtualization technology under an operating system (such as a Linux system), which can transform an operating system into a virtual machine monitoring program, enabling the host computer to run multiple isolated virtual environments.

[0046] Further, in step 105, a secure container may be created on the virtual machine instance so that the virtual processor of the secure container has a target number of virtual processor cores. When a secure container is created on the virtual machine instance, an independent kernel may be run for the secure container to ensure the reliability of the secure container.

[0047] Specifically, the container image of the secure container to be created can be loaded on the virtual machine instance; and the secure container can be created on the virtual machine instance based on the container image. Specifically, the code in the container image can be run on the virtual machine instance created by KVM, and then a secure container can be created on the virtual machine instance, so that the secure container runs on the independent kernel created by KVM.

[0048] It is worth noting that the security container involved in the embodiments of the present application may be a shared security container or an exclusive security container. For a shared security container, each virtual processor core in the security container is a process and is not bound to a physical virtual processor core. The upper limit of the processor time available to the security container is limited by the processor quota (cpu.quota), so the waste of processor resources is low, or even no processor resources are wasted. Each virtual processor core in an exclusive security container is bound to a physical virtual processor core. If the processor time scheduling method provided in the embodiments of the present application is applied to an exclusive security container, a high waste of processor resources will be introduced. Therefore, the security container in the embodiments of the present application mainly refers to a shared security container. In some embodiments of the present application, in addition to obtaining the resource request amount, resource limit amount, and expansion multiple from the configuration file of the security container, it is also possible to configure in the configuration file of the security container whether the security container is shared or exclusive. Accordingly, if Figure 1b As shown, it is also possible to obtain from the configuration file of the security container whether the security container is a shared security container. If so, the container creation method provided in the embodiment of the present application is used to create a security container, that is, Figure 1b As shown, the number of virtual processor cores of the secure container, i.e., the first number, is determined according to the resource request amount and the resource limit amount. Specifically, the aforementioned formula (1) can be used to determine it. Furthermore, the aforementioned formula (3) can be used to expand the number of virtual processor cores of the secure container to obtain the target number of virtual processor cores. The aforementioned formula (2) can also be used to determine the restricted use time (such as cpu.quota) of the secure container. Furthermore, a secure container can be created according to the target number of virtual processor cores; and the restricted use time (such as cpu.quota) of the secure container can be set. Accordingly, if the secure container is an exclusive secure container, the aforementioned secure container creation method can be used to create the secure container. Specifically, the aforementioned formula (1) can be used to determine the number of virtual processor cores of the secure container, i.e., the first number; and the aforementioned formula (2) can be used to determine the restricted use time (such as cpu.quota) of the secure container. Furthermore, a secure container can be created according to the first number of virtual processor cores; and the restricted use time (such as cpu.quota) of the secure container can be set.

[0049] For a shared secure container that has been created, it has a target number of virtual processor cores, which is greater than the number of virtual processor cores determined based on the resource request amount and the resource limit amount, providing a prerequisite for using elastic processor bandwidth control when the load of the virtual processor of the secure container meets the high load condition.

[0050] In some embodiments, the secure container may support the elastic processor bandwidth control technology by default. In other embodiments, the elastic processor bandwidth control technology may be enabled in the secure container after the secure container is created. Since the secure container introduces a virtualization layer, the secure container is isolated from the host kernel. Therefore, it is necessary to enable the elastic processor bandwidth control technology simultaneously at both the secure container and the host level so that the elastic processor bandwidth control technology can take effect in the secure container.

[0051] Specifically, a specific command line (cmdline) parameter can be added to the configuration file (such as a yaml file) of the secure container to instruct the client operating system (Guest OS) to enable the elastic processor bandwidth control technology. The client operating system refers to the operating system of the virtual machine instance where the secure container is located. The command line (cmdline) parameter refers to the command line parameter passed to the kernel at startup, and is a configuration option passed when starting a program or kernel. When starting a secure container, the elastic bandwidth control technology can be enabled through the command line parameter. Specifically, a command line for instructing the client operating system to start the elastic processor bandwidth control function, such as "elastic_cpu=on", can be added to the configuration file of the secure container. During the process of creating a secure container, the command line is passed to the client operating system through a container management tool (such as KVM). Based on the command line, the client operating system can start the elastic processor bandwidth control function to enable the processor elastic control function at the secure container level.

[0052] At the host level, this is achieved through the virtual processor core extension mechanism of the secure container. Specifically, during the creation of the secure container, the host's operating system can enable the elastic processor bandwidth control function through the command line.

[0053] After the elastic processor bandwidth control function is enabled at both the secure container and the host machine level, the elastic processor bandwidth control can be implemented through the expanded target number of virtual processor cores. The following is a specific description of the process of implementing elastic processor bandwidth control using the processor time scheduling method provided in the embodiment of the present application.

[0054] Figure 2 The flowchart of the processor time scheduling method provided in the embodiment of the present application is shown in FIG. Figure 2 As shown, the method mainly includes the following steps: 201. When the load of the virtual processor of the secure container meets a high load condition, obtain the first unconsumed time duration accumulated by the virtual processor of the secure container in a historical scheduling cycle.

[0055] The virtual processor has a target number of virtual processor cores; the target number is obtained by expanding the first number; the first number is determined according to the resource request amount and resource limit amount of the secure container. For the determination method of the first number and the target number, please refer to the relevant content of the aforementioned embodiment, which will not be repeated here.

[0056] 202. Use a physical processor to execute a task by consuming a first time period using a target number of virtual processor cores.

[0057] In this embodiment, for any scheduling period X, a target number of virtual processor cores can be called to execute the tasks of the scheduling period X; and the total time T consumed by the target number of virtual processor cores to complete the tasks of the scheduling period X is counted. x If the total time consumed by the target number of virtual processor cores to complete the tasks of the scheduling cycle X is less than the limited usage time, then the unconsumed time of the target number of virtual processor cores in the scheduling cycle X is increased based on the accumulated unconsumed time to obtain the unconsumed accumulated time corresponding to the scheduling cycle X.

[0058] The limited usage duration refers to the upper limit of the time during which the secure container can use the physical processor, which is equal to the first quantity multiplied by the call cycle, that is: cpu.quota = nr_vcpu * cpu.period(4).

[0059] cpu.quota refers to the upper limit of processor time that can be used by the secure container, that is, the limit on usage time.

[0060] The time t that the target number of virtual processor cores do not consume in the scheduling cycle X x , which is equal to the limited usage time minus the total time T consumed by the target number of virtual processor cores to complete the tasks of the scheduling cycle X x That is, t x =cpu.quota-T x Correspondingly, the cumulative unconsumed duration corresponding to the scheduling period X is It can be expressed as: . i represents the i-th scheduling period. It represents the time that the target number of virtual processor cores are not consumed in the i-th scheduling cycle X.

[0061] Accordingly, if the total time consumed by the target number of virtual processor cores to complete the tasks of the scheduling cycle X is greater than or equal to the limited usage time, it is determined that the load of the virtual processor of the secure container meets the set high load condition, and the processor time scheduling method provided in the embodiment of the present application is used in the next scheduling cycle (X+1) of scheduling cycle X.

[0062] For the previous scheduling cycle (k-1) of the current scheduling cycle k, if the total time consumed by the target number of virtual processor cores to complete the task in the previous scheduling cycle (k-1) reaches the limited usage time corresponding to the security container, it is determined that the load of the virtual processor of the security container meets the set high load condition. Accordingly, in this embodiment, the set high load condition is implemented as follows: the total time consumed by the target number of virtual processor cores to complete the task in the previous scheduling cycle (k-1) reaches the limited usage time corresponding to the security container.

[0063] In some other embodiments, the processor utilization of the secure container may also be monitored. The processor utilization may reflect the processor load level. If the processor utilization of the secure container is greater than or equal to a set utilization threshold, it is determined that the load of the virtual processor of the secure container meets the set high load condition. Accordingly, in this embodiment, the set high load condition is implemented as follows: the processor utilization of the secure container is greater than or equal to the set utilization threshold.

[0064] Furthermore, the processor time scheduling method provided in the embodiment of the present application can be used in the current scheduling cycle k. Specifically, the accumulated unconsumed duration of the virtual processor of the secure container in the historical scheduling cycle can be obtained. In the embodiment of the present application, the scheduling cycle before the current scheduling cycle is referred to as the historical scheduling cycle. Among them, if the current scheduling cycle k is the first scheduling cycle after detecting that the load of the virtual processor of the secure container meets the set high load condition, then the accumulated unconsumed duration of the virtual processor of the secure container in the historical scheduling cycle can be expressed as: , that is, the accumulated unconsumed duration of the virtual processor of the secure container in the historical scheduling cycle is equal to the accumulated unconsumed duration corresponding to the (k-1)th scheduling cycle.

[0065] If the current scheduling cycle k is another scheduling cycle after the load of the virtual processor of the secure container is detected to meet the set high load condition, then the accumulated unconsumed time of the virtual processor of the secure container in the historical scheduling cycle is equal to the accumulated unconsumed time corresponding to the scheduling cycle in which the load of the virtual processor of the secure container is detected to meet the set high load condition, minus the time consumed in the scheduling cycle after the load of the virtual processor of the secure container is detected to meet the set high load condition, which exceeds the restricted usage time (such as cpu.quota) corresponding to the secure container. The restricted usage time (such as cpu.quota) refers to the upper limit of the time that the secure container uses the physical processor.

[0066] For example, assuming that the scheduling cycle in which the load of the virtual processor of the secure container meets the set high load condition is the (kj)th scheduling cycle, the unconsumed cumulative duration corresponding to the (kj)th scheduling cycle can be expressed as , then the accumulated unconsumed time of the virtual processor of the secure container in the historical scheduling cycle is equal to .in, Indicates the duration of the i-th scheduling cycle that exceeds the usage limit corresponding to the secure container (such as cpu.quota).

[0067] Furthermore, the physical processors may be used to execute tasks by using the target number of virtual processor cores and consuming the unconsumed time accumulated by the virtual processors in historical scheduling cycles.

[0068] In this embodiment, by expanding the logical cores (i.e., virtual processor cores) allocated to the traditional security container, the one-to-one restriction of the usage time (Quota) and the virtual processor cores in the traditional security container is broken. When the load is high, the security container can use the expanded virtual processor cores, i.e., the expanded logical cores, to consume the unconsumed time accumulated in the historical scheduling cycle, thereby realizing elastic processor bandwidth control, helping to meet burst load requirements and improving the service quality of the security container.

[0069] Specifically, for the current scheduling cycle k, the duration of the virtual processor that can use the physical processor in excess of the limit in the current scheduling cycle k can be obtained from the unconsumed duration accumulated by the virtual processor in the historical scheduling cycles. In the embodiment of the present application, for the convenience of description and distinction, the unconsumed duration accumulated by the virtual processor of the secure container in the historical scheduling cycles is defined as the first duration; and the duration of the virtual processor that can use the physical processor in excess of the limit in the current scheduling cycle k is defined as the second duration T k2 .

[0070] In some embodiments, the second duration T may be determined based on the expansion multiple and the limited usage duration corresponding to the secure container. k2 . The expansion multiple is equal to the target number divided by the aforementioned first number. Specifically, the product of the expansion multiple and the limited usage time (Quota) can be calculated as the total time that the virtual processor of the secure container can use the physical processor in the current scheduling cycle k; further, the total time that the virtual processor of the secure container can use the physical processor in the current scheduling cycle k can be calculated, and the difference between the limited usage time can be calculated as the time that the virtual processor can use the physical processor beyond the limit in the current scheduling cycle k, that is, the second time T k2 Since the number of virtual processor cores of the secure container is increased by multiple times, the total time that the virtual processors of the secure container can use the physical processors in the current scheduling cycle k is also expanded by multiple times compared to the limited usage time (Quota), so that the expanded virtual processors can have enough physical processor time to execute tasks, thereby improving the overall performance.

[0071] Further, the second duration T can be obtained from the first duration that has not been consumed by the virtual processor of the secure container in the historical scheduling cycle. k2 After that, a second duration T can be added based on the corresponding limited usage duration of the secure container (such as cpu.quota). k2 , to get the target duration. Target duration = cpu.quota + T k2 .

[0072] Furthermore, a target duration of time may be allocated to the target number of virtual processor cores, so that the target number of virtual processor cores can use physical processors to execute tasks of the current scheduling cycle k within the allocated time.

[0073] Specifically, the constraint condition is that the sum of the time allocated to the target number of virtual processor cores is equal to the target duration, and the corresponding duration to be allocated of each of the target number of virtual processor cores is determined according to the resource requirements of the tasks executed by each virtual processor core in the current scheduling cycle.

[0074] Optionally, for each virtual processor core, the processor time required for the virtual processor core to perform the task can be collected within the current scheduling cycle k. Resource requirements can be expressed in terms of percentage of processor time, absolute value of processor time, or other units of measurement. Further, the weight of the target number of virtual processor cores can be calculated based on the processor time required for the target number of virtual processor cores to perform the task. For any virtual processor core, its weight can be equal to the percentage of the processor time required for the virtual processor core to perform the task, which accounts for the sum of the processor time required for the target number of virtual processor cores to perform the task. Further, based on the weight of the target number of virtual processor cores, the corresponding time to be allocated for each of the target number of virtual processor cores can be determined. The corresponding time to be allocated for any virtual processor core is equal to the weight of the virtual processor core multiplied by the target time.

[0075] Furthermore, a corresponding time to be allocated can be allocated to each virtual processor core to allocate a target time for a target number of virtual processor cores. In this way, each virtual processor core can execute the task of the current scheduling cycle k within its allocated time, thereby realizing elastic processor bandwidth control of the secure container, helping to meet burst load requirements and improving the service quality of the secure container.

[0076] After the target duration is allocated to the target number of virtual processor cores, the second duration can be subtracted from the stored first duration as the new duration accumulated and not consumed by the virtual processor in the historical scheduling cycle, so that the processor time can be scheduled based on the new duration in the next scheduling cycle until the accumulated unconsumed duration is consumed. After the accumulated unconsumed duration is consumed, the total time allocated to the target number of virtual processor cores can be equal to the limited usage duration as a constraint condition, and the limited usage duration can be allocated to the target number of virtual processor cores. In this way, each virtual processor core can execute the tasks of the corresponding scheduling cycle within the time allocated to it.

[0077] In some embodiments, the first unconsumed time length of the virtual processor of the secure container acquired in the current scheduling period k in the historical scheduling period may be less than the second time length T determined above. k2 , the first duration can be added to the limited usage duration (cpu.quota) corresponding to the secure container as the total duration allocated to the target number of virtual processor cores in the current scheduling cycle (defined as the fourth duration). Further, the fourth duration can be allocated to the target number of virtual processor cores. In this way, the target number of virtual processor cores use physical processors to execute tasks in the current scheduling cycle k within the allocated time, realizing elastic processor bandwidth control of the secure container, helping to meet burst load requirements and improve the service quality of the secure container.

[0078] For a specific implementation of allocating a fourth duration of time to a target number of virtual processor cores, reference may be made to the aforementioned content of allocating a target duration of time to a target number of virtual processor cores, which will not be described in detail herein.

[0079] Since the elastic processor bandwidth control technology allows the unused processor time in each scheduling cycle to be accumulated and used during periods of high processor load, the processor quota (cpu.quota) limit of the secure container is broken through during periods of high load, thereby improving the service quality of the secure container. However, this may intensify the competition for processor resources among containers on the same host machine, thereby affecting the service quality of the neighboring containers of the secure container. Among them, the neighboring containers of the secure container refer to other containers deployed on the same host machine as the secure container, and share the physical processor of the host machine with the secure container. Therefore, it is possible to prioritize ensuring that the processor quota (cpu.quota) of the neighboring container is met, and on this basis, the need for the secure container to break through the processor quota (cpu.quota) is met. Based on this, in some embodiments of the present application, such as Figure 3 As shown in the figure, a dynamic adjustment mechanism for the scheduling weight of the secure container is introduced.

[0080] Specifically, the scheduling weights of each container deployed on the host (including the security container and other containers deployed on the host) can be pre-configured. Among them, the scheduling weights of each pre-configured container can be the same or different. In some embodiments, the scheduling weights of each pre-configured container are the same, which is equal to 1 / N. N represents the total number of containers deployed on the host, including the security container and other containers deployed on the host. In other embodiments, the scheduling weight of each container can be configured according to the restricted usage time of each container deployed on the host. Specifically, for any container A, the ratio of the restricted usage time of container A to the sum of the restricted usage time of each container can be calculated as the scheduling weight of container A. Alternatively, the restricted usage time of container A can be used as the scheduling weight of container A. The scheduling weight of the aforementioned configured container is the initial scheduling weight of the container.

[0081] When the virtual processor load of the secure container meets the set high load condition, the scheduling weight of the secure container can be reduced to obtain the target scheduling weight of the secure container, where the target scheduling weight is less than the initial scheduling weight of the secure container and the target scheduling weight is less than the scheduling weights of other containers deployed on the host.

[0082] The target scheduling weight may be pre-set. The target scheduling weight is smaller than the scheduling weights of other containers deployed on the host. In this way, when the virtual processor load of the secure container meets the set high load condition, the scheduling weight of the secure container can be set to the pre-set target scheduling weight. The target scheduling weight is smaller than the initial scheduling weight of the secure container.

[0083] Alternatively, when the virtual processor load of the secure container meets the set high load condition, the scheduling weight of the secure container can be reduced by a set gradient to obtain the target scheduling weight of the secure container. That is, when the virtual processor load of the secure container meets the set high load condition, the current scheduling weight of the secure container is subtracted from the set gradient to obtain the target scheduling weight of the secure container. Assuming that the set gradient is 0.05, the current scheduling weight of the secure container is subtracted from 0.5 to obtain the target scheduling weight of the secure container.

[0084] Furthermore, the duration (defined as the third duration) that the secure container uses the physical processor in the current scheduling period k can be determined based on the target scheduling weight of the secure container and the scheduling weights of other containers deployed on the host. Specifically, the ratio P of the target scheduling weight and the sum of the scheduling weights of the containers deployed on the host can be calculated, and then the product of the ratio P and the scheduling period (Period) can be calculated to obtain the third duration that the secure container uses the physical processor in the current scheduling period k.

[0085] Furthermore, if the third duration is less than or equal to the restricted usage duration corresponding to the secure container (such as cpu.quota), it can be determined that the total duration that the secure container can use the physical processor in the current scheduling cycle k is the restricted usage duration, and the restricted usage duration can be allocated to the target number of virtual processor cores. In this way, the target number of virtual processor cores of the secure container can execute the tasks of the current scheduling cycle k within the restricted usage duration.

[0086] Accordingly, if the third duration is greater than the restricted usage duration corresponding to the secure container (such as cpu.quota), the second duration during which the secure container can use the physical processor beyond the limit in the current scheduling cycle k can be determined based on the difference between the third duration and the restricted usage duration corresponding to the secure container (such as cpu.quota). In this way, on the one hand, the dynamic scheduling weight adjustment of the secure container can be taken into account, and the processor quota of other containers can be guaranteed to be met first, thereby reducing the processor resource conflict between the secure container and other containers, thereby reducing the interference of the elastic processor bandwidth control technology on the neighboring containers. On the other hand, the elastic processor bandwidth control technology can continue to be used in the secure container to break through the restriction of the restricted usage duration (i.e., processor quota) corresponding to the secure container, which helps to improve the service quality of the secure container.

[0087] In some embodiments, the difference between the third duration and the restricted usage duration corresponding to the security container (such as cpu.quota) can be used as the second duration during which the security container can exceed the limit on the use of the physical processor in the current scheduling cycle k.

[0088] In other embodiments, the product of the expansion multiple of the virtual processor core and the restricted usage time corresponding to the security container can be calculated as the total time that the security container can use the physical processor in the current scheduling period k. The expansion multiple is equal to the target number divided by the first number. Afterwards, the difference between the total time that the security container can use the physical processor in the current scheduling period k and the restricted usage time corresponding to the security container can be calculated. For ease of description and distinction, the difference between the total time that the security container can use the physical processor in the current scheduling period k and the restricted usage time (Quota) corresponding to the security container is defined as the first difference, and the difference between the third time and the restricted usage time corresponding to the security container (such as cpu.quota) is defined as the second difference. Furthermore, the minimum value can be selected from the first difference and the second difference as the second time that the security container can use the physical processor beyond the limit in the current scheduling period k. From the first difference between the total duration that the security container can use the physical processor in the current scheduling cycle k and the limited usage duration (Quota) corresponding to the security container, and the second difference between the third duration and the limited usage duration (Quota), the smaller one is selected as the second duration, which can balance the duration that the security container can use the physical processor in excess of the limit determined according to the dynamic scheduling weight of the security container, which is different from the duration that the security container can use the physical processor in excess of the limit determined according to the product of the expansion multiple and the limited usage duration (Quota). Selecting the minimum value between the two can ensure that the duration that the security container uses the physical processor in excess of the limit is still limited, thereby not excessively occupying resources.

[0089] After determining the second duration during which the secure container can use the physical processor beyond the limit in the current scheduling cycle k, the second duration can be obtained from the first duration, and the second duration can be added to the corresponding limited usage duration of the secure container to obtain the target duration. Furthermore, the target duration can be allocated to the target number of virtual processor cores, so that the target number of virtual processor cores use the physical processor to perform the tasks of the current scheduling cycle k within the allocated time, realizing elastic processor bandwidth control of the secure container, allowing the secure container to break through the limit of its processor quota, and helping to improve the service quality of the secure container in the event of a sudden processor load.

[0090] In actual applications, in some cases, the secure container needs to obtain processor information to perform some operations. For example, the secure container needs to obtain the number of virtual processor cores for resource initialization. In some embodiments, when the process in the container is started, the kernel interface or the system scheduling interface can be read to initialize resources. Among them, the kernel interface can be the / proc / cpuinfo interface or the / proc / stat interface. The system call interface can be the / sys / devices / system / cpu / online interface, the / sys / devices / system / cpu / offline interface, the / sys / devices / system / cpu / possible interface or the / sys / devices / system / cpu / present, etc.

[0091] Among them, / proc / cpuinfo is part of the / proc file system in the operating system (such as the Linux system), which provides a mechanism to access the kernel's information about the processor. By reading the / proc / cpuinfo file, you can get detailed information about the processors installed in the system. Therefore, the application in the container can read the / proc / cpuinfo kernel interface to obtain processor information in order to initialize the thread pool according to the number of available virtual processor cores (such as the number of CPU cores). / proc / stat contains data about various statistics in the system, including statistics about processors (such as CPUs).

[0092] / sys / devices / system / cpu / online is used to set or view which virtual processor cores (such as CPU cores) are online in the current system. / sys / devices / system / cpu / offline is used to set or view which virtual processor cores (such as CPU cores) are offline in the current system. / sys / devices / system / cpu / possible displays the range of all possible virtual processor cores (such as CPU cores) in the system. / sys / devices / system / cpu / present displays the range of virtual processor cores (such as CPU cores) that actually exist in the system.

[0093] Since the number of virtual processor cores of the secure container is expanded in the embodiment of the present application, when providing processor information to the secure container, it is necessary to hide the expanded (target number-first number) virtual processor cores. This is mainly because the number of virtual processor cores perceived by the application in user state within the secure container is consistent with the processor quota (cpu.quota) of the secure container, thereby avoiding confusion and inconsistency in resource management. User-state applications will initialize and allocate resources based on the visible number of virtual processor cores. If the number of virtual processor cores perceived by the application in user state is inconsistent with the processor quota (cpu.quota) of the secure container, it may cause confusion in resource management. By hiding the additional expanded number of virtual processor cores, it can be ensured that the number of virtual processor cores visible from the container perspective and the processor quota (cpu.quota) of the secure container are one-to-one, thereby simplifying resource management.

[0094] Based on this, in some embodiments of the present application, in response to the secure container's access operation to the processor information, a resource view of a first number of virtual processor cores may be provided to the secure container. The secure container's access operation to the processor information may be implemented as a read operation on the aforementioned kernel interface or system call interface.

[0095] like Figure 3 For the convenience of description and distinction, Figure 3 vCPU represents a virtual processor core. The vCPU visible from the perspective of the secure container is denoted as gvCPU, and the actual vCPU of the secure container is denoted as hvCPU. Figure 3 The resource request and resource limit of the container creation request in , the determined number of virtual processor cores (number of vCPUs) is 4, that is, the first number is equal to 4. The expansion multiple is 2, that is, the number of virtual processor cores (target number) of the actually created secure container is 8, such as Figure 3 Since the extended virtual processor cores are mostly used to handle processor load burst applications in the secure container, the extended virtual processor cores can be called burst-type virtual processor cores, such as Figure 3 The burstable vCPUs in Figure 3 The "burst vCPU creation mechanism" here refers to the secure container creation process provided by the aforementioned container creation method. Figure 3 In the example, the number of virtual processor cores visible from the application perspective in the secure container is 4, that is, Figure 3 gvCPU0-3 in .

[0096] In order to implement the hiding mechanism of the extended virtual processor core, in some embodiments of the present application, for example Figure 3As shown, the actual number of virtual processor cores in the secure container (i.e., the target number) is scaled by the expansion multiple to obtain the number of virtual processor cores visible from the perspective of the secure container (i.e., the first number). For the convenience of description, the expansion multiple is recorded as f; the actual number of virtual processor cores in the secure container (i.e., the target number) is recorded as s; the number of virtual processor cores visible from the perspective of the secure container (i.e., the first number) is recorded as s', then s'=s / f. Figure 3 In this case, s'=4, s=8, and f=2.

[0097] Specifically, Figure 4 As shown, in the kernel of the virtual machine's operating system (Guest OS kernel), a bitmap can be used to mark whether the virtual processor core is online. Each bit in the bitmap corresponds to a virtual processor core, 1 represents that the virtual processor core is online, and 0 represents that the virtual processor core corresponding to the bit is not online. Alternatively, 0 represents that the virtual processor core is online, and 1 represents that the virtual processor core corresponding to the bit is not online, etc. Figure 4 As shown, hiding the multiple extended virtual processor cores can be implemented by retaining the bits [0, s') in the bitmap and clearing the bits [s', s), so that the number of virtual processor cores visible from the perspective of the secure container is the first number.

[0098] Based on this, in response to the secure container's access operation to the processor information, the first bitmap corresponding to the target number of virtual processor cores can be determined. Figure 4 As shown in Figure (a). One bit of the first bitmap corresponds to one virtual processor core; Figure 4 In the example, a bit value of 1 indicates that the bit corresponds to a virtual processor core, and a bit value of 0 indicates that the bit does not correspond to a virtual processor core. Further, the first bitmap can be modified into a second bitmap according to the expansion multiple; the number of target bits in the second bitmap is equal to the first number; the target bit refers to the bit that represents the corresponding virtual processor core. The second bitmap is as follows Figure 4 As shown in Figure (b), Figure 4 In the figure (b), the bit with a value of 1 represents the target bit. Furthermore, the second bitmap can be provided to the secure container, so that the resource view of the first number of virtual processor cores can be provided to the secure container. The secure container perceives the first number of virtual processor cores and can perform resource management based on the first number of virtual processor cores. In this way, the additional number of virtual processor cores can be hidden, and the number of virtual processor cores visible from the container perspective can be ensured to be one-to-one with the processor quota (cpu.quota) of the secure container, avoiding confusion and inconsistency in resource management.

[0099] To ensure isolation between different applications, different applications can be bound to different virtual processor cores to avoid resource contention. When an application is bound to a virtual processor core (i.e., gvCPU) from the perspective of a secure container, the application is actually deployed on the aforementioned expansion multiple (i.e., f) hvCPUs, thereby making full use of processor resources.

[0100] The idea of ​​setting up the Burst vCPU mapping mechanism is to map f hvCPUs to one gvCPU. When an application or service is bound to a gvCPU, it can actually run on f hvCPUs, thereby fully utilizing CPU resources; and this process is transparent to the application or service. The mapping relationship is calculated according to the following formula: (5).

[0101] In formula (5), i represents the i-th gvCPU, that is, the i-th virtual processor core visible from the container perspective. Assuming that the total number of hvCPUs (i.e., the target number) s is 8 and the expansion factor is 2, then gvCPU0=hvCPU0+hvCPU4.

[0102] Specifically, a bitmap can be used to maintain the core binding information of an application. A bit being 1 indicates that the application can run on the virtual processor core corresponding to the bit, and a bit being 0 indicates that the application cannot run on the virtual processor core corresponding to the bit. When the application sets the core binding information, the burst vCPU mapping mechanism can disperse and bind the application to f (i.e., the expansion multiple) hvCPUs according to the relationship in the above formula; when the application reads the core binding information, the burst vCPU mapping mechanism aggregates f hvCPUs to one gvCPU according to the relationship in the above formula.

[0103] Based on the above-mentioned burst vCPU mapping mechanism, the target virtual processor core to be bound and the process to be bound of the processor binding operation can be obtained in response to the processor binding operation of the secure container. Among them, the secure container can read the kernel interface or the system call interface to perform the processor binding operation. The kernel interface can be / sys / fs / cgroup / cpuset / cpuset.cpus or / sys / fs / cgroup / cpuset / cpuset.effective_cpus, etc. The system call interface can be sched_setaffinity or sched_getaffinity, etc.

[0104] Among them, / sys / fs / cgroup / cpuset / cpuset.cpus is used to specify a set of processor cores (such as CPU cores) that can be used by processes in the resource control group (Cgroup). / sys / fs / cgroup / cpuset / cpuset.effective_cpus is used to display the set of processor cores (such as CPU cores) that can actually be used by processes in the current resource control group (Cgroup).

[0105] sched_setaffinity is a system call that is used to set the affinity of a process's processor (such as a CPU). This means that it can specify which processor cores (such as CPU cores) a process can only run on. ched_getaffinity is a system call that is used to get the current processor (such as a CPU) affinity setting of a process.

[0106] Further, according to the expansion multiple f, the target bit corresponding to the target virtual processor core in the first map corresponding to f (i.e., the expansion multiple) bits can be determined. The target bit corresponding to the target virtual processor core in the first map corresponding to f (i.e., the expansion multiple) bits can be determined according to the above formula (1). Figure 5 As shown, the target bit corresponding to gvCPU0 in the first bit map corresponds to the f bits corresponding to hvCPU0 and hvCPU4. Further, the process to be bound can be bound to the virtual processor core corresponding to the determined f expansion multiple bits, so that the process to be bound can be run on the expansion multiple (i.e., f) virtual processor cores, making full use of processor resources and improving processor resource utilization.

[0107] The aforementioned embodiment provides a hiding and mapping mechanism for multiple extended virtual processor cores. This mechanism hides the multiple extended virtual processor cores that support the elastic processor bandwidth control technology, and reasonably maps the virtual processor cores visible from the container perspective with the multiple extended virtual processor cores, thereby making the multiple extended virtual processor cores transparent to the applications in the secure container, and the applications in the secure container have no modification cost.

[0108] It is worth noting that the security container provided in the embodiment of the present application can run various services, such as database services, online shopping services, video services or cloud computing services, but is not limited to this. The inventor of the present application applies the security container provided in the embodiment of the present application to the database, and uses the container creation method provided in the embodiment of the present application to create the security container corresponding to the database, and uses the processor time scheduling method provided in the embodiment of the present application to schedule resources for the security container corresponding to the database, and uses the Transaction Processing Performance Council Benchmark H (TPC-H) to evaluate the performance of the database. Among them, TPC-H is a widely used benchmark for evaluating the performance of database systems. The TPC-H benchmark covers a variety of complex query patterns and is designed to simulate data analysis and reporting tasks in the real world.

[0109] The main indicators of TPC-H include: (1) Duration, which refers to the total time required to complete all queries in the TPC-H benchmark test. The lower the duration, the better. The lower the duration, the faster the system completes all queries and the higher the performance. (2) Throughput, which refers to the amount of work that the system can complete per unit time, usually the number of queries completed per hour. The higher the throughput, the better. The higher the throughput, the more queries the system can handle per unit time and the better the performance.

[0110] The test results show that, when the database configuration remains unchanged, the security container corresponding to the database is created using the container creation method provided in the embodiment of the present application, and the processor time scheduling method provided in the embodiment of the present application is used to schedule resources for the security container corresponding to the database, so that the TPC-H duration (Duration) indicator of the database is reduced by 32% and the throughput (Throughput) indicator is improved by 45%.

[0111] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 201 and 202 can be device A; for another example, the execution subject of step 201 can be device A, and the execution subject of step 202 can be device B; and so on.

[0112] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel, and the sequence numbers of the operations, such as 201, 202, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel.

[0113] Accordingly, an embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned container creation method and / or processor time scheduling method.

[0114] The embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned container creation method and / or processor time scheduling method. In the embodiment of the present application, the specific implementation form of the computer program product is not limited. In some embodiments, the computer program product can be implemented as an application (Application, APP), a mini-program, a computer-side client, a program module, a plug-in, an installation package, a software development kit (Software Development Kit, SDK), an image file of a CD (such as an ISO file), a plug-in or software in the form of software as a service (Software as a Service, SaaS), etc., but is not limited to this.

[0115] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 6 As shown, the electronic device includes: a memory 60a and a processor 60b. The memory 60a is used to store computer programs.

[0116] The processor 60b is coupled to the memory 60a, and is used to execute a computer program to execute the steps in the container creation method and / or the processor time scheduling method provided in the above embodiments. For the specific implementation of each step, please refer to the relevant description of the above embodiments, which will not be repeated here.

[0117] In some optional embodiments, such as Figure 6 As shown, the electronic device may also include optional components such as a communication component 60c, a power component 60d, a display component 60e and an audio component 60f. Figure 6 The components are shown schematically only, and do not mean that the electronic device must include Figure 6 The components shown do not necessarily mean that the electronic device can only include Figure 6 Components shown.

[0118] in addition, Figure 6 The components in the dashed box are optional components, not mandatory components, and may depend on the product form of the electronic device. The electronic device of this embodiment may be implemented as a terminal device such as a desktop computer, a laptop computer, a mobile phone, or an IoT device; or it may be various server devices such as a traditional server, a cloud server, or a server cluster.

[0119] In an embodiment of the present application, the memory is used to store a computer program and can be configured to store various other data to support operations on the device where it is located. Among them, the processor can execute the computer program stored in the memory to implement the corresponding control logic. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random-Access Memory, SRAM), electrically erasable programmable read only memory (Electrically Erasable Programmable Read Only Memory, EEPROM), erasable programmable read only memory (Electrical Programmable Read Only Memory, EPROM), programmable read only memory (Programmable Read Only Memory, PROM), read only memory (Read Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0120] In the embodiment of the present application, the processor may be any hardware processing device that can execute the logic of the above method. Optionally, the processor may be a central processing unit (CPU), a graphics processing unit (GPU) or a microcontroller unit (MCU); it may also be a field programmable gate array (FPGA), a programmable array logic device (PAL), a general array logic device (GAL), a complex programmable logic device (CPLD) or other programmable devices; or it may be an advanced reduced instruction set (RISC) processor (Advanced RISC Machines, ARM) or a system on chip (System on Chip, SoC), etc., but not limited thereto.

[0121] In an embodiment of the present application, the communication component is configured to facilitate wired or wireless communication between the device in which it is located and other devices. The device in which the communication component is located can access a wireless network based on a communication standard, such as Wireless Fidelity (WiFi), 2G or 3G, 4G, 5G or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can also be implemented based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology or other technologies.

[0122] In an embodiment of the present application, the display component may include a liquid crystal display (LCD) and a touch panel (TP). If the display component includes a touch panel, the display component may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0123] In an embodiment of the present application, a power supply component is configured to provide power to various components of the device in which it is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component is located.

[0124] In an embodiment of the present application, the audio component may be configured to output and / or input audio signals. For example, the audio component includes a microphone (Microphone, MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal. For example, for a device with a language interaction function, voice interaction with a user may be achieved through an audio component.

[0125] It should be noted that the descriptions such as “first” and “second” in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit “first” and “second” to different types.

[0126] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program codes.

[0127] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate a device for implementing the functions specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0128] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0129] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0130] In a typical configuration, a computing device includes one or more processors (CPU, etc.), input / output interfaces, network interfaces, and memory.

[0131] Memory may include non-permanent storage in a computer-readable medium, in the form of random-access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0132] Computer storage media is readable storage media, also known as readable media. Readable storage media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0133] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the above elements.

[0134] The above contents are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A processor time scheduling method, characterized in that: include: When the load of the virtual processor of the secure container meets the high load condition, obtaining the first unconsumed time length accumulated by the virtual processor of the secure container in the historical scheduling cycle; the virtual processor has a target number of virtual processor cores; The target quantity is obtained by expanding the first quantity; the first quantity is determined according to the resource request quantity and resource limit quantity of the secure container; The first time period is consumed by using the target number of virtual processor cores to use physical processors to execute the task.

2. The method according to claim 1, characterized in that The step of consuming the first time duration by using the target number of virtual processor cores to execute the task using a physical processor includes: For the current scheduling period, obtaining, from the first time period, a second time period during which the secure container can use the physical processor in excess of the limit in the current scheduling period; The second duration is added to the limited usage duration corresponding to the secure container to obtain a target duration; the limited usage duration refers to the upper limit of the time when the secure container uses the physical processor; The target duration is allocated to the target number of virtual processor cores, so that the target number of virtual processor cores use the physical processors to execute tasks of the current scheduling cycle within the allocated time.

3. The method according to claim 2, characterized in that The obtaining, from the first time period, a second time period during which the secure container can use the physical processor beyond the limit in the current scheduling period includes: Calculate the product of the expansion multiple and the limited usage time as the total time that the virtual processor can use the physical processor in the current scheduling cycle; the expansion multiple is equal to the target number divided by the first number; A first difference between the total duration and the restricted usage duration is calculated as the second duration, and the second duration is obtained from the first duration.

4. The method according to claim 2, characterized in that: Other containers are deployed on the host machine where the secure container is located, and the secure container shares the physical processor with the other containers; the method further includes: When the load of the virtual processor of the secure container meets the set high load condition, reducing the scheduling weight of the secure container to obtain the target scheduling weight of the secure container; Determining, according to the scheduling weights of the other containers and the target scheduling weights of the secure container, a third duration for the secure container to use the physical processor in the current scheduling cycle; the target scheduling weight is less than the scheduling weights of the other containers; If the third duration is greater than the restricted usage duration corresponding to the safety container, the second duration is determined according to a second difference between the third duration and the restricted usage duration.

5. The method according to claim 4, characterized in that The method further comprises: Calculate the product of the expansion multiple and the limited usage time as the total time that the security container can use the physical processor in the current scheduling cycle; the expansion multiple is equal to the target number divided by the first number; Calculating a first difference between the total duration and the restricted usage duration; The determining the second duration according to a second difference between the third duration and the restricted usage duration includes: The minimum value between the first difference and the second difference is selected as the second duration.

6. The method according to claim 2, characterized in that The time for allocating the target duration to the target number of virtual processor cores includes: Taking the sum of the time allocated to the target number of virtual processor cores equal to the target duration as a constraint condition, determining the duration to be allocated corresponding to each of the target number of virtual processor cores according to the resource requirements of the tasks executed by each virtual processor core in the current scheduling cycle; A corresponding time to be allocated is allocated to each virtual processor core, so as to allocate a total of a target time to the target number of virtual processor cores.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: For the previous scheduling cycle of the current scheduling cycle, if the total time consumed by the target number of virtual processor cores to complete tasks in the previous scheduling cycle reaches the limited usage time corresponding to the security container, it is determined that the load of the virtual processor of the security container meets the set high load condition.

8. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Obtaining a container creation request, where the container creation request is used to request the creation of the secure container, and the container creation request includes a resource request amount and a resource limit amount; Determine the number of virtual processor cores of the virtual processor according to the resource request amount and the resource limit amount as the first number; Expanding the first quantity to obtain the target quantity; A virtual machine instance is created on a host machine according to the target number of virtual processor cores; and the secure container is created on the virtual machine instance so that the virtual processor of the secure container has the target number of virtual processor cores.

9. The method according to claim 8, characterized in that The container creation request further includes: an expansion multiple; the expansion multiple is greater than 1; The step of expanding the first quantity to obtain the target quantity includes: The first quantity is expanded according to the expansion multiple to obtain the target quantity.

10. The method according to claim 8, characterized in that Also includes: In response to the secure container's access operation to the processor information, a resource view of the first number of virtual processor cores is provided to the secure container.

11. The method according to claim 10, characterized in that In response to the secure container accessing the processor information, providing the secure container with a resource view of the first number of virtual processor cores, comprising: In response to the secure container accessing the processor information, determining a first bitmap corresponding to the target number of virtual processor cores; one bit of the first bitmap corresponds to one virtual processor core; According to the expansion multiple, the first bitmap is modified into a second bitmap; the number of target bits in the second bitmap is equal to the first number; the target bit refers to the bit representing the corresponding virtual processor core; the expansion multiple is equal to the target number divided by the first number; The second bitmap is provided to the secure container to provide the secure container with a resource view of the first number of virtual processor cores.

12. The method according to claim 11, characterized in that Also includes: In response to a processor binding operation of the secure container, obtaining a target virtual processor core to be bound and a process to be bound to the processor binding operation; According to the expansion multiple, determine the expansion multiple bits corresponding to the target bit corresponding to the target virtual processor core in the first bitmap; The process to be bound is bound to the virtual processor core corresponding to the expansion multiple bits.

13. A container creation method, characterized in that: include: Obtain a container creation request, where the container creation request is used to request the creation of a secure container, and the container creation request includes a resource request amount and the resource limit amount; Determine, according to the resource request amount and the resource limit amount, the number of virtual processor cores of the secure container as a first number; Expanding the first quantity to obtain a target quantity; Creating a virtual machine instance on the host machine according to the target number of virtual processor cores; The secure container is created on the virtual machine instance to utilize the target number of virtual processor cores to consume the previously accumulated unconsumed processor time of the secure container to execute tasks when the load of the virtual processor of the secure container meets the high load condition.

14. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store a computer program; The processor is coupled to the memory and configured to execute the computer program to perform the steps of the method according to any one of claims 1 to 13.

15. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the method according to any one of claims 1 to 13.

16. A computer program product, characterized in that The method comprises a computer program which, when executed by one or more processors, causes the one or more processors to execute the steps of the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Rolling resource credits for scheduling of virtual computer resources

    CN111176796A

  • Virtual machine resource extension method and device and related equipment

    CN112463297A

  • Resource scheduling method, device, storage medium and system

    CN116400999A

  • Secure resource pool method and system for containerization deployment

    CN117032896A

  • Virtual machine configuration method and device, equipment and storage medium

    CN117170819A

Cited By

  • Processor time scheduling and container creation method, device, medium, and program product

    WO2026092160A1