Method for generating unique ID in distributed system

A distributed system, the only technology, applied in the field of distributed systems, can solve the problems of IDs are not sorted, cannot meet the needs of multi-agent deployment, and has a single point of risk, etc.

Inactive Publication Date: 2017-12-08
成都数联铭品科技有限公司
View PDF3 Cites 18 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] Existing typical solutions include: 1. Database self-growth sequence or field; method: use database, unique in the entire database, advantages: simple, convenient, acceptable performance, natural sorting of IDs, disadvantages: single point risk, when the amount of data exceeds the database When accessing capabilities, you will encounter expansion and performance bottlenecks
2. UUID, method: directly call the UUID function or generate a third-party library, advantages: simple and convenient; disadvantages: IDs are not sorted and have no business relevance
3. snowflake algorithm: method: use 41bit as the number of milliseconds, 10bit as the ID of the machine (5 bits are the data center, 5 bits of the machine ID), 12bit as the serial number within milliseconds (meaning that each node is in every millisecond It can generate 4096 IDs), and there is a sign bit at the end, which is always 0; advantages: fast speed, high concurrency, and scalability; disadvantages: since there are only 10bit machine IDs, it cannot meet the requirements of multi-agent deployment, and can only be used as a sepa

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
  • Method for generating unique ID in distributed system
  • Method for generating unique ID in distributed system
  • Method for generating unique ID in distributed system

Examples

Experimental program
Comparison scheme
Effect test

Example Embodiment

[0043] Example 1:

[0044] Assuming that the APPID number on a host is 14678502, the IP address of the host is 192.132.2.65, the timestamp is 150034382, and the auto-incrementing serial number is 6, the ID generation process is:

[0045] Perform high 64bit calculation: shift the APPID number 14678502 on the host by 32bit to the left, divide the ip address into: 192, 132, 2, 65, and perform displacement filling respectively.

[0046]

[0047]

[0048] OR the APPID and ip address:

[0049]

[0050] Assign the low 64bit: the first position is 0, the time stamp is shifted to the left by 22bit,

[0051]

[0052]

[0053]

[0054] OR the timestamp with the self-incrementing serial number

[0055]

[0056] The high 64bit and low 64bit are spliced ​​together to generate a unique ID: 6304368927414739221705276340000006.

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 discloses a method for generating an unique ID in a distributed system, related to the field of distributed systems. The method for generating the unique ID in the distributed system is characterized by performing segmented assignment on the ID and storing the APPID of the host, the IP address of the host, the timestamp, and the time self-increasing sequence respectively. The generation speed is fast caused by the shift stitching of different data modules; and the required business information can be carried, therefore, the acquisition and distribution of the information can be easily performed among the distributed systems. According to the method for generating the unique ID in the distributed system, the communication with any external storage devices is not performed in the process of generating the ID, therefore, the possibility of errors is greatly reduced, and the generation process is accelerated; the generation of the ID is based on the timestamp, therefore, the generated ID is monotonic and ordered; and the APPID, IP, millisecond time and sequence number in milliseconds are stitched, therefore, the extension can be performed in the whole IP range, and the requirement of applying the distributed deployment more is greatly met.

Description

technical field [0001] The invention relates to the field of distributed systems, in particular to a method for generating a unique ID in a distributed system. Background technique [0002] In the distributed system, it is necessary to distinguish and identify the machines and equipment in the system. In order to identify different machines and equipment in these different systems, it is necessary to establish the identity serial number of each machine and equipment. This serial number is what we often say ID, in a system we need the ID of each machine device to be unique. [0003] Existing typical solutions include: 1. Database self-growth sequence or field; method: use database, unique in the entire database, advantages: simple, convenient, acceptable performance, natural sorting of IDs, disadvantages: single point risk, when the amount of data exceeds the database When accessing capabilities, you will encounter scaling and performance bottlenecks. 2. UUID, method: direc...

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
IPC IPC(8): H04L29/12
CPCH04L61/3015H04L2101/30H04L2101/33
Inventor 曾昌强周昊张伟
Owner 成都数联铭品科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products