Method, device and equipment for allocating power preserving memory segment
By directly handling the allocation requests for the power-protected memory segment through the first controller, the resource consumption problem caused by the main controller forwarding is solved, and more efficient mseg allocation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DAWNING INFORMATION IND (BEIJING) CO LTD
- Filing Date
- 2024-12-20
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, the allocation efficiency of power-protected memory segments is low, mainly because the main controller node needs to forward requests, which consumes system resources and results in low allocation efficiency.
The first controller directly receives and processes the allocation requests for power-protected memory segments, determines the pre-allocated set of mseg, and directly allocates unused mseg, avoiding the forwarding process of the main controller and improving allocation efficiency.
It saves system resources, improves the allocation efficiency of power-saving memory segments, and ensures the accuracy and performance of mseg allocation.
Smart Images

Figure CN122309099A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus and device for allocating power-saving memory segments. Background Technology
[0002] Power-saving memory is a crucial means of ensuring data integrity in centralized storage systems. Its primary function is to back up user data cached in DDR (Double Data Rate) memory to persistent storage media when the storage device loses power. Then, when power is restored, the backed-up user data is restored to the specified DDR memory.
[0003] As a high-performance, highly available foundational service, the mseg (Memory Segment) management module maintains the power-protected memory space of each controller in the array, providing functions such as power-protected memory allocation, mirroring, status updates, and reclamation on a mseg basis. It requires that the global rotation speed of mseg can support the highest performance target of the flash array, that the module itself does not become a bottleneck in the entire IO (Input / Output) path, and that the reliability of multiple replicas is guaranteed.
[0004] In existing technologies, to achieve high performance in MSEG allocation, the MSEG management module is designed as a master-slave distributed structure, consisting of a master controller node and multiple slave controller nodes. When a user requests MSEG allocation, the user initiates the request to the master controller node, which then forwards the request to each controller node. Alternatively, the user can first obtain worker node routing information from the master controller node and then send a service request to the slave controller nodes. However, both methods require the master controller node to perform forwarding, which consumes additional system resources and results in low efficiency in memory segment allocation. Summary of the Invention
[0005] This invention provides a method for allocating power-protected memory segments, which uses a first controller to allocate power-protected memory segments without requiring a main controller to forward requests and then a slave controller to perform the allocation. This saves system resources and improves the allocation efficiency of power-protected memory segments.
[0006] Firstly, this application provides a method for allocating power-saving memory segments, applied in a server, the server including multiple controllers, the method comprising:
[0007] The first controller receives the allocation request for the power-saving memory segment mseg sent by the user through the first controller, wherein the first controller is any one of the plurality of controllers;
[0008] The first controller determines a pre-allocated set of msegs based on the allocation request, wherein the pre-allocated set of msegs includes multiple pre-allocated first msegs;
[0009] The first controller allocates a first target mseg from the mseg pre-allocation set to the allocation request, wherein the first target mseg is any unused first mseg in the mseg pre-allocation set;
[0010] The first controller uses the first target mseg to store the data corresponding to the allocation request.
[0011] In the above method, the allocation of power-saving memory segments is realized through the first controller, which does not require the main controller to forward the request and then the slave controller to perform the allocation. This saves system resources and improves the allocation efficiency of power-saving memory segments.
[0012] In one possible implementation, the allocation request includes a service type and a current service instance distribution; the current service instance distribution is used to describe the respective functions of each controller in the server.
[0013] The step of determining the mseg pre-allocation set by the first controller according to the allocation request includes:
[0014] The first controller obtains the target index based on the current service instance distribution;
[0015] The first controller determines the target mseg pre-segment set whose index value is the same as the target index in each target mseg pre-segment set as the mseg pre-segment set, wherein each target mseg pre-segment set is obtained using the service type.
[0016] In the above method, the target index is obtained through the current service instance distribution, and then the mseg pre-segmentation set is determined through the target index, which improves retrieval efficiency.
[0017] In one possible implementation, the method further includes:
[0018] If the first target mseg does not exist in the mseg pre-allocation set, the first controller determines whether the allocation request has a target identifier.
[0019] If it exists, the first controller sends a request to the second controller to request the second mseg, the second controller sends the second mseg to the first controller, the first controller allocates the requested second mseg to the allocation request, and uses the second mseg to store the data, wherein the second controller is any one of the other controllers among the plurality of controllers besides the first controller;
[0020] If the application does not exist, the user will be notified of the application failure via the first controller.
[0021] In the above method, a target identifier is set to determine whether the request is mandatory. If so, and there is no MSeg in the pre-allocated set, a second MSeg needs to be requested from the second controller to ensure that the request is executed. This improves the accuracy of allocation.
[0022] In one possible implementation, after allocating the target mseg in the pre-splitting set to the allocation request via the first controller, the method further includes:
[0023] The first controller increments the number of successful mseg allocations by a first specified number to obtain the updated number of successful mseg allocations.
[0024] The first controller increments the total number of mseg allocations by the first specified number to obtain the updated total number of mseg allocations.
[0025] When the updated total number of mseg allocations is greater than the second specified number, the first controller divides the updated number of successful mseg allocations by the updated total number of mseg allocations to obtain the allocation success ratio, wherein the second specified number is greater than the first specified number;
[0026] If the allocation success rate is greater than a first specified threshold, the number of pre-allocated msegs in the mseg pre-allocation set is reduced by the first controller;
[0027] If the allocation success rate is less than the second specified threshold, the number of pre-allocated msegs in the mseg pre-allocation set is increased by the first controller, wherein the second specified threshold is less than the first specified threshold.
[0028] In the above method, the number of mseg in the pre-allocated set is adjusted by the allocation success ratio to ensure that users can obtain mseg directly from their local machine when requesting mseg, thereby improving the allocation performance of mseg.
[0029] In one possible implementation, after dividing the updated number of successful MSEG allocations by the total number of updated MSEG allocations using the first controller to obtain the allocation success ratio, the method further includes:
[0030] The first controller sets the total number of mseg allocations to a preset initial value and the number of successful mseg allocations to the initial value.
[0031] In the above method, by setting the total number of mseg allocations to a preset initial value and the number of successful mseg allocations to the initial value through the first controller, the accuracy of the number of msegs in the subsequent pre-allocation set is ensured.
[0032] In one possible implementation, after allocating the target mseg in the pre-splitting set to the allocation request via the first controller, the method further includes:
[0033] The first controller obtains the current number of msegs in the mseg pre-segmentation set and the total number of msegs in the second controller;
[0034] If the current quantity is less than the preset quantity, and the total number of mseg is greater than the third specified threshold, then the first controller sends a request to the second controller to apply for the first mseg;
[0035] The first controller receives the first mseg sent by the second controller and adds the first mseg to the mseg pre-splitting set.
[0036] In the above method, the number of msegs in the pre-allocation set is adjusted by the current number of msegs in the pre-allocation set and the total number of msegs in the second controller, so as to ensure that users can directly request msegs from their local machine when the total number of msegs is sufficient, thus ensuring allocation performance.
[0037] In one possible implementation, after receiving the allocation request for the power-saving memory segment mseg sent by the user through the first controller, the method further includes:
[0038] Obtain the first total number of mseg in the second controller and the second total number of allocated mseg;
[0039] Divide the second total number by the first total number to obtain the mseg usage rate;
[0040] If the usage rate of mseg is not greater than the fourth specified threshold, then the step of determining the mseg pre-allocation set by the first controller according to the allocation request is executed;
[0041] If the usage rate of mseg is greater than the fourth specified threshold, then the business type in the allocation request is obtained; and if the business type is a specified business type, then the allocation request is not responded to.
[0042] If the business type is not the specified business type, then the step of determining the mseg pre-allocation set through the first controller according to the allocation request is executed.
[0043] In the above method, when mseg is used frequently, requests of a specific business type are not responded to, so as to ensure that requests corresponding to higher priority business types can be executed, and to ensure that important business processes do not fail to run in extreme scenarios.
[0044] Secondly, this application provides a power-saving memory segment allocation device, the device comprising:
[0045] The receiving module is used to receive the allocation request of the power-saving memory segment mseg sent by the user through the first controller, wherein the first controller is any one of multiple controllers in the server;
[0046] The pre-allocation set determination module is used to determine the mseg pre-allocation set according to the allocation request through the first controller, wherein the mseg pre-allocation set includes multiple pre-allocated first msegs;
[0047] The allocation module is configured to allocate a first target mseg in the mseg pre-allocation set to the allocation request through the first controller, wherein the first target mseg is any unused first mseg in the mseg pre-allocation set;
[0048] A storage module is used to store data corresponding to the allocation request using the first target mseg through the first controller.
[0049] In one possible implementation, the allocation request includes a service type and a current service instance distribution; the current service instance distribution is used to describe the respective functions of each controller in the server.
[0050] The pre-segmentation set determination module is specifically used for:
[0051] The first controller obtains the target index based on the current service instance distribution;
[0052] The first controller determines the target mseg pre-segment set whose index value is the same as the target index in each target mseg pre-segment set as the mseg pre-segment set, wherein each target mseg pre-segment set is obtained using the service type.
[0053] In one possible implementation, the device further includes:
[0054] The judgment module is used to determine whether the allocation request has a target identifier if the first target mseg does not exist in the mseg pre-splitting set;
[0055] The application module is used to, if it exists, send a request for a second mseg to the second controller through the first controller, send the second mseg to the first controller through the second controller, allocate the applied second mseg to the allocation request through the first controller, and use the second mseg to store the data, wherein the second controller is any one of the other controllers among the plurality of controllers besides the first controller;
[0056] The prompt module is used to notify the user of application failure via the first controller if the application does not exist.
[0057] In one possible implementation, the device further includes:
[0058] The first number adjustment module is used to, after the first controller allocates the target mseg in the mseg pre-splitting set to the allocation request, increase the number of successful mseg allocations by a first specified number through the first controller to obtain the updated number of successful mseg allocations.
[0059] The second number adjustment module is used to increase the total number of mseg allocations by the first specified number through the first controller to obtain the updated total number of mseg allocations;
[0060] The allocation success ratio determination module is used to divide the updated mseg allocation success count by the updated mseg allocation success count through the first controller when the updated total number of mseg allocations is greater than the second specified number of times, thereby obtaining the allocation success ratio, wherein the second specified number of times is greater than the first specified number of times;
[0061] The first adjustment module is used to reduce the number of pre-allocated msegs in the mseg pre-allocation set through the first controller if the allocation success rate is greater than a first specified threshold.
[0062] The second adjustment module is used to increase the number of pre-allocated msegs in the mseg pre-allocation set through the first controller if the allocation success rate is less than a second specified threshold, wherein the second specified threshold is less than the first specified threshold.
[0063] In one possible implementation, the device further includes:
[0064] The initial value setting module is used to, after dividing the updated number of successful mseg allocations by the updated total number of mseg allocations through the first controller to obtain the allocation success ratio, set the total number of mseg allocations to a preset initial value through the first controller, and set the number of successful mseg allocations to the initial value.
[0065] In one possible implementation, the first adjustment module is further configured to:
[0066] After allocating the target mseg in the mseg pre-splitting set to the allocation request through the first controller, the current number of msegs in the mseg pre-splitting set and the total number of msegs in the second controller are obtained through the first controller;
[0067] If the current quantity is less than the preset quantity, and the total number of mseg is greater than the third specified threshold, then the first controller sends a request to the second controller to apply for the first mseg;
[0068] The first controller receives the first mseg sent by the second controller and adds the first mseg to the mseg pre-splitting set.
[0069] In one possible implementation, the first adjustment module is further configured to:
[0070] After receiving the user's request to allocate a power-saving memory segment (mseg) through the first controller, the first total number of msegs in the second controller and the second total number of allocated msegs are obtained.
[0071] Divide the second total number by the first total number to obtain the mseg usage rate;
[0072] If the usage rate of mseg is not greater than the fourth specified threshold, then the step of determining the mseg pre-allocation set by the first controller according to the allocation request is executed;
[0073] If the usage rate of mseg is greater than the fourth specified threshold, then the business type in the allocation request is obtained; and if the business type is a specified business type, then the allocation request is not responded to.
[0074] If the business type is not the specified business type, then the step of determining the mseg pre-allocation set through the first controller according to the allocation request is executed.
[0075] Thirdly, this application provides a server, comprising:
[0076] Memory, used to store program instructions;
[0077] A processor is configured to invoke program instructions stored in the memory and execute the steps included in the power-saving memory segment allocation method described in any one of the first aspects according to the obtained program instructions.
[0078] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the power-saving memory segment allocation method described above.
[0079] Fifthly, embodiments of this application provide a computer program product, including a computer program stored in a computer-readable storage medium; when a processor of a memory access device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the memory access device to perform the steps in the power-saving memory segment allocation method described above.
[0080] For the various aspects in the second to fifth sections above, and the technical effects that each aspect may achieve, please refer to the above description of the technical effects that the various possible solutions in the first section may achieve. They will not be repeated here. Attached Figure Description
[0081] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0082] Figure 1 A flowchart illustrating a prior art method for allocating power-saving memory segments, provided for embodiments of this application;
[0083] Figure 2 This is one of the flowcharts illustrating a method for allocating power-saving memory segments, provided as an embodiment of this application.
[0084] Figure 3 A flowchart illustrating the allocation method when the first target mseg does not exist in the mseg pre-splitting set provided in this application embodiment;
[0085] Figure 4A flowchart illustrating the process of adjusting the number of mseg in the pre-segmented set, provided in an embodiment of this application;
[0086] Figure 5 A schematic diagram illustrating the process of supplementing mseg in the pre-segmented set provided in this application embodiment;
[0087] Figure 6 A flowchart illustrating the method for allocating power-saving memory segments provided in this application embodiment;
[0088] Figure 7 A second schematic flowchart illustrating the method for allocating power-saving memory segments provided in this application embodiment;
[0089] Figure 8 A schematic diagram of a power-saving memory segment allocation device provided for an embodiment of this application;
[0090] Figure 9 This is a schematic diagram of a server provided in an embodiment of this application. Detailed Implementation
[0091] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The specific operating methods in the method embodiments can also be applied to the device embodiments or system embodiments.
[0092] In the description of this application, "multiple" is understood as "at least two". "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. A connected to B can represent: A and B directly connected, or A and B connected through C. Furthermore, in the description of this application, terms such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.
[0093] In existing technologies, to meet the high performance requirements of MSEG allocation, the MSEG management module is designed as a distributed structure with one master and multiple agents, i.e., it includes a master controller node and multiple slave controller nodes. For example... Figure 1 As shown, when a user requests the allocation of a MSEG, the user initiates the request to the master controller node, which then forwards the request to each controller node. Alternatively, the user can first obtain worker node routing information from the master controller node and then send a service request to the slave controller nodes. However, both methods require the master controller node to perform forwarding, which consumes additional system resources and results in low efficiency in memory segment allocation.
[0094] In response, this application provides a method for allocating power-saving memory segments. The allocation of power-saving memory segments is achieved through a first controller, eliminating the need for the main controller to forward requests and the slave controller to perform the allocation. This saves system resources and improves the allocation efficiency of power-saving memory segments.
[0095] like Figure 2 The diagram shown illustrates the flowchart of the power-saving memory segment allocation method, which may include the following steps:
[0096] Step 201: Receive the user's allocation request for the power-saving memory segment mseg through the first controller, wherein the first controller is any one of the plurality of controllers;
[0097] The allocation request includes the service type, the current service instance distribution, and the number of replicas; the number of replicas is the amount of data corresponding to the allocation request that needs to be stored. The current service instance distribution describes the respective functions of each controller in the server. For example, the server has four controllers: controller 1, controller 2, controller 3, and controller 4. If controller 1 is the first controller, controller 2 is the second controller, and controllers 3 and 4 are not used, then the corresponding current service instance distribution is 11000000. For example, if the current service instance distribution is 10100000, then the corresponding functions of each controller are: controller 1 is the first controller, controller 3 is the second controller, and controllers 2 and 4 are not used.
[0098] In this embodiment, the current service instance distribution is represented by binary numbers.
[0099] Step 202: The first controller determines a pre-allocated set of msegs according to the allocation request, wherein the pre-allocated set of msegs includes multiple pre-allocated first msegs;
[0100] In one possible implementation, step 202 may be specifically implemented as follows: the first controller obtains the target index according to the current service instance distribution; the first controller determines the target mseg pre-segmentation set whose index value is the same as the target index in each target mseg pre-segmentation set as the mseg pre-segmentation set, wherein each target mseg pre-segmentation set is obtained using the service type.
[0101] In this embodiment of the application, since the current service instance distribution is a binary number, the binary number of the current service instance distribution is converted into a decimal number to obtain the target index.
[0102] In one possible implementation, the target mseg pre-splitting set is obtained in the following manner:
[0103] By utilizing the pre-defined correspondence between business types and mseg pre-allocation sets, the target mseg pre-allocation set corresponding to the business type in the allocation request is determined.
[0104] Step 203: Assign the first target mseg in the mseg pre-allocation set to the allocation request through the first controller, wherein the first target mseg is any unused first mseg in the mseg pre-allocation set;
[0105] Step 204: The first controller uses the first target mseg to store the data corresponding to the allocation request.
[0106] In one possible implementation, step 204 may specifically be implemented as: storing the same number of data as the number of replicas in the first target mseg, based on the number of replicas in the allocation request.
[0107] For example, if the number of replicas is 2, then two copies of the data corresponding to the allocation request are stored in the first target mseg.
[0108] To ensure that certain types of allocation requests must be executed, such as Figure 3 The diagram shows a flowchart of the allocation method when the first target mseg does not exist in the mseg pre-allocation set. Specifically, it may include the following steps:
[0109] Step 301: If the first target MSEG does not exist in the MSEG pre-allocation set, the first controller determines whether the allocation request has a target identifier; if yes, proceed to step 302; if no, proceed to step 303.
[0110] The target identifier in this application embodiment can be a quantity or characters, and is preset. This application embodiment does not limit the target identifier, and the target identifier in this application embodiment can be set according to the specific actual situation.
[0111] Step 302: Send a request for a second MSeg to the second controller through the first controller, send the second MSeg to the first controller through the second controller, and allocate the requested second MSeg to the allocation request through the first controller, and use the second MSeg to store the data;
[0112] Wherein, the second controller is any one of the other controllers among the plurality of controllers besides the first controller;
[0113] In this embodiment, the second controller is used to create the mseg. Furthermore, after storing the data using the second mseg, a message indicating successful allocation is displayed.
[0114] Step 303: Prompt the user to confirm the application failure via the first controller.
[0115] To ensure that users obtain MSegs directly from their local machines whenever they request them, thus improving MSeg allocation performance, in one possible implementation, after executing step 203, the number of MSegs in the pre-allocated set can be adjusted based on the allocation success rate. For example... Figure 4 The flowchart described above illustrates the process of adjusting the number of mseg in the pre-splitting set, which may specifically include the following steps:
[0116] Step 401: Increment the number of successful mseg allocations by a first specified number through the first controller to obtain the updated number of successful mseg allocations;
[0117] Step 402: Increase the total number of mseg allocations by the first specified number through the first controller to obtain the updated total number of mseg allocations;
[0118] The first specified number of times in this embodiment is 1, but the specific value of the first specified number of times in this embodiment is not limited. The first specified number of times in this embodiment can be set according to the specific actual situation.
[0119] It should be noted that the execution order of steps 401 and 402 in this embodiment is not limited. Step 401 can be executed first, followed by step 402. Alternatively, step 402 can be executed first, followed by step 401. Steps 401 and 402 can also be executed simultaneously.
[0120] Step 403: When the updated total number of MSEG allocations is greater than the second specified number, the first controller divides the updated number of successful MSEG allocations by the updated total number of MSEG allocations to obtain the allocation success ratio, wherein the second specified number is greater than the first specified number; the allocation success ratio can be obtained through formula (1):
[0121]
[0122] Where σ is the allocation success rate, n is the number of successful allocations of the updated mseg, and N is the total number of allocations of the updated mseg.
[0123] Step 404: If the allocation success rate is greater than the first specified threshold, then the number of pre-allocated msegs in the mseg pre-allocation set is reduced by the first controller;
[0124] The first specified threshold in this application embodiment can be set according to the specific actual situation. This application embodiment does not limit the specific value of the first specified threshold.
[0125] In this embodiment, step 404 can be specifically implemented as follows: If the allocation success rate is greater than a first specified threshold, the first controller sends a request to the second controller to apply for pre-allocated MSegs in the MSeg pre-allocation set. After receiving the request, the second controller sends the same number of MSegs as the number of applications in the request to the first controller, and the first controller stores the MSegs in the MSeg pre-allocation set. The number of applications is less than the number of applications in the previous request.
[0126] In one possible implementation, the number of applications is determined in the following way:
[0127] By using a pre-set correspondence between each allocation success ratio and each quantity, a target quantity corresponding to the allocation success ratio is determined, and the target quantity is determined as the application quantity.
[0128] Step 405: If the allocation success rate is less than the second specified threshold, the number of pre-allocated msegs in the mseg pre-allocation set is increased by the first controller, wherein the second specified threshold is less than the first specified threshold.
[0129] In this embodiment, the number of pre-divided msegs in the mseg pre-divided set is similar to the specific implementation in step 404 described above, except that the number of applications is different. This embodiment will not be described again here.
[0130] To ensure accuracy, in one possible implementation, after executing step 403, the first controller sets the total number of mseg allocations to a preset initial value, and sets the number of successful mseg allocations to the initial value.
[0131] The initial value in this embodiment is 0, but the specific value of the initial value in this embodiment is not limited. The initial value in this embodiment can be set according to the specific actual situation.
[0132] To ensure users can promptly request MSegs, the pre-allocated MSegs in the set need to be replenished in a timely manner. For example... Figure 5 The diagram illustrates the process of supplementing the pre-segmented set with mseg, which may include the following steps:
[0133] Step 501: Obtain the current number of msegs in the mseg pre-splitting set and the total number of msegs in the second controller through the first controller;
[0134] Step 502: If the current quantity is less than the preset quantity and the total number of mseg is greater than the third specified threshold, then the first controller sends a request to the second controller to apply for the first mseg;
[0135] It should be noted that the preset quantity and the third specified threshold in this application embodiment can be set according to the specific actual situation. This application embodiment does not limit the specific values of the preset quantity and the third specified threshold.
[0136] Step 503: Receive the first mseg sent by the second controller through the first controller, and add the first mseg to the mseg pre-splitting set.
[0137] In this embodiment of the application, if the current quantity is not less than the preset quantity, or the total quantity of the mseg is not greater than the third specified threshold, then the first mseg in the mseg pre-splitting set will not be added.
[0138] This application also provides another method for allocating power-saving memory segments, such as... Figure 6 The diagram shown illustrates the flowchart of the power-saving memory segment allocation method, which may include the following steps:
[0139] Step 601: Obtain the first total number of mseg in the second controller and the second total number of allocated mseg;
[0140] Step 602: Divide the second total quantity by the first total quantity to obtain the mseg utilization rate; wherein, the mseg utilization rate can be obtained through formula (2):
[0141]
[0142] Where μ is the usage rate of mseg, m1 is the first total quantity, and m2 is the second total quantity.
[0143] Step 603: Determine whether the usage rate of mseg is greater than the fourth specified threshold. If not, proceed to step 604; if yes, proceed to step 605.
[0144] The fourth specified threshold in this application embodiment can be set according to the specific actual situation. This application embodiment does not limit the specific value of the fourth specified threshold.
[0145] Step 604: The step of determining the MSEG pre-allocation set by the first controller according to the allocation request; (Step 202)
[0146] Step 605: Obtain the service type in the allocation request;
[0147] Step 606: Determine whether the business type is a specified business type. If yes, proceed to step 607; otherwise, proceed to step 604.
[0148] In this embodiment, a lower-priority business type is set as a pre-defined business type. For example, the pre-defined business type could be a volume read / write business type. Because the front-end volume read / write business type receives user data into the system without restraint during data reading and writing, the system caches a large amount of data, consuming a significant amount of mseg for caching. This can lead to insufficient mseg availability during critical business processes, such as failover or metadata caching, causing IO to drop to zero or errors. Therefore, when the mseg usage exceeds a fourth specified threshold, it is necessary to control the total mseg usage of the volume read / write business type, limiting its allocation of mseg. For users sending requests for volume read / write business types, the requests will not be responded to, and a message indicating limited mseg usage will be returned.
[0149] It should be noted that the specified business types mentioned above are only for illustrative purposes and do not limit the specified business types in the embodiments of this application. The specified business types in the embodiments of this application can be set according to the specific actual situation.
[0150] Step 607: Do not respond to the allocation request;
[0151] This application embodiment can also dynamically adjust the number of MSeg replicas, replica distribution, and pre-allocated MSeg quantity based on the health status of the used MSegs. Previously allocated MSegs may fail during inter-controller data read / write and synchronization due to abnormal states of cluster nodes or processes. These abnormalities are then fed back to the business modules using the MSegs via error codes or a temporary cluster abnormal node bitmap distribution. When updating the MSeg status, the business modules synchronize this abnormal information to the first controller, which then dynamically adjusts the number of MSeg replicas, replica distribution, and pre-allocated MSeg quantity for subsequent allocations.
[0152] Here, replica distribution is used to represent the controllers corresponding to each replica.
[0153] In one possible implementation, dynamically adjusting the number of MSeg replicas, replica distribution, and MSeg pre-allocation quantity based on the health status of the used MSeg can be specifically implemented as follows:
[0154] Adjust the number of replicas: Determine the health status of each controller based on the health status of the controllers already using MSEG. If the number of controllers with a normal health status is not less than the number of replicas, then the number of replicas will not be adjusted. If the number of controllers with a normal health status is less than the number of replicas, then the number of replicas will be adjusted to be the same as the number of controllers with a normal health status.
[0155] Replica Distribution Adjustment: Based on the health status of each controller using MSEG, determine its health status. For any given controller, check if a corresponding replica exists. If it does, and the controller's health status is normal, the process ends. If it does, and the controller's health status is abnormal, remove the replica corresponding to that controller. If it doesn't exist, and the controller's health status is abnormal, the process ends. If it doesn't exist, and the controller's health status is normal, determine if the controller's identifier is the smallest among all controllers with no corresponding replicas. If so, match that controller with replicas of controllers that don't have a corresponding replica.
[0156] Adjust the number of pre-allocated MSEGs: Determine the health status of each controller based on the health status of the MSEGs already used, and set the number of MSEGs in the pre-allocation set corresponding to the controller with an abnormal health status to 0.
[0157] In one possible implementation, the health status of each controller is determined in the following way:
[0158] For any given controller, if all used MSegs corresponding to that controller have normal health statuses, then the controller's health status is determined to be normal. If any of the used MSegs corresponding to that controller have MSegs with all abnormal health statuses, then the health status of that controller is determined to be abnormal.
[0159] Below, in conjunction with Figure 7 The method for allocating the power-saving memory segment in the embodiments of this application is described, and may specifically include the following steps:
[0160] Step 701: Receive the user's allocation request for the power-saving memory segment mseg via the first controller.
[0161] Wherein, the first controller is any one of the plurality of controllers;
[0162] Step 702: The first controller determines the MSEG pre-allocation set based on the allocation request.
[0163] The mseg pre-splitting set includes multiple pre-allocated first msegs;
[0164] Step 703: Determine whether the first target mseg exists in the mseg pre-seg set; if yes, proceed to step 704; if no, proceed to step 706.
[0165] Wherein, the first target mseg is any unused first mseg in the mseg pre-splitting set.
[0166] Step 704: Assign the first target mseg in the mseg pre-splitting set to the allocation request via the first controller;
[0167] Step 705: The first controller uses the first target mseg to store the data corresponding to the allocation request;
[0168] Step 706: Determine whether the allocation request has a target identifier through the first controller. If yes, proceed to step 707; otherwise, proceed to step 710.
[0169] Step 707: Send a request to the second controller to request the second MSEG through the first controller;
[0170] Step 708: Send the second mseg to the first controller through the second controller;
[0171] Step 709: Assign the requested second mseg to the allocation request via the first controller, and use the second mseg to store the data;
[0172] Wherein, the second controller is any one of the other controllers among the plurality of controllers besides the first controller;
[0173] Step 710: Prompt the user to confirm the application failure via the first controller.
[0174] Based on the same inventive concept, this application also provides a power-saving memory segment allocation device, see [link to relevant documentation]. Figure 8 The device 800 includes:
[0175] The receiving module 810 is used to receive a power-saving memory segment mseg allocation request sent by a user through a first controller, wherein the first controller is any one of multiple controllers in the server;
[0176] The pre-allocation set determination module 820 is used to determine the mseg pre-allocation set according to the allocation request through the first controller, wherein the mseg pre-allocation set includes a plurality of pre-allocated first msegs;
[0177] The allocation module 830 is configured to allocate a first target mseg in the mseg pre-allocation set to the allocation request through the first controller, wherein the first target mseg is any unused first mseg in the mseg pre-allocation set;
[0178] Storage module 840 is used to store data corresponding to the allocation request using the first target mseg through the first controller.
[0179] In one possible implementation, the allocation request includes a service type and a current service instance distribution; the current service instance distribution is used to describe the respective functions of each controller in the server.
[0180] The pre-segmentation set determination module 820 is specifically used for:
[0181] The first controller obtains the target index based on the current service instance distribution;
[0182] The first controller determines the target mseg pre-segment set whose index value is the same as the target index in each target mseg pre-segment set as the mseg pre-segment set, wherein each target mseg pre-segment set is obtained using the service type.
[0183] In one possible implementation, the device further includes:
[0184] The judgment module 850 is used to determine whether the allocation request has a target identifier if the first target mseg does not exist in the mseg pre-splitting set;
[0185] The application module 860 is used to, if it exists, send a request for a second mseg to the second controller through the first controller, send the second mseg to the first controller through the second controller, allocate the applied second mseg to the allocation request through the first controller, and use the second mseg to store the data, wherein the second controller is any one of the other controllers among the plurality of controllers besides the first controller;
[0186] The prompt module 870 is used to prompt the user that the application failed if the application does not exist, through the first controller.
[0187] In one possible implementation, the device further includes:
[0188] The first number adjustment module 880 is used to, after the first controller allocates the target mseg in the mseg pre-splitting set to the allocation request, increase the number of successful mseg allocations by a first specified number through the first controller to obtain the updated number of successful mseg allocations.
[0189] The second number adjustment module 890 is used to increase the total number of mseg allocations by the first specified number through the first controller to obtain the updated total number of mseg allocations;
[0190] The allocation success ratio determination module 891 is used to divide the updated mseg allocation success count by the updated mseg allocation success count through the first controller when the updated total number of mseg allocations is greater than the second specified number of times, thereby obtaining the allocation success ratio, wherein the second specified number of times is greater than the first specified number of times;
[0191] The first adjustment module 892 is used to reduce the number of pre-allocated msegs in the mseg pre-allocation set through the first controller if the allocation success rate is greater than a first specified threshold.
[0192] The second adjustment module 893 is used to increase the number of pre-allocated msegs in the mseg pre-allocation set through the first controller if the allocation success rate is less than the second specified threshold, wherein the second specified threshold is less than the first specified threshold.
[0193] In one possible implementation, the device further includes:
[0194] The initial value setting module 894 is used to, after dividing the updated number of successful mseg allocations by the updated total number of mseg allocations through the first controller to obtain the allocation success ratio, set the total number of mseg allocations to a preset initial value through the first controller, and set the number of successful mseg allocations to the initial value.
[0195] In one possible implementation, the first adjustment module 892 is further configured to:
[0196] After allocating the target mseg in the mseg pre-splitting set to the allocation request through the first controller, the current number of msegs in the mseg pre-splitting set and the total number of msegs in the second controller are obtained through the first controller;
[0197] If the current quantity is less than the preset quantity, and the total number of mseg is greater than the third specified threshold, then the first controller sends a request to the second controller to apply for the first mseg;
[0198] The first controller receives the first mseg sent by the second controller and adds the first mseg to the mseg pre-splitting set.
[0199] In one possible implementation, the first adjustment module 892 is further configured to:
[0200] After receiving the user's request to allocate a power-saving memory segment (mseg) through the first controller, the first total number of msegs in the second controller and the second total number of allocated msegs are obtained.
[0201] Divide the second total number by the first total number to obtain the mseg usage rate;
[0202] If the usage rate of mseg is not greater than the fourth specified threshold, then the step of determining the mseg pre-allocation set by the first controller according to the allocation request is executed;
[0203] If the usage rate of mseg is greater than the fourth specified threshold, then the business type in the allocation request is obtained; and if the business type is a specified business type, then the allocation request is not responded to.
[0204] If the business type is not the specified business type, then the step of determining the mseg pre-allocation set through the first controller according to the allocation request is executed.
[0205] Based on the same inventive concept, this application also provides a server. The server can implement the function of the aforementioned power-saving memory segment allocation device, see reference... Figure 9 The server includes:
[0206] At least one processor 901 and a memory 902 connected to at least one processor 901. In this embodiment, the specific connection medium between the processor 901 and the memory 902 is not limited. Figure 9 The example shown is the connection between processor 901 and memory 902 via bus 900. Bus 900 is... Figure 9 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The Bus 900 can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 9 The term is represented by a single thick line, but this does not imply that there is only one bus or one type of bus. Alternatively, the processor 901 can also be called a controller; there is no restriction on the name.
[0207] In this embodiment, memory 902 stores instructions executable by at least one processor 901. By executing the instructions stored in memory 902, at least one processor 901 can perform the power-saving memory segment allocation method described above. Processor 901 can implement... Figure 5 The functions of each module in the device shown.
[0208] The processor 901 is the control center of the device. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in memory 902 and calling data stored in memory 902, the processor can perform various functions and process data, thereby monitoring the device as a whole.
[0209] In one possible design, processor 901 may include one or more processing units. Processor 901 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into processor 901. In some embodiments, processor 901 and memory 902 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.
[0210] The processor 901 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array, or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the power-saving memory segment allocation method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or as a combination of hardware and software modules within the processor.
[0211] Memory 902, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 902 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 902 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 902 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0212] By designing and programming the processor 901, the code corresponding to the power-saving memory segment allocation method described in the aforementioned embodiments can be embedded into the chip, enabling the chip to execute it during operation. Figure 1 The steps of the data storage method in the illustrated embodiment are as follows. How to design and program the processor 901 is a technique well-known to those skilled in the art and will not be described further here.
[0213] This application also provides a computer-readable storage medium storing computer-executable instructions required to execute the processor, including a program required to execute the processor.
[0214] In some possible implementations, various aspects of the power-saving memory segment allocation method provided in this application can also be implemented as a program product, which includes program code. When the program product is run on an electronic device, the program code is used to cause the electronic device to perform the steps in the power-saving memory segment allocation method according to various exemplary embodiments of this application described above.
[0215] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0216] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations 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, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0217] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0218] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0219] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0220] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for allocating power-saving memory segments, characterized in that, Applied to a server, wherein the server includes multiple controllers, the method includes: The first controller receives the allocation request for the power-saving memory segment mseg sent by the user through the first controller, wherein the first controller is any one of the plurality of controllers; The first controller determines a pre-allocated set of msegs based on the allocation request, wherein the pre-allocated set of msegs includes multiple pre-allocated first msegs; The first controller allocates a first target mseg from the mseg pre-allocation set to the allocation request, wherein the first target mseg is any unused first mseg in the mseg pre-allocation set; The first controller uses the first target mseg to store the data corresponding to the allocation request.
2. The method according to claim 1, characterized in that, The allocation request includes the service type and the current service instance distribution; the current service instance distribution is used to describe the corresponding functions of each controller in the server. The step of determining the mseg pre-allocation set by the first controller according to the allocation request includes: The first controller obtains the target index based on the current service instance distribution; The first controller determines the target mseg pre-segment set whose index value is the same as the target index in each target mseg pre-segment set as the mseg pre-segment set, wherein each target mseg pre-segment set is obtained using the service type.
3. The method according to claim 1, characterized in that, The method further includes: If the first target mseg does not exist in the mseg pre-allocation set, the first controller determines whether the allocation request has a target identifier. If it exists, the first controller sends a request to the second controller to request the second mseg, the second controller sends the second mseg to the first controller, the first controller allocates the requested second mseg to the allocation request, and uses the second mseg to store the data, wherein the second controller is any one of the other controllers among the plurality of controllers besides the first controller; If the application does not exist, the user will be notified of the application failure via the first controller.
4. The method according to claim 1, characterized in that, After allocating the target MSeg in the pre-splitting set to the allocation request via the first controller, the method further includes: The first controller increments the number of successful mseg allocations by a first specified number to obtain the updated number of successful mseg allocations. The first controller increments the total number of mseg allocations by the first specified number to obtain the updated total number of mseg allocations. When the updated total number of mseg allocations is greater than the second specified number, the first controller divides the updated number of successful mseg allocations by the updated total number of mseg allocations to obtain the allocation success ratio, wherein the second specified number is greater than the first specified number; If the allocation success rate is greater than a first specified threshold, the number of pre-allocated msegs in the mseg pre-allocation set is reduced by the first controller; If the allocation success rate is less than the second specified threshold, the number of pre-allocated msegs in the mseg pre-allocation set is increased by the first controller, wherein the second specified threshold is less than the first specified threshold.
5. The method according to claim 4, characterized in that, After dividing the updated number of successful MSEG allocations by the total number of updated MSEG allocations using the first controller to obtain the allocation success ratio, the method further includes: The first controller sets the total number of mseg allocations to a preset initial value and the number of successful mseg allocations to the initial value.
6. The method according to claim 1, characterized in that, After allocating the target MSeg in the pre-splitting set to the allocation request via the first controller, the method further includes: The first controller obtains the current number of msegs in the mseg pre-segmentation set and the total number of msegs in the second controller; If the current quantity is less than the preset quantity, and the total number of mseg is greater than the third specified threshold, then the first controller sends a request to the second controller to apply for the first mseg; The first controller receives the first mseg sent by the second controller and adds the first mseg to the mseg pre-splitting set.
7. The method according to claim 1, characterized in that, After receiving the power-saving memory segment (mseg) allocation request sent by the user through the first controller, the method further includes: Obtain the first total number of mseg in the second controller and the second total number of allocated mseg; Divide the second total number by the first total number to obtain the mseg usage rate; If the usage rate of mseg is not greater than the fourth specified threshold, then the step of determining the mseg pre-allocation set by the first controller according to the allocation request is executed; If the usage rate of mseg is greater than the fourth specified threshold, then the business type in the allocation request is obtained; and if the business type is a specified business type, then the allocation request is not responded to. If the business type is not the specified business type, then the step of determining the mseg pre-allocation set through the first controller according to the allocation request is executed.
8. A power-saving memory segment allocation device, characterized in that, The device includes: The receiving module is used to receive the allocation request of the power-saving memory segment mseg sent by the user through the first controller, wherein the first controller is any one of multiple controllers in the server; The pre-allocation set determination module is used to determine the mseg pre-allocation set according to the allocation request through the first controller, wherein the mseg pre-allocation set includes multiple pre-allocated first msegs; The allocation module is configured to allocate a first target mseg in the mseg pre-allocation set to the allocation request through the first controller, wherein the first target mseg is any unused first mseg in the mseg pre-allocation set; A storage module is used to store data corresponding to the allocation request using the first target mseg through the first controller.
9. A server, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the steps of the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.