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.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
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.
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com