Method for generating unique ID (identification) in distributed system

A distributed system, the only technology, applied in special data processing applications, instruments, electrical digital data processing, etc., can solve problems such as increasing the complexity of system integration, and achieve the effect of reducing the difficulty of system integration and high efficiency

Inactive Publication Date: 2017-05-31
HUBEI JINCHU NETWORK TECH
View PDF4 Cites 17 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

And the generated IDs are ordered, which is helpful for paging and sorting, but it must rely on the third-party tool Redis, which increases the complexity of system integration

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

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0027] 1) Get the milliseconds of the current time: 762824999253053440;

[0028] 2) Suppose the number of milliseconds of the base time set in the system is 1288834974657, so subtract the number of milliseconds of the base time: 762824999253053440 - 1288834974657 = 762823710418078783;

[0029] 3) Assuming that the system business type, service type, and server are 2, 9, and 1 respectively, obtain the current business type, service type, and server number values;

[0030] 4) Obtain the self-increment number 5 within milliseconds;

[0031] 5) Calculate id:

[0032] Step a: Subtract 1288834974657 from the number of milliseconds 762824999253053440 to get 762823710418078783, and the value obtained by shifting 24 bits to the left is 2269171050489053184;

[0033] milliseconds decimal 762823710418078783 binary (64 bit) 0000101010010110000110000001111101111101101101110000110000111111 operate shift left 24 bits binary value (64 bit) 000111110111110...

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 relates to an ID (identification) generation method, in particular to a method for generating a unique ID in a distributed system. The method is specifically characterized in that a 64-bit long type integer is split according to a preset bit; a current time millisecond number, service type, a service module number, a server number and a serial number in milliseconds form a long type integer through displacement filling. The method has the advantages that when the method is used for generating the ID, the efficiency is high; the performance influence caused by inquiry and paging of large data volume is avoided; moreover, integration with the system is convenient and fast.

Description

technical field [0001] The invention relates to a method for generating an ID, in particular to a method for generating a unique ID in a distributed system. Background technique [0002] In a distributed system, how to quickly and efficiently generate a system unique ID is a problem often encountered when designing a system. There are mainly the following three methods for generating IDs in the prior art to suit different scenarios, needs and performance requirements, but each has its own defects. [0003] 1. Database self-growth sequence [0004] Using the self-growth sequence of the database, the implementation is simple, the IDs are in order, and it is very helpful for paging and sorting. However, different databases have different sequence grammars and implementations, and it is very troublesome to migrate databases, merge multiple tables, and divide databases into tables and databases. And in the case of a single database or read-write separation or one master and mu...

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 Applications(China)
IPC IPC(8): G06F17/30
CPCG06F16/21
Inventor 余杨志熊烽胡波
Owner HUBEI JINCHU NETWORK TECH
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