A method and system for generating a unique identifier

An identifier and identification technology, applied in the field of identifiers, can solve the problems of large storage space, no sorting, and high indexing efficiency, and achieve the effect of allocating more machines and improving structural coupling.

Active Publication Date: 2021-03-30
GUANGDONG EFLYCLOUD COMPUTING CO LTD
View PDF8 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] (1) UUID, the implementation of UUID is relatively simple. It generates a series of unordered unique identifiers based on the MAC address and timestamp of the network card, and there is no sorting, so the trend cannot be guaranteed to increase. The storage space is large and the query efficiency is low;
[0005] (2) The MySQL database is incremented by using MySQL's auto_increment (digital self-increment attribute). To be suitable for a distributed system architecture, at least two MySQL databases are required to generate odd and even numbers by distinguishing the initial value and step size of auto_increment , using the digital self-increment sequence mechanism of the database to improve reliability, but the disadvantage is also obvious, that is, the entire system is unavailable when the database is abnormal;
[0006] (3) The snowflake algorithm (SnowFlake) uses a 64-bit long number as a globally unique identifier; it is widely used in distributed systems, where 1 bit of inapplicable bit indicates positive or negative, and then 41 bits of it are used as The number of milliseconds (the length can be used for 69 years), 10 bits are used as the working machine identification (up to 1024 nodes are deployed in the branch), and 12 bits are used as the serial number (it is the counting sequence number, and each node can generate 4096 identification numbers per millisecond) ), the advantage is that it is stored in the database in an orderly manner according to time, the indexing efficiency is high, and the generation does not depend on the database. The system time is called back or changed, which may cause id conflicts or duplication

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
  • A method and system for generating a unique identifier
  • A method and system for generating a unique identifier
  • A method and system for generating a unique identifier

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0044] like figure 1 As shown, this embodiment discloses a method for generating a unique identifier, including the following steps:

[0045] Step S0, the distributed system sends a request to obtain a unique identifier to the number obtainer, and after receiving the request, the number obtainer sends a registration identification factor request to the number issuer;

[0046] This embodiment preferably provides a unique identifier to the distributed system, but is not limited to only providing it to the distributed system, and other unique identifiers that need to be used can be realized through this embodiment;

[0047] Step S1, the number issuer receives the registration identification factor request sent by the number taker and the parameter information of the number taker, records the parameter information of the number taker and sends the identification factor to the number taker; the parameter information includes machine number, machine number It is used to manage and ...

Embodiment 2

[0065] This implementation discloses a unique identifier generation system based on the generation method of the embodiment, including a number issuer device and a number taker device, and the number taker device includes a buffer unit and a generation unit;

[0066] The number fetcher device is used to receive the request for obtaining the unique identifier sent by the distributed system, and after receiving the request for obtaining the unique identifier, the number fetcher device sends a registration identification factor request to the number sender device;

[0067] The number issuing device is used to receive the registration identification factor request sent by the number taking device and the parameter information of the number taking device, record the parameter information of the number taking device and send the identification factor to the number taking device;

[0068] The number fetcher device is also used to receive the identification factor sent by the number is...

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 and system for generating a unique identifier. The steps of the generating method include: a number issuer receives a registration identification factor request sent by a number taker and parameter information of the number taker, and records the parameters of the number taker information and send the identification factor to the number obtainer; the number obtainer receives the identification factor sent by the number sender, and the buffer unit of the number obtainer buffers the identification factor; the generation unit of the number obtainer obtains the identification factor from the buffer unit, and according to The identification factor generates a unique identifier. The design principle of the present invention is reliable and the structure is clear and definite, the double-buffer queue adopted ensures high availability, and the generated unique identifier does not depend on time, so it has the prospect of wide application.

Description

technical field [0001] The present invention relates to the technical field of identifiers, in particular to a method and system for generating a unique identifier. Background technique [0002] In a distributed system, it is often necessary to use a globally unique identifier to define corresponding different types of data, such as: unique identifiers for orders, unique identifiers for messages, and unique identifiers for data links. The unique identifier can facilitate indexing, occupies relatively little space, and is convenient for storage. [0003] At present, there are many ways to obtain a unique identifier in the existing technology, and there are mainly the following solutions: [0004] (1) UUID, the implementation of UUID is relatively simple. It generates a series of unordered unique identifiers based on the MAC address and timestamp of the network card, and there is no sorting, so the trend cannot be guaranteed to increase. The storage space is large and the que...

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): H04L29/08
CPCH04L67/1097H04L67/146
Inventor 李伟豪史伟闵宇
Owner GUANGDONG EFLYCLOUD COMPUTING CO LTD
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