Resource balancing method and device of distributed code storage system and electronic equipment

By obtaining and evaluating resource information of each storage server in a distributed code storage system, generating and executing replica mobile tasks, the problem of unbalanced resource occupation between storage servers is solved and resource utilization is improved.

CN119512718APending Publication Date: 2025-02-25HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310995637.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-08
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

As the distributed code storage system is used and expanded, the resource usage between each storage server will become increasingly unbalanced, resulting in a low resource utilization rate of the storage system.

Method used

After the distributed code storage system is initialized, the storage resource information and hot resource information of each storage server are obtained, storage resource evaluation and hot resource evaluation are carried out, and replica movement tasks are generated and executed to balance the resource occupation of the storage server.

Benefits of technology

The dynamic balance between storage resources and hot resources of the distributed code storage system is realized, the resource utilization rate of the entire system is improved, and unnecessary resource occupation is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512718A_ABST
    Figure CN119512718A_ABST
Patent Text Reader

Abstract

The invention relates to a resource balancing method and device of a distributed code storage system and electronic equipment. The method comprises the following steps: acquiring storage resource information and hotspot resource information of each storage server of the distributed code storage system; according to the storage resource information, carrying out storage resource evaluation on the storage server, and according to the hotspot resource information, carrying out hotspot resource evaluation on the storage server; generating a copy moving task for moving a target code warehouse copy stored in the storage server with unbalanced resources to other storage servers under the condition that the storage resources or the hotspot resources of the storage server are unbalanced; and allocating the copy moving task to the corresponding storage server for execution, and performing copy moving on the target code warehouse copy. The problem that the resource utilization rate of a storage system is low due to the fact that resource occupancy among storage servers is more unbalanced along with use and capacity expansion of a distributed code storage system in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a resource balancing method, device, and electronic device for a distributed code storage system. Background Art

[0002] Compared with traditional distributed storage systems, the distributed code storage system uses Git repositories as the smallest storage unit for code storage, which results in higher CPU (Central Processing Unit) resource utilization, higher system input and output IO interface resource utilization, more bandwidth resources, and higher storage resources during data processing. This is because of the characteristics of Git repositories. Decompressing, reading and writing packages, and repackaging Git repositories involve a lot of computing and bandwidth, which is particularly evident when the number of user requests is large or the repositories are large.

[0003] With the use of distributed code storage systems, the stored code data has gradually increased. The distributed multi-copy code storage architecture has been horizontally expanded many times. At the same time, there are also reasons such as unpredictable user behavior, which leads to more and more serious imbalance in resource usage among storage servers, including the number of requests / computing, bandwidth, storage and other resources.

[0004] It should be noted that this section is intended to provide a background or context for the embodiments of the present invention stated in the claims, and should not be admitted as prior art by including the descriptions herein in this section. Summary of the invention

[0005] The embodiments of the present invention provide a resource balancing method, device, and electronic device for a distributed code storage system, which at least solves the problem in the related art that as the distributed code storage system is used and expanded, the resource usage between each storage server becomes increasingly unbalanced, thereby leading to low resource utilization of the storage system.

[0006] An embodiment of the present invention provides a resource balancing method for a distributed code storage system, comprising: after the distributed code storage system is initialized, when scheduling balancing is triggered, obtaining storage resource information and hotspot resource information of each storage server of the distributed code storage system; performing storage resource evaluation on the storage server according to the storage resource information, and performing hotspot resource evaluation on the storage server according to the hotspot resource information, wherein the hotspot resource is resource information of the storage server other than storage resources; when the storage resources or hotspot resources of the storage server are unbalanced, generating a replica moving task for moving a target code repository copy stored in the storage server with unbalanced resources to other storage servers, wherein the target code repository copy is one of the code repository copies in the storage server; assigning the replica moving task to the corresponding storage server for execution, and performing replica moving on the target code repository copy to balance the storage resources or hotspot resources of the storage servers in the distributed code storage system.

[0007] Beneficial effects of the embodiments of the present invention: by using the storage resource information and hotspot resource information of each storage server of the distributed code storage system to perform storage resource balancing and hotspot resource balancing respectively, a dynamic balance of storage resources and hotspot resources of the distributed code storage system is achieved. This ensures that the resource utilization rate of the entire distributed code storage system is at a high level, avoiding unnecessary resource occupation. This solves the problem in the related art that as the distributed code storage system is used and expanded, the resource occupation between each storage server becomes increasingly unbalanced, thereby leading to low resource utilization of the storage system.

[0008] As an optional embodiment, the storage resource information includes: occupied storage space, total storage space; based on the storage resource information, performing a storage resource evaluation on the storage server, including: performing a storage resource scoring on the storage resources of the storage server based on the storage resource information, wherein the storage resource score is used to characterize the balance status of the storage resources; when the storage resource score of the storage server reaches a first preset threshold, determining that the storage resources of the storage server are balanced; when the storage resource score of the storage server does not reach the first preset threshold, determining that the storage resources of the storage server are unbalanced.

[0009] The storage resource of the storage server is scored based on the storage resource information including the occupied storage space and the total storage space. When the storage resource score reaches a first preset threshold, the storage resource is determined to be balanced. Otherwise, the storage resource is determined to be unbalanced and a storage resource balancing operation is required.

[0010] As an optional embodiment, storage resource scoring is performed on the storage resources of the storage server based on the storage resource information, including: when the total storage space sizes of the storage servers are the same, the storage resource score of the storage server is calculated based on the occupied storage space of the storage server to be scored and the total storage space of the storage servers; when the total storage space sizes of the storage servers are different, the storage resource score of the storage server is calculated based on the maximum and minimum values ​​of the total storage space of multiple storage servers for resource balancing and the occupied storage space of the storage server to be scored.

[0011] Different calculation methods are used to calculate the storage resource score based on whether the total storage space size of each storage server is the same, making the storage resource score more accurate. The storage resource score is calculated based on the occupied space of the storage server and the total space of each storage server, effectively reflecting the resource occupation level of the storage server when the total storage space of each storage server is consistent. The storage resource score is calculated based on the maximum and minimum values ​​of the total storage space of the storage server and the occupied storage space of the storage server, accurately and effectively reflecting the resource occupation level of the storage server when the total storage space of each storage server is inconsistent.

[0012] As an optional embodiment, the hotspot resource information includes at least one of the following hotspot parameters: request volume, interface time consumption, interface traffic, and active data volume; based on the hotspot resource information, a hotspot resource evaluation is performed on the storage server, including: hotspot resource scoring of the hotspot resources of the storage server based on the hotspot resource information, wherein the hotspot resource score is used to characterize the balance status of the hotspot resources; when the hotspot resource score of the storage server reaches a second preset threshold, determining that the hotspot resources of the storage server are balanced; when the hotspot resource score of the storage server does not reach the second preset threshold, determining that the hotspot resources of the storage server are unbalanced.

[0013] The hotspot resource information of the storage server including the request volume, interface time consumption, interface traffic, and active data volume is used to score the hotspot resources. When the hotspot resource score reaches a second preset threshold, the hotspot resources are determined to be balanced. Otherwise, the hotspot resources are determined to be unbalanced and a hotspot resource balancing operation is required.

[0014] As an optional embodiment, a hotspot resource score is performed on the hotspot resources of the storage server based on the hotspot resource information, including: calculating a hotspot sub-score of the hotspot parameter based on the numerical value of the hotspot parameter in the hotspot resource information and the average value of the hotspot parameter of each storage server; calculating the hotspot resource score of the storage server based on the weight corresponding to each hotspot parameter and the hotspot sub-score of each hotspot parameter.

[0015] According to the value of the hotspot parameter in the hotspot resource information and the average value of the hotspot parameters of each storage server, the hotspot sub-score of the hotspot parameter is calculated to effectively reflect the resource occupancy level of each hotspot parameter. According to the weight corresponding to each hotspot parameter and the hotspot sub-score of each hotspot parameter, the hotspot resource score of the storage server is calculated to accurately and effectively reflect the occupancy of hotspot resources.

