Number generation method and device

A technology for numbering and generating modules, which is applied in the computer field and can solve problems such as repeated number generation, lower writing performance, and data movement, and achieve the effect of overcoming the long number length

Pending Publication Date: 2021-06-04
BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] Using the UUID method results in a longer length of the generated number, and when it is stored as a database index, because the database index is mostly in the form of a B+ tree, when an unordered number is inserted, it may cause a new record to be inserted into the appropriate Move a large amount of data around the location, thereby reducing write performance;
[0006] The use of the snowFlake algorithm relies on the clock of the machine. If the server clock is dialed back, it will cause duplicate numbers to be generated. In a distributed environment, the clock of each server cannot be completely synchronized, and sometimes it is not globally incremented.

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
  • Number generation method and device
  • Number generation method and device
  • Number generation method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0032] Exemplary embodiments of the present invention are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present invention to facilitate understanding, and they should be regarded as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

[0033] Those skilled in the art know that the embodiments of the present invention can be implemented as a system, device, device, method or computer program product.

[0034] figure 1 is a schematic diagram of the main steps of the code generation method according to an embodiment of the present invention.

[0035] like figure 1 As shown, the serial number generation m...

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 number generation method and device, and relates to the technical field of computers. A specific embodiment of the method comprises the following steps: after a request for acquiring a unique number sent by a distributed application system is received, searching a stored latest number in a blockchain network; according to the stored latest number, obtaining the unique number through calculation according to a preset rule; and returning the unique number to the distributed application system. According to the embodiment, the defects that the generated number is long and the database writing performance is reduced due to the fact that a UUID mode is used can be overcome, dependence on a clock of a machine is avoided, the situation that the number is not globally increased is avoided, and high efficiency and reliability are achieved.

Description

technical field [0001] The present invention relates to the field of computer technology, in particular to a method and device for generating numbers. Background technique [0002] In a distributed environment, numbers (such as ID (identification)) are often used as unique identifiers in many projects. For example, in distributed services, some services send messages to queues, and other services consume messages from queues, and messages may be repeated. , the consumer side needs to be idempotent. In order to achieve idempotency of the business, there needs to be a non-repeatable and increasing number. In addition, order numbers, user numbers, etc. will use a unique increasing number. [0003] At present, there are mainly two methods for generating distributed unique self-incrementing numbers: one is to use UUID (Universally Unique Identifier, universally unique identification code): String uuid=UUID.randomUUID().toString(), this way A globally unique identification code w...

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): G06F16/22G06F16/27
CPCG06F16/2228G06F16/27
Inventor 肖竹
Owner BEIJING WODONG TIANJUN INFORMATION TECH 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