CPU cache allocation method, apparatus, device, storage medium and program product
By establishing an instance set in the cloud platform and adjusting CPU cache allocation based on cache hit rate, the problem of not being able to allocate CPU cache on demand in existing technologies is solved, thereby improving task processing capabilities and resource utilization efficiency.
Patent Information
- Application Number
- PCT/CN2025/109011
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-07-23
- Filing Date
- 2025-07-17
- Publication Date
- 2026-01-29
AI Technical Summary
Existing cloud platforms cannot allocate CPU cache on demand, resulting in low processing capacity for tasks on instances.
By establishing an instance set, sending information to the server to indicate exclusive CPU cache allocation, and adjusting cache allocation based on the instance's cache hit rate, on-demand allocation of CPU cache is achieved.
It improves the processing capacity of the corresponding tasks of the instance and increases the utilization efficiency of CPU cache resources.
Smart Images

Figure CN2025109011_29012026_PF_FP_ABST
Abstract
Description
CPU cache allocation method, device, equipment, storage medium and program product
[0001] Cross-reference to Related Applications
[0002] The present disclosure claims priority to Chinese Patent Application No. 202410987298.3, filed on July 23, 2024 in China, the entire contents of which are incorporated herein by reference. TECHNICAL FIELD
[0003] The present disclosure relates to the technical field of wireless cloud technology, and particularly relates to a CPU cache allocation method, device, equipment, storage medium and program product. BACKGROUND
[0004] The emergence of central processing unit (CPU) cache is mainly to solve the contradiction between the CPU operation speed and the memory read-write speed. Because the CPU operation speed is much faster than the memory read-write speed, the CPU will spend a long time waiting for data to come or writing data into the memory. Referring to FIG. 1, there are usually three levels of caches in the CPU, namely L1, L2 and L3 caches. Each CPU core of each CPU has its own L1 cache. According to different design schemes, the L2 cache can be unique to each CPU or shared by multiple CPU cores. And the L3 cache is shared by all CPU cores on a CPU.
[0005] The existing cloud platform uses a CPU cache sharing mode of multiple tasks to use the CPU cache. This mode cannot allocate the CPU cache to a certain instance in the cloud platform as needed, thereby causing the problem of low processing capacity of the instance corresponding task. SUMMARY
[0006] The purpose of the present disclosure is to provide a CPU cache allocation method, device, equipment, storage medium and program product to solve the problem that the CPU cache cannot be allocated to a certain instance in the cloud platform as needed, thereby causing the problem of low processing capacity of the instance corresponding task.
[0007] To achieve the above purpose, in a first aspect, the present disclosure provides a CPU cache allocation method applied to a cloud platform management device, comprising:
[0008] Based on the received instance establishment request, a first instance set is established;
[0009] The first information is sent to the server, and the first information is used to indicate that the first instance set requests CPU cache exclusive and indicate that the first cache needs to be allocated to the first instance set.
[0010] In some embodiments, the method further comprises:
[0011] obtaining a cache hit rate of each instance in the first instance set;
[0012] in the case that the first instance exists, instructing the server to increase the cache occupied by the first instance, the cache hit rate of the first instance being less than a first threshold value;
[0013] in the case that the second instance exists, instructing the server to decrease the cache occupied by the second instance, the cache hit rate of the second instance being greater than a second threshold value, the second threshold value being greater than the first threshold value.
[0014] In some embodiments, the instructing the server to increase the cache occupied by the first instance comprises:
[0015] instructing the server to increase the cache occupied by the first instance by M cache units, M being calculated according to the cache hit rate of the first instance and the first threshold value, and M > 0.
[0016] In some embodiments, the instructing the server to decrease the cache occupied by the second instance comprises:
[0017] instructing the server to decrease the cache occupied by the second instance by N cache units, N being calculated according to the cache hit rate of the second instance and the second threshold value, and N > 0.
[0018] In some embodiments, the method further comprises:
[0019] receiving second information and third information reported by the server; or,
[0020] obtaining second information and third information from the server;
[0021] wherein the second information is used to indicate whether the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances and to indicate cache information of the CPU to which the server belongs;
[0022] the third information is used to indicate whether the CPU cache exclusive function is in an enabled state.
[0023] In some embodiments, the method further comprises:
[0024] in the case that the second information indicates that the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances and the third information indicates that the CPU cache exclusive function is in the enabled state, determining the first cache to be allocated to the first instance set according to the cache information of the CPU to which the server belongs.
[0025] In some embodiments, the method further comprises:
[0026] obtaining a cache hit rate of a third instance, the cache allocation mode of the third instance being a shared cache allocation mode;
[0027] in a case where the cache hit rate of the third instance is less than a third threshold, instructing the server to reduce cache allocation for the first instance set.
[0028] In some embodiments, the instructing the server to reduce cache allocation for the first instance set comprises:
[0029] instructing the server to reduce cache size for a fourth instance in the first instance set; or,
[0030] instructing the server to reduce cache size for each instance in the first instance set, and the cache size reduced for each instance being the same; or,
[0031] instructing the server to reduce cache size for a target instance in the first instance set, the target instance being determined based on a preset algorithm and being one or more.
[0032] In some embodiments, the method further comprises:
[0033] obtaining a cache hit rate of a fifth instance, the cache allocation mode of the fifth instance being a shared cache allocation mode;
[0034] in a case where the first instance exists and the cache hit rate of the fifth instance is less than a third threshold, instructing the server to reduce cache allocation for the first instance set.
[0035] In a second aspect, the disclosure also provides a CPU cache allocation method applied to a server, comprising:
[0036] receiving first information sent by a cloud platform management device, the first information being used to indicate that the first instance set requests CPU cache exclusivity and to indicate first cache that needs to be allocated to the first instance set;
[0037] based on the indication of the first information, allocating the first cache that needs to be exclusively allocated to the first instance set.
[0038] In some embodiments, the method further comprises:
[0039] reporting second information and third information to the cloud platform management device; or,
[0040] based on a request of the cloud platform management device, sending second information and third information to the cloud platform management device;
[0041] The second information is used to indicate whether the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances and to indicate cache information of the CPU to which the server belongs.
[0042] The third information is used to indicate whether the CPU cache exclusive function is in an enabled state.
[0043] In some embodiments, in a case where a proportion of cache of the CPU to which the server belongs that is exclusively allocated is less than a fourth threshold value, the second information is used to indicate that the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances.
[0044] In a third aspect, the present disclosure further provides a CPU cache allocation apparatus, comprising:
[0045] A first processing module is configured to establish a first instance set based on a received instance establishment request.
[0046] A first sending module is configured to send first information to a server, the first information being used to indicate that the first instance set requests CPU cache exclusively and to indicate first cache that needs to be allocated to the first instance set.
[0047] In a fourth aspect, the present disclosure further provides a cloud platform management device, comprising a processor and a transceiver, the transceiver being controlled by the processor to receive and send data, and the processor being configured to perform the following operations:
[0048] establish a first instance set based on a received instance establishment request;
[0049] send first information to a server, the first information being used to indicate that the first instance set requests CPU cache exclusively and to indicate first cache that needs to be allocated to the first instance set.
[0050] In a fifth aspect, the present disclosure further provides a cloud platform management device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; the processor implements the CPU cache allocation method of the first aspect when executing the program.
[0051] In a sixth aspect, the present disclosure further provides a CPU cache allocation apparatus, comprising:
[0052] A first receiving module is configured to receive first information sent by a cloud platform management device, the first information being used to indicate that a first instance set requests CPU cache exclusively and to indicate first cache that needs to be allocated to the first instance set.
[0053] A cache allocation module is configured to allocate first cache that needs to be exclusively allocated to the first instance set based on the indication of the first information.
[0054] In a seventh aspect, the present disclosure provides a server, comprising a processor and a transceiver, the transceiver receiving and sending data under the control of the processor, and the processor being configured to perform the following operations:
[0055] receiving first information sent by a cloud platform management device, the first information being used to indicate that the first instance set requests CPU cache exclusive and to indicate first cache needed to be allocated to the first instance set;
[0056] allocating the first cache needed to be exclusive to the first instance set based on the indication of the first information.
[0057] In an eighth aspect, the present disclosure provides a server, comprising a memory, a processor and a program stored in the memory and executable on the processor; the processor executes the program to implement the CPU cache allocation method of the second aspect.
[0058] In a ninth aspect, the present disclosure provides a computer readable storage medium, having a computer program stored thereon, the program being executable by a processor to implement the steps of the CPU cache allocation method of the first aspect, or to implement the steps of the CPU cache allocation method of the second aspect.
[0059] In a tenth aspect, the present disclosure provides a computer program product, comprising computer instructions, the computer instructions being executable by a processor to implement the steps of the CPU cache allocation method of the first aspect, or to implement the steps of the CPU cache allocation method of the second aspect.
[0060] The above technical solutions of the present disclosure have at least the following beneficial effects:
[0061] In the embodiments of the present disclosure, the first instance set is established based on the received instance establishment request, and then the first information is sent to the server, the first information being used to indicate that the first instance set requests CPU cache exclusive and to indicate first cache needed to be allocated to the first instance set, so that the server can allocate the first cache needed to be exclusive to the first instance set based on the indication of the first information, which can realize on-demand allocation of CPU cache according to actual conditions and improve the processing capability of the instance corresponding task. BRIEF DESCRIPTION OF DRAWINGS
[0062] FIG. 1 shows a schematic diagram of a CPU cache;
[0063] FIG. 2 shows a flowchart of a CPU cache allocation method according to an embodiment of the present disclosure;
[0064] FIG. 3 shows a flowchart of a CPU cache allocation method according to another embodiment of the present disclosure;
[0065] Figure 4 shows a third flowchart of the CPU cache allocation method according to an embodiment of the present disclosure;
[0066] Figure 5 shows a first block diagram of the CPU cache allocation apparatus according to an embodiment of the present disclosure;
[0067] Figure 6 shows a hardware structure diagram of the cloud platform management device according to an embodiment of the present disclosure;
[0068] Figure 7 shows a second block diagram of the CPU cache allocation apparatus according to an embodiment of the present disclosure;
[0069] Figure 8 shows a hardware structure diagram of the server according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0070] To make the technical problems, technical solutions and advantages of the present disclosure clearer, specific embodiments will be described in detail below with reference to the accompanying drawings.
[0071] The capacity of CPU cache is much smaller than that of memory, but the exchange speed is much faster than that of memory. As shown in Figure 1, there are three levels of cache in the CPU, i.e. L1, L2 and L3 cache. Among them, L1 cache is divided into data cache and instruction cache, and the CPU first obtains instructions and data from L1 cache. If L1 cache does not exist, it is obtained from L2 cache. If the data is not in L2 cache, it is obtained from L3 cache. If the data is not in L3 cache, it is obtained from memory.
[0072] In the existing cloud platform, a single task cannot currently apply for a segment of exclusive (or exclusive) CPU cache. More commonly, multiple tasks share CPU cache to use CPU cache. This method cannot allocate CPU cache to a certain instance in the cloud platform as needed, thereby causing the problem of low processing capacity of the instance corresponding to the task.
[0073] To solve the above technical problems, the present disclosure provides a CPU cache allocation method, apparatus, device, storage medium and program product. The method and the apparatus are based on the same application concept. Since the principles of the method and the apparatus for solving problems are similar, the implementation of the apparatus and the method can be mutually referred to, and the repeated parts will not be described again.
[0074] As shown in Figure 2, a flowchart of the CPU cache allocation method provided by an embodiment of the present disclosure is shown. The method is applied to a cloud platform management device, i.e. the method is executed by the cloud platform management device. The method comprises:
[0075] Step 201, based on the received instance establishment request, establishing a first instance set;
[0076] The step 201 can specifically include that the cloud platform management device receives an instance establishment request sent by the third network element, and establishes the first instance set based on the received instance establishment request.
[0077] The instance referred to in the present application refers to one of a virtual machine instance, a container instance, a thread instance, and an application instance, and is uniformly referred to as an instance.
[0078] The step 202 sends first information to a server, where the first information is used to indicate that the first instance set requests CPU cache exclusive and indicates first cache that needs to be allocated to the first instance set.
[0079] Here, the cloud platform management device pre-stores cache information of CPUs to which each server belongs (that is, cache occupation of CPUs to which each server belongs), where the cache information of CPUs to which each server belongs can be reported to the cloud platform management device by each server. The cache information of CPUs to which each server belongs can be stored in the form of a CPU cache list. The first cache that needs to be allocated to the first instance set is determined by the cache information of CPUs to which each server belongs.
[0080] Where the first instance set is composed of instances T1, T2,..., and Tn, respectively needs to exclusively occupy X1, X2,..., and Xn bytes of CPU cache (that is, the first cache that needs to be allocated to the first instance set), and a total of X1+X2+…+Xn bytes of CPU cache is applied. It should be noted that cache exclusive is applicable to all levels of CPU cache.
[0081] The method of the embodiment of the present disclosure can make the server allocate the first cache that can be exclusively occupied to the first instance set based on the indication of the first information, and further can realize on-demand allocation of CPU cache according to actual conditions, and improve the processing capability of the instance corresponding task.
[0082] In an optional embodiment, the method of the present disclosure further includes:
[0083] 1) Obtain the cache hit rate of each instance in the first instance set;
[0084] Where the cache hit rate refers to the proportion of data that can be found by the CPU when accessing the cache. That is, the cache hit rate is the CPU cache hit rate. It should be understood that the cache hit rate of the instance refers to the proportion of data that can be found by the CPU when accessing the cache allocated to the instance. The cache hit rate of the instance can be obtained after the instance is actually run. For each instance in the first instance set, the cache hit rate of the instance in the past T time period is obtained after the instance is actually run for a period of time.
[0085] 2) in the presence of a first instance, instructing the server to increase the cache occupied by the first instance, the cache hit rate of the first instance being less than a first threshold value;
[0086] Here, the cache hit rate of the first instance being less than the first threshold value means that the first instance meeting the condition is allocated less cache, and the cache occupied by the first instance needs to be increased.
[0087] Further, in the step 2), instructing the server to increase the cache occupied by the first instance comprises:
[0088] Instructing the server to increase the cache occupied by the first instance by M cache units, M being calculated according to the cache hit rate of the first instance and the first threshold value, and M>0.
[0089] Let the first threshold value be A, and the cache hit rate of the first instance be Rm. When Rm
[0090] 3) in the presence of a second instance, instructing the server to reduce the cache occupied by the second instance, the cache hit rate of the second instance being greater than a second threshold value, the second threshold value being greater than the first threshold value.
[0091] Here, the cache hit rate of the second instance being greater than the second threshold value means that the second instance meeting the condition is allocated more cache, and the cache occupied by the second instance needs to be reduced.
[0092] Further, in the step 3), instructing the server to reduce the cache occupied by the second instance comprises:
[0093] Instructing the server to reduce the cache occupied by the second instance by N cache units, N being calculated according to the cache hit rate of the second instance and the second threshold value, and N>0.
[0094] Let the second threshold value be B, and the cache hit rate of the second instance be Rn. When Rn
[0095] It should be noted that the increased and reduced cache can be in units of bytes or in units of cache lines.
[0096] The embodiment can dynamically adjust the cache allocated to the instance according to the running condition of the instance through the above processing, so that the cache resources can be efficiently utilized, and the CPU data operation efficiency is improved. In the embodiment, the cache allocated to the instance is adjusted based on the cache hit rate of the instance. Similarly, the cache allocated to the instance can also be adjusted based on the cache missing rate of the instance, which can also be referred to as the cache miss rate. Specifically as follows:
[0097] Obtaining the cache missing rate of each instance in the first instance set;
[0098] In the case where the sixth instance exists, instructing the server to increase the cache occupied by the sixth instance, the cache missing rate of the sixth instance being greater than a fifth threshold value;
[0099] In the case where the seventh instance exists, instructing the server to reduce the cache occupied by the seventh instance, the cache missing rate of the seventh instance being less than a sixth threshold value, the sixth threshold value being less than the fifth threshold value.
[0100] In an optional embodiment, the method of the present disclosure further comprises:
[0101] Receiving the second information and the third information reported by the server; or,
[0102] Obtaining the second information and the third information from the server;
[0103] The second information is used to indicate whether the server belongs to a CPU having the function of allocating CPU cache exclusively to the instance and to indicate the cache information of the CPU to which the server belongs.
[0104] The third information is used to indicate whether the CPU cache exclusive function is in an open state.
[0105] That is, the server will actively report the second information and the third information to the cloud platform management device, or the cloud platform management device can actively (by sending a request) obtain the second information and the third information from the server side. The second information is used to indicate whether the server belongs to a CPU having the function of allocating CPU cache exclusively (or not sharing cache) to the instance and to indicate the cache information of the CPU to which the server belongs. That is, the server will actively report the cache information of the CPU to which the server belongs to the cloud platform management device, specifically the cache size of each CPU core in each CPU.
[0106] Further, the method of the present disclosure further comprises:
[0107] In a case where the second information indicates that the CPU to which the server belongs has a function of allocating CPU cache exclusively to instances, and the third information indicates that the CPU cache exclusive function is in an open state, a first cache required to be allocated to the first instance set is determined according to cache information of the CPU to which the server belongs.
[0108] It should be noted that the cloud platform management device establishes a CPU cache list for storing cache information of the CPU to which the server belongs, that is, storing the CPU cache occupation situation.
[0109] In a case where the indication of the second information and the third information meets the corresponding condition, the cloud platform management device determines the first cache required to be allocated to the first instance set based on the cache information of the CPU to which the server belongs, so as to instruct the server side to allocate the cache exclusively to the first instance set, thereby improving the processing capability of the instance corresponding task.
[0110] The first threshold and the second threshold form a cache hit rate range interval, and any operation is not performed on the first instance set falling into the cache hit rate range interval [A, B].
[0111] In an optional embodiment, the method of the present disclosure further comprises:
[0112] The cache hit rate range interval is obtained by one of the following methods:
[0113] Autonomously setting;
[0114] Artificial intelligence AI generation;
[0115] Input of other network elements.
[0116] That is, the cache hit rate range interval can be autonomously set by the cloud platform management device, or generated by means such as big data AI technology, or obtained by input of other network elements.
[0117] In an optional embodiment, the method of the present disclosure further comprises:
[0118] Obtaining a cache hit rate of a third instance, the cache allocation mode of the third instance being a shared cache allocation mode;
[0119] In a case where the cache hit rate of the third instance is less than a third threshold, instructing the server to reduce cache allocation for the first instance set.
[0120] In the embodiment, the third instance is distinguished from the instances in the first instance set, the cache allocation mode of the third instance is the shared cache (non-exclusive cache) allocation mode, when the cache hit rate of the third instance is less than the third threshold value, it indicates that the CPU cache currently allocated to the third embodiment is less, in order to ensure the processing capacity of the third instance corresponding to the business, and realize the balance of shared cache and exclusive cache, instruct the server to reduce the cache allocation for the first instance set, that is, reduce the cache size of the exclusive cache instance.
[0121] Further, instructing the server to reduce the cache allocation for the first instance set comprises:
[0122] Instructing the server to reduce the cache size of the fourth instance in the first instance set; here, the fourth instance is an instance in the first instance set, which can be a certain specific instance. Or,
[0123] Instructing the server to reduce the cache size of each instance in the first instance set, and the cache size reduced by each instance is the same; or,
[0124] Instructing the server to reduce the cache size of the target instance in the first instance set, the target instance is determined based on a preset algorithm, and is one or more.
[0125] It should be noted that the third threshold value can be set by the cloud platform management device, or generated by big data AI technology or other means, or obtained by input of other network elements.
[0126] Corresponding to the case that the cache hit rate of the first instance in the first instance set is less than the first threshold value, in an optional embodiment, the method of the present disclosure further comprises:
[0127] Obtaining the cache hit rate of the fifth instance, the cache allocation mode of the fifth instance is the shared cache allocation mode;
[0128] In the case that the first instance exists and the cache hit rate of the fifth instance is less than the third threshold value, instructing the server to reduce the cache allocation for the first instance set.
[0129] That is, when the cache hit rate of the first instance in the exclusive cache allocation mode is less than the first threshold value and the cache hit rate of the fifth instance in the shared cache allocation mode is less than the third threshold value, both cases exist at the same time, then the operation of increasing the cache occupied by the first instance is not considered, that is, the balance mechanism of shared cache and exclusive cache is preferred, and the operation of instructing the server to reduce the cache allocation for the first instance set is executed.
[0130] In order to provide accurate reference basis for subsequent instance cache allocation, after the business processing corresponding to the first instance set is completed, the method of the present disclosure further comprises:
[0131] The cache information of the CPU to which the server belongs is recorded and updated. That is, the cache usage (occupied) of each CPU on the server is recorded and updated.
[0132] As shown in FIG. 3, a flowchart of the CPU cache allocation method provided by the embodiment of the present disclosure is shown. The method is applied to a server, that is, the method is executed by the server. The method comprises:
[0133] Step 301: receiving first information sent by a cloud platform management device, the first information being used to indicate that the first instance set requests CPU cache exclusive and to indicate first cache that needs to be allocated to the first instance set;
[0134] The first instance set is composed of instances T1, T2,..., Tn, which need to exclusively occupy X1, X2,..., Xn bytes of CPU cache (i.e., the first cache that needs to be allocated to the first instance set), and the total amount of CPU cache applied is X1+X2+…+Xn bytes. It should be noted that cache exclusive is applicable to all levels of CPU cache.
[0135] Step 302: allocating the first cache that needs to be exclusively occupied for the first instance set based on the indication of the first information.
[0136] That is, the server provides CPU cache of X1, X2,..., Xn bytes that needs to be exclusively occupied, i.e., the first cache, according to the indication of the first information.
[0137] It should be noted that the method executed by the server side corresponds to the method executed by the cloud platform management device side.
[0138] The CPU cache allocation method of the embodiment of the present disclosure can realize on-demand allocation of CPU cache according to actual conditions by receiving first information sent by a cloud platform management device, the first information being used to indicate that the first instance set requests CPU cache exclusive and to indicate first cache that needs to be allocated to the first instance set, and allocating the first cache that needs to be exclusively occupied for the first instance set based on the indication of the first information, thereby improving the processing capability of the instance corresponding task.
[0139] In an optional embodiment, the method of the present disclosure further comprises:
[0140] reporting second information and third information to the cloud platform management device; or,
[0141] sending second information and third information to the cloud platform management device based on the request of the cloud platform management device;
[0142] The second information is used to indicate whether the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances and to indicate cache information of the CPU to which the server belongs.
[0143] The third information is used to indicate whether the CPU cache exclusive function is in an open state.
[0144] That is, the server actively reports the second information and the third information to the cloud platform management device, or provides the second information and the third information to the cloud platform management device through a request sent by the cloud platform management device. The second information is used to indicate whether the CPU to which the server belongs has the function of allocating CPU cache exclusively (or non-shared cache) to instances and to indicate cache information of the CPU to which the server belongs. That is, the server actively reports the cache information of the CPU to which the server belongs to the cloud platform management device, and specifically reports the cache size of each CPU core in each CPU.
[0145] Here, the server provides the second information and the third information to the cloud platform management device, and the purpose is to assist the cloud platform management device in determining the first cache to be allocated to the first instance set.
[0146] Optionally, in a case where the proportion of the cache of the CPU to which the server belongs that is exclusively allocated is less than a fourth threshold value, the second information is used to indicate that the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances.
[0147] That is, when the server determines that the cache of 1 physical CPU is exclusively allocated by a certain proportion H% (the proportion of cache that is exclusively allocated is greater than or equal to H%), the second information reported to the cloud platform management device indicates that the CPU to which the server belongs does not have the function of allocating CPU cache exclusively (or non-shared cache) to instances. Conversely, the second information reported to the cloud platform management device indicates that the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances. This provides a reference basis for the cloud platform management device side whether to apply for deploying an instance with exclusive cache on the corresponding CPU.
[0148] In an optional embodiment, the method of the present disclosure further includes:
[0149] detecting a cache hit rate of each instance in the first instance set in a historical time period in which the instance runs;
[0150] reporting the cache hit rate of each instance in the first instance set to the cloud platform management device.
[0151] The embodiment can assist the cloud platform management device to dynamically adjust the cache allocated to the instance according to the running condition of the instance by periodically detecting the cache hit rate of each instance in the first instance set and reporting the cache hit rate to the cloud platform management device.
[0152] Referring to FIG. 4, by way of an example, a specific implementation process of the method of the present disclosure is described from the perspective of inter-device interaction. In FIG. 4, the first network element refers to a server, and the second network element refers to a cloud platform management device.
[0153] In step 401, the server reports information A to the cloud platform management device when accessing the cloud platform management device, or the cloud platform management device actively applies for obtaining information A. Information A indicates whether the CPU to which the server belongs has the function of allocating CPU cache exclusively (or not sharing cache) to an instance. The server also reports the cache size of each CPU core in each CPU.
[0154] In step 402, each server (operating system) reports or the cloud platform management device obtains information B from the server. Information B indicates whether the CPU cache exclusive function is in an open state or a closed state.
[0155] In step 403, the cloud platform management device establishes a CPU cache list for storing the occupied state of the CPU cache.
[0156] In step 404, a threshold value H is set, 0 < H ≤ 100. When the cloud platform management device determines that the cache of one physical CPU is exclusively occupied by a certain percentage H%, the cloud platform management device will not continue to apply for deploying an instance that exclusively occupies cache on the physical CPU.
[0157] Alternatively, when the server determines that the cache of one physical CPU is exclusively occupied by a certain percentage H% (the cache exclusive occupation percentage is greater than or equal to H%), the information A reported to the cloud platform management device indicates that the CPU to which the server belongs does not have the function of allocating CPU cache exclusively (or not sharing cache) to an instance.
[0158] In step 405, the cloud platform management device receives an instance establishment request sent by the third network element, establishes a virtual machine / container instance (hereinafter referred to as an instance), and sends information C to the server. Information C indicates that the server considers the CPU cache exclusive function when establishing an instance. The instance T1, T2,..., and Tn are composed of X1, X2,..., and Xn bytes of CPU cache that need to be exclusively occupied. A total of X1+X2+……+Xn bytes of CPU cache are applied.
[0159] In step 406, a range interval [A, B] of cache hit rate is set. The range interval can be set by the cloud platform management device, generated by big data AI technology, or input by other network elements (such as the fourth network element in the figure).
[0160] Step 407, the cloud platform management device adjusts the cache size occupied by each instance according to the cache hit rate.
[0161] Specifically, the cloud platform management device obtains the cache hit rates R1, R2…Rn of each instance in the past T time period (the specific implementation can be that the server periodically detects the cache hit rates R1, R2…Rn of each instance in the past T time period and reports to the cloud platform management device), if Rm (1≤m≤n) is in the range interval [A, B], no operation is performed. If Rm<A, increase the cache occupied by Tm instances, increase |(A-Rm) / k| cache units, and k is a coefficient. If Rm>B, reduce the cache occupied by Tm instances, reduce |(B-Rm) / k| cache units, and k is a coefficient. The increased and reduced cache can be in units of bytes or in units of cache lines.
[0162] Step 408, the cloud platform management device records and updates the CPU cache usage of the server to which the cloud platform management device belongs.
[0163] As shown in FIG. 5, the embodiment of the disclosure also provides a CPU cache allocation apparatus, which comprises:
[0164] The first processing module 501 is configured to establish a first instance set based on the received instance establishment request.
[0165] The first sending module 502 is configured to send first information to the server, wherein the first information is used to indicate that the first instance set requests CPU cache exclusive and indicate the first cache to be allocated to the first instance set.
[0166] In some embodiments, the apparatus of the embodiment of the disclosure further comprises:
[0167] The first obtaining module is configured to obtain the cache hit rate of each instance in the first instance set.
[0168] The second processing module is configured to, in the case that the first instance exists, instruct the server to increase the cache occupied by the first instance, and the cache hit rate of the first instance is less than a first threshold value.
[0169] The third processing module is configured to, in the case that the second instance exists, instruct the server to reduce the cache occupied by the second instance, and the cache hit rate of the second instance is greater than a second threshold value, and the second threshold value is greater than the first threshold value.
[0170] In some embodiments, the second processing module comprises:
[0171] The first processing unit is configured to instruct the server to increase the cache occupied by the first instance by M cache units, where M is calculated according to the cache hit rate of the first instance and the first threshold, and M>0.
[0172] In some embodiments, the third processing module comprises:
[0173] The second processing unit is configured to instruct the server to decrease the cache occupied by the second instance by N cache units, where N is calculated according to the cache hit rate of the second instance and the second threshold, and N>0.
[0174] In some embodiments, the apparatus of the embodiments of the present disclosure further comprises:
[0175] The second receiving module is configured to receive second information and third information reported by the server; or,
[0176] The second obtaining module is configured to obtain second information and third information from the server.
[0177] The second information is used to indicate whether the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances and to indicate cache information of the CPU to which the server belongs.
[0178] The third information is used to indicate whether the CPU cache exclusive function is in an enabled state.
[0179] In some embodiments, the apparatus of the embodiments of the present disclosure further comprises:
[0180] The fourth processing module is configured to, in a case where the second information indicates that the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances and the third information indicates that the CPU cache exclusive function is in the enabled state, determine the first cache that needs to be allocated to the first instance set according to the cache information of the CPU to which the server belongs.
[0181] In some embodiments, the apparatus of the embodiments of the present disclosure further comprises:
[0182] The third obtaining module is configured to obtain the cache hit rate of a third instance, where the cache allocation mode of the third instance is a shared cache allocation mode.
[0183] The fifth processing module is configured to, in a case where the cache hit rate of the third instance is less than a third threshold, instruct the server to decrease the cache allocation for the first instance set.
[0184] In some embodiments, the fifth processing module comprises:
[0185] a third processing unit, configured to instruct the server to reduce the cache size of a fourth instance in the first instance set; or
[0186] a fourth processing unit, configured to instruct the server to reduce the cache size of each instance in the first instance set, and the reduced cache size of each instance is the same; or
[0187] a fifth processing unit, configured to instruct the server to reduce the cache size of a target instance in the first instance set, the target instance is determined based on a preset algorithm, and the target instance is one or more.
[0188] In some embodiments, the apparatus of the embodiments of the present disclosure further comprises:
[0189] a fourth obtaining module, configured to obtain a cache hit rate of a fifth instance, the cache allocation mode of the fifth instance being a shared cache allocation mode;
[0190] a sixth processing module, configured to instruct the server to reduce the cache allocation for the first instance set in a case where the first instance exists and the cache hit rate of the fifth instance is less than a third threshold.
[0191] The CPU cache allocation apparatus of the embodiments of the present disclosure establishes a first instance set based on a received instance establishment request, then sends first information to a server, the first information being used to instruct the first instance set to request CPU cache exclusive and to instruct a first cache that needs to be allocated to the first instance set, so that the server can allocate the first cache that can be exclusively occupied to the first instance set based on the instruction of the first information, so that the on-demand allocation of CPU cache can be realized according to actual conditions, and the processing capability of the task corresponding to the instance is improved.
[0192] In order to better achieve the above purpose, as shown in FIG. 6, the embodiments of the present disclosure further provide a cloud platform management device, which comprises a processor 600 and a transceiver 610, the transceiver 610 receives and sends data under the control of the processor 600, and the processor 600 is used to execute the following processes:
[0193] establish a first instance set based on a received instance establishment request;
[0194] send first information to a server, the first information being used to instruct the first instance set to request CPU cache exclusive and to instruct a first cache that needs to be allocated to the first instance set.
[0195] In some embodiments, the processor 600 is further used to:
[0196] obtain a cache hit rate of each instance in the first instance set;
[0197] instructing the server to increase cache occupied by the first instance if the first instance exists, the cache hit rate of the first instance being less than a first threshold value;
[0198] instructing the server to decrease cache occupied by the second instance if the second instance exists, the cache hit rate of the second instance being greater than a second threshold value, the second threshold value being greater than the first threshold value.
[0199] In some embodiments, the processor 600 is further configured to:
[0200] instructing the server to increase cache occupied by the first instance by M cache units, M being calculated according to the cache hit rate of the first instance and the first threshold value, and M>0.
[0201] In some embodiments, the processor 600 is further configured to:
[0202] instructing the server to decrease cache occupied by the second instance by N cache units, N being calculated according to the cache hit rate of the second instance and the second threshold value, and N>0.
[0203] In some embodiments, the processor 600 is further configured to:
[0204] receiving second information and third information reported by the server; or,
[0205] obtaining second information and third information from the server;
[0206] wherein the second information is used to indicate whether the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances and to indicate cache information of the CPU to which the server belongs.
[0207] the third information is used to indicate whether the CPU cache exclusive function is in an enabled state.
[0208] In some embodiments, the processor 600 is further configured to:
[0209] if the second information indicates that the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances and the third information indicates that the CPU cache exclusive function is in an enabled state, determining the first cache that needs to be allocated to the first instance set according to the cache information of the CPU to which the server belongs.
[0210] In some embodiments, the processor 600 is further configured to:
[0211] obtaining a cache hit rate of a third instance, the cache allocation mode of the third instance being a shared cache allocation mode;
[0212] in a case where the cache hit rate of the third instance is less than a third threshold, instructing the server to reduce cache allocation for the first instance set.
[0213] In some embodiments, the processor 600 is further configured to:
[0214] instruct the server to reduce cache size for a fourth instance in the first instance set; or,
[0215] instruct the server to reduce cache size for each instance in the first instance set, and the reduced cache size of each instance is the same; or,
[0216] instruct the server to reduce cache size for a target instance in the first instance set, the target instance is determined based on a preset algorithm, and the target instance is one or more.
[0217] In some embodiments, the processor 600 is further configured to:
[0218] obtain a cache hit rate of a fifth instance, the cache allocation mode of the fifth instance being a shared cache allocation mode;
[0219] in a case where the first instance exists and the cache hit rate of the fifth instance is less than a third threshold, instruct the server to reduce cache allocation for the first instance set.
[0220] The cloud platform management device of the embodiments of the present disclosure establishes a first instance set based on the received instance establishment request, then sends first information to the server, the first information being used to indicate that the first instance set requests CPU cache exclusive and indicate a first cache that needs to be allocated to the first instance set, so that the server can allocate the first cache that can be exclusively occupied to the first instance set based on the indication of the first information, so that the CPU cache can be allocated on demand according to the actual situation, and the processing capability of the instance corresponding task is improved.
[0221] The embodiments of the present disclosure also provide a cloud platform management device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implements each process in the CPU cache allocation method embodiments as described above when executing the program, and achieves the same technical effects. To avoid repetition, it will not be repeated here.
[0222] As shown in FIG. 7, the embodiments of the present disclosure also provide a CPU cache allocation apparatus, which includes:
[0223] The first receiving module 701 is configured to receive first information sent by the cloud platform management device, the first information being used to indicate that the first instance set requests CPU cache exclusive and indicate first cache that needs to be allocated to the first instance set;
[0224] The cache allocation module 702 is configured to allocate the first cache that needs to be exclusive to the first instance set based on the indication of the first information.
[0225] In some embodiments, the apparatus of the embodiments of the present disclosure further includes:
[0226] The second sending module is configured to report second information and third information to the cloud platform management device; or,
[0227] The third sending module is configured to send the second information and the third information to the cloud platform management device based on a request of the cloud platform management device.
[0228] The second information is used to indicate whether the CPU to which the server belongs has the function of allocating CPU cache exclusive to instances and indicate cache information of the CPU to which the server belongs.
[0229] The third information is used to indicate whether the CPU cache exclusive function is in an open state.
[0230] In some embodiments, in a case where the proportion of the cache of the CPU to which the server belongs that is exclusive is less than a fourth threshold value, the second information is used to indicate that the CPU to which the server belongs has the function of allocating CPU cache exclusive to instances.
[0231] The CPU cache allocation apparatus of the embodiments of the present disclosure receives first information sent by the cloud platform management device, the first information being used to indicate that the first instance set requests CPU cache exclusive and indicate first cache that needs to be allocated to the first instance set, and allocates the first cache that needs to be exclusive to the first instance set based on the indication of the first information, so that on-demand allocation of CPU cache can be realized according to actual conditions, and the processing capability of the instance corresponding task is improved.
[0232] In order to better achieve the above-mentioned purpose, as shown in FIG. 8, the embodiments of the present disclosure further provide a server, including a processor 800 and a transceiver 810, the transceiver 810 receives and sends data under the control of the processor 800, and the processor is used to execute the following processes:
[0233] The first information sent by the cloud platform management device is received, the first information being used to indicate that the first instance set requests CPU cache exclusive and indicate first cache that needs to be allocated to the first instance set;
[0234] allocate, for the first instance set, first caches that need to be exclusively occupied based on the indication of the first information.
[0235] In some embodiments, the processor 800 is further configured to:
[0236] report second information and third information to the cloud platform management device; or,
[0237] send, based on a request of the cloud platform management device, second information and third information to the cloud platform management device;
[0238] The second information is used to indicate whether the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances and to indicate cache information of the CPU to which the server belongs.
[0239] The third information is used to indicate whether the CPU cache exclusive function is in an enabled state.
[0240] In some embodiments, in a case where a proportion of the cache of the CPU to which the server belongs that is exclusively occupied is less than a fourth threshold value, the second information is used to indicate that the CPU to which the server belongs has the function of allocating CPU cache exclusively to instances.
[0241] The server of the embodiment of the present disclosure, by receiving first information sent by the cloud platform management device, the first information being used to indicate that the first instance set requests CPU cache exclusively and to indicate first caches that need to be allocated to the first instance set, allocates, for the first instance set, first caches that need to be exclusively occupied based on the indication of the first information, so that on-demand allocation of CPU cache can be realized according to actual conditions, and the processing capability of the instance for the corresponding task is improved.
[0242] The embodiment of the present disclosure further provides a server, including a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implements each process in the CPU cache allocation method embodiment as described above when executing the program, and achieves the same technical effects. To avoid repetition, it will not be repeated here.
[0243] The embodiment of the present disclosure further provides a computer readable storage medium having a computer program stored thereon, the program being executable by a processor to implement each process in the CPU cache allocation method embodiment as described above and achieve the same technical effects. To avoid repetition, it will not be repeated here. The computer readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0244] The embodiment of the present disclosure further provides a computer program product comprising computer instructions, which, when executed by a processor, implement each process of the method embodiment shown in FIG. 2 or FIG. 3, and can achieve the same technical effects. To avoid repetition, details are not described herein.
[0245] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including, but not limited to, disk memory and optical memory, etc.) containing computer usable program code.
[0246] The present application is described with reference to flowcharts and / or block diagrams according to the method, device (system) and computer program product of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams 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 produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device that implements the functions specified in one or more flows or blocks in the flowcharts and / or block diagrams.
[0247] These computer program instructions can also be stored in a computer-readable storage medium that can direct the computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable storage medium produce a paper product including instruction devices that implement the functions specified in one or more flows or blocks in the flowcharts and / or block diagrams.
[0248] These computer program instructions can also be loaded into a computer or other programmable data processing device, so that the computer or other programmable device performs a series of operation steps to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more flows or blocks in the flowcharts and / or block diagrams.
[0249] The above is the preferred embodiment of the present disclosure, and it should be pointed out that for those skilled in the art, without departing from the principles of the present disclosure, a number of improvements and refinements can be made, which should also be considered as the protection scope of the present disclosure.
Claims
1. A CPU cache allocation method, applied to a cloud platform management device, the method comprising: Based on the received instance creation request, create the first instance set; Send a first message to the server, the first message being used to instruct the first instance set to request exclusive CPU cache access and to indicate the first cache that needs to be allocated to the first instance set.
2. The method according to claim 1, further comprising: Get the cache hit rate of each instance in the first instance set; If a first instance exists, instruct the server to increase the cache occupied by the first instance, where the cache hit rate of the first instance is less than a first threshold. In the presence of a second instance, the server is instructed to reduce the cache occupied by the second instance, wherein the cache hit rate of the second instance is greater than a second threshold, and the second threshold is greater than the first threshold.
3. The method according to claim 2, wherein, The instruction to the server to increase the cache occupied by the first instance includes: The server is instructed to increase the cache occupied by the first instance by M cache units, where M is calculated based on the cache hit rate of the first instance and the first threshold, and M > 0.
4. The method according to claim 2, wherein, The instruction to the server to reduce the cache used by the second instance includes: The server is instructed to reduce the cache occupied by the second instance by N cache units, where N is calculated based on the cache hit rate of the second instance and the second threshold, and N > 0.
5. The method according to claim 1, further comprising: Receive the second and third information reported by the server; or, Obtain the second and third information from the server; The second information is used to indicate whether the CPU to which the server belongs has the function of exclusively allocating CPU cache to the instance and to indicate the cache information of the CPU to which the server belongs. The third piece of information is used to indicate whether the CPU cache exclusive function is enabled.
6. The method according to claim 5, further comprising: When the second information indicates that the CPU to which the server belongs has the function of exclusively allocating CPU cache to instances, and the third information indicates that the exclusive CPU cache function is enabled, the first cache to be allocated to the first instance set is determined based on the cache information of the CPU to which the server belongs.
7. The method according to claim 1, further comprising: Obtain the cache hit rate of the third instance, wherein the cache allocation method of the third instance is a shared cache allocation method; If the cache hit rate of the third instance is less than a third threshold, the server is instructed to reduce cache allocation for the first instance set.
8. The method according to claim 7, wherein, The instruction to the server to reduce cache allocation for the first set of instances includes: Instruct the server to reduce the cache size for the fourth instance in the first instance set; or, The server is instructed to reduce the cache size for each instance in the first instance set, with the reduction being the same for each instance; or, The server is instructed to reduce the cache size for target instances in the first instance set, which are determined based on a preset algorithm and consist of one or more instances.
9. The method according to claim 2, further comprising: Obtain the cache hit rate of the fifth instance, wherein the cache allocation method of the fifth instance is a shared cache allocation method; If the first instance exists and the cache hit rate of the fifth instance is less than the third threshold, the server is instructed to reduce cache allocation for the first instance set.
10. A CPU cache allocation method, applied to a server, the method comprising: Receive first information sent by the cloud platform management device, the first information being used to instruct the first instance set to request exclusive CPU cache and to instruct the first cache that needs to be allocated to the first instance set; Based on the indication of the first information, a first cache that needs to be exclusively used is allocated to the first instance set.
11. The method according to claim 10, further comprising: Report the second and third information to the cloud platform management device; or, Based on the request from the cloud platform management device, send the second and third information to the cloud platform management device; The second information is used to indicate whether the CPU to which the server belongs has the function of exclusively allocating CPU cache to the instance and to indicate the cache information of the CPU to which the server belongs. The third piece of information is used to indicate whether the CPU cache exclusive function is enabled.
12. The method according to claim 11, wherein, If the proportion of the CPU cache belonging to the server that is exclusively occupied is less than the fourth threshold, the second information is used to indicate that the CPU belonging to the server has the function of exclusively allocating CPU cache to instances.
13. A CPU cache allocation device, comprising: The first processing module is used to create a first instance set based on the received instance creation request; The first sending module is used to send first information to the server, the first information being used to instruct the first instance set to request exclusive CPU cache access and to instruct the first cache that needs to be allocated to the first instance set.
14. A cloud platform management device, comprising a processor and a transceiver, wherein the transceiver receives and transmits data under the control of the processor, wherein... The processor is used to perform the following operations: Based on the received instance creation request, create the first instance set; Send a first message to the server, the first message being used to instruct the first instance set to request exclusive CPU cache access and to indicate the first cache that needs to be allocated to the first instance set.
15. A cloud platform management device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; wherein, When the processor executes the program, it implements the CPU cache allocation method as described in any one of claims 1 to 9.
16. A CPU cache allocation device, comprising: The first receiving module is used to receive first information sent by the cloud platform management device. The first information is used to instruct the first instance set to request exclusive CPU cache and to instruct the first cache that needs to be allocated to the first instance set. The cache allocation module is used to allocate a first cache that needs to be exclusively used to the first instance set based on the indication of the first information.
17. A server comprising a processor and a transceiver, the transceiver receiving and transmitting data under the control of the processor, wherein, The processor is used to perform the following operations: Receive first information sent by the cloud platform management device, the first information being used to instruct the first instance set to request exclusive CPU cache and to instruct the first cache that needs to be allocated to the first instance set; Based on the indication of the first information, a first cache that needs to be exclusively used is allocated to the first instance set.
18. A server, comprising a memory, a processor, and a program stored in the memory and executable on the processor; wherein, When the processor executes the program, it implements the CPU cache allocation method as described in any one of claims 10 to 12.
19. A computer-readable storage medium having a computer program stored thereon, wherein, When the program is executed by the processor, it implements the steps of the CPU cache allocation method as described in any one of claims 1 to 9, or implements the steps of the CPU cache allocation method as described in any one of claims 10 to 12.
20. A computer program product comprising computer instructions that, when executed by a processor, implement the steps of the CPU cache allocation method as claimed in any one of claims 1 to 9, or implement the steps of the CPU cache allocation method as claimed in any one of claims 10 to 12.
Citation Information
Patent Citations
Cache partitioning in virtualized environments
CN102483718A
Cache space exclusive initialization method and related device
CN110096455A
Atomic operation processing method, equipment, device and storage medium
CN114661428A
Virtualized cache allocation in a virtualized computing system
US20240028361A1