[0016] As an optional embodiment, a replica movement task is generated to move a target code repository copy stored in a storage server with unbalanced resources to another storage server, including: taking the storage server with unbalanced resources as a source server, and selecting a target code repository copy to be moved from the source server, wherein the source server includes at least one copy; selecting a target server according to a selection principle, wherein the target server is a storage server that receives the target code repository copy, and the selection principle is a principle of selecting a storage server that receives the target code repository copy as the target server; generating a replica movement task according to the source server, the target code repository copy and the target server.

[0017] A replica moving task is generated according to the target code repository replica of the unbalanced storage server and the selected target server, so that the target code repository replica is moved to the target server through the execution of the replica moving task, so that the resources of the source server are balanced.

[0018] As an optional embodiment, after generating a replica move task based on the source server, the target code repository copy and the target server, the method further includes: evaluating whether the source server is still resource unbalanced after the replica move task is executed; if there is still resource imbalance after evaluating that the source server executes the replica move task, continuing to generate replica move tasks until resources are balanced or the maximum number of replica move tasks is reached.

[0019] After the replica move task is executed, the source server is evaluated to see whether it is balanced. If it is not balanced, the replica move task is continued to be generated until the resources of the source server are balanced or the number of replica move tasks reaches the set maximum number. Then a series of replica move tasks are generated to make the resources of the source server as balanced as possible.

[0020] As an optional embodiment, after the target code repository copy and the target server generate a replica move task, the method also includes: performing conflict detection on the replica move task according to a conflict principle and execution parameters of the replica move task, wherein the execution parameters include the executed replica identifier and the execution time; when it is determined that the replica move task is a non-conflicting task, continuing to execute subsequent steps; when it is determined that the replica move task is a conflicting task, deleting the conflicting task and regenerating the replica move task.

[0021] After the replica move task is generated, conflict detection is performed according to the conflict principle. If there is a conflict with other replica move tasks, the conflicting task is deleted and a new replica move task is generated. This avoids the subsequent execution process being unable to execute due to task conflicts, affecting the resource balancing process.

[0022] As an optional embodiment, evaluating whether the source server is still resource-unbalanced after the replica move task is executed includes: simulating the resource information of the source server after executing the replica move task; predicting the resource score of the source server after execution based on the simulated resource information; and determining that the source server is still resource-unbalanced if the resource score of the source server after execution does not reach a preset threshold.

[0023] According to the replica move task, the resource information of the source server after the task is executed is simulated, and the resource score is performed based on the simulated resource information. If the resource score does not reach the preset threshold, it is determined that the source server is still resource unbalanced. The resource balance state of the source server after the replica move task is executed is accurately evaluated.

[0024] As an optional embodiment, the replica move task is assigned to the corresponding storage server for execution, and the copy of the target code repository is moved, including: assigning the replica move task to the source server according to the identifier of the source server corresponding to the replica move task; adding the replica move task to the task queue in a preset order until the task queue is full or all the replica move tasks are added to the task queue; executing the current task of the task queue and removing the completed current task; updating the current task of the task queue and continuing to execute until the tasks in the task queue are completed.

[0025] The replica moving task is executed according to the task queue of the source server. When there are multiple replica moving tasks, the replica moving tasks can be executed in sequence effectively and quickly, thereby improving the execution efficiency of the replica moving tasks.

[0026] As an optional embodiment, updating the current task of the task queue includes: in the absence of a replica moving task that has not been added to the task queue, directly updating the current task of the task queue according to the execution order of the task queue; in the absence of a replica moving task that has not been added to the task queue, adding the replica moving tasks that have not been added to the task queue to the task queue according to the preset order, updating the task queue, and updating the current task based on the updated task queue.

[0027] Since the number of replica moving tasks does not necessarily match the number that the task queue can accommodate, after each replica moving task is executed, the task queue is updated, the replica moving tasks that have not been added to the task queue are added to the task queue, and the current tasks that the task queue needs to execute are updated so that the task queue can execute the replica moving tasks. This ensures that the task queue is used to effectively and quickly execute the replica moving tasks and avoids the omission of replica moving tasks.

[0028] As an optional embodiment, after the distributed code storage system is initialized, when the scheduling balance is triggered, before obtaining the resource information of each storage server of the distributed code storage system, the method also includes: receiving the set scheduling time and / or scheduling frequency; during the operation period after the distributed code storage system is initialized, triggering the scheduling balance according to the scheduling time and / or scheduling frequency; or monitoring the target event of the distributed code storage system; and automatically triggering the scheduling balance after monitoring the occurrence of the target event.

[0029] The triggering of the scheduling balance can be realized according to the preset scheduling time and / or scheduling frequency to automatically trigger the scheduling balance according to the scheduling time and / or scheduling frequency. The scheduling balance can also be automatically triggered according to the monitoring of the target event, so as to realize automatic scheduling balance and maintain the resource balance of each storage server of the distributed code storage system.

[0030] As an optional embodiment, after assigning the replica movement task to the corresponding storage server for execution to perform the replica movement, the method further includes: calculating the relative standard deviation of the multiple storage servers according to the resource scores of the multiple storage servers as the total score of the multiple storage servers, wherein the multiple storage servers are multiple storage servers of the same rebalancing group; the rebalancing group is obtained by dividing the availability zones of the distributed code storage system according to the number of replicas of the code repository and the disaster recovery principle, the rebalancing group includes at least one availability zone, the availability zone includes at least one storage server, and the disaster recovery principle includes the storage principle of storing replicas in the storage server and the distribution principle of the storage server in the availability zone.

[0031] After performing the replica move task, resource scoring can also be performed on multiple storage servers in the same balancing group to characterize the resource balance of the entire balancing group.

[0032] An embodiment of the present invention provides a resource balancing device for a distributed code storage system, comprising: an acquisition module, used to acquire storage resource information and hotspot resource information of each storage server of the distributed code storage system when the distributed code storage system is initialized and scheduling balance is triggered; an evaluation module, used to perform storage resource evaluation on the storage server according to the storage resource information, and perform hotspot resource evaluation on the storage server according to the hotspot resource information, wherein the hotspot resource is resource information of the storage server other than storage resources; a generation module, used to generate a replica movement task for moving a target code repository copy stored in an unbalanced storage server to other storage servers when the storage resources or hotspot resources of the storage server are unbalanced, wherein the target code repository copy is one of the code repository copies in the storage server; an execution module, used to assign the replica movement task to the corresponding storage server for execution, and perform replica movement on the target code repository copy to balance the storage resources or hotspot resources of the storage servers in the distributed code storage system.

[0033] Beneficial effects of the embodiments of the present invention: by using the storage resource information and hotspot resource information of each storage server of the distributed code storage system to perform storage resource balancing and hotspot resource balancing respectively, a dynamic balance of storage resources and hotspot resources of the distributed code storage system is achieved. This ensures that the resource utilization rate of the entire distributed code storage system is at a high level, avoiding unnecessary resource occupation. This solves the problem in the related art that as the distributed code storage system is used and expanded, the resource occupation between each storage server becomes increasingly unbalanced, thereby leading to low resource utilization of the storage system.

[0034] An embodiment of the present invention provides an electronic device, comprising: a processor, and a memory storing a program, wherein the program comprises instructions, and when the instructions are executed by the processor, the processor executes any one of the resource balancing methods for a distributed code storage system described above.

[0035] An embodiment of the present invention provides a non-transitory machine-readable medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute any one of the above-mentioned resource balancing methods for a distributed code storage system.

[0036] The details of one or more embodiments of the invention are set forth in the following drawings and description so that other features, objects, and advantages of the invention are more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other embodiments can be obtained based on these drawings without creative work.

[0038] Figure 1 is a flow chart of a resource balancing method for a distributed code storage system according to an embodiment of the present invention;

[0039] Figure 2 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention;

[0040] Figure 3 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention;

[0041] Figure 4 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention;

[0042] Figure 5 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention;

[0043] Figure 6 is a schematic diagram of a resource rebalancing process of a distributed code storage system according to an embodiment of the present invention;

[0044] Figure 7 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention;

