Distributed ID generation method

A distributed, parameter-generating technology, applied in the computer field, can solve problems such as inability to meet requirements, and achieve the effect of convenient linear expansion

Inactive Publication Date: 2019-12-10
MOLBASE SHANGHAI BIOTECH CO LTD
View PDF5 Cites 13 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

At present, common schemes include UUID, Flicker scheme, snowflake algorithm, etc., but they can no longer meet the needs, and a service that generates a globally unique ID is needed

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
  • Distributed ID generation method
  • Distributed ID generation method
  • Distributed ID generation method

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0033] Please refer to the attached Figure 1~3 , a distributed ID generation method, comprising the following steps:

[0034] S1. Read the service type identifiers of multiple services stored in the MySQL database and the ID generation parameters of the multiple services.

[0035] S2. Loading and caching the service type identifiers of multiple services and the ID generation parameters of multiple services, wherein the caching service is provided by Redis, and the ID generation parameters include the ID initial allocation value, the length of the application ID number segment, and the latest application ID No. segment time and loading scale factor etc.

[0036] S3. The service type identifier maintains a corresponding relationship with the ID generation parameter. Determine the current ID value of each service according to the ID generation parameters, the current ID value is equal to the initial ID allocation value of the ID generation parameters by default, and cache the ...

Embodiment 2

[0042] A distributed ID generation device, comprising:

[0043] The data parameter reading module is used to read the ID generation parameters of multiple services and realize interaction with the cache module.

[0044] The cache module is configured to cache service type identifiers of multiple services and ID generation parameters of multiple services, and the service type identifiers maintain a corresponding relationship with the ID generation parameters.

[0045] The ID generation request receiving module is configured to receive an ID generation request, and the ID generation request carries a service type identifier.

[0046] The ID generation module is used to search data in the cache according to the service type identifier. If it is determined that there is a current ID value corresponding to the service type identifier in the cache, the ID current value plus one is set as a new ID current value to obtain a new ID. The current value.

[0047] A cache update module, ...

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 distributed ID generation method. The method comprises the following steps: S1, reading a service type identifier and ID generation parameters stored in a database; S2, loading and caching a service type identifier and an ID generation parameter; S3, keeping a corresponding relationship between the service type identifier and the ID generation parameter; S4, receiving anID generation instruction; S5, searching cache data according to the service type identifier; S6, judging the current value of ID and returning an ID generation result; and S7, running the new ID segment application task. According to the distributed ID generation method, the globally unique and monotonically increasing ID can be generated, the ID cannot be repeated or returned under any condition, and the distributed ID generation method has the capacity of efficiently generating the ID and has the capacity of providing various IDs.

Description

technical field [0001] The present application relates to the field of computer technology, in particular to a distributed ID generation method and device. Background technique [0002] In a distributed system, it is necessary to uniquely identify data, messages, http requests, etc., and it is required to generate a globally unique and monotonically increasing ID (identity, unique code). In any case, the ID cannot be repeated or rolled back, and the ID can be generated efficiently. and the ability to provide multiple IDs. At present, common solutions include UUID, Flicker solution, snowflake algorithm, etc., but they can no longer meet the demand, and a service that generates a globally unique ID is needed. Contents of the invention [0003] Embodiments of the present application provide a distributed ID generation method and device. [0004] The embodiment of the application adopts the following technical solutions: [0005] A distributed ID generation method is charac...

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/27G06F16/21
CPCG06F16/27G06F16/21
Inventor 杨造
Owner MOLBASE SHANGHAI BIOTECH 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