WO2019170011A1 - Task allocation method and device, and distributed storage system - Google Patents

Task allocation method and device, and distributed storage system Download PDF

Info

Publication number
WO2019170011A1
WO2019170011A1 PCT/CN2019/076048 CN2019076048W WO2019170011A1 WO 2019170011 A1 WO2019170011 A1 WO 2019170011A1 CN 2019076048 W CN2019076048 W CN 2019076048W WO 2019170011 A1 WO2019170011 A1 WO 2019170011A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage node
available storage
node
available
storage
Prior art date
Application number
PCT/CN2019/076048
Other languages
French (fr)
Chinese (zh)
Inventor
黄华东
夏伟强
王伟
林起芊
Original Assignee
杭州海康威视系统技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州海康威视系统技术有限公司 filed Critical 杭州海康威视系统技术有限公司
Publication of WO2019170011A1 publication Critical patent/WO2019170011A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems

Definitions

  • the present disclosure relates to the field of storage technologies, and in particular, to a task allocation method and apparatus, and a distributed storage system.
  • the distributed storage system may include: a management node, and a plurality of storage nodes managed by the management node.
  • the terminal can store data in the distributed storage system through the management node and the storage node.
  • the terminal when a terminal needs to store data in a distributed storage system, the terminal may send a storage request to the management node. Thereafter, the management node may allocate a storage task to the target storage node among the plurality of storage nodes according to the storage request, and instruct the terminal to store the data through the target storage node.
  • the management node needs to allocate multiple storage tasks separately. If the management node allocates multiple storage tasks to the same storage node, the write data load of the storage node is large, resulting in a low load balance in the entire distributed storage system.
  • the present disclosure provides a task allocation method and apparatus, and a distributed storage system, which can solve the problem of low load balancing in a distributed storage system.
  • the technical solution is as follows:
  • a task assignment method for managing a node, the method comprising:
  • the target storage node is filtered among the at least one available storage node;
  • a storage task to be executed is allocated to the target storage node based on the storage request.
  • the method before the screening the target storage node in the at least one available storage node, the method further includes:
  • M times the average value of the number of allocations is determined as the threshold number of allocation times, M ⁇ 1.
  • the method further includes:
  • the determining a plurality of available storage nodes in the distributed storage system includes:
  • a storage node whose write data load value is smaller than a preset load threshold in the distributed storage system is used as the available storage node.
  • screening the target storage node in the at least one available storage node including:
  • the available storage node with the smallest sum of allocation times and write data load values among the at least one available storage node is the target storage node;
  • the target storage node is randomly selected among the at least one available storage node.
  • the method further includes:
  • the target storage node is screened among the plurality of available storage nodes.
  • the method before filtering the target storage node in the at least one available storage node, the method further includes:
  • the preset condition includes: (osdx ⁇ avg)/avg ⁇ M-1, osdx is the number of allocations of the xth available storage node, x ⁇ 1, avg is the average of the allocation times, M ⁇ 1.
  • a task assignment apparatus for managing a node, the task assignment apparatus comprising:
  • a first determining module configured to determine, after receiving the storage request sent by the terminal, multiple available storage nodes in the distributed storage system
  • An obtaining module configured to acquire an allocation number of each of the plurality of available storage nodes in a preset time period, where the number of allocations of the available storage nodes is the number of times the available storage nodes are allocated storage tasks;
  • a first screening module configured to filter a target storage node among the at least one available storage node when there is at least one available storage node whose number of allocations is less than an allocation number threshold
  • an allocating module configured to allocate, to the target storage node, a storage task to be executed based on the storage request.
  • the task distribution device further includes:
  • a second determining module configured to determine an average number of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node
  • a third determining module configured to determine M times the average value of the number of allocation times as the threshold number of allocation times, M ⁇ 1.
  • the task distribution device further includes:
  • a receiving module configured to receive load information sent by each storage node in the distributed storage node, where the load information sent by each storage node is used to indicate a write data load value of each storage node;
  • a fourth determining module configured to determine, according to the load information sent by each storage node, a write data load value of each storage node
  • the first determining module is configured to use, as the available storage node, a storage node in the distributed storage system whose write data load value is less than a preset load threshold.
  • the first screening module is used to:
  • the available storage node with the smallest sum of allocation times and write data load values among the at least one available storage node is the target storage node;
  • the target storage node is randomly selected among the at least one available storage node.
  • the task distribution device further includes:
  • a second screening module configured to filter the target storage node among the plurality of available storage nodes when there is no available storage node whose allocation number is less than the allocation number threshold.
  • the task distribution device further includes:
  • a fifth determining module configured to determine an average value of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node
  • a sixth determining module configured to determine, when the number of allocations of the xth available storage node of the plurality of available storage nodes meets a preset condition, that the number of allocations of the xth available storage node is less than the threshold of the number of allocations;
  • the preset condition includes: (osdx ⁇ avg)/avg ⁇ M-1, osdx is the number of allocations of the xth available storage node, x ⁇ 1, avg is the average of the allocation times, M ⁇ 1.
  • a third aspect provides a computer device including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through a bus; the memory is configured to store the computer program; For executing the program stored on the memory, implementing the method described in the first aspect.
  • a computer readable storage medium having stored therein a computer program that, when executed by a processor, implements the method of the first aspect.
  • a distributed storage system comprising a management node and a plurality of storage nodes, the management node comprising the task allocation device of the second aspect.
  • a distributed storage system comprising a management node and a plurality of storage nodes, the management node comprising the computer device of the third aspect.
  • a computer program product which, when run on a computer, causes the computer to perform the task assignment method of the first aspect.
  • the task allocation method provided by the embodiment of the present disclosure, before the storage task to be executed is allocated, when there are at least one available storage node whose allocation number is less than the allocation number threshold among the plurality of available storage nodes, it is determined that the allocation number is small and available. A storage node and a target storage node for performing storage tasks among the available storage nodes. Therefore, the management node is prevented from allocating more storage tasks to the same storage node, and the load value balance degree of the distributed storage system is improved.
  • FIG. 1 is a schematic diagram of an application environment involved in a task allocation method according to an embodiment of the present disclosure
  • FIG. 2 is a flowchart of a method for assigning a task according to an embodiment of the present disclosure
  • FIG. 3 is a flowchart of a method for another task allocation method according to an embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of a task distribution apparatus according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic structural diagram of another task distribution apparatus according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of still another task distribution apparatus according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of still another task distribution apparatus according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of still another task distribution apparatus according to an embodiment of the present disclosure.
  • FIG. 1 is a schematic diagram of an application environment involved in a task allocation method according to an embodiment of the present disclosure.
  • the application environment includes a distributed storage system 0 and a terminal 1 .
  • the distributed storage system 0 may include: a management node 01, and a plurality of storage nodes 02 managed by the management node 01.
  • a management node 01 collectively manages three storage nodes 02 as an example, and the three storage nodes 02 are respectively a first storage node, a second storage node, and a third storage node.
  • the terminal 1 can store data in the distributed storage system 0 through the management node 01 and the storage node 02.
  • the management node 01 can be a server or a server cluster composed of multiple servers.
  • the management node 01 may also be referred to as a metadata management server (English: metadata service; abbreviation: MDS).
  • the storage node 02 may also be referred to as an object storage device (English: object storage device; abbreviated as: OSD).
  • the management node 01 can establish a communication connection with the terminal 1 and the storage node 02.
  • FIG. 2 is a flowchart of a method for assigning a task according to an embodiment of the present disclosure.
  • the task assignment method may be used in the management node 01 in FIG. 1. As shown in FIG. 2, the task assignment method includes:
  • Step 201 After receiving the storage request sent by the terminal, determine a plurality of available storage nodes in the distributed storage system.
  • Step 202 Acquire an allocation number of each available storage node of the plurality of available storage nodes in a preset time period, where the number of allocations of the available storage nodes is the number of times the available storage nodes are allocated storage tasks.
  • Step 203 When there are at least one available storage node whose allocation number is less than the allocation number threshold, the target storage node is filtered in the at least one available storage node.
  • Step 204 Allocate a storage task to be executed to the target storage node based on the storage request.
  • the number of allocation times and the number of allocation times of each available storage node are compared to determine an available storage node with a small number of allocations. And filter the target storage nodes used to perform storage tasks among these available storage nodes. Therefore, the number of allocations of each storage node is relatively balanced, which avoids the management node allocating more storage tasks to the same storage node, and improves the load value balance degree of the distributed storage system.
  • FIG. 3 is a flowchart of a method for assigning another task according to an embodiment of the present disclosure.
  • the task allocation method may be used in the distributed storage system in FIG. 1. As shown in FIG. 3, the task assignment method includes:
  • Step 301 The storage node sends load information to the management node. Go to step 302.
  • the load information sent by each storage node to the management node may be used to indicate the write data load value of each storage node.
  • the load information sent by the first storage node to the management node may be used to indicate the write data load value of the first storage node
  • the load information sent by the second storage node to the management node may be used to indicate the write data load value of the second storage node. Wait.
  • the write data load value of the storage node is a value for reflecting the write data load of the storage node, and the write data load of the storage node is positively correlated with the write data load value of the storage node.
  • each storage node in the distributed storage system may send load information to the management node every preset time period to notify the management node of the write data load value of the storage node.
  • the management node may store the load information of each storage node, and after receiving the load information sent by the same storage node again, update the load information of the storage node.
  • Step 302 The terminal sends a storage request to the management node. Go to step 303.
  • the user When the user needs to control the terminal to store data in the distributed storage system, the user can operate on the terminal to trigger the terminal to send a storage request to the management node.
  • Step 303 The management node determines a write data load value of each storage node according to load information sent by each storage node. Go to step 304.
  • the management node may acquire the pre-stored load information sent by each storage node, and determine the write data load value of each storage node according to the load information sent by each storage node.
  • Step 304 The management node uses a plurality of storage nodes in the distributed storage system whose write data load value is less than a preset load threshold as the plurality of available storage nodes. Go to step 305.
  • a preset load threshold is pre-stored on the management node, and after determining the write data load value of each storage node in the distributed storage system, the management node may compare the write data load value of each storage node with the preset load threshold. And determining, by the plurality of storage nodes, a plurality of storage nodes whose write data load value is less than the preset load threshold, and using the multiple storage nodes as available storage nodes.
  • the write data load value of the first storage node is 95%
  • the write data load value of the second storage node is 50%
  • the write data load value of the third storage node is 40%
  • the preset load threshold is 80%.
  • the management node may use both the first storage node and the second storage node as available storage nodes. At this time, there are two available storage nodes in the distributed storage system.
  • the management node filters out a plurality of available storage nodes in the plurality of storage nodes in the distributed storage system by using a preset load threshold, where the available storage node is a storage node with a smaller data load value.
  • Available storage nodes can continue to be assigned storage tasks, but continuing to allocate storage tasks to non-available storage nodes can result in non-available storage nodes not functioning properly.
  • Step 305 The management node acquires the number of allocations of each available storage node of the plurality of available storage nodes within a preset time period. Go to step 306.
  • the number of allocations of available storage nodes is the number of times the available storage node is assigned a storage task.
  • the management node may record the number of times the storage node is allocated a storage task after each time a storage task is allocated to the storage node.
  • the management node may record that the number of allocations of the first storage node is 1. At this time, the management node may record that the number of allocations of the first storage node is 1, the number of allocations of the second storage node is 0, and the number of allocations of the third storage node is 0. If the management node allocates a storage task to the second storage node at the second moment, the management node may update the allocation number of the second storage node from 0 to 1.
  • the management node may record that the number of allocations of the first storage node is 1, the number of allocations of the second storage node is 1, and the number of allocations of the third storage node is 0. It should be noted that, if the fourth storage node is newly added to the distributed storage system at the second moment, the fourth storage node is a storage node that is not assigned a storage task, and the management node may record the fourth storage node. The number of allocations is 0.
  • the management node can also periodically clear the number of records (for example, the management node can clear the number of records every hour).
  • the management node may acquire, in step 305, the number of allocations of each available storage node that was previously recorded, which is the number of allocations in the time period between the time of the last clearing and the current time (that is, the preset time period). .
  • Step 306 The management node determines an average number of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node. Go to step 307.
  • the management node may use the average of the number of allocations of the plurality of available storage nodes as the average of the number of allocations.
  • Step 307 The management node determines M times of the average number of allocation times as the allocation number threshold. Go to step 308.
  • the management node may multiply the average number of allocation times by M to obtain the allocation number threshold, M ⁇ 1.
  • the allocation number threshold is equal to the average number of allocation times.
  • the allocation number threshold is 1.3 times the average value of the allocation times.
  • M is equal to 1 or 1.3.
  • M may be other values greater than or equal to 1. This embodiment of the present disclosure does not limit this.
  • Step 308 The management node determines, by the plurality of available storage nodes, whether there is at least one available storage node whose allocation number is less than the allocation number threshold. If there are at least one available storage node whose number of allocations is less than the allocation number threshold, the step 309 is performed; if there is no at least one available storage node whose allocation number is less than the allocation number threshold, the execution is performed. Step 310.
  • the management node may compare the number of allocations of each available storage node to the number of allocation thresholds to determine if the number of allocations per available storage node is less than the number of allocation thresholds. For example, the management node may make the number of allocations of each available storage node worse than the number of allocation thresholds. When the obtained difference is less than zero, it is determined that the number of allocations of the available storage nodes is less than the allocation number threshold.
  • the management node may not directly perform step 307 and step 308, but directly determine whether the allocated number of available storage nodes meets the preset.
  • the preset condition may be (osdx–avg)/avg ⁇ M-1, where osdx is the number of allocations of the xth available storage node among the n available storage nodes, x ⁇ 1. If the number of allocations of a storage node satisfies the preset condition, the management node may determine that the allocation number of the storage node is less than the allocation number threshold.
  • Step 309 The management node filters the target storage node in the at least one available storage node. Go to step 311.
  • the management node may filter one storage node as the target storage node among the at least one available storage node.
  • the manner in which the management node filters the target storage node in the at least one available storage node may be various, and the following four screening manners are exemplified in the embodiment of the present disclosure.
  • the management node may filter the available storage nodes with the smallest number of allocations as the target storage node among the at least one available storage node based on the number of allocations of each available storage node acquired in step 305.
  • the management node may filter, according to the write data load value of each available storage node determined in step 303, the available storage node with the smallest write data load value as the target storage node in the at least one available storage node. .
  • the management node may calculate the available data storage node based on the write data load value of each available storage node determined in step 303 and the number of allocations of each available storage node determined in step 305. Write the sum of the data load value and the number of allocations. Thereafter, the management node may filter the available storage nodes with the smallest sum of allocation times and write data load values as the target storage node among the at least one available storage node. That is, the management node can use the available storage nodes with smaller write data load values and allocation times as the target storage nodes to further improve the load balancing degree of the plurality of available storage nodes.
  • the management node may randomly filter one storage node as the target storage node among the at least one available storage node.
  • Step 310 The management node filters the target storage node among the plurality of available storage nodes. Go to step 311.
  • the management node may be at the time The target storage node is filtered from the plurality of available storage nodes.
  • the process of filtering the target storage node in the plurality of available storage nodes may refer to the step of filtering the target storage node in the at least one available storage node in step 309, which is not described herein.
  • Step 311 The management node allocates a storage task to be executed to the target storage node based on the storage request.
  • the management node may allocate a storage task to be executed to the target storage node based on the storage request sent by the terminal in step 302.
  • the terminal may also instruct the terminal to store data through the target storage node.
  • the terminal can then store the data in the distributed storage system through the target storage node to which the storage task is assigned.
  • the management node may increase the number of allocations of the target storage node recorded by one.
  • the number of available storage nodes determined by the management node in step 304 is taken as an example.
  • the management node may directly use the available storage node as the target storage node, and allocate the storage task to be executed to the target storage node.
  • the management node may prohibit the continued allocation of the storage task, or the management node may select one of the current storage nodes and allocate a storage task to the storage node.
  • the management node may allocate a storage task to the target storage node among the multiple storage nodes according to the storage request sent by the terminal, and instruct the terminal to store the data through the target storage node.
  • the management node allocates more than one storage task to the newly added storage node, thereby The write data load of the newly added storage node is large, resulting in a low load balance in the entire distributed storage system.
  • the management node regardless of whether the distributed storage system is expanded, the management node performs a reasonable allocation storage task according to the write data load value and the number of allocations of each storage node. In this way, when the newly added storage node occurs, the management node allocates multiple storage tasks to the newly added storage node, thereby improving the load balancing degree in the distributed storage system.
  • the number of allocation times and the number of allocation times of each available storage node are compared to determine an available storage node with a small number of allocations. And filter the target storage nodes used to perform storage tasks among these available storage nodes. Therefore, the number of allocations of each storage node is relatively balanced, which avoids the management node allocating more storage tasks to the same storage node, and improves the load value balance degree of the distributed storage system.
  • FIG. 4 is a schematic structural diagram of a task distribution apparatus according to an embodiment of the present disclosure.
  • the task distribution apparatus may be used to manage a node.
  • the task distribution apparatus 40 may include:
  • the first determining module 401 is configured to determine, after receiving the storage request sent by the terminal, multiple available storage nodes in the distributed storage system;
  • the obtaining module 402 is configured to obtain an allocation number of each available storage node of the plurality of available storage nodes in a preset time period, where the number of allocations of the available storage nodes is the number of times the available storage nodes are allocated storage tasks;
  • the first screening module 403 is configured to filter the target storage node in the at least one available storage node when there are at least one available storage node whose allocation number is less than the allocation number threshold.
  • the allocating module 404 is configured to allocate a storage task to be executed to the target storage node based on the storage request.
  • the first screening module combines the first determining module and the obtaining module by comparing the allocation times of each available storage node with A number of allocation thresholds are determined to determine available storage nodes with a small number of allocations, and the allocation module filters the target storage nodes for performing storage tasks among the available storage nodes. Therefore, the management node is prevented from allocating more storage tasks to the same storage node, and the load value balance degree of the distributed storage system is improved.
  • FIG. 5 is a schematic structural diagram of another task distribution apparatus 40 according to an embodiment of the present disclosure. As shown in FIG. 5, the task distribution apparatus 40 may further include:
  • a second determining module 405, configured to determine an average number of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node;
  • the third determining module 406 is configured to determine M times of the average number of allocation times as the allocation number threshold, and M ⁇ 1.
  • FIG. 6 is a schematic structural diagram of another task distribution apparatus 40 according to an embodiment of the present disclosure.
  • the task distribution apparatus 40 may further include:
  • the receiving module 407 is configured to receive load information sent by each storage node in the distributed storage node, where the load information sent by each storage node is used to indicate a write data load value of each storage node;
  • a fourth determining module 408, configured to determine, according to load information sent by each storage node, a write data load value of each storage node;
  • the first determining module 401 is configured to use, as an available storage node, a storage node in the distributed storage system whose write data load value is less than a preset load threshold.
  • the first screening module 403 can be used to:
  • the available storage node with the smallest sum of the allocation number and the write data load value in the at least one available storage node is the target storage node;
  • the target storage node is randomly selected in at least one of the available storage nodes.
  • FIG. 7 is a schematic structural diagram of another task distribution apparatus 40 according to an embodiment of the present disclosure.
  • the task distribution apparatus 40 may further include:
  • the second screening module 409 is configured to filter the target storage node among the plurality of available storage nodes when there are no available storage nodes whose allocation times are less than the allocation number threshold.
  • FIG. 8 is a schematic structural diagram of still another task distribution apparatus 40 according to an embodiment of the present disclosure.
  • the task distribution apparatus 40 may further include:
  • the fifth determining module 410 is configured to determine an average number of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node;
  • the sixth determining module 411 is configured to determine, when the number of allocations of the xth available storage node of the plurality of available storage nodes meets the preset condition, that the number of allocations of the xth available storage node is less than the allocation number threshold;
  • the preset conditions include: (osdx–avg)/avg ⁇ M-1, osdx is the number of allocations of the xth available storage node, x ⁇ 1, avg is the average of the number of allocations, and M ⁇ 1.
  • the first screening module combines the first determining module and the obtaining module by comparing the allocation times of each available storage node with A number of allocation thresholds are determined to determine available storage nodes with a small number of allocations, and the allocation module filters the target storage nodes for performing storage tasks among the available storage nodes. Therefore, the number of allocations of each storage node is relatively balanced, which avoids the management node allocating more storage tasks to the same storage node, and improves the load value balance degree of the distributed storage system.
  • An embodiment of the present disclosure provides a computer device, including a processor and a memory, wherein the memory is configured to store a computer program, and the processor is configured to execute a program stored on the memory to implement the task assignment method.
  • the embodiment of the present disclosure further provides a computer readable storage medium, where the computer program is stored in the storage medium, and the task assignment method is implemented when the computer program is executed by the processor.
  • the embodiment of the invention further provides a computer program product, when the computer program product is run on a computer, causing the computer to execute the task assignment method.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present disclosure relates to the technical field of storage, and provided thereby are a task allocation method and device and a distributed storage system. The method comprises: after receiving a storage request sent by a terminal, determining a plurality of available storage nodes in a distributed storage system; acquiring the number of allocation instances for each available storage node among the plurality of available storage nodes within a preset period of time, wherein the number of allocation instances for the available storage nodes is the number of times storage tasks are allocated to the available storage nodes; when at least one available storage node of which the number of allocation instances is less than a number of allocation instances threshold exists among the plurality of available storage nodes, screening a target storage node among said at least one available storage node; and allocating a storage task to be executed to the target storage node on the basis of the storage request. The present disclosure solves the problem of a low level of load balance in a distributed storage system, and the present disclosure is used to allocate storage tasks.