[0045] Figure 8 is a schematic diagram of a scheduling device for resource balancing in a distributed code storage system according to an embodiment of the present invention;

[0046] Fig. 9 is a schematic diagram of a resource rebalancing architecture of a distributed code storage system according to an embodiment of the present invention;

[0047] Fig.10 Schematic diagram of the structure of the electronic device of this embodiment. DETAILED DESCRIPTION

[0048] Embodiments of the present embodiment will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present embodiment are shown in the accompanying drawings, it should be understood that the present embodiment can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, which are instead provided for a more thorough and complete understanding of the present embodiment. It should be understood that the drawings and embodiments of the present embodiment are only for exemplary purposes and are not intended to limit the scope of protection of the present embodiment.

[0049] Compared with traditional distributed storage, the code storage service has a higher CPU resource usage rate, a higher resource usage rate of the system's input and output IO interfaces, more bandwidth resources, and a higher storage usage rate. This is because the code storage service uses the Git repository as the smallest storage unit. Every time a user pushes / pull a Git repository, accesses a web page, etc., the code storage service may need to decompress, read / write packages, repack (repack), and transfer data for the repository. Due to the characteristics of Git, operations such as decompression, reading / writing packages, and repackaging involve a lot of computing and bandwidth. This is particularly true when the number of user requests is large or the repository is large.

[0050] Some cloud service systems provide Git repository hosting services based on distributed multi-copy code storage systems. As the number of system users grows, the distributed multi-copy code storage architecture needs to be horizontally expanded multiple times. At the same time, as the system is used, there are also unpredictable user behaviors and other reasons, which will lead to more and more serious imbalance in resource usage between storage servers in the distributed code storage system, including the number of requests / computing, bandwidth, storage and other resources.

[0051] Similarly, the number of requests, CPU usage, and storage usage are also very unbalanced. The deviation in resource usage of each storage server has even exceeded 60%. On the other hand, for storage servers that have been expanded horizontally, resources have been under load for a long time, which will cause some storage servers to have a continuously high resource usage, while the newly added storage servers will be at a lower level for a long period of time, resulting in a serious resource imbalance.

[0052] For distributed code storage systems, when users perform code repository operations on the storage system, including the growth of existing code repositories and the deletion of code repositories by users, this will cause resource imbalance in the storage servers used to store code repositories. In addition, due to the random storage strategy for incremental repositories, that is, the copies of the repositories are randomly stored on storage servers, the activity of the repositories will change over time, causing resource imbalance on each storage server. The horizontal expansion of storage servers in distributed code storage systems will also lead to unbalanced resource usage.

[0053] Unbalanced resource usage will bring the following problems to the architecture: Low resource utilization: Some storage servers have high resource usage, while some storage servers have low resource usage. This is undoubtedly a huge waste of resources and goes against the original design intention of distributed storage. Availability issues: When the resource usage of the storage server reaches 100%, service unavailability will occur. Increased operation and maintenance costs: When the storage usage of the storage server reaches 100%, manual copy movement and database changes are required, which will greatly increase the operation and maintenance costs and there is also a risk of data errors. Impact on horizontal expansion: When the architecture is expanded horizontally, the newly added storage servers will be in a state of low resource utilization for a long time and cannot effectively share the architecture pressure.

[0054] With the use and expansion of the above-mentioned distributed code storage system, the resource occupation between each storage server will become increasingly unbalanced, resulting in low resource utilization of the storage system. This embodiment proposes a resource balancing method for a distributed code storage system, which can perform storage resource balancing and hotspot resource balancing respectively through the storage resource information and hotspot resource information of each storage server of the distributed code storage system, thereby realizing a dynamic balance of storage resources and hotspot resources of the distributed code storage system.

[0055] This ensures that the resource utilization rate of the entire distributed code storage system is at a high level, avoiding unnecessary resource occupation. The problem in the related art that as the distributed code storage system is used and expanded, the resource occupation between each storage server becomes increasingly unbalanced, resulting in low resource utilization of the storage system is solved.

[0056] The resource balancing method of the distributed code storage system provided in this specification can be applied to electronic devices for cloud server resource scheduling. The electronic devices may include notebooks, desktop computers, smart phones, smart wearable devices (virtual reality glasses, smart watches, etc.), tablet computers, etc. Of course, the resource balancing method of the distributed code storage system provided in this specification can also be applied to applications running in the above-mentioned electronic devices. For example, the resource balancing method of the distributed code storage system can be applied to a browser with an instant messaging function, and can also be applied to an instant messaging software.

[0057] Figure 1 is a flow chart of a resource balancing method for a distributed code storage system according to an embodiment of the present invention. Figure 1 As shown, a resource balancing method for a distributed code storage system provided by an embodiment of the present invention includes the following steps:

[0058] Step S101, after the distributed code storage system is initialized, in the case of triggering scheduling balance, obtaining storage resource information and hotspot resource information of each storage server of the distributed code storage system;

[0059] Step S102, performing storage resource evaluation on the storage server according to the storage resource information, and performing hotspot resource evaluation on the storage server according to the hotspot resource information, wherein the hotspot resource is resource information of the storage server other than the storage resource;

[0060] Step S103, when the storage resources or hot spot resources of the storage server are unbalanced, generating a copy moving task for moving the target code repository copy stored in the storage server with unbalanced resources to another storage server, wherein the target code repository copy is one of the code repository copies in the storage server;

[0061] Step S104, assigning the replica movement task to the corresponding storage server for execution, and performing replica movement on the target code repository replica to balance the storage resources or hot spot resources of the storage server in the distributed code storage system.

[0062] The resource balancing method of the above-mentioned distributed code storage system provided in the embodiment of the present invention can be applied to cloud server resource scheduling. Storage resource balancing and hotspot resource balancing are performed respectively through the storage resource information and hotspot resource information of each storage server of the distributed code storage system, so as to realize the dynamic balance of storage resources and hotspot resources of the distributed code storage system. This ensures that the resource utilization rate of the entire distributed code storage system is at a high level, avoiding unnecessary resource occupation. This solves the problem in the related art that as the distributed code storage system is used and expanded, the resource occupation between each storage server will become increasingly unbalanced, thereby leading to low resource utilization of the storage system.

[0063] When the above-mentioned distributed code storage system is initialized, it will perform an initial resource allocation, usually an incremental balance. The newly added data will be stored on which storage server based on the resource level of the existing storage servers. Moreover, the newly added data is usually only allocated to the storage server with more abundant storage resources based on the level of storage resources of each storage server for incremental balance. The hot resources of the storage server other than storage resources, such as the number of active warehouses, number of requests, traffic, and interface time, are not balanced, which leads to focusing only on storage balance and ignoring the balance of hot spot resources.

[0064] With the use of distributed code storage systems, the data in code repositories increases, and the differences in resource usage of various storage servers increase, resulting in resource shortages on some storage servers and resource waste on some storage servers, causing resource imbalance on storage servers. In particular, after the distributed code storage system has been horizontally expanded, the resource usage level of the newly added storage servers is low during the calculation time, exacerbating the resource imbalance between storage servers.

[0065] This embodiment provides a resource balancing method for a distributed code storage system. After the distributed code storage system is initialized, when scheduling balancing is triggered, storage resource scoring and hot resource scoring are performed based on the storage resource information and hot resource information of the storage server, so that storage resources and hot resource are compatible and balanced.

[0066] Specifically, when performing storage resource balancing, storage resource evaluation is performed on the storage server according to the storage resource information. When the storage resource score of the storage server indicates that the storage resources are unbalanced, a copy movement task is generated to move the target code repository copy stored in the storage server with unbalanced storage resources to other storage servers, and the task is assigned to the corresponding storage server for execution. The target code repository copy is moved until the storage resources of the storage servers in the distributed code storage system are balanced.

[0067] When performing hotspot resource balancing, the hotspot resource evaluation is performed on the storage server according to the hotspot resource information. When the hotspot resource score of the storage server indicates that the hotspot resources are unbalanced, a copy movement task is generated to move the target code repository copy stored in the storage server with unbalanced hotspot resources to other storage servers and assigned to the corresponding storage server for execution. The copy of the target code repository is moved until the hotspot resources of the storage servers in the distributed code storage system are balanced.

