Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Task scheduling method and system based on consistent hash algorithm

A technology of task scheduling and hash algorithm, applied in computing, multi-program device, program control design, etc., can solve problems such as inability to execute multiple times, inability to randomly assign tasks, etc.

Active Publication Date: 2019-06-18
福建省华渔教育科技有限公司
View PDF8 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, this method cannot randomly assign tasks, nor can it execute the same task multiple times

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Task scheduling method and system based on consistent hash algorithm
  • Task scheduling method and system based on consistent hash algorithm
  • Task scheduling method and system based on consistent hash algorithm

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0097] Please refer to image 3 as well as Figure 4 , the first embodiment of the present invention is:

[0098] A task scheduling mechanism based on consistent hash algorithm, including

[0099] When the execution unit starts for the first time, it will generate a unique ID code, and use the ID code as the hash value of the execution unit; when entering a task, obtain the hash of the task according to the information of the task (for example, there is an ID in the task information) value;

[0100] Assign the registered execution units, that is, the hash values ​​of the available execution units and the hash values ​​of the tasks to be executed, to the consistent hash ring; the available execution orders include execution unit 1, execution unit 2 and execution unit 3; The tasks to be executed include task 1 and task 2, such as image 3 shown;

[0101] Obtain the execution times n of task 1 to be executed, task 1 only needs to be executed once, that is, n is 1;

[0102] ...

Embodiment 2

[0108] Please refer to Figure 5 , the second embodiment of the present invention is:

[0109] A task scheduling mechanism based on a consistent hash algorithm, which differs from the first embodiment above in that:

[0110]After the above mapping relationship is established, if task 2 is deleted, then clear the mapping relationship between the task and the corresponding execution unit; update the mapping table from the execution unit to the task according to the mapping relationship, that is, delete execution unit 1 to task 2, Execution unit 3—the mapping table of task 2; the hash value of the task on the consistent hash ring is also cleared on the consistent hash ring, task 1 and execution unit 2, task 3 and execution unit 3 and execution The mapping relationship of unit 2 remains unchanged. like Figure 5 shown.

Embodiment 3

[0111] Please refer to Image 6 , the third embodiment of the present invention is:

[0112] A task scheduling mechanism based on a consistent hash algorithm, which differs from the second embodiment above in that:

[0113] After the above mapping relationship is established, if the execution unit 2 goes offline, that is, the execution unit 2 is unavailable and is deleted, the hash value of the execution unit 2 is deleted on the consistent hash ring, such as Image 6 As shown; since the mapping relationship is established between the execution unit 2 and the task 1 and task 3 in the first embodiment, so for the task 1 and the task 3, according to the above method, according to Figure 5 In the consistent hash ring, the mapping relationship between task 1 and execution unit, task 3 and execution unit 3 and execution unit 1 is established, and the mapping table from execution unit to task is updated according to the mapping relationship.

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a task scheduling mechanism and system based on a consistent hash algorithm. The method comprises the steps of obtaining a hash value of an available execution unit and a hash value of a task to be executed; distributing the hash value of the execution unit and the hash value of the task to a consistent hash ring; obtaining the execution times of the task; choosing a search direction; searching for n hash values of corresponding execution units closest to the position of the hash value of the task on the consistent hash ring according the search direction; enabling the value of the n is equal to the value of the execution times; obtaining n execution units corresponding to the hash values of the n corresponding execution units; establishing a mapping relation between the task and the n execution units; establishing a mapping table from the execution units to the task according to the mapping relation. According to the task scheduling mechanism, the consistent hash algorithm is applied to a task scheduling technology, the task and the execution units can be flexibly matched, and the scheduling requirement of periodical tasks can be met.

Description

technical field [0001] The invention relates to task scheduling technology, in particular to a task scheduling mechanism and system based on a consistent hash algorithm. Background technique [0002] In some scenarios that require periodic execution of fixed tasks, after the task entry is completed, the task will be woken up periodically for execution, and some scenarios also require the number of executions of the task (for example, the dial test program needs to be executed multiple times to ensure the reliability of sampling and statistical accuracy), the traditional task queue is not competent in this scenario, and some simple distributed algorithms cannot achieve random assignment of tasks. [0003] For example, the Chinese patent with the publication number CN 104915259 A provides a task scheduling method applied to a distributed acquisition system, setting a task scheduling strategy on the console, that is, determining the task name, the maximum number of threads, and...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F9/48
CPCG06F9/4881
Inventor 刘德建阮桂亮郭玉湖
Owner 福建省华渔教育科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products