Description

任务分配方法及装置、分布式存储系统Task allocation method and device, distributed storage system
相关申请的交叉引用Cross-reference to related applications
本公开要求于2018年03月07日提交、申请号为201810185894.4、发明名称为“任务分配方法及装置、分布式存储系统”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。The present disclosure claims priority to Chinese Patent Application No. 20110118 589 4.4, entitled "Task Assignment Method and Apparatus, Distributed Storage System," filed on March 7, 2018, the entire disclosure of which is incorporated herein by reference. .
技术领域Technical field
本公开涉及存储技术领域,特别涉及一种任务分配方法及装置、分布式存储系统。The present disclosure relates to the field of storage technologies, and in particular, to a task allocation method and apparatus, and a distributed storage system.
背景技术Background technique
随着存储技术的发展,分布式存储系统得到了广泛的应用。分布式存储系统可以包括:管理节点,以及该管理节点管理的多个存储节点。终端能够通过该管理节点和存储节点在分布式存储系统中存储数据。With the development of storage technology, distributed storage systems have been widely used. The distributed storage system may include: a management node, and a plurality of storage nodes managed by the management node. The terminal can store data in the distributed storage system through the management node and the storage node.
相关技术中,当终端需要在分布式存储系统中存储数据时,终端可以向管理节点发送存储请求。之后,管理节点可以根据该存储请求,为多个存储节点中的目标存储节点分配存储任务,并指示终端通过该目标存储节点进行数据的存储。In the related art, when a terminal needs to store data in a distributed storage system, the terminal may send a storage request to the management node. Thereafter, the management node may allocate a storage task to the target storage node among the plurality of storage nodes according to the storage request, and instruct the terminal to store the data through the target storage node.
由于相关技术中,需要在分布式存储系统中存储数据的终端越来越多,因此管理节点需要分别分配多个存储任务。若管理节点将多个存储任务均分配给同一个存储节点,则该存储节点的写数据负载较大,导致整个分布式存储系统中的负载均衡程度较低。Due to the increasing number of terminals in the related art that need to store data in a distributed storage system, the management node needs to allocate multiple storage tasks separately. If the management node allocates multiple storage tasks to the same storage node, the write data load of the storage node is large, resulting in a low load balance in the entire distributed storage system.
发明内容Summary of the invention
本公开提供了一种任务分配方法及装置、分布式存储系统,可以解决分布式存储系统中的负载均衡程度较低的问题,所述技术方案如下:The present disclosure provides a task allocation method and apparatus, and a distributed storage system, which can solve the problem of low load balancing in a distributed storage system. The technical solution is as follows:
第一方面,提供了一种任务分配方法,用于管理节点,所述方法包括:In a first aspect, a task assignment method is provided for managing a node, the method comprising:
在接收到终端发送的存储请求后,确定分布式存储系统中的多个可用存储 节点;After receiving the storage request sent by the terminal, determining a plurality of available storage nodes in the distributed storage system;
获取所述多个可用存储节点中每个可用存储节点在预设时间段内的分配次数,其中,可用存储节点的分配次数为可用存储节点被分配存储任务的次数;Obtaining an allocation number of each of the plurality of available storage nodes within a preset time period, wherein the number of allocations of the available storage nodes is the number of times the available storage nodes are allocated storage tasks;
当所述多个可用存储节点中存在分配次数小于分配次数阈值的至少一个可用存储节点时,在所述至少一个可用存储节点中筛选目标存储节点;When there is at least one available storage node whose allocation number is less than the allocation number threshold, the target storage node is filtered among the at least one available storage node;
基于所述存储请求为所述目标存储节点分配待执行的存储任务。A storage task to be executed is allocated to the target storage node based on the storage request.
可选的,在所述至少一个可用存储节点中筛选目标存储节点之前,所述方法还包括:Optionally, before the screening the target storage node in the at least one available storage node, the method further includes:
根据所述每个可用存储节点的分配次数,确定所述多个可用存储节点的分配次数平均值;Determining, according to the number of allocations of each available storage node, an average number of allocation times of the plurality of available storage nodes;
将所述分配次数平均值的M倍确定为所述分配次数阈值,M≥1。M times the average value of the number of allocations is determined as the threshold number of allocation times, M ≥ 1.
可选的,M=1.3。Optional, M = 1.3.
可选的,所述方法还包括:Optionally, the method further includes:
接收所述分布式存储节点中每个存储节点发送的负载信息,所述每个存储节点发送的负载信息用于指示所述每个存储节点的写数据负载值;Receiving load information sent by each storage node in the distributed storage node, where the load information sent by each storage node is used to indicate a write data load value of each storage node;
根据所述每个存储节点发送的负载信息,确定所述每个存储节点的写数据负载值;Determining, according to the load information sent by each storage node, a write data load value of each storage node;
所述确定分布式存储系统中的多个可用存储节点,包括:The determining a plurality of available storage nodes in the distributed storage system includes:
将所述分布式存储系统中写数据负载值小于预设负载阈值的存储节点作为所述可用存储节点。A storage node whose write data load value is smaller than a preset load threshold in the distributed storage system is used as the available storage node.
可选的,在所述至少一个可用存储节点中筛选目标存储节点,包括:Optionally, screening the target storage node in the at least one available storage node, including:
在所述至少一个可用存储节点中筛选分配次数最小的可用存储节点为所述目标存储节点;Filtering, in the at least one available storage node, an available storage node with the smallest number of allocations as the target storage node;
或者,在所述至少一个可用存储节点中筛选写数据负载值最小的可用存储节点为所述目标存储节点;Or filtering, in the at least one available storage node, an available storage node with the smallest write data load value as the target storage node;
或者,在所述至少一个可用存储节点中筛选分配次数和写数据负载值之和最小的可用存储节点为所述目标存储节点;Or the available storage node with the smallest sum of allocation times and write data load values among the at least one available storage node is the target storage node;
或者,在所述至少一个可用存储节点中随机筛选目标存储节点。Alternatively, the target storage node is randomly selected among the at least one available storage node.
可选的,所述方法还包括:Optionally, the method further includes:
当所述多个可用存储节点中不存在分配次数小于分配次数阈值的可用存储 节点时,在所述多个可用存储节点中筛选目标存储节点。When there is no available storage node whose allocation number is less than the allocation number threshold among the plurality of available storage nodes, the target storage node is screened among the plurality of available storage nodes.
可选地,在所述至少一个可用存储节点中筛选目标存储节点之前,所述方法还包括:Optionally, before filtering the target storage node in the at least one available storage node, the method further includes:
根据所述每个可用存储节点的分配次数,确定所述多个可用存储节点的分配次数平均值;Determining, according to the number of allocations of each available storage node, an average number of allocation times of the plurality of available storage nodes;
当所述多个可用存储节点中第x个可用存储节点的分配次数满足预设条件时,确定所述第x个可用存储节点的分配次数小于所述分配次数阈值;Determining, when the number of allocations of the xth available storage node of the plurality of available storage nodes meets a preset condition, determining that the number of allocations of the xth available storage node is less than the threshold of the number of allocations;
其中,所述预设条件包括:(osdx–avg)/avg<M-1,osdx为所述第x个可用存储节点的分配次数,x≥1,avg为所述分配次数平均值,M≥1。The preset condition includes: (osdx−avg)/avg<M-1, osdx is the number of allocations of the xth available storage node, x≥1, avg is the average of the allocation times, M≥ 1.
第二方面,提供了一种任务分配装置,用于管理节点,所述任务分配装置包括:In a second aspect, a task assignment apparatus is provided for managing a node, the task assignment apparatus comprising:
第一确定模块,用于在接收到终端发送的存储请求后,确定分布式存储系统中的多个可用存储节点;a first determining module, configured to determine, after receiving the storage request sent by the terminal, multiple available storage nodes in the distributed storage system;
获取模块,用于获取所述多个可用存储节点中每个可用存储节点在预设时间段内的分配次数,其中,可用存储节点的分配次数为可用存储节点被分配存储任务的次数;An obtaining module, configured to acquire an allocation number of each of the plurality of available storage nodes in a preset time period, where the number of allocations of the available storage nodes is the number of times the available storage nodes are allocated storage tasks;
第一筛选模块,用于在所述多个可用存储节点中存在分配次数小于分配次数阈值的至少一个可用存储节点时,在所述至少一个可用存储节点中筛选目标存储节点;a first screening module, configured to filter a target storage node among the at least one available storage node when there is at least one available storage node whose number of allocations is less than an allocation number threshold;
分配模块,用于基于所述存储请求为所述目标存储节点分配待执行的存储任务。And an allocating module, configured to allocate, to the target storage node, a storage task to be executed based on the storage request.
可选的,所述任务分配装置还包括:Optionally, the task distribution device further includes:
第二确定模块,用于根据所述每个可用存储节点的分配次数,确定所述多个可用存储节点的分配次数平均值;a second determining module, configured to determine an average number of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node;
第三确定模块,用于将所述分配次数平均值的M倍确定为所述分配次数阈值,M≥1。a third determining module, configured to determine M times the average value of the number of allocation times as the threshold number of allocation times, M≥1.
可选的,M=1.3。Optional, M = 1.3.
可选的,所述任务分配装置还包括:Optionally, the task distribution device further includes:
接收模块,用于接收所述分布式存储节点中每个存储节点发送的负载信息,所述每个存储节点发送的负载信息用于指示所述每个存储节点的写数据负载 值;a receiving module, configured to receive load information sent by each storage node in the distributed storage node, where the load information sent by each storage node is used to indicate a write data load value of each storage node;
第四确定模块,用于根据所述每个存储节点发送的负载信息,确定所述每个存储节点的写数据负载值;a fourth determining module, configured to determine, according to the load information sent by each storage node, a write data load value of each storage node;
所述第一确定模块用于将所述分布式存储系统中写数据负载值小于预设负载阈值的存储节点作为所述可用存储节点。The first determining module is configured to use, as the available storage node, a storage node in the distributed storage system whose write data load value is less than a preset load threshold.
可选的,所述第一筛选模块用于:Optionally, the first screening module is used to:
在所述至少一个可用存储节点中筛选分配次数最小的可用存储节点为所述目标存储节点;Filtering, in the at least one available storage node, an available storage node with the smallest number of allocations as the target storage node;
或者,在所述至少一个可用存储节点中筛选写数据负载值最小的可用存储节点为所述目标存储节点;Or filtering, in the at least one available storage node, an available storage node with the smallest write data load value as the target storage node;
或者,在所述至少一个可用存储节点中筛选分配次数和写数据负载值之和最小的可用存储节点为所述目标存储节点;Or the available storage node with the smallest sum of allocation times and write data load values among the at least one available storage node is the target storage node;
或者,在所述至少一个可用存储节点中随机筛选目标存储节点。Alternatively, the target storage node is randomly selected among the at least one available storage node.
可选的,所述任务分配装置还包括:Optionally, the task distribution device further includes:
第二筛选模块,用于在所述多个可用存储节点中不存在分配次数小于分配次数阈值的可用存储节点时,在所述多个可用存储节点中筛选目标存储节点。And a second screening module, configured to filter the target storage node among the plurality of available storage nodes when there is no available storage node whose allocation number is less than the allocation number threshold.
可选地,所述任务分配装置还包括:Optionally, the task distribution device further includes:
第五确定模块,用于根据所述每个可用存储节点的分配次数,确定所述多个可用存储节点的分配次数平均值;a fifth determining module, configured to determine an average value of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node;
第六确定模块,用于在所述多个可用存储节点中第x个可用存储节点的分配次数满足预设条件时,确定所述第x个可用存储节点的分配次数小于所述分配次数阈值;a sixth determining module, configured to determine, when the number of allocations of the xth available storage node of the plurality of available storage nodes meets a preset condition, that the number of allocations of the xth available storage node is less than the threshold of the number of allocations;
其中,所述预设条件包括:(osdx–avg)/avg<M-1,osdx为所述第x个可用存储节点的分配次数,x≥1,avg为所述分配次数平均值,M≥1。The preset condition includes: (osdx−avg)/avg<M-1, osdx is the number of allocations of the xth available storage node, x≥1, avg is the average of the allocation times, M≥ 1.
第三方面,提供了一种计算机设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过总线完成相互间的通信;存储器,用于存放计算机程序;处理器,用于执行存储器上所存放的程序,实现第一方面所述的方法。A third aspect provides a computer device including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through a bus; the memory is configured to store the computer program; For executing the program stored on the memory, implementing the method described in the first aspect.
第四方面,提供了一种计算机可读存储介质,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现第一方面所述的方法。In a fourth aspect, a computer readable storage medium is provided having stored therein a computer program that, when executed by a processor, implements the method of the first aspect.
第五方面,提供了一种分布式存储系统,所述分布式存储系统包括管理节点和多个存储节点,所述管理节点包括第二方面所述的任务分配装置。In a fifth aspect, a distributed storage system is provided, the distributed storage system comprising a management node and a plurality of storage nodes, the management node comprising the task allocation device of the second aspect.
第六方面,提供了一种分布式存储系统,所述分布式存储系统包括管理节点和多个存储节点,所述管理节点包括第三方面所述的计算机设备。In a sixth aspect, a distributed storage system is provided, the distributed storage system comprising a management node and a plurality of storage nodes, the management node comprising the computer device of the third aspect.
第七方面,提供了一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得计算机执行第一方面所述的任务分配方法。In a seventh aspect, a computer program product is provided, which, when run on a computer, causes the computer to perform the task assignment method of the first aspect.
本公开提供的技术方案带来的有益效果是:The beneficial effects brought by the technical solutions provided by the present disclosure are:
本公开实施例提供的任务分配方法中,在分配待执行的存储任务前,通过在多个可用存储节点中存在分配次数小于分配次数阈值的至少一个可用存储节点时,确定分配次数较小的可用存储节点,并在这些可用存储节点中筛选用于执行存储任务的目标存储节点。从而避免了管理节点为同一个存储节点分配较多的存储任务,提高了分布式存储系统的负载值均衡程度。In the task allocation method provided by the embodiment of the present disclosure, before the storage task to be executed is allocated, when there are at least one available storage node whose allocation number is less than the allocation number threshold among the plurality of available storage nodes, it is determined that the allocation number is small and available. A storage node and a target storage node for performing storage tasks among the available storage nodes. Therefore, the management node is prevented from allocating more storage tasks to the same storage node, and the load value balance degree of the distributed storage system is improved.
附图说明DRAWINGS
为了更清楚地说明本公开实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present disclosure. Other drawings may also be obtained from those of ordinary skill in the art in light of the inventive work.
图1为本公开实施例提供的任务分配方法所涉及的应用环境示意图;FIG. 1 is a schematic diagram of an application environment involved in a task allocation method according to an embodiment of the present disclosure;
图2为本公开实施例提供的一种任务分配方法的方法流程图;FIG. 2 is a flowchart of a method for assigning a task according to an embodiment of the present disclosure;
图3为本公开实施例提供的另一种任务分配方法的方法流程图;FIG. 3 is a flowchart of a method for another task allocation method according to an embodiment of the present disclosure;
图4为本公开实施例提供的一种任务分配装置的结构示意图;FIG. 4 is a schematic structural diagram of a task distribution apparatus according to an embodiment of the present disclosure;
图5为本公开实施例提供的另一种任务分配装置的结构示意图;FIG. 5 is a schematic structural diagram of another task distribution apparatus according to an embodiment of the present disclosure;
图6为本公开实施例提供的又一种任务分配装置的结构示意图;FIG. 6 is a schematic structural diagram of still another task distribution apparatus according to an embodiment of the present disclosure;
图7为本公开实施例提供的再一种任务分配装置的结构示意图;FIG. 7 is a schematic structural diagram of still another task distribution apparatus according to an embodiment of the present disclosure;
图8为本公开实施例提供的再一种任务分配装置的结构示意图。FIG. 8 is a schematic structural diagram of still another task distribution apparatus according to an embodiment of the present disclosure.
具体实施方式Detailed ways
为使本公开的目的、技术方案和优点更加清楚,下面将结合附图对本公开实施方式作进一步地详细描述。The embodiments of the present disclosure will be further described in detail below with reference to the accompanying drawings.
图1为本公开实施例提供的任务分配方法所涉及的应用环境示意图,如图1所示,该应用环境包括分布式存储系统0和终端1。分布式存储系统0可以包括:管理节点01,以及该管理节点01管理的多个存储节点02。图1中以管理节点01共管理三个存储节点02为例,这三个存储节点02分别为第一存储节点、第二存储节点和第三存储节点)。终端1可以通过管理节点01和存储节点02在分布式存储系统0中存储数据。FIG. 1 is a schematic diagram of an application environment involved in a task allocation method according to an embodiment of the present disclosure. As shown in FIG. 1 , the application environment includes a distributed storage system 0 and a terminal 1 . The distributed storage system 0 may include: a management node 01, and a plurality of storage nodes 02 managed by the management node 01. In FIG. 1 , a management node 01 collectively manages three storage nodes 02 as an example, and the three storage nodes 02 are respectively a first storage node, a second storage node, and a third storage node. The terminal 1 can store data in the distributed storage system 0 through the management node 01 and the storage node 02.
可选的,管理节点01可以为一个服务器,或者多个服务器组成的服务器集群。管理节点01还可以称为元数据管理服务器(英文:metadata service;简称:MDS),存储节点02还可以称为对象存储设备(英文:object storage device;简称:OSD)。管理节点01可以与终端1以及存储节点02建立通信连接。Optionally, the management node 01 can be a server or a server cluster composed of multiple servers. The management node 01 may also be referred to as a metadata management server (English: metadata service; abbreviation: MDS). The storage node 02 may also be referred to as an object storage device (English: object storage device; abbreviated as: OSD). The management node 01 can establish a communication connection with the terminal 1 and the storage node 02.
图2为本公开实施例提供的一种任务分配方法的方法流程图,该任务分配方法可以用于图1中的管理节点01,如图2所示,该任务分配方法包括:FIG. 2 is a flowchart of a method for assigning a task according to an embodiment of the present disclosure. The task assignment method may be used in the management node 01 in FIG. 1. As shown in FIG. 2, the task assignment method includes:
步骤201、在接收到终端发送的存储请求后,确定分布式存储系统中的多个可用存储节点。Step 201: After receiving the storage request sent by the terminal, determine a plurality of available storage nodes in the distributed storage system.
步骤202、获取多个可用存储节点中每个可用存储节点在预设时间段内的分配次数,其中,可用存储节点的分配次数为可用存储节点被分配存储任务的次数。Step 202: Acquire an allocation number of each available storage node of the plurality of available storage nodes in a preset time period, where the number of allocations of the available storage nodes is the number of times the available storage nodes are allocated storage tasks.
步骤203、当多个可用存储节点中存在分配次数小于分配次数阈值的至少一个可用存储节点时,在至少一个可用存储节点中筛选目标存储节点。Step 203: When there are at least one available storage node whose allocation number is less than the allocation number threshold, the target storage node is filtered in the at least one available storage node.
步骤204、基于存储请求为目标存储节点分配待执行的存储任务。Step 204: Allocate a storage task to be executed to the target storage node based on the storage request.
综上所述,本公开实施例提供的任务分配方法中,在分配待执行的存储任务前,通过比较每个可用存储节点的分配次数与分配次数阈值,以确定分配次数较小的可用存储节点,并在这些可用存储节点中筛选用于执行存储任务的目标存储节点。从而使得各个存储节点的分配次数比较均衡,避免了管理节点为同一个存储节点分配较多的存储任务,提高了分布式存储系统的负载值均衡程度。In summary, in the task allocation method provided by the embodiment of the present disclosure, before the storage task to be executed is allocated, the number of allocation times and the number of allocation times of each available storage node are compared to determine an available storage node with a small number of allocations. And filter the target storage nodes used to perform storage tasks among these available storage nodes. Therefore, the number of allocations of each storage node is relatively balanced, which avoids the management node allocating more storage tasks to the same storage node, and improves the load value balance degree of the distributed storage system.
图3为本公开实施例提供的另一种任务分配方法的方法流程图,该任务分配方法可以用于图1中的分布式存储系统。如图3所示,该任务分配方法包括:FIG. 3 is a flowchart of a method for assigning another task according to an embodiment of the present disclosure. The task allocation method may be used in the distributed storage system in FIG. 1. As shown in FIG. 3, the task assignment method includes:
步骤301、存储节点向管理节点发送负载信息。执行步骤302。Step 301: The storage node sends load information to the management node. Go to step 302.
需要说明的是,每个存储节点向管理节点发送的负载信息可以用于指示该每个存储节点的写数据负载值。如第一存储节点向管理节点发送的负载信息可以用于指示第一存储节点的写数据负载值,第二存储节点向管理节点发送的负载信息可以用于指示第二存储节点的写数据负载值等。需要说明的是,存储节点的写数据负载值为用于反映存储节点的写数据负载的数值,存储节点的写数据负载与存储节点的写数据负载值正相关。It should be noted that the load information sent by each storage node to the management node may be used to indicate the write data load value of each storage node. The load information sent by the first storage node to the management node may be used to indicate the write data load value of the first storage node, and the load information sent by the second storage node to the management node may be used to indicate the write data load value of the second storage node. Wait. It should be noted that the write data load value of the storage node is a value for reflecting the write data load of the storage node, and the write data load of the storage node is positively correlated with the write data load value of the storage node.
可选的,该分布式存储系统中的每个存储节点均可以每隔预设时间段向管理节点发送负载信息,以告知管理节点该存储节点的写数据负载值。管理节点可以对每个存储节点的负载信息进行存储,并在再次接收到同一存储节点发送的负载信息后,对该存储节点的负载信息进行更新。Optionally, each storage node in the distributed storage system may send load information to the management node every preset time period to notify the management node of the write data load value of the storage node. The management node may store the load information of each storage node, and after receiving the load information sent by the same storage node again, update the load information of the storage node.
步骤302、终端向管理节点发送存储请求。执行步骤303。Step 302: The terminal sends a storage request to the management node. Go to step 303.
当用户需要控制终端在分布式存储系统中存储数据时,用户可以在终端上操作,以触发终端向管理节点发送存储请求。When the user needs to control the terminal to store data in the distributed storage system, the user can operate on the terminal to trigger the terminal to send a storage request to the management node.
步骤303、管理节点根据每个存储节点发送的负载信息,确定每个存储节点的写数据负载值。执行步骤304。Step 303: The management node determines a write data load value of each storage node according to load information sent by each storage node. Go to step 304.
管理节点在接收到终端发送的存储请求后,可以获取预先存储的每个存储节点发送的负载信息,并根据每个存储节点发送的负载信息,确定每个存储节点的写数据负载值。After receiving the storage request sent by the terminal, the management node may acquire the pre-stored load information sent by each storage node, and determine the write data load value of each storage node according to the load information sent by each storage node.
步骤304、管理节点将分布式存储系统中写数据负载值小于预设负载阈值的多个存储节点作为多个可用存储节点。执行步骤305。Step 304: The management node uses a plurality of storage nodes in the distributed storage system whose write data load value is less than a preset load threshold as the plurality of available storage nodes. Go to step 305.
管理节点上预先存储有预设负载阈值,管理节点在确定分布式存储系统中每个存储节点的写数据负载值后,可以将每个存储节点的写数据负载值与该预设负载阈值进行比较,以确定该多个存储节点中写数据负载值小于该预设负载阈值的多个存储节点,并将该多个存储节点作为可用存储节点。A preset load threshold is pre-stored on the management node, and after determining the write data load value of each storage node in the distributed storage system, the management node may compare the write data load value of each storage node with the preset load threshold. And determining, by the plurality of storage nodes, a plurality of storage nodes whose write data load value is less than the preset load threshold, and using the multiple storage nodes as available storage nodes.
例如,假设第一存储节点的写数据负载值为95%,第二存储节点的写数据负载值为50%,第三存储节点的写数据负载值为40%,预设负载阈值为80%。则管理节点可以将第一存储节点和第二存储节点均作为可用存储节点,此时,分布式存储系统中共存在两个可用存储节点。For example, assume that the write data load value of the first storage node is 95%, the write data load value of the second storage node is 50%, the write data load value of the third storage node is 40%, and the preset load threshold is 80%. The management node may use both the first storage node and the second storage node as available storage nodes. At this time, there are two available storage nodes in the distributed storage system.
在步骤304中管理节点通过预设负载阈值在分布式存储系统中的多个存储 节点中筛选出了多个可用存储节点,该可用存储节点也即是写数据负载值较小的存储节点,该可用存储节点可以继续被分配存储任务,但若继续给非可用存储节点分配存储任务,则会导致非可用存储节点无法正常运行。In step 304, the management node filters out a plurality of available storage nodes in the plurality of storage nodes in the distributed storage system by using a preset load threshold, where the available storage node is a storage node with a smaller data load value. Available storage nodes can continue to be assigned storage tasks, but continuing to allocate storage tasks to non-available storage nodes can result in non-available storage nodes not functioning properly.
步骤305、管理节点获取多个可用存储节点中每个可用存储节点在预设时间段内的分配次数。执行步骤306。Step 305: The management node acquires the number of allocations of each available storage node of the plurality of available storage nodes within a preset time period. Go to step 306.
可用存储节点的分配次数为该可用存储节点被分配存储任务的次数。The number of allocations of available storage nodes is the number of times the available storage node is assigned a storage task.
可选的,在步骤302之前,管理节点在每次为一个存储节点分配存储任务后,均可以记录该存储节点被分配存储任务的次数。Optionally, before step 302, the management node may record the number of times the storage node is allocated a storage task after each time a storage task is allocated to the storage node.
示例的,假设在步骤302之前的第一时刻,管理节点为第一存储节点分配了存储任务,则管理节点可以记录该第一存储节点的分配次数为1。此时,管理节点可以记录:第一存储节点的分配次数为1,第二存储节点的分配次数为0,第三存储节点的分配次数为0。若管理节点在第二时刻为第二存储节点分配了存储任务,则管理节点可以将第二存储节点的分配次数由0更新为1。此时,管理节点可以记录:第一存储节点的分配次数为1,第二存储节点的分配次数为1,第三存储节点的分配次数为0。需要说明的是,若第二时刻该分布式存储系统中新加入了第四存储节点,则该第四存储节点为未被分配存储任务的存储节点,该管理节点可以记录该第四存储节点的分配次数为0。For example, if the management node allocates a storage task to the first storage node at the first moment before step 302, the management node may record that the number of allocations of the first storage node is 1. At this time, the management node may record that the number of allocations of the first storage node is 1, the number of allocations of the second storage node is 0, and the number of allocations of the third storage node is 0. If the management node allocates a storage task to the second storage node at the second moment, the management node may update the allocation number of the second storage node from 0 to 1. At this time, the management node may record that the number of allocations of the first storage node is 1, the number of allocations of the second storage node is 1, and the number of allocations of the third storage node is 0. It should be noted that, if the fourth storage node is newly added to the distributed storage system at the second moment, the fourth storage node is a storage node that is not assigned a storage task, and the management node may record the fourth storage node. The number of allocations is 0.
进一步地,管理节点还可以定时对记录的次数进行清零(例如管理节点可以每小时对记录的次数进行一次清零)。管理节点在步骤305中可以获取之前记录的每个可用存储节点的分配次数,该分配次数为上次清零的时刻到当前时刻之间的时间段(也即预设时间段)内的分配次数。Further, the management node can also periodically clear the number of records (for example, the management node can clear the number of records every hour). The management node may acquire, in step 305, the number of allocations of each available storage node that was previously recorded, which is the number of allocations in the time period between the time of the last clearing and the current time (that is, the preset time period). .
步骤306、管理节点根据每个可用存储节点的分配次数,确定多个可用存储节点的分配次数平均值。执行步骤307。Step 306: The management node determines an average number of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node. Go to step 307.
管理节点在获取到每个可用存储节点的分配次数后,可以将多个可用存储节点的分配次数的平均值作为分配次数平均值。After obtaining the number of allocations of each available storage node, the management node may use the average of the number of allocations of the plurality of available storage nodes as the average of the number of allocations.
示例的,假设多个可用存储节点包括n个可用存储节点,则该n个可用存储节点的分配次数平均值avg=(osd1+osd2+…+osdn)/n,其中,osd1表示n个可用存储节点中第一个可用存储节点的分配次数,osd2表示n个可用存储节点中第二个可用存储节点的分配次数,osdn表示n个可用存储节点中第n个可用存储节点的分配次数。By way of example, assuming that a plurality of available storage nodes include n available storage nodes, the average number of allocations of the n available storage nodes is avg=(osd1+osd2+...+osdn)/n, where osd1 represents n available storage nodes. The number of allocations of the first available storage node, osd2 represents the number of allocations of the second available storage node among the n available storage nodes, and osdn represents the number of allocations of the nth available storage node among the n available storage nodes.
步骤307、管理节点将分配次数平均值的M倍确定为分配次数阈值。执行步骤308。Step 307: The management node determines M times of the average number of allocation times as the allocation number threshold. Go to step 308.
在确定分配次数平均值后,管理节点可以将分配次数平均值乘以M,以得到分配次数阈值,M≥1。After determining the average number of allocation times, the management node may multiply the average number of allocation times by M to obtain the allocation number threshold, M ≥ 1.
可选的,M=1,此时,该分配次数阈值等于分配次数平均值。Optionally, M=1, at this time, the allocation number threshold is equal to the average number of allocation times.
可选的,M=1.3,此时,该分配次数阈值为分配次数平均值的1.3倍。Optionally, M=1.3. At this time, the allocation number threshold is 1.3 times the average value of the allocation times.
需要说明的是,本公开实施例中以M等于1或1.3为例,可选地,M还可以为大于或等于1的其他数值,本公开实施例对此不作限定。It should be noted that, in the embodiment of the present disclosure, M is equal to 1 or 1.3. Alternatively, M may be other values greater than or equal to 1. This embodiment of the present disclosure does not limit this.
步骤308、管理节点判断多个可用存储节点中是否存在分配次数小于分配次数阈值的至少一个可用存储节点。若多个可用存储节点中存在分配次数小于分配次数阈值的至少一个可用存储节点,则执行步骤309;若多个可用存储节点中不存在分配次数小于分配次数阈值的至少一个可用存储节点,则执行步骤310。Step 308: The management node determines, by the plurality of available storage nodes, whether there is at least one available storage node whose allocation number is less than the allocation number threshold. If there are at least one available storage node whose number of allocations is less than the allocation number threshold, the step 309 is performed; if there is no at least one available storage node whose allocation number is less than the allocation number threshold, the execution is performed. Step 310.
管理节点可以将每个可用存储节点的分配次数与该分配次数阈值进行比较,以确定每个可用存储节点的分配次数是否小于分配次数阈值。示例的,管理节点可以将每个可用存储节点的分配次数与该分配次数阈值进行做差。当得到的差值小于零时,确定该可用存储节点的分配次数小于该分配次数阈值。The management node may compare the number of allocations of each available storage node to the number of allocation thresholds to determine if the number of allocations per available storage node is less than the number of allocation thresholds. For example, the management node may make the number of allocations of each available storage node worse than the number of allocation thresholds. When the obtained difference is less than zero, it is determined that the number of allocations of the available storage nodes is less than the allocation number threshold.
可选的,管理节点在确定每个可用存储节点的分配次数,以及分配次数平均值后,还可以无需执行步骤307和步骤308,而是直接判断每个可用存储节点的分配次数是否满足预设条件,该预设条件可以为(osdx–avg)/avg<M-1,其中,osdx为n个可用存储节点中的第x个可用存储节点的分配次数,x≥1。若某一存储节点的分配次数满足该预设条件,则管理节点可以确定该存储节点的分配次数小于分配次数阈值。Optionally, after determining the number of allocations of each available storage node and the average number of allocation times, the management node may not directly perform step 307 and step 308, but directly determine whether the allocated number of available storage nodes meets the preset. Condition, the preset condition may be (osdx–avg)/avg<M-1, where osdx is the number of allocations of the xth available storage node among the n available storage nodes, x≥1. If the number of allocations of a storage node satisfies the preset condition, the management node may determine that the allocation number of the storage node is less than the allocation number threshold.
步骤309、管理节点在至少一个可用存储节点中筛选目标存储节点。执行步骤311。Step 309: The management node filters the target storage node in the at least one available storage node. Go to step 311.
在确定负载值小于预设负载阈值,且分配次数小于分配次数阈值的至少一个可用存储节点后,管理节点可以在该至少一个可用存储节点中筛选一个存储节点作为目标存储节点。管理节点在至少一个可用存储节点中筛选目标存储节点的方式可以多种多样,本公开实施例中将以以下的四种筛选方式进行举例说明。After determining that the load value is less than the preset load threshold and the number of allocations is less than the at least one available storage node, the management node may filter one storage node as the target storage node among the at least one available storage node. The manner in which the management node filters the target storage node in the at least one available storage node may be various, and the following four screening manners are exemplified in the embodiment of the present disclosure.
在第一种筛选方式中,管理节点可以基于步骤305中获取的每个可用存储 节点的分配次数,在上述至少一个可用存储节点中筛选分配次数最小的可用存储节点为目标存储节点。In the first screening mode, the management node may filter the available storage nodes with the smallest number of allocations as the target storage node among the at least one available storage node based on the number of allocations of each available storage node acquired in step 305.
在第二种筛选方式中,管理节点可以基于步骤303中确定的每个可用存储节点的写数据负载值,在上述至少一个可用存储节点中筛选写数据负载值最小的可用存储节点为目标存储节点。In the second screening mode, the management node may filter, according to the write data load value of each available storage node determined in step 303, the available storage node with the smallest write data load value as the target storage node in the at least one available storage node. .
在第三种筛选方式中,管理节点可以基于步骤303中确定的每个可用存储节点的写数据负载值,以及步骤305中确定的每个可用存储节点的分配次数,计算每个可用存储节点的写数据负载值和分配次数之和。之后,管理节点可以在上述至少一个可用存储节点中筛选分配次数和写数据负载值之和最小的可用存储节点为目标存储节点。也即是,管理节点可以将写数据负载值和分配次数均较小的可用存储节点作为目标存储节点,以进一步提高多个可用存储节点的负载均衡程度。In a third screening mode, the management node may calculate the available data storage node based on the write data load value of each available storage node determined in step 303 and the number of allocations of each available storage node determined in step 305. Write the sum of the data load value and the number of allocations. Thereafter, the management node may filter the available storage nodes with the smallest sum of allocation times and write data load values as the target storage node among the at least one available storage node. That is, the management node can use the available storage nodes with smaller write data load values and allocation times as the target storage nodes to further improve the load balancing degree of the plurality of available storage nodes.
在第四种筛选方式中,管理节点可以在至少一个可用存储节点中随机筛选一个存储节点作为目标存储节点。In the fourth screening mode, the management node may randomly filter one storage node as the target storage node among the at least one available storage node.
步骤310、管理节点在多个可用存储节点中筛选目标存储节点。执行步骤311。Step 310: The management node filters the target storage node among the plurality of available storage nodes. Go to step 311.
当分布式存储系统中的多个可用存储节点中并不存在分配次数小于分配次数阈值的可用存储节点时,可以表明此时该多个可用存储节点的分配次数比较均衡,此时管理节点可以在该多个可用存储节点中筛选目标存储节点。When there are no available storage nodes whose number of allocations is smaller than the number of allocation times in the plurality of available storage nodes in the distributed storage system, it may be indicated that the number of allocations of the plurality of available storage nodes is relatively balanced at this time, and the management node may be at the time The target storage node is filtered from the plurality of available storage nodes.
管理节点在多个可用存储节点中筛选目标存储节点的过程可以参考步骤309中在至少一个可用存储节点中筛选目标存储节点的步骤,本公开实施例在此不做赘述。The process of filtering the target storage node in the plurality of available storage nodes may refer to the step of filtering the target storage node in the at least one available storage node in step 309, which is not described herein.
步骤311、管理节点基于存储请求为目标存储节点分配待执行的存储任务。Step 311: The management node allocates a storage task to be executed to the target storage node based on the storage request.
在筛选得到目标存储节点后,管理节点可以基于步骤302中终端发送的存储请求,为目标存储节点分配待执行的存储任务。终端还可以指示终端通过该目标存储节点进行数据的存储。之后,终端就可以通过被分配存储任务的目标存储节点在分布式存储系统中进行数据的存储。After the target storage node is obtained, the management node may allocate a storage task to be executed to the target storage node based on the storage request sent by the terminal in step 302. The terminal may also instruct the terminal to store data through the target storage node. The terminal can then store the data in the distributed storage system through the target storage node to which the storage task is assigned.
另外,管理节点在为该目标存储节点分配存储任务后,管理节点可以将记录的该目标存储节点的分配次数加一。In addition, after the management node allocates a storage task to the target storage node, the management node may increase the number of allocations of the target storage node recorded by one.
需要说明的是,本公开实施例中以步骤304管理节点确定出的可用存储节 点的个数为多个为例。可选地,若管理节点确定出的可用存储节点的个数为1时,管理节点可以直接将这一个可用存储节点作为目标存储节点,并为该目标存储节点分配待执行的存储任务。若管理节点确定出的可用存储节点的个数为0,则可以表明当前分布式存储系统中并不存在能够继续分配存储任务的存储节点。此时,管理节点可以禁止继续分配存储任务,或者管理节点可以在当前的所有存储节点中选择一个存储节点,并为该存储节点分配存储任务。It should be noted that, in the embodiment of the present disclosure, the number of available storage nodes determined by the management node in step 304 is taken as an example. Optionally, if the number of available storage nodes determined by the management node is 1, the management node may directly use the available storage node as the target storage node, and allocate the storage task to be executed to the target storage node. If the number of available storage nodes determined by the management node is 0, it may indicate that there is no storage node in the current distributed storage system that can continue to allocate storage tasks. At this time, the management node may prohibit the continued allocation of the storage task, or the management node may select one of the current storage nodes and allocate a storage task to the storage node.
相关技术中,管理节点可以根据终端发送的存储请求,为多个存储节点中的目标存储节点分配存储任务,并指示终端通过该目标存储节点进行数据的存储。且通常情况下,若分布式存储系统进行了扩容,也即分布式存储系统中出现了新增的存储节点,则管理节点会将较多个存储任务均分配给该新增的存储节点,从而导致该新增的存储节点的写数据负载较大,导致整个分布式存储系统中的负载均衡程度较低。In the related art, the management node may allocate a storage task to the target storage node among the multiple storage nodes according to the storage request sent by the terminal, and instruct the terminal to store the data through the target storage node. Generally, if a distributed storage system is expanded, that is, a new storage node appears in the distributed storage system, the management node allocates more than one storage task to the newly added storage node, thereby The write data load of the newly added storage node is large, resulting in a low load balance in the entire distributed storage system.
而本公开实施例中,无论该分布式存储系统是否扩容,管理节点均根据每个存储节点的写数据负载值和分配次数进行合理的分配存储任务。这样一来,避免了在出现新增的存储节点时,管理节点将多个存储任务均分配给该新增的存储节点,提高了分布式存储系统中的负载均衡程度。In the embodiment of the present disclosure, regardless of whether the distributed storage system is expanded, the management node performs a reasonable allocation storage task according to the write data load value and the number of allocations of each storage node. In this way, when the newly added storage node occurs, the management node allocates multiple storage tasks to the newly added storage node, thereby improving the load balancing degree in the distributed storage system.
综上所述,本公开实施例提供的任务分配方法中,在分配待执行的存储任务前,通过比较每个可用存储节点的分配次数与分配次数阈值,以确定分配次数较小的可用存储节点,并在这些可用存储节点中筛选用于执行存储任务的目标存储节点。从而使得各个存储节点的分配次数比较均衡,避免了管理节点为同一个存储节点分配较多的存储任务,提高了分布式存储系统的负载值均衡程度。In summary, in the task allocation method provided by the embodiment of the present disclosure, before the storage task to be executed is allocated, the number of allocation times and the number of allocation times of each available storage node are compared to determine an available storage node with a small number of allocations. And filter the target storage nodes used to perform storage tasks among these available storage nodes. Therefore, the number of allocations of each storage node is relatively balanced, which avoids the management node allocating more storage tasks to the same storage node, and improves the load value balance degree of the distributed storage system.
图4为本公开实施例提供的一种任务分配装置的结构示意图,该任务分配装置可以用于管理节点,如图4所示,该任务分配装置40可以包括:FIG. 4 is a schematic structural diagram of a task distribution apparatus according to an embodiment of the present disclosure. The task distribution apparatus may be used to manage a node. As shown in FIG. 4, the task distribution apparatus 40 may include:
第一确定模块401,用于在接收到终端发送的存储请求后,确定分布式存储系统中的多个可用存储节点;The first determining module 401 is configured to determine, after receiving the storage request sent by the terminal, multiple available storage nodes in the distributed storage system;
获取模块402,用于获取多个可用存储节点中每个可用存储节点在预设时间段内的分配次数,其中,可用存储节点的分配次数为可用存储节点被分配存储任务的次数;The obtaining module 402 is configured to obtain an allocation number of each available storage node of the plurality of available storage nodes in a preset time period, where the number of allocations of the available storage nodes is the number of times the available storage nodes are allocated storage tasks;
第一筛选模块403,用于在多个可用存储节点中存在分配次数小于分配次数阈值的至少一个可用存储节点时,在至少一个可用存储节点中筛选目标存储节点;The first screening module 403 is configured to filter the target storage node in the at least one available storage node when there are at least one available storage node whose allocation number is less than the allocation number threshold.
分配模块404,用于基于存储请求为目标存储节点分配待执行的存储任务。The allocating module 404 is configured to allocate a storage task to be executed to the target storage node based on the storage request.
综上所述,本公开实施例提供的任务分配装置中,在分配模块分配待执行的存储任务前,第一筛选模块结合第一确定模块和获取模块通过比较每个可用存储节点的分配次数与分配次数阈值,以确定分配次数较小的可用存储节点,分配模块在这些可用存储节点中筛选用于执行存储任务的目标存储节点。从而避免了管理节点为同一个存储节点分配较多的存储任务,提高了分布式存储系统的负载值均衡程度。In summary, in the task allocation apparatus provided by the embodiment of the present disclosure, before the allocating module allocates the storage task to be executed, the first screening module combines the first determining module and the obtaining module by comparing the allocation times of each available storage node with A number of allocation thresholds are determined to determine available storage nodes with a small number of allocations, and the allocation module filters the target storage nodes for performing storage tasks among the available storage nodes. Therefore, the management node is prevented from allocating more storage tasks to the same storage node, and the load value balance degree of the distributed storage system is improved.
图5为本公开实施例提供的另一种任务分配装置40的结构示意图,如图5所示,在图4的基础上,该任务分配装置40还可以包括:FIG. 5 is a schematic structural diagram of another task distribution apparatus 40 according to an embodiment of the present disclosure. As shown in FIG. 5, the task distribution apparatus 40 may further include:
第二确定模块405,用于根据每个可用存储节点的分配次数,确定多个可用存储节点的分配次数平均值;a second determining module 405, configured to determine an average number of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node;
第三确定模块406,用于将分配次数平均值的M倍确定为分配次数阈值,M≥1。The third determining module 406 is configured to determine M times of the average number of allocation times as the allocation number threshold, and M≥1.
可选的,M=1.3。Optional, M = 1.3.
可选的,图6为本公开实施例提供的又一种任务分配装置40的结构示意图,如图6所示,在图5的基础上,该任务分配装置40还可以包括:Optionally, FIG. 6 is a schematic structural diagram of another task distribution apparatus 40 according to an embodiment of the present disclosure. As shown in FIG. 6, the task distribution apparatus 40 may further include:
接收模块407,用于接收分布式存储节点中每个存储节点发送的负载信息,每个存储节点发送的负载信息用于指示每个存储节点的写数据负载值;The receiving module 407 is configured to receive load information sent by each storage node in the distributed storage node, where the load information sent by each storage node is used to indicate a write data load value of each storage node;
第四确定模块408,用于根据每个存储节点发送的负载信息,确定每个存储节点的写数据负载值;a fourth determining module 408, configured to determine, according to load information sent by each storage node, a write data load value of each storage node;
第一确定模块401用于将分布式存储系统中写数据负载值小于预设负载阈值的存储节点作为可用存储节点。The first determining module 401 is configured to use, as an available storage node, a storage node in the distributed storage system whose write data load value is less than a preset load threshold.
可选的,第一筛选模块403可以用于:Optionally, the first screening module 403 can be used to:
在至少一个可用存储节点中筛选分配次数最小的可用存储节点为目标存储节点;Filtering, at least one available storage node, the available storage node with the smallest number of allocations as the target storage node;
或者,在至少一个可用存储节点中筛选写数据负载值最小的可用存储节点为目标存储节点;Or filtering the available storage node with the smallest write data load value as the target storage node in the at least one available storage node;
或者,在至少一个可用存储节点中筛选分配次数和写数据负载值之和最小的可用存储节点为目标存储节点;Or, the available storage node with the smallest sum of the allocation number and the write data load value in the at least one available storage node is the target storage node;
或者,在至少一个可用存储节点中随机筛选目标存储节点。Alternatively, the target storage node is randomly selected in at least one of the available storage nodes.
可选的,图7为本公开实施例提供的再一种任务分配装置40的结构示意图,如图7所示,在图5的基础上,该任务分配装置40还可以包括:Optionally, FIG. 7 is a schematic structural diagram of another task distribution apparatus 40 according to an embodiment of the present disclosure. As shown in FIG. 7, the task distribution apparatus 40 may further include:
第二筛选模块409,用于在多个可用存储节点中不存在分配次数小于分配次数阈值的可用存储节点时,在多个可用存储节点中筛选目标存储节点。The second screening module 409 is configured to filter the target storage node among the plurality of available storage nodes when there are no available storage nodes whose allocation times are less than the allocation number threshold.
可选地,图8为本公开实施例提供的再一种任务分配装置40的结构示意图,如图8所示,在图4的基础上,该任务分配装置40还可以包括:Optionally, FIG. 8 is a schematic structural diagram of still another task distribution apparatus 40 according to an embodiment of the present disclosure. As shown in FIG. 8, the task distribution apparatus 40 may further include:
第五确定模块410,用于根据每个可用存储节点的分配次数,确定多个可用存储节点的分配次数平均值;The fifth determining module 410 is configured to determine an average number of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node;
第六确定模块411,用于在多个可用存储节点中第x个可用存储节点的分配次数满足预设条件时,确定第x个可用存储节点的分配次数小于分配次数阈值;The sixth determining module 411 is configured to determine, when the number of allocations of the xth available storage node of the plurality of available storage nodes meets the preset condition, that the number of allocations of the xth available storage node is less than the allocation number threshold;
其中,预设条件包括:(osdx–avg)/avg<M-1,osdx为第x个可用存储节点的分配次数,x≥1,avg为分配次数平均值,M≥1。The preset conditions include: (osdx–avg)/avg<M-1, osdx is the number of allocations of the xth available storage node, x≥1, avg is the average of the number of allocations, and M≥1.
综上所述,本公开实施例提供的任务分配装置中,在分配模块分配待执行的存储任务前,第一筛选模块结合第一确定模块和获取模块通过比较每个可用存储节点的分配次数与分配次数阈值,以确定分配次数较小的可用存储节点,分配模块在这些可用存储节点中筛选用于执行存储任务的目标存储节点。从而使得各个存储节点的分配次数比较均衡,避免了管理节点为同一个存储节点分配较多的存储任务,提高了分布式存储系统的负载值均衡程度。In summary, in the task allocation apparatus provided by the embodiment of the present disclosure, before the allocating module allocates the storage task to be executed, the first screening module combines the first determining module and the obtaining module by comparing the allocation times of each available storage node with A number of allocation thresholds are determined to determine available storage nodes with a small number of allocations, and the allocation module filters the target storage nodes for performing storage tasks among the available storage nodes. Therefore, the number of allocations of each storage node is relatively balanced, which avoids the management node allocating more storage tasks to the same storage node, and improves the load value balance degree of the distributed storage system.
本公开实施例提供了一种计算机设备,包括处理器和存储器,其中,存储器,用于存放计算机程序;处理器,用于执行存储器上所存放的程序,实现上述任务分配方法。An embodiment of the present disclosure provides a computer device, including a processor and a memory, wherein the memory is configured to store a computer program, and the processor is configured to execute a program stored on the memory to implement the task assignment method.
本公开实施例还提供了一种计算机可读存储介质,存储介质内存储有计算机程序,计算机程序被处理器执行时实现上述任务分配方法。The embodiment of the present disclosure further provides a computer readable storage medium, where the computer program is stored in the storage medium, and the task assignment method is implemented when the computer program is executed by the processor.
本发明实施例还提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行上述任务分配方法。The embodiment of the invention further provides a computer program product, when the computer program product is run on a computer, causing the computer to execute the task assignment method.
需要说明的是,本公开实施例提供的任务分配方法实施例与任务分配装置实施例以及分布式存储系统实施例均可以互相参考,本公开实施例对此不做限 定。It should be noted that the embodiment of the present invention, the embodiment of the present invention, the embodiment of the present invention, and the embodiment of the present invention are not limited.
以上所述仅为本公开的可选实施例,并不用以限制本公开,凡在本公开的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本公开的保护范围之内。The above description is only an alternative embodiment of the present disclosure, and is not intended to limit the disclosure, and any modifications, equivalents, improvements, etc., made within the spirit and principles of the present disclosure should be included in the protection of the present disclosure. Within the scope.