[0068] Since the code data in the distributed code storage system is stored in the form of code warehouses, it can be understood that the smallest data unit in the storage server is the code warehouse. Therefore, the processing methods of storage resource balancing and hotspot resource balancing are to transfer the code warehouse copies in the unbalanced storage server to other storage servers to balance the storage server resources. The difference lies in the storage resource scoring and hotspot resource scoring methods.

[0069] The storage resource score depends on the storage resource information of the storage server. The storage resource score of the storage server is determined by calculation in a set manner through the storage resource information of the storage server. It is used to characterize the storage resource balance level of all storage servers in the distributed code storage system.

[0070] The hotspot resource score depends on the hotspot resource information of the storage server. The hotspot resource score of the storage server is determined by calculating the hotspot resource information of the storage server in a set manner, which is used to characterize the hotspot resource balance level of all storage servers in the distributed code storage system.

[0071] It should be noted that, under normal circumstances, the balance of storage resources and the balance of hotspot resources are synchronized, that is, the more code repositories stored in the storage server, the more storage resources are occupied, and the more hotspot resources are usually.

[0072] However, in a distributed code storage system, different storage servers can be set to different heats, that is, some storage servers are set to be used infrequently and have a lower heat, some storage servers are used normally and have a normal heat, and some storage servers are used frequently and have a higher heat. This leads to the opposite of the balance of storage resources and the balance of hotspot resources in some cases, that is, the more storage resources, the less hotspot resources are occupied.

[0073] However, no matter whether the storage resource balance and the hotspot resource balance are synchronized or opposite, there will be a time when the storage resource is close to balance, resulting in a deterioration of the hotspot resource balance, or when the hotspot resource is close to balance, resulting in a deterioration of the storage resource. For this, the first preset threshold of the storage resource balance or the second preset threshold of the hotspot resource balance can be adjusted, so that the storage resource and the hotspot resource are finally balanced.

[0074] It should be noted that the first preset threshold or the second preset threshold can be set for a single storage server, or for multiple or all storage servers, mainly depending on the storage performance of the storage server itself. During implementation, it can be set according to specific circumstances.

[0075] The above steps achieve a dynamic balance between storage resources and hotspot resources of the distributed code storage system. This ensures that the resource utilization rate of the entire distributed code storage system is at a high level, avoiding unnecessary resource occupation. This solves the problem in the related art that as the distributed code storage system is used and expanded, the resource occupation between each storage server becomes increasingly unbalanced, resulting in low resource utilization of the storage system.

[0076] Figure 2 FIG. 1 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention. Figure 2 As shown, the embodiment of the present invention also provides another resource balancing method for a distributed code storage system, which is applied to cloud server resource scheduling. Optionally, the resource balancing method for a distributed code storage system provided by the embodiment of the present invention can be used in step S102 provided in the above embodiment. In the above step S102, the storage resource information includes: occupied storage space, total storage space; based on the storage resource information, storage resource evaluation of the storage server includes:

[0077] Step S201, performing storage resource scoring on the storage resources of the storage server according to the storage resource information, wherein the storage resource scoring is used to characterize the balance status of the storage resources;

[0078] Step S202, when the storage resource score of the storage server reaches a first preset threshold, determining the storage resource balance of the storage server;

[0079] Step S203: When the storage resource score of the storage server does not reach the first preset threshold, it is determined that the storage resources of the storage server are unbalanced.

[0080] The resource balancing method of the above-mentioned distributed code storage system provided by an embodiment of the present invention can score the storage resources of the storage server according to the storage resource information including the occupied storage space and the total storage space. When the storage resource score reaches a first preset threshold, the storage resources are determined to be balanced; otherwise, it is determined that the storage resources are unbalanced and a storage resource balancing operation is required.

[0081] The above storage resource information includes the occupied storage space occupied by the data stored in the storage server to be scored, the total storage space of the storage server, and the total storage space of other storage servers. The storage resource score of the storage server to be scored is determined by comparing the total storage space of the storage server with the total storage space of other storage servers.

[0082] The sizes of all storage servers in the distributed code storage system are fully considered to accurately reflect the storage resource balance level of the storage server to be scored in all storage servers in the distributed code storage system.

[0083] As an optional embodiment, storage resource scoring is performed on the storage resources of the storage server based on the storage resource information, including: when the total storage space sizes of the storage servers are the same, the storage resource score of the storage server is calculated based on the occupied storage space of the storage server to be scored and the total storage space of the storage servers; when the total storage space sizes of the storage servers are different, the storage resource score of the storage server is calculated based on the maximum and minimum values ​​of the total storage space of multiple storage servers for resource balancing and the occupied storage space of the storage server to be scored.

[0084] Since it is necessary to consider the total storage space of the storage server to be scored and the size relationship with other storage spaces. Under normal circumstances, the total storage space of the storage servers of the distributed code storage system is consistent. Therefore, the resource balance level can be reflected by the ratio of the storage space occupied by the storage server to be scored to the total storage space of the storage server to be scored.

[0085] It should be noted that, in this case, the total storage space of the storage server to be scored is consistent with the total storage space of other storage servers and can be replaced during calculation.

[0086] However, there is also a situation where the total storage space of the storage server of the distributed code storage system is inconsistent, some are large, and some are small. This may also exist after multiple horizontal expansions. For this situation, it is necessary to use a normalized method to calculate a standard storage space to characterize the standard level of storage servers of different storage controls. Then, the storage resource score is determined by the ratio of the occupied storage space to the standard storage space.

[0087] When calculating the standard storage space, the calculation is performed based on the maximum and minimum values ​​of the total storage space of multiple storage servers of the distributed code storage system and the total storage space of the storage server to be scored. For example, the standard storage space is calculated by the following formula.

[0088]

[0089] Where a′ is the standard storage space, a is the total storage space of the storage server to be scored, min(a) is the minimum total storage space of the storage server, and max(a) is the maximum total storage space of the storage server.

[0090] Different calculation methods are used to calculate the storage resource score based on whether the total storage space size of each storage server is the same, making the storage resource score more accurate. The storage resource score is calculated based on the occupied space of the storage server and the total space of each storage server, which effectively reflects the resource occupancy level of the storage server when the total storage space of each storage server is consistent.

[0091] The storage resource score is calculated based on the maximum and minimum values ​​of the total storage space of the storage server and the occupied storage space of the storage server, accurately and effectively reflecting the resource occupancy level of the storage server when the total storage space of each storage server is inconsistent.

[0092] Figure 3 FIG. 1 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention. Figure 3 As shown, the embodiment of the present invention also provides another resource balancing method for a distributed code storage system, which is applied to cloud server resource scheduling. Optionally, the resource balancing method for a distributed code storage system provided by the embodiment of the present invention can be used in step S102 provided in the above embodiment. In the above step S102, the hotspot resource information includes at least one of the following hotspot parameters: request volume, interface time consumption, interface traffic, and active data volume; based on the hotspot resource information, the storage server is evaluated for hotspot resources, including:

[0093] Step S301, performing hotspot resource scoring on the hotspot resources of the storage server according to the hotspot resource information, wherein the hotspot resource scoring is used to characterize the balance status of the hotspot resources;

[0094] Step S302, when the hotspot resource score of the storage server reaches a second preset threshold, determining the hotspot resource balance of the storage server;

[0095] Step S303: When the hotspot resource score of the storage server does not reach the second preset threshold, it is determined that the hotspot resources of the storage server are unbalanced.

[0096] The resource balancing method of the above-mentioned distributed code storage system provided by an embodiment of the present invention scores the hotspot resources of the storage server according to the hotspot resource information including the request volume, interface time consumption, interface traffic, and active data volume. When the hotspot resource score reaches a second preset threshold, the hotspot resource is determined to be balanced. Otherwise, it is determined that the hotspot resource is unbalanced and a hotspot resource balancing operation is required.