Claims (19)

  1. 一种任务分配方法,用于管理节点,所述方法包括:A task assignment method for managing a node, the method comprising:
    在接收到终端发送的存储请求后,确定分布式存储系统中的多个可用存储节点;After receiving the storage request sent by the terminal, determining a plurality of available storage nodes in the distributed storage system;
    获取所述多个可用存储节点中每个可用存储节点在预设时间段内的分配次数,其中,可用存储节点的分配次数为可用存储节点被分配存储任务的次数;Obtaining an allocation number of each of the plurality of available storage nodes within a preset time period, wherein the number of allocations of the available storage nodes is the number of times the available storage nodes are allocated storage tasks;
    当所述多个可用存储节点中存在分配次数小于分配次数阈值的至少一个可用存储节点时,在所述至少一个可用存储节点中筛选目标存储节点;When there is at least one available storage node whose allocation number is less than the allocation number threshold, the target storage node is filtered among the at least one available storage node;
    基于所述存储请求为所述目标存储节点分配待执行的存储任务。A storage task to be executed is allocated to the target storage node based on the storage request.
  2. 根据权利要求1所述的方法,在所述至少一个可用存储节点中筛选目标存储节点之前,所述方法还包括:The method of claim 1, before the screening of the target storage node in the at least one available storage node, the method further comprising:
    根据所述每个可用存储节点的分配次数,确定所述多个可用存储节点的分配次数平均值;Determining, according to the number of allocations of each available storage node, an average number of allocation times of the plurality of available storage nodes;
    将所述分配次数平均值的M倍确定为所述分配次数阈值,M≥1。M times the average value of the number of allocations is determined as the threshold number of allocation times, M ≥ 1.
  3. 根据权利要求2所述的方法,M=1.3。The method of claim 2, M = 1.3.
  4. 根据权利要求1至3任一所述的方法,所述方法还包括:The method according to any one of claims 1 to 3, further comprising:
    接收所述分布式存储节点中每个存储节点发送的负载信息,所述每个存储节点发送的负载信息用于指示所述每个存储节点的写数据负载值;Receiving load information sent by each storage node in the distributed storage node, where the load information sent by each storage node is used to indicate a write data load value of each storage node;
    根据所述每个存储节点发送的负载信息,确定所述每个存储节点的写数据负载值;Determining, according to the load information sent by each storage node, a write data load value of each storage node;
    所述确定分布式存储系统中的多个可用存储节点,包括:The determining a plurality of available storage nodes in the distributed storage system includes:
    将所述分布式存储系统中写数据负载值小于预设负载阈值的存储节点作为所述可用存储节点。A storage node whose write data load value is smaller than a preset load threshold in the distributed storage system is used as the available storage node.
  5. 根据权利要求4所述的方法,在所述至少一个可用存储节点中筛选目标存储节点,包括:The method of claim 4, screening the target storage node in the at least one available storage node, comprising:
    在所述至少一个可用存储节点中筛选分配次数最小的可用存储节点为所述目标存储节点;Filtering, in the at least one available storage node, an available storage node with the smallest number of allocations as the target storage node;
    或者,在所述至少一个可用存储节点中筛选写数据负载值最小的可用存储节点为所述目标存储节点;Or filtering, in the at least one available storage node, an available storage node with the smallest write data load value as the target storage node;
    或者,在所述至少一个可用存储节点中筛选分配次数和写数据负载值之和最小的可用存储节点为所述目标存储节点;Or the available storage node with the smallest sum of allocation times and write data load values among the at least one available storage node is the target storage node;
    或者,在所述至少一个可用存储节点中随机筛选目标存储节点。Alternatively, the target storage node is randomly selected among the at least one available storage node.
  6. 根据权利要求1至3任一所述的方法,所述方法还包括:The method according to any one of claims 1 to 3, further comprising:
    当所述多个可用存储节点中不存在分配次数小于所述分配次数阈值的可用存储节点时,在所述多个可用存储节点中筛选目标存储节点。When there is no available storage node whose allocation number is less than the allocation number threshold among the plurality of available storage nodes, the target storage node is screened among the plurality of available storage nodes.
  7. 根据权利要求1所述的方法,在所述至少一个可用存储节点中筛选目标存储节点之前,所述方法还包括:The method of claim 1, before the screening of the target storage node in the at least one available storage node, the method further comprising:
    根据所述每个可用存储节点的分配次数,确定所述多个可用存储节点的分配次数平均值;Determining, according to the number of allocations of each available storage node, an average number of allocation times of the plurality of available storage nodes;
    当所述多个可用存储节点中第x个可用存储节点的分配次数满足预设条件时,确定所述第x个可用存储节点的分配次数小于所述分配次数阈值;Determining, when the number of allocations of the xth available storage node of the plurality of available storage nodes meets a preset condition, determining that the number of allocations of the xth available storage node is less than the threshold of the number of allocations;
    其中,所述预设条件包括:(osdx avg)/avg<M-1,osdx为所述第x个可用存储节点的分配次数,x≥1,avg为所述分配次数平均值,M≥1。The preset condition includes: (osdx avg)/avg<M-1, osdx is the number of allocations of the xth available storage node, x≥1, avg is the average of the allocation times, M≥1 .
  8. 一种任务分配装置,用于管理节点,所述任务分配装置包括:A task assignment device for managing a node, the task assignment device comprising:
    第一确定模块,用于在接收到终端发送的存储请求后,确定分布式存储系统中的多个可用存储节点;a first determining module, configured to determine, after receiving the storage request sent by the terminal, multiple available storage nodes in the distributed storage system;
    获取模块,用于获取所述多个可用存储节点中每个可用存储节点在预设时间段内的分配次数,其中,可用存储节点的分配次数为可用存储节点被分配存储任务的次数;An obtaining module, configured to acquire an allocation number of each of the plurality of available storage nodes in a preset time period, where the number of allocations of the available storage nodes is the number of times the available storage nodes are allocated storage tasks;
    第一筛选模块,用于在所述多个可用存储节点中存在分配次数小于分配次数阈值的至少一个可用存储节点时,在所述至少一个可用存储节点中筛选目标存储节点;a first screening module, configured to filter a target storage node among the at least one available storage node when there is at least one available storage node whose number of allocations is less than an allocation number threshold;
    分配模块,用于基于所述存储请求为所述目标存储节点分配待执行的存储任务。And an allocating module, configured to allocate, to the target storage node, a storage task to be executed based on the storage request.
  9. 根据权利要求8所述的任务分配装置,所述任务分配装置还包括:The task assigning device according to claim 8, wherein the task assigning device further comprises:
    第二确定模块,用于根据所述每个可用存储节点的分配次数,确定所述多个可用存储节点的分配次数平均值;a second determining module, configured to determine an average number of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node;
    第三确定模块,用于将所述分配次数平均值的M倍确定为所述分配次数阈值,M≥1。a third determining module, configured to determine M times the average value of the number of allocation times as the threshold number of allocation times, M≥1.
  10. 根据权利要求9所述的任务分配装置,M=1.3。The task distribution device according to claim 9, M = 1.3.
  11. 根据权利要求8至10任一所述的任务分配装置,所述任务分配装置还包括:The task distribution device according to any one of claims 8 to 10, further comprising:
    接收模块,用于接收所述分布式存储节点中每个存储节点发送的负载信息,所述每个存储节点发送的负载信息用于指示所述每个存储节点的写数据负载值;a receiving module, configured to receive load information sent by each storage node in the distributed storage node, where the load information sent by each storage node is used to indicate a write data load value of each storage node;
    第四确定模块,用于根据所述每个存储节点发送的负载信息,确定所述每个存储节点的写数据负载值;a fourth determining module, configured to determine, according to the load information sent by each storage node, a write data load value of each storage node;
    所述第一确定模块用于将所述分布式存储系统中写数据负载值小于预设负载阈值的存储节点作为所述可用存储节点。The first determining module is configured to use, as the available storage node, a storage node in the distributed storage system whose write data load value is less than a preset load threshold.
  12. 根据权利要求11所述的任务分配装置,所述第一筛选模块用于:The task distribution device according to claim 11, wherein the first screening module is configured to:
    在所述至少一个可用存储节点中筛选分配次数最小的可用存储节点为所述目标存储节点;Filtering, in the at least one available storage node, an available storage node with the smallest number of allocations as the target storage node;
    或者,在所述至少一个可用存储节点中筛选写数据负载值最小的可用存储节点为所述目标存储节点;Or filtering, in the at least one available storage node, an available storage node with the smallest write data load value as the target storage node;
    或者,在所述至少一个可用存储节点中筛选分配次数和写数据负载值之和最小的可用存储节点为所述目标存储节点;Or the available storage node with the smallest sum of allocation times and write data load values among the at least one available storage node is the target storage node;
    或者,在所述至少一个可用存储节点中随机筛选目标存储节点。Alternatively, the target storage node is randomly selected among the at least one available storage node.
  13. 根据权利要求8至10任一所述的任务分配装置,所述任务分配装置还包括:The task distribution device according to any one of claims 8 to 10, further comprising:
    第二筛选模块,用于在所述多个可用存储节点中不存在分配次数小于分配次数阈值的可用存储节点时,在所述多个可用存储节点中筛选目标存储节点。And a second screening module, configured to filter the target storage node among the plurality of available storage nodes when there is no available storage node whose allocation number is less than the allocation number threshold.
  14. 根据权利要求8所述的任务分配装置,所述任务分配装置还包括:The task assigning device according to claim 8, wherein the task assigning device further comprises:
    第五确定模块,用于根据所述每个可用存储节点的分配次数,确定所述多个可用存储节点的分配次数平均值;a fifth determining module, configured to determine an average value of allocation times of the plurality of available storage nodes according to the number of allocations of each available storage node;
    第六确定模块,用于在所述多个可用存储节点中第x个可用存储节点的分配次数满足预设条件时,确定所述第x个可用存储节点的分配次数小于所述分配次数阈值;a sixth determining module, configured to determine, when the number of allocations of the xth available storage node of the plurality of available storage nodes meets a preset condition, that the number of allocations of the xth available storage node is less than the threshold of the number of allocations;
    其中,所述预设条件包括:(osdx avg)/avg<M-1,osdx为所述第x个可用存储节点的分配次数,x≥1,avg为所述分配次数平均值,M≥1。The preset condition includes: (osdx avg)/avg<M-1, osdx is the number of allocations of the xth available storage node, x≥1, avg is the average of the allocation times, M≥1 .
  15. 一种分布式存储系统,所述分布式存储系统包括管理节点和多个存储节点,所述管理节点包括权利要求8至14任一所述的任务分配装置。A distributed storage system comprising a management node and a plurality of storage nodes, the management node comprising the task allocation device of any one of claims 8 to 14.
  16. 一种计算机设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过总线完成相互间的通信;存储器,用于存放计算机程序;处理器,用于执行存储器上所存放的程序,实现权利要求1至7任一所述的任务分配方法。A computer device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface, the memory complete communication with each other through the bus; the memory for storing the computer program; and the processor for executing the memory The stored program implements the task assignment method of any one of claims 1 to 7.
  17. 一种分布式存储系统,所述分布式存储系统包括管理节点和多个存储节点,所述管理节点包括权利要求14所述的计算机设备。A distributed storage system comprising a management node and a plurality of storage nodes, the management node comprising the computer device of claim 14.
  18. 一种计算机可读存储介质,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1至7任一所述的任务分配方法。A computer readable storage medium having stored therein a computer program, the computer program being executed by a processor to implement the task assignment method of any one of claims 1 to 7.
  19. 一种计算机可读程序产品,当所述计算机程序产品在计算机上运行时,使得计算机执行权利要求1至7任一所述的任务分配方法。A computer readable program product, when the computer program product is run on a computer, causing the computer to perform the task assignment method of any one of claims 1 to 7.