[0097] As an optional embodiment, a hotspot resource score is performed on the hotspot resources of the storage server based on the hotspot resource information, including: calculating a hotspot sub-score of the hotspot parameter based on the value of the hotspot parameter in the hotspot resource information and the average value of the hotspot parameters of each storage server; calculating the hotspot resource score of the storage server based on the weight corresponding to each hotspot parameter and the hotspot sub-score of each hotspot parameter.

[0098] According to the value of the hotspot parameter in the hotspot resource information and the average value of the hotspot parameters of each storage server, the hotspot sub-score of the hotspot parameter is calculated to effectively reflect the resource occupancy level of each hotspot parameter. According to the weight corresponding to each hotspot parameter and the hotspot sub-score of each hotspot parameter, the hotspot resource score of the storage server is calculated to accurately and effectively reflect the occupancy of hotspot resources.

[0099] Since hotspot resource information includes data from multiple dimensions, when scoring, it is necessary to calculate the sub-scores according to the dimensions of each hotspot parameter, and then calculate the final hotspot resource score based on the corresponding weights. For example,

[0100]

[0101] Among them, c is the hot resource score, x i refers to the hotspot parameter (variable factor), is the mean value of the variable factor, w i is the variable weight, and n is the number of variable factors. For hotspot balancing, the variable factors include the number of active warehouses, the number of requests, the traffic, and the interface time consumption, and the weights are set as needed.

[0102] It should be noted that in some cases, the storage resource information may include parameters of other dimensions, and the storage resource score may also be calculated in the above manner. However, in this embodiment, for storage balance, the variable factor is only the storage occupied space, and the weight is 100%.

[0103] Figure 4 FIG. 1 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention. Figure 4 As shown, the embodiment of the present invention also provides another resource balancing method for a distributed code storage system, which is applied to cloud server resource scheduling. Optionally, the resource balancing method for a distributed code storage system provided by the embodiment of the present invention can be used in step S103 provided in the above embodiment. The above step S103 generates a copy moving task for moving the target code repository copy stored in the storage server with unbalanced resources to other storage servers, including:

[0104] Step S401, taking a storage server with unbalanced resources as a source server, and selecting a target code repository copy to be moved from the source server, wherein the source server includes at least one copy;

[0105] Step S402, selecting a target server according to a selection principle, wherein the target server is a storage server that receives a copy of the target code repository, and the selection principle is a principle of selecting a storage server that receives a copy of the target code repository as the target server;

[0106] Step S403: Generate a replica move task according to the source server, the target code repository replica and the target server.

[0107] The resource balancing method of the above-mentioned distributed code storage system provided by an embodiment of the present invention generates a replica moving task based on the target code repository copy of the unbalanced storage server and the selected target server, so that the target code repository copy is moved to the target server through the execution of the replica moving task, thereby balancing the resources of the source server.

[0108] The target code repository copy to be moved from the source server may be selected according to certain rules, such as random selection. It may also be selected in the order of storage time or in the order of storage space occupied. The purpose is to select a target code repository copy from the source server for movement so as to balance the resources of the source server.

[0109] The target server can be selected based on the selection principle mentioned above, and can be selected in combination with the architecture of the distributed code storage service system. From an architectural point of view, the distributed code storage system is divided into at least one availability zone, each availability zone includes at least one storage server. According to the selection principle, the storage server in the same availability zone or different availability zones can be selected as the target server. The selection principle can also be appropriately adjusted according to the storage principle of the code repository replica.

[0110] As an optional embodiment, after generating a replica move task based on the source server, the target code repository copy and the target server, the method also includes: evaluating whether the source server is still resource unbalanced after the replica move task is executed; if there is still resource imbalance after evaluating the source server to execute the replica move task, continue to generate replica move tasks until the resources are balanced or the maximum number of replica move tasks is reached.

[0111] After executing the replica move task, the source server is evaluated to see whether it is balanced. If it is still unbalanced, continue to generate replica move tasks until the resources of the source server are balanced or the number of replica move tasks reaches the set maximum number. Then, a series of replica move tasks are generated to make the resources of the source server as balanced as possible.

[0112] After the replica move task is generated, the task is evaluated to determine whether to continue to generate the replica move task, thereby achieving one-time generation of multiple replica move tasks for the source server, so that the source server can achieve balance in one balancing process as much as possible.

[0113] As an optional embodiment, after the target code repository copy and the target server generate a copy move task, the method also includes: performing conflict detection on the copy move task according to the conflict principle and the execution parameters of the copy move task, wherein the execution parameters include the executed copy identifier and the execution time; when it is determined that the copy move task is a non-conflicting task, continuing to execute subsequent steps; when it is determined that the copy move task is a conflicting task, deleting the conflicting task and regenerating the copy move task.

[0114] After the replica move task is generated, conflict detection is performed according to the conflict principle. In the event of a conflict with other replica move tasks, the conflicting task is deleted and a new replica move task is generated. This avoids subsequent executions being unable to be executed due to task conflicts, affecting the resource balancing process.

[0115] The above conflict principle is related to task execution. For example, it is not allowed to operate the same warehouse replica at the same time. If the operation time and operation object of two replica move tasks are the same, this will cause a conflict, which will cause the task execution to fail or the task execution process to terminate, affecting the progress of the balancing process.

[0116] As an optional embodiment, evaluating whether the source server is still resource-unbalanced after the replica move task is executed includes: simulating the resource information of the source server after executing the replica move task; predicting the resource score of the source server after execution based on the simulated resource information; and determining that the source server is still resource-unbalanced if the resource score of the source server after execution does not reach a preset threshold.

[0117] According to the replica move task, the resource information of the source server after the task is executed is simulated, and the resource score is performed based on the simulated resource information. If the resource score does not reach the preset threshold, it is determined that the source server is still resource unbalanced. The resource balance state of the source server after the replica move task is executed is accurately evaluated.

[0118] It should be noted that the simulated resource information here can be storage resource information or hotspot resource information. When the resource score after the source server is executed does not reach the preset threshold, it can refer to that the storage resource score after execution does not reach the first preset threshold, or it can refer to that the hotspot resource score after execution does not reach the second preset threshold. It depends on whether the balancing process is storage balancing or hotspot balancing.

[0119] Figure 5 FIG. 1 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention. Figure 5 As shown, the embodiment of the present invention also provides another resource balancing method for a distributed code storage system, which is applied to the above-mentioned scheduling device. Optionally, the resource balancing method for a distributed code storage system provided by the embodiment of the present invention can be used in step S104 provided in the above-mentioned embodiment. The above-mentioned step S104 assigns the copy movement task to the corresponding storage server for execution, and performs copy movement on the target code repository copy, including:

[0120] Step S501, assigning a replica migration task to a source server according to an identifier of the source server corresponding to the replica migration task;

[0121] Step S502, adding the replica moving tasks to the task queue in a preset order until the task queue is full or all the replica moving tasks are added to the task queue;

[0122] Step S503, executing the current task in the task queue, and removing the current task that has been completed;

[0123] Step S504, updating the current task in the task queue, and continuing to execute until the tasks in the task queue are completed.

[0124] The resource balancing method of the above-mentioned distributed code storage system provided by an embodiment of the present invention executes the replica movement task according to the task queue of the source server. When there are multiple replica movement tasks, the replica movement tasks can be effectively and quickly executed in sequence, thereby improving the execution efficiency of the replica movement tasks.

[0125] The task queue of the storage server can execute replica movement tasks more efficiently, quickly and accurately, especially when there are a large number of replica movement tasks. Sending and executing them one by one is inefficient and has poor security. Multiple replica movement tasks can be directly packaged and sent to the storage server. The storage server will use the task queue to execute them in an orderly manner, thereby improving task execution efficiency.

[0126] As an optional embodiment, updating the current task of the task queue includes: in the absence of a replica moving task that has not been added to the task queue, directly updating the current task of the task queue according to the execution order of the task queue; in the absence of a replica moving task that has not been added to the task queue, adding the replica moving tasks that have not been added to the task queue to the task queue in a preset order, updating the task queue, and updating the current task based on the updated task queue.