PCT/CN2019/076048 2018-03-07 2019-02-25 Task allocation method and device, and distributed storage system WO2019170011A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810185894.4 2018-03-07
CN201810185894.4A CN110244901B (en) 2018-03-07 2018-03-07 Task allocation method and device and distributed storage system

Publications (1)

Publication Number Publication Date
WO2019170011A1 true WO2019170011A1 (en) 2019-09-12

Family

ID=67845838

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/076048 WO2019170011A1 (en) 2018-03-07 2019-02-25 Task allocation method and device, and distributed storage system

Country Status (2)

Country Link
CN (1) CN110244901B (en)
WO (1) WO2019170011A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111176840A (en) * 2019-12-20 2020-05-19 青岛海尔科技有限公司 Distributed task allocation optimization method and device, storage medium and electronic device

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020210362A1 (en) * 2019-04-08 2020-10-15 Ares Technologies, Inc. Systems, devices, and methods for machine learning using a distributed framework
CN110648076A (en) * 2019-09-27 2020-01-03 苏州达家迎信息技术有限公司 Task allocation method, device, equipment and storage medium
CN112256204B (en) * 2020-10-28 2022-06-03 重庆紫光华山智安科技有限公司 Storage resource allocation method and device, storage node and storage medium
CN114900518A (en) * 2022-04-02 2022-08-12 中国光大银行股份有限公司 Task allocation method, device, medium and electronic equipment for directed distributed network

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106131227A (en) * 2016-08-31 2016-11-16 浪潮(北京)电子信息产业有限公司 Balancing method of loads, meta data server system and load balance system
CN106161610A (en) * 2016-06-29 2016-11-23 华为技术有限公司 A kind of method and system of distributed storage
CN107465729A (en) * 2017-07-25 2017-12-12 北京计算机技术及应用研究所 Dummy node copy adjustment system and method based on access times ranking

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104144127A (en) * 2013-05-08 2014-11-12 华为软件技术有限公司 Load balancing method and device
CN103810244B (en) * 2013-12-09 2017-10-27 北京理工大学 A kind of expansion method of the distributed data-storage system based on data distribution
CN103701916B (en) * 2013-12-31 2017-10-27 赛凡信息科技(厦门)有限公司 The dynamic load balancing method of distributed memory system
CN104765572B (en) * 2015-03-25 2017-12-19 华中科技大学 The virtual storage server system and its dispatching method of a kind of energy-conservation
CN106550003B (en) * 2015-09-23 2020-09-11 腾讯科技(深圳)有限公司 Load balancing control method, device and system
US10034407B2 (en) * 2016-07-22 2018-07-24 Intel Corporation Storage sled for a data center

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106161610A (en) * 2016-06-29 2016-11-23 华为技术有限公司 A kind of method and system of distributed storage
CN106131227A (en) * 2016-08-31 2016-11-16 浪潮(北京)电子信息产业有限公司 Balancing method of loads, meta data server system and load balance system
CN107465729A (en) * 2017-07-25 2017-12-12 北京计算机技术及应用研究所 Dummy node copy adjustment system and method based on access times ranking

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111176840A (en) * 2019-12-20 2020-05-19 青岛海尔科技有限公司 Distributed task allocation optimization method and device, storage medium and electronic device
CN111176840B (en) * 2019-12-20 2023-11-28 青岛海尔科技有限公司 Distribution optimization method and device for distributed tasks, storage medium and electronic device