[0127] Since the number of replica moving tasks does not necessarily match the number that the task queue can accommodate, after each replica moving task is executed, the task queue is updated, the replica moving tasks that have not been added to the task queue are added to the task queue, and the current tasks that need to be executed by the task queue are updated so that the task queue can execute the replica moving tasks. This ensures that the task queue is used to effectively and quickly execute the replica moving tasks and avoids the omission of replica moving tasks.

[0128] It should be noted that there are also some resource balancing methods for distributed systems in related technologies, such as the data balancing strategy of HDFS. HDFS (Hadoop Distributed File System) is a distributed file system. The HDFS architecture uses data balancing strategies to ensure the robustness of the system. The HDFS data balancing strategy has a set of design principles, including but not limited to: data cannot be lost, the number of data backups cannot be changed, and the number of data blocks in each rack cannot be changed. It cannot occupy too many resources and cannot affect the normal operation of the Name Node.

[0129] The execution method of the HDFS data balancing strategy is to move data blocks, but before that, rebalancing will obtain statistical information, and then decide the source node and target node based on the strategy and algorithm, and then select the appropriate data block.

[0130] HDFS is very different from the distributed multi-copy code storage architecture of this embodiment. HDFS provides services to the outside in the form of files, but the distributed multi-copy code storage architecture provides services to the outside in the form of Git repositories. Moreover, the distributed multi-copy code storage architecture has very high requirements for computing resources, and the balance of computing resources needs to be strictly considered in the rebalancing design.

[0131] The disadvantage is that the data balancing strategy of HDFS has a single function and only balances storage, and does not support hot data balancing.

[0132] There is also a rebalancing of ElasticSearch (abbreviated as ES), which is a distributed search and data analysis engine. The index in ES may store a large amount of data, which may exceed the hardware limitations of a single node. To solve this problem, ES provides the function of subdividing the index into multiple fragments, which is shard. In addition, in order to improve availability and implement a failover mechanism for shards when problems occur, ElasticSearch copies one or more of the index shards into so-called replica shards.

[0133] ES's rebalancing capability is used to balance the resources of each shard. The goal of ES balancing is to balance the number of shards on different nodes as much as possible, and to spread the shards of each index as much as possible on each node. ES uses a weighted approach to evaluate the resource usage of the node where the shard is located. ES will calculate a weight value for each combination of shard and node. The node with the lowest weight value is the target node for the shard. Similarly, the greater the difference in weight values, the more imbalanced it means. Rebalancing will move the selected shard from a high-weight node to a low-weight node. The rebalancing execution behavior of ES is to move shards.

[0134] The disadvantage is that it only balances the number of data in the shards, and does not handle the storage size and hot data.

[0135] The implementation method provided in this embodiment is a service based on a distributed multi-copy code storage architecture in the related technology, and its main purpose is to balance the computing, bandwidth, storage and other resource usage among various storage servers in the architecture. Figure 6 FIG. 1 is a schematic diagram of a resource rebalancing process of a distributed code storage system according to an embodiment of the present invention. Figure 6 As shown in Figure 1, the start time of rebalancing, the number of executions per day, and the execution parameters can be dynamically configured. When rebalancing starts, an analysis and decision are made for all storage servers.

[0136] It should be noted that the initial balancing strategy of the distributed code storage system can be understood as incremental balancing. The newly added data will be stored on which server based on the resource level of the existing storage server. However, as the data grows, the number of storage servers will continue to increase, and the resource level of the newly added storage server will be 0. At this time, the existing data needs to be moved to the newly added storage server. This process is called rebalancing.

[0137] Analysis: Obtain, aggregate, and analyze data from the TSDB (Time Series Database) service, mainly including collecting resource information (storage, computing, bandwidth, etc.), warehouse and replica information of each storage server, and then planning and calculating the score of each storage server according to the scoring algorithm.

[0138] The storage server score includes the hotspot resource score and the storage resource score. The storage server indicators are: for storage balance, only the storage occupied size. For hotspot balance, there are four indicators: the number of active warehouses, the number of requests, the traffic, and the interface time.

[0139] The quantitative algorithm mainly calculates the hotspot resource score and storage resource score by weighted + relative deviation. The calculation formula is:

[0140]

[0141] Among them, c is the score, x i is the indicator (variable factor), is the mean value of the variable factor, w i is the variable weight, n is the number of variable factors. For storage balancing, the variable factor only includes storage occupancy, and the weight is 100%. For hotspot balancing, the variable factors include the number of active warehouses, the number of requests, the traffic, and the interface time consumption, and the weight is set as needed.

[0142] Decision: Decision is mainly used to generate several valid replica moving tasks.

[0143] Generate replica move tasks: After the analysis is completed, if the storage is found to be unbalanced, the source server, target server, and source replica are selected, and a replica move task is created. Then, it is evaluated whether the operation will be balanced. If it is still unbalanced, the replica move tasks are continued to be created until the storage is balanced or the maximum number (decision_num) is reached. After the complete decision, it is expected that no more than decision_num replica move tasks will be generated.

[0144] Verification task: The generated decision_num replica moving tasks are stored in the task table. If there is a conflict in the replica moving tasks, such as not being allowed to operate the replicas of the same warehouse at the same time, or destroying the availability zone where the warehouse is located, the conflicting replica moving tasks will be canceled. Then the total score before and after the replica moving tasks are calculated.

[0145] Whenever a valid replica move task is generated, the effect of the replica move task after execution is simulated and calculated, and then the score is corrected and the next valid replica move task is generated.

[0146] After the decision is made, a task queue is assigned to each storage server with a queue depth of queue_len, and then the task is executed as follows:

[0147] Step 1: Add replica movement tasks to task queues in order until all queues are full or there are no replica movement tasks available.

[0148] Step 2: Execute the current copy moving task in the queue. After the current copy moving task is completed, remove the task from the queue.

[0149] Step 3: Whenever a current copy move task is completed, the task allocation will be re-triggered and the first step will be re-executed.

[0150] Step 4: All replica movement tasks are completed. The replica movement task is completed and the relevant data of this rebalancing is recorded.

[0151] Figure 7 FIG. 1 is a flow chart of another resource balancing method of a distributed code storage system according to an embodiment of the present invention. Figure 7 As shown, the embodiment of the present invention also provides another resource balancing method for a distributed code storage system, which is applied to the above-mentioned scheduling device. Optionally, in addition to steps S101-S104, in step S101, after the distributed code storage system is initialized, before triggering scheduling balancing, before obtaining resource information of each storage server of the distributed code storage system, the method also includes:

[0152] Step S701, receiving a set scheduling time and / or scheduling frequency;

[0153] Step S702, during the operation period after the distributed code storage system is initialized, triggering scheduling balance according to the scheduling time and / or scheduling frequency;

[0154] Or, step S703, monitoring target events of the distributed code storage system;

[0155] Step S704: After the target event is monitored, scheduling balance is automatically triggered.

[0156] In the resource balancing method of the distributed code storage system provided by the embodiment of the present invention, the triggering of scheduling balance can be based on the preset scheduling time and / or scheduling frequency, so as to automatically trigger the scheduling balance according to the scheduling time and / or scheduling frequency.

[0157] The scheduling balance can also be automatically triggered according to the monitoring of the target event, so as to realize automatic scheduling balance and maintain the resource balance of each storage server of the distributed code storage system. The above target event can be horizontal expansion. In some cases, vertical expansion can also lead to aggravated resource imbalance. Therefore, vertical expansion can also be set to trigger scheduling balance.

[0158] As an optional embodiment, after the replica movement task is assigned to the corresponding storage server for execution to perform the replica movement, the method also includes: calculating the relative standard deviation of the multiple storage servers based on the resource scores of the multiple storage servers as the total score of the multiple storage servers, wherein the multiple storage servers are multiple storage servers of the same rebalancing group; the rebalancing group is obtained by dividing the availability zones of the distributed code storage system according to the number of replicas of the code repository and the disaster recovery principle, the rebalancing group includes at least one availability zone, the availability zone includes at least one storage server, the disaster recovery principle includes the storage principle of storing replicas in the storage server, and the distribution principle of the storage server in the availability zone.

[0159] After performing the replica move task, resource scoring can also be performed on multiple storage servers in the same balancing group to characterize the resource balance of the entire balancing group.

[0160] The division of rebalancing groups needs to be carried out under the condition of ensuring the architectural principles (architecture disaster recovery, warehouse disaster recovery, architecture SLA (Service Level Agreement), data reliability, etc.), so the rebalancing capability must consider the following issues: Number of replicas: The warehouse defaults to three replicas, but it will be expanded to five replicas or even more in the future.

[0161] Warehouse disaster recovery: The multi-copy architecture has a very important disaster recovery design, that is, multiple copies of a warehouse must be distributed to different availability zones to ensure data reliability. Architecture disaster recovery: The Galileo architecture allows storage servers to be distributed to multiple availability zones (three copies: availability zones ≥ 3, five copies: availability zones ≥ 5).

[0162] When dividing the rebalancing group, the following situations need to be divided separately, as shown in Table 1, which is an example table of the division of the rebalancing group.

[0163] Table 1 Example of division of rebalancing groups

[0164]

[0165] In general, a rebalancing group consists of one or more availability zones. The goal of rebalancing is to balance all storage servers in a rebalancing group.

[0166] The storage servers in a rebalancing group calculate the indicators and find the storage server with the largest / smallest deviation value based on the indicators. The source and target storage servers for rebalancing are found within a rebalancing group. When searching for the rebalancing target storage server, the following conditions must be met: there cannot be two copies of the same warehouse in one availability zone.

[0167] The total score of the rebalancing group can be used to observe the "benefit" generated by a balancing process. After each balancing, the total score of the rebalancing group will decrease. If the total score of the rebalancing group before balancing is lower than the total score of the rebalancing group after balancing, then this balancing process is unreasonable. The total score is mainly used to observe the effect of rebalancing, not in the decision-making process. The main implementation is to regularly calculate the total score of the rebalancing group of all storage servers in the rebalancing group.

[0168] Similar to the storage server score calculation method, the rebalancing group also has a total score to describe the balance status of all storage servers in the group, that is, the relative standard deviation cost, which is calculated as follows:

[0169]

[0170] In the formula, δ is the standard deviation, is the average resource score, N is the number of storage servers in the rebalancing group, and z i The resource score of the i-th storage server. The smaller the cost value, the smaller the deviation and the more balanced the rebalancing group. In the balanced state, the cost value is in [1,slop 2 ] interval, slop is the tolerance deviation value. Since resource balance cannot achieve complete balance in theory, as long as the deviation is below the tolerance deviation value, it is considered balanced. The tolerance deviation value can be set.

[0171] Figure 8 is a schematic diagram of a scheduling device for resource balancing of a distributed code storage system according to an embodiment of the present invention. Figure 8As shown, based on the resource balancing method of the above-mentioned distributed code storage system provided by an embodiment of the present invention, an embodiment of the present invention also provides a resource balancing device for a distributed code storage system, which is applied to resource scheduling of a cloud server. The device includes: an acquisition module 81, an evaluation module 82, a generation module 83, and an execution module 84. The device is described in detail below.

[0172] An acquisition module 81 is used to acquire storage resource information and hotspot resource information of each storage server of the distributed code storage system when the distributed code storage system is initialized and scheduling balance is triggered; an evaluation module 82 is connected to the acquisition module 81 and is used to perform storage resource evaluation on the storage server according to the storage resource information, and to perform hotspot resource evaluation on the storage server according to the hotspot resource information, wherein hotspot resources are resource information of the storage server other than storage resources; a generation module 83 is connected to the evaluation module 82 and is used to generate a copy movement task for moving the target code repository copy stored in the storage server with unbalanced resources to other storage servers when the storage resources or hotspot resources of the storage server are unbalanced, wherein the target code repository copy is one of the code repository copies in the storage server; an execution module 84 is connected to the generation module 83 and is used to assign the copy movement task to the corresponding storage server for execution, and to perform copy movement on the target code repository copy to balance the storage resources or hotspot resources of the storage servers in the distributed code storage system.

[0173] The resource balancing device for a distributed code storage system provided in the embodiment of the present invention performs storage resource balancing and hotspot resource balancing respectively through the storage resource information and hotspot resource information of each storage server of the distributed code storage system, thereby achieving a dynamic balance of the storage resources and hotspot resources of the distributed code storage system. This ensures that the resource utilization rate of the entire distributed code storage system is at a high level, avoiding unnecessary resource occupation. This solves the problem in the related art that as the distributed code storage system is used and expanded, the resource occupation between each storage server becomes increasingly unbalanced, resulting in low resource utilization of the storage system.

[0174] Fig. 9 is a structural block diagram of a scheduling device that adopts a dynamic exclusive resource and shared resource combination solution according to an embodiment of the present invention. Fig. 9 As shown, this embodiment proposes a device for dynamically adjusting exclusive resources of a cloud server, including code storage service, TSDB service, operation and maintenance service, kv storage service, front-end interface, grafana and link tracking.

[0175] Code storage service: One of the core services of the distributed multi-copy code storage architecture, it mainly stores the user's Git repository and provides external Git repository read and write services.

[0176] TSDB service: It is a time series database. The behavior / activity data of the code storage service will be collected and stored in the application.

[0177] Operation and maintenance service: Run the rebalancing service.

[0178] Kv (key-value) storage service: provides distributed lock services to ensure data consistency.

[0179] Front-end interface: used to display the rebalancing process and results, as well as historical data.

[0180] Monitoring instrumentation system grafana and link tracking: achieve observability of rebalancing services.

[0181] In order to ensure that online services are not affected and to accurately and precisely achieve rapid and continuous balancing of the architecture, the rebalancing scheduling strategy of this embodiment allows configuration of multiple rebalancing behaviors and related parameters.

[0182] An embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory in communication with the at least one processor. The memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the electronic device executes the method of the embodiment of the present invention.

[0183] An embodiment of the present invention further provides a non-transitory machine-readable medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute the method of the embodiment of the present invention.

[0184] An embodiment of the present invention further provides a computer program product, including a computer program, wherein the computer program, when executed by a processor of a computer, is used to enable the computer to execute the method of the embodiment of the present invention.

[0185] Fig.10 is a schematic diagram of the structure of the electronic device of this embodiment, referring to Fig.10, a block diagram of an electronic device that can be used as a server or client of an embodiment of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. Electronic devices are intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0186] like Fig.10 As shown, the electronic device includes a computing unit 1001, which can store data stored in a read-only memory (ROM)

[0187] The computer program in the computing unit 1001, the ROM 1002 or the computer program loaded from the storage unit 1008 into the random access memory (RAM) 1003 is used to perform various appropriate actions and processes. In the RAM 1003, various programs and data required for the operation of the electronic device can also be stored. The computing unit 1001, the ROM 1002 and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0188] A plurality of components in the electronic device are connected to the I / O interface 1005, including: an input unit 1006, an output unit 1007, a storage unit 1008, and a communication unit 1009. The input unit 1006 may be any type of device capable of inputting information into the electronic device, and the input unit 1006 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 1007 may be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1008 may include, but is not limited to, a disk, an optical disk. The communication unit 1009 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, for example, a Bluetooth device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0189] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a CPU, a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above. For example, in some embodiments, the method embodiments of the present invention may be implemented as a computer program, which is tangibly contained in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on an electronic device via ROM 1002 and / or communication unit 1009. In some embodiments, the computing unit 1001 may be configured to perform the above-described method in any other appropriate manner (e.g., by means of firmware).

[0190] The computer programs for implementing the methods of the embodiments of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0191] In the context of an embodiment of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable signal medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0192] It should be noted that the term "including" and its variations used in the embodiments of the present invention are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The modifications of "one" and "multiple" mentioned in the embodiments of the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more".

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

[0194] The various steps described in the method implementation methods provided in the embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method implementation methods may include additional steps and / or omit the steps shown. The scope of protection of the present invention is not limited in this respect.