Also Published As

Publication number Publication date
CN110244901B (en) 2021-03-26
CN110244901A (en) 2019-09-17

Similar Documents

Publication Publication Date Title
WO2019170011A1 (en) Task allocation method and device, and distributed storage system
US10637916B2 (en) Method and device for storage resource allocation for video cloud storage
US11586673B2 (en) Data writing and reading method and apparatus, and cloud storage system
US8874811B2 (en) System and method for providing a flexible buffer management interface in a distributed data grid
US10235047B2 (en) Memory management method, apparatus, and system
US8185905B2 (en) Resource allocation in computing systems according to permissible flexibilities in the recommended resource requirements
CN108881512B (en) CTDB virtual IP balance distribution method, device, equipment and medium
CN113037794B (en) Method, device and system for computing resource allocation scheduling
US8683480B2 (en) Resource allocation for a plurality of resources for a dual activity system
CN110096220B (en) Distributed storage system, data processing method and storage node
CN111309644B (en) Memory allocation method and device and computer readable storage medium
CN112269661B (en) Partition migration method and device based on Kafka cluster
CN112256433B (en) Partition migration method and device based on Kafka cluster
KR20130072220A (en) Multi-level port expansion for port multipliers
CN112214288B (en) Pod scheduling method, device, equipment and medium based on Kubernetes cluster
CN109039694B (en) Global network resource allocation method and device for service
CN106021026B (en) Backup method and device
CN114442910A (en) Method, electronic device and computer program product for managing storage system
CN112468458B (en) Scheduling method based on neutron layering mechanism
CN115878309A (en) Resource allocation method, device, processing core, equipment and computer readable medium
CN110955522B (en) Resource management method and system for coordination performance isolation and data recovery optimization
CN112748850B (en) Method, apparatus and computer program product for storage management
CN115794362A (en) Resource allocation method, cloud host and computer-readable storage medium
CN109840217B (en) Cache resource allocation and device
CN109962963B (en) Message processing method and device

Legal Events

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

Ref document number: 19764140

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19764140

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19764140

Country of ref document: EP

Kind code of ref document: A1