[0195] The term "embodiment" in this specification refers to specific features, structures or characteristics described in conjunction with the embodiment that can be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. The various embodiments in this specification are described in a related manner, and the same or similar parts between the various embodiments refer to each other. In particular, for the device, equipment, and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment.

[0196] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the attached claims.

Claims

1. A resource balancing method for a distributed code storage system, comprising: After the distributed code storage system is initialized, when the scheduling balance is triggered, the storage resource information and hot resource information of each storage server of the distributed code storage system are obtained; Performing storage resource evaluation on the storage server according to the storage resource information, and performing hotspot resource evaluation on the storage server according to the hotspot resource information, wherein the hotspot resource is resource information of the storage server other than storage resources; In the case where the storage resources or hot spot resources of the storage server are unbalanced, a copy moving task is generated to move the target code repository copy stored in the storage server with unbalanced resources to another storage server, wherein the target code repository copy is one of the code repository copies in the storage server; The replica movement task is assigned to the corresponding storage server for execution, and the target code repository replica is moved to balance storage resources or hot spot resources of the storage server in the distributed code storage system.

2. The method according to claim 1, wherein: The storage resource information includes: occupied storage space and total storage space; based on the storage resource information, storage resource evaluation of the storage server includes: Performing a storage resource score on the storage resources of the storage server according to the storage resource information, wherein the storage resource score is used to characterize a balance status of the storage resources; When the storage resource score of the storage server reaches a first preset threshold, determining a storage resource balance of the storage server; When the storage resource score of the storage server does not reach the first preset threshold, it is determined that the storage resources of the storage server are unbalanced.

3. The method according to claim 2, wherein: Performing storage resource scoring on the storage resources of the storage server according to the storage resource information includes: When the total storage space of each storage server is the same, the storage resource score of the storage server to be scored is calculated according to the occupied storage space of the storage server to be scored and the total storage space of each storage server; When the total storage space sizes of the storage servers are different, the storage resource score of the storage server is calculated based on the maximum and minimum total storage spaces of the multiple storage servers performing resource balancing and the occupied storage space of the storage server to be scored.

4. The method according to claim 1, wherein: The hotspot resource information includes at least one of the following hotspot parameters: request volume, interface time consumption, interface traffic, and active data volume; and hotspot resource evaluation is performed on the storage server according to the hotspot resource information, including: Performing a hotspot resource score on the hotspot resources of the storage server according to the hotspot resource information, wherein the hotspot resource score is used to characterize a balance status of the hotspot resources; When the hotspot resource score of the storage server reaches a second preset threshold, determining a hotspot resource balance of the storage server; When the hotspot resource score of the storage server does not reach the second preset threshold, it is determined that the hotspot resources of the storage server are unbalanced.

5. The method according to claim 4, wherein: Performing hotspot resource scoring on the hotspot resources of the storage server according to the hotspot resource information includes: Calculating a hotspot sub-score of the hotspot parameter according to the value of the hotspot parameter in the hotspot resource information and the average value of the hotspot parameter of each storage server; The hotspot resource score of the storage server is calculated based on the weight corresponding to each hotspot parameter and the hotspot sub-score of each hotspot parameter.

6. The method according to claim 1, wherein: Generate a replica migration task to migrate the target code repository replica stored in the resource-unbalanced storage server to another storage server, including: The storage server with unbalanced resources is used as a source server, and a target code repository copy to be moved is selected from the source server, wherein the source server includes at least one copy; Selecting a target server according to a selection principle, wherein the target server is a storage server that receives a copy of the target code repository, and the selection principle is a principle of selecting a storage server that receives a copy of the target code repository as the target server; A replica moving task is generated according to the source server, the target code repository replica and the target server.

7. The method according to claim 6, wherein: After generating a replica move task according to the source server, the target code repository replica and the target server, the method further includes: evaluating whether the source server still has resource imbalance after the replica move task is executed; After evaluating whether the source server executes the replica move task, if there is still a resource imbalance, continue to generate replica move tasks until the resources are balanced or the maximum number of replica move tasks is reached.

8. The method according to claim 6, wherein: After the target code repository copy and the target server generate a copy move task, the method further includes: Performing conflict detection on the replica moving task according to a conflict principle and execution parameters of the replica moving task, wherein the execution parameters include an executed replica identifier and an execution time; If it is determined that the replica moving task is a non-conflicting task, continue to execute subsequent steps; When it is determined that the replica moving task is a conflicting task, the conflicting task is deleted and a replica moving task is regenerated.

9. The method according to claim 7, wherein: Evaluating whether the source server still has resource imbalance after the replica migration task is executed includes: Simulating resource information of the source server after executing the replica migration task; Predicting a resource score after execution of the source server based on the simulated resource information; When the resource score after execution of the source server does not reach a preset threshold, it is determined that the source server still has resource imbalance.

10. The method according to claim 1, wherein: Allocating the replica movement task to the corresponding storage server for execution, and performing replica movement on the target code repository replica, including: Allocating the replica migration task to the source server according to an identifier of the source server corresponding to the replica migration task; Adding the replica moving tasks to a task queue in a preset order until the task queue is full or all the replica moving tasks are added to the task queue; Execute the current task in the task queue and remove the completed current task; Update the current task in the task queue and continue executing until the tasks in the task queue are completed.

11. The method according to claim 10, wherein: Update the current task of the task queue, including: In the case that there is no replica moving task that is not added to the task queue, the current task of the task queue is updated directly according to the execution order of the task queue; In the case that there are still replica moving tasks that have not been added to the task queue, the replica moving tasks that have not been added to the task queue are added to the task queue according to the preset order, the task queue is updated, and the current task is updated based on the updated task queue.

12. The method according to claim 1, wherein: After the distributed code storage system is initialized, in the case where scheduling balance is triggered, before obtaining resource information of each storage server of the distributed code storage system, the method further includes: receiving the set scheduling time and / or scheduling frequency; During operation after the distributed code storage system is initialized, triggering scheduling balance according to the scheduling time and / or scheduling frequency; Or, monitoring target events of the distributed code storage system; After the target event is detected, the scheduling balance is automatically triggered.

13. The method according to any one of claims 1 to 12, wherein: After allocating the replica movement task to the corresponding storage server for execution to move the replica, the method further includes: Calculating, according to the resource scores of the plurality of storage servers, a relative standard deviation of the plurality of storage servers as a total score of the plurality of storage servers, wherein the plurality of storage servers are a plurality of storage servers in the same rebalancing group; The rebalancing group is obtained by dividing the availability zones of the distributed code storage system according to the number of copies of the code repository and the disaster recovery principle. The rebalancing group includes at least one availability zone, and the availability zone includes at least one storage server. The disaster recovery principle includes the storage principle of storing copies in storage servers and the distribution principle of storage servers in availability zones.

14. A resource balancing device for a distributed code storage system, comprising: An acquisition module is used to acquire storage resource information and hotspot resource information of each storage server of the distributed code storage system when the distributed code storage system is initialized and the scheduling balance is triggered; An evaluation module, configured to perform storage resource evaluation on the storage server according to the storage resource information, and perform hotspot resource evaluation on the storage server according to the hotspot resource information, wherein the hotspot resource is resource information of the storage server other than storage resources; A generation module, configured to generate a copy movement task for moving a target code repository copy stored in a storage server with unbalanced resources to another storage server when storage resources or hot spot resources of the storage server are unbalanced, wherein the target code repository copy is one of the code repository copies in the storage server; The execution module is used to assign the replica movement task to the corresponding storage server for execution, and to perform replica movement on the target code repository replica to balance the storage resources or hot spot resources of the storage server in the distributed code storage system.

15. An electronic device, comprising: A processor, and a memory storing a program, wherein the program includes instructions, which, when executed by the processor, cause the processor to execute the resource balancing method for a distributed code storage system according to any one of claims 1 to 13.

16. A non-transitory machine-readable medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the resource balancing method for a distributed code storage system according to any one of claims 1 to 13.

Citation Information

Cited By

  • Mass video monitoring information storage system based on distributed storage and implementation method

    CN120263927A