CN117453818A - Distributed ID generation method and tool based on database - Google Patents

Distributed ID generation method and tool based on database Download PDF

Info

Publication number
CN117453818A
CN117453818A CN202311395109.5A CN202311395109A CN117453818A CN 117453818 A CN117453818 A CN 117453818A CN 202311395109 A CN202311395109 A CN 202311395109A CN 117453818 A CN117453818 A CN 117453818A
Authority
CN
China
Prior art keywords
interval
module
buffer1
buffer2
updating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311395109.5A
Other languages
Chinese (zh)
Inventor
田昊辰
李新
韩成轩
黎文志
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Langchao Intelligent Medical Technology Co ltd
Original Assignee
Shandong Langchao Intelligent Medical Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Langchao Intelligent Medical Technology Co ltd filed Critical Shandong Langchao Intelligent Medical Technology Co ltd
Priority to CN202311395109.5A priority Critical patent/CN117453818A/en
Publication of CN117453818A publication Critical patent/CN117453818A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a distributed ID generation method and a tool based on a database, which relate to the technical field of databases and comprise the following steps: s1, when a service generates an ID request database, firstly acquiring an usable ID interval; s2, two ID interval caches are built in the service local and are used for storing the ID interval acquired in the step S1; s3, when the service generates an ID request database, sequentially calling the IDs in one ID interval cache, and when the ID usage in the ID interval cache reaches a set threshold, updating the unused ID interval to the other ID interval cache; when the ID in one of the ID interval caches is used up, automatically switching to the other ID interval cache for completing updating; s4, repeatedly executing the step S3, namely circularly caching the ID interval by using two ID interval caches established locally by the service. The invention can keep the trend increasing while generating the global unique ID, and can support high concurrency and high availability.

Description

Distributed ID generation method and tool based on database
Technical Field
The invention relates to the technical field of databases, in particular to a distributed ID generation method and tool based on a database.
Background
Along with the continuous acceleration of the modernization and the intellectualization of society, the data volume of various systems is increased in an explosive manner, and if the same database and a large list table are used by various systems at the same time, the reduction of the response speed of the system inevitably causes the influence on the user experience, so that a distributed system and a database sub-table become a scheme for solving the problem, but the sub-database sub-table is on the premise that a globally unique ID is needed, and the database self-increasing scheme in a monomer age is not suitable for the current service any more.
The existing distributed ID mainstream solution comprises a snowflake algorithm and a Redis-based self-increasing solution, but the snowflake algorithm is seriously dependent on a machine clock, ID repetition can be caused if the machine clock is callback, the Redis-based self-increasing solution is dependent on a Redis component, redis is required to be generated each time an ID is generated, and Redis can become a bottleneck under high concurrency.
Disclosure of Invention
Aiming at the defects of the current distributed ID mainstream solution, the invention provides a distributed ID generation method and tool based on a database, which can keep the trend increasing while generating a global unique ID without introducing new system components, and can support high concurrency and high availability.
In a first aspect, the present invention provides a method for generating a distributed ID based on a database, which solves the above technical problems by adopting the following technical scheme:
a database-based distributed ID generation method, comprising the steps of:
s1, when a service generates an ID request database, firstly acquiring an usable ID interval;
s2, two ID interval caches are built in the service local and are used for storing the ID interval acquired in the step S1;
s3, when the service generates an ID request database, sequentially calling the IDs in one of the ID interval caches, and when the ID usage in the ID interval cache reaches a set threshold, acquiring a new ID interval or updating the unused ID interval acquired in the step S1 to the other ID interval cache; when the ID in one of the ID interval caches is used up, automatically switching to the other ID interval cache for completing updating;
s4, repeatedly executing the step S3, namely circularly caching the ID interval by using two ID interval caches established locally by the service.
Optionally, step S2 is executed, and the service local establishes two ID interval buffers: buffer1 and buffer2, buffer1 and buffer2 storing different ID interval sections obtained in step S1 respectively;
when the service generates the ID request database,
(1) Calling the ID in the buffer1, acquiring a new ID interval section when the ID usage in the buffer1 reaches a set threshold value or updating the ID interval section acquired in the step S1 into the buffer2, and then automatically switching to the buffer2 after the ID in the buffer1 is used up;
(2) Calling the ID in the buffer2, acquiring a new ID interval section when the ID usage in the buffer2 reaches a set threshold value or updating the ID interval section acquired in the step S1 into the buffer1, and then automatically switching to the buffer1 after the ID in the buffer2 is used up;
and (3) repeating the steps (1) and (2), namely circularly caching the ID interval by using the buffer1 and the buffer 2.
Further optionally, step (1) is executed, when the ID usage in buffer1 reaches 10% of the set threshold, sending get_id to the listener, where the listener first checks whether an ID interval is buffered in buffer2, if yes, service is automatically switched to buffer2 to obtain ID when buffer1 is used up, if no, the database is requested to obtain the latest ID interval or the acquired and unused ID interval is buffered in buffer2;
and (2) executing the step, when the ID usage in the buffer2 reaches the set threshold value of 10%, sending a GET_ID notification to the monitor, wherein the monitor firstly checks whether the ID interval is cached in the buffer1, if so, automatically switching the service to the buffer1 to acquire the ID when the buffer2 is used up, and otherwise, requesting the database to acquire the latest ID interval or caching the acquired and unused ID interval in the buffer1.
Optionally, different signaling requirements of each service are distinguished by using the biz_type, and the number segments acquired by each biz_type are isolated from each other and do not affect each other.
In a second aspect, the present invention provides a distributed ID generation tool based on a database, which solves the above technical problems by adopting the following technical scheme:
a database-based distributed ID generation tool, comprising:
an ID interval acquisition module, configured to acquire an ID interval that can be used when a service generates an ID request database;
the cache establishing module is used for locally establishing two ID interval caches to store the ID interval acquired by the ID interval acquisition module;
the ID generation module is used for sequentially calling the IDs in one of the ID interval section caches when the service generates an ID request database;
the setting module is used for setting a threshold value of the ID use amount in the ID interval cache;
the threshold judging module is used for judging whether the ID usage amount in the ID interval cache reaches a set threshold;
the exhaustion judging module is used for judging whether the ID usage amount in the ID interval section buffer memory is exhausted or not;
the updating module is used for updating the unused ID interval cache when the ID usage amount in the ID interval cache reaches a set threshold value;
the returning module is used for returning to the ID generating module when the ID usage amount in the ID interval section cache does not reach the set threshold value;
the automatic switching module is used for automatically switching to another ID interval section buffer for completing updating when the ID use amount in the ID interval section buffer is used up;
and the alternate circulation module is used for alternately caching the ID interval acquired by the ID interval acquisition module by using the two ID interval caches established in the service local.
Optionally, the related buffer establishment module establishes two ID interval buffers of buffer1 and buffer2 in the service local; the alternate circulation module alternately uses the buffer1 and the buffer2, and the buffer ID interval acquisition module acquires different ID intervals;
when the service generates the ID request database,
firstly, an ID generating module calls an ID in a buffer1, when a threshold judging module judges that the ID usage in the buffer1 reaches a set threshold, an updating module updates an ID interval acquired by an ID interval acquiring module into a buffer2, and when an exhaustion judging module judges that the ID in the buffer1 is exhausted, the updating module automatically switches to the buffer2 after the updating is completed through an automatic switching module;
and secondly, the ID generation module calls the ID in the buffer2, and when the threshold judgment module judges that the ID usage in the buffer2 reaches a set threshold, the updating module updates the ID interval acquired by the ID interval acquisition module into the buffer1, and when the exhaustion judgment module judges that the ID in the buffer2 is exhausted, the updating module automatically switches to the buffer1 after the updating is completed.
Further optionally, the setting module sets a threshold for 10% of the usage of the ID in the ID interval cache;
when the threshold judging module judges that the ID usage in the buffer1 reaches 10% of a set threshold, sending a GET_ID notification to a monitor, firstly checking whether an ID interval is cached in the buffer2 by the monitor, if so, automatically switching to the buffer2 to acquire the ID by the automatic switching module when the exhaustion judging module judges that the buffer1 is exhausted, and otherwise, updating the cache of the unused ID interval acquired by the ID interval acquiring module to the buffer2 by the updating module;
when the threshold judging module judges that the ID usage in the buffer2 reaches 10% of a set threshold, the GET_ID is sent to the monitor, the monitor firstly checks whether the ID interval is cached in the buffer1, if yes, the buffer1 is automatically switched to obtain the ID through the automatic switching module when the exhaustion judging module judges that the buffer2 is exhausted, and if not, the unused ID interval cache obtained by the ID interval obtaining module is updated to the buffer1 through the updating module.
Optionally, after the related ID interval section acquiring module acquires a plurality of usable ID intervals, the ID intervals are distinguished by using biz_type based on different signaling requirements of each service, and the number segments acquired by each biz_type are isolated from each other and do not affect each other.
The distributed ID generation method and tool based on the database have the beneficial effects that compared with the prior art:
according to the invention, under the condition that a new system component is not introduced, the defects of difficult expansion and overlarge database pressure after the step length of the database main key is determined are overcome by utilizing the characteristic of the self-increasing of the database main key, the ID which is globally unique and has gradually increased trend can be stably generated, and meanwhile, the method has the characteristics of high concurrency and high availability.
Drawings
FIG. 1 is a flow chart of a method according to a first embodiment of the invention;
FIG. 2 is a diagram showing a connection of modules according to a second embodiment of the present invention;
fig. 3 is a second module connection diagram of a second embodiment of the present invention.
Detailed Description
In order to make the technical scheme, the technical problems to be solved and the technical effects of the invention more clear, the technical scheme of the invention is clearly and completely described below by combining specific embodiments.
Embodiment one:
with reference to fig. 1, this embodiment proposes a distributed ID generation method based on a database, which includes the following steps:
s1, when the service generates an ID request database, firstly, an available ID interval is acquired.
It should be added that the different number sending requirements of each service are distinguished by using the biz_type, and the number segments acquired by each biz_type are isolated from each other and do not affect each other. Later, if higher performance requirements exist, only the biz_type needs to be subjected to library and table division.
S2, two ID interval section caches of a buffer1 and a buffer2 are built in a service local and are used for storing the ID interval sections obtained in the step S1, wherein the buffer1 and the buffer2 respectively store different ID interval sections obtained in the step S1.
S3, when the service generates an ID request database,
(a) Calling the ID in the buffer1, when the ID usage in the buffer1 reaches 10% of a set threshold, sending a GET_ID notification to a monitor, firstly checking whether an ID interval is cached in the buffer2 by the monitor, if so, automatically switching the service to the buffer2 to acquire the ID when the buffer1 is used up, otherwise, requesting the database to acquire the latest ID interval or caching the acquired and unused ID interval in the buffer2;
(b) When the ID usage in buffer2 reaches 10% of a set threshold, sending GET_ID notification to a monitor, wherein the monitor firstly checks whether an ID interval is cached in buffer1, if so, automatically switches to buffer1 to acquire the ID when the buffer2 is used up, and otherwise, requests a database to acquire the latest ID interval or caches the acquired and unused ID interval in buffer1.
And repeatedly executing the buffer ID interval, namely circularly caching the ID interval by using the buffer1 and the buffer 2.
S4, repeatedly executing the steps (a) and (b) of the step S3, namely circularly caching the usable ID interval section acquired in the step S1 by using the buffer1 and the buffer 2.
Taking the buffer1 and the buffer2 as an example to be used sequentially, it is necessary to supplement that when the step S1 is executed to obtain an ID interval section which can be used, the ID interval section is stored in the buffer1, when the ID usage in the buffer1 reaches 10% of a set threshold, GET_ID is sent to a monitor, the monitor firstly checks whether the ID interval section is cached in the buffer2, if yes, the service is automatically switched to the buffer2 to obtain the ID when the buffer1 is used up, and if not, a database is requested to obtain a new ID interval section to be cached in the buffer2; when a plurality of usable ID sections are acquired in the step S1, the first two ID sections are selected in sequence and correspondingly stored in a buffer1 and a buffer2, when the ID usage in the buffer1 reaches 10% of a set threshold, GET_ID is sent to a monitor, the monitor firstly checks whether the ID sections are cached in the buffer2, if yes, service is automatically switched to the buffer2 to acquire ID when the buffer1 is used up, and if not, the acquired ID sections are cached in the buffer2 in sequence.
It should be further added that when the buffered ID interval in buffer1 or buffer2 is exhausted, buffer1 or buffer2 automatically deletes the buffered ID interval.
Embodiment two:
referring to fig. 2 and 3, this embodiment proposes a distributed ID generation tool based on a database, which includes:
an ID interval acquisition module, configured to acquire an ID interval that can be used when a service generates an ID request database;
the cache establishing module is used for locally establishing two ID interval caches to store the ID interval acquired by the ID interval acquisition module;
the ID generation module is used for sequentially calling the IDs in one of the ID interval section caches when the service generates an ID request database;
the setting module is used for setting a threshold value of the ID use amount in the ID interval cache;
the threshold judging module is used for judging whether the ID usage amount in the ID interval cache reaches a set threshold;
the exhaustion judging module is used for judging whether the ID usage amount in the ID interval section buffer memory is exhausted or not;
the updating module is used for updating the unused ID interval cache when the ID usage amount in the ID interval cache reaches a set threshold value;
the returning module is used for returning to the ID generating module when the ID usage amount in the ID interval section cache does not reach the set threshold value;
the automatic switching module is used for automatically switching to another ID interval section buffer for completing updating when the ID use amount in the ID interval section buffer is used up;
and the alternate circulation module is used for alternately caching the ID interval acquired by the ID interval acquisition module by using the two ID interval caches established in the service local.
In this embodiment, after the ID interval obtaining module obtains a plurality of usable ID intervals, the ID intervals are distinguished by using biz_type based on different signaling requirements of each service, and the number intervals obtained by each biz_type are isolated from each other and do not affect each other.
In this embodiment, the buffer establishment module establishes two ID interval buffers of buffer1 and buffer2 in the service local; the alternate circulation module alternately uses the buffer1 and the buffer2, and the buffer ID interval acquisition module acquires different ID intervals.
The setting module sets the threshold value of the ID usage amount in the ID interval cache to be 10%.
When the service generates the ID request database,
firstly, referring to fig. 2, an ID generating module invokes an ID in a buffer1, when a threshold judging module judges that the usage amount of the ID in the buffer1 reaches 10% of a set threshold, sending a get_id notification to a monitor, and the monitor firstly checks whether an ID interval is cached in the buffer2, if yes, automatically switches to the buffer2 to obtain the ID through an automatic switching module when the exhaustion judging module judges that the buffer1 is exhausted, and otherwise, updates the ID interval cache obtained by the ID interval obtaining module to the buffer2 through an updating module;
next, referring to fig. 3, the ID generating module invokes the ID in the buffer2, when the threshold judging module judges that the usage amount of the ID in the buffer2 reaches 10% of the set threshold, the get_id is sent to the monitor, and the monitor first checks whether the ID section is cached in the buffer1, if yes, when the exhaustion judging module judges that the buffer2 is exhausted, the ID is automatically switched to the buffer1 by the automatic switching module, and if not, the ID section cache acquired by the ID section acquiring module is updated to the buffer1 by the updating module.
Taking the buffer1 and the buffer2 as an example to be used sequentially, if the buffer1 and the buffer2 are needed to be supplemented, when the step S1 is executed to acquire a usable ID interval, the ID interval is stored in the buffer1, when the threshold judging module judges that the ID usage in the buffer1 reaches 10% of a set threshold, GET_ID is sent to a monitor, the monitor firstly checks whether the buffer2 is cached in the ID interval, if the buffer2 is used up, the buffer1 is judged to be used up by the exhaustion judging module, the buffer2 is automatically switched to acquire the ID by the automatic switching module, and if the buffer2 is not used up by the exhaustion judging module, the ID interval acquiring module acquires a new ID interval cache to be updated in the buffer2; when the step S1 is executed to obtain a plurality of usable ID sections, the first two ID sections are selected in sequence and correspondingly stored in the buffer1 and the buffer2, when the threshold judging module judges that the ID usage in the buffer2 reaches 10% of the set threshold, GET_ID is sent to the monitor, the monitor firstly checks whether the buffer1 is used for caching the ID sections, if yes, the automatic switching module is used for automatically switching to the buffer1 to obtain the ID when the exhaustion judging module judges that the buffer2 is exhausted, and if not, the updating module is used for sequentially caching the ID sections obtained by the ID section obtaining module into the buffer1.
It should be further added that when the buffered ID interval in buffer1 or buffer2 is exhausted, buffer1 or buffer2 automatically deletes the buffered ID interval.
In summary, by adopting the distributed ID generation method and tool based on the database, the trend is kept increasing while generating the global unique ID without introducing new system components, and high concurrency and high availability can be supported.
The foregoing has outlined rather broadly the principles and embodiments of the present invention in order that the detailed description of the invention may be better understood. Based on the above-mentioned embodiments of the present invention, any improvements and modifications made by those skilled in the art without departing from the principles of the present invention should fall within the scope of the present invention.

Claims (8)

1. The distributed ID generation method based on the database is characterized by comprising the following steps:
s1, when a service generates an ID request database, firstly acquiring an usable ID interval;
s2, two ID interval caches are built in the service local and are used for storing the ID interval acquired in the step S1;
s3, when the service generates an ID request database, sequentially calling the IDs in one of the ID interval caches, and when the ID usage in the ID interval cache reaches a set threshold, acquiring a new ID interval or updating the unused ID interval acquired in the step S1 to the other ID interval cache; when the ID in one of the ID interval caches is used up, automatically switching to the other ID interval cache for completing updating;
s4, repeatedly executing the step S3, namely circularly caching the ID interval by using two ID interval caches established locally by the service.
2. The method for generating a distributed ID based on a database as claimed in claim 1, wherein step S2 is performed, and the service local establishes two ID interval buffers: buffer1 and buffer2, buffer1 and buffer2 storing different ID interval sections obtained in step S1 respectively;
when the service generates the ID request database,
(1) Calling the ID in the buffer1, acquiring a new ID interval section when the ID usage in the buffer1 reaches a set threshold value or updating the ID interval section acquired in the step S1 into the buffer2, and then automatically switching to the buffer2 after the ID in the buffer1 is used up;
(2) Calling the ID in the buffer2, acquiring a new ID interval section when the ID usage in the buffer2 reaches a set threshold value or updating the ID interval section acquired in the step S1 into the buffer1, and then automatically switching to the buffer1 after the ID in the buffer2 is used up;
and (3) repeating the steps (1) and (2), namely circularly caching the ID interval by using the buffer1 and the buffer 2.
3. The method of generating a distributed ID based on a database as claimed in claim 2, wherein the step (1) is executed, when the ID usage in buffer1 reaches 10% of a set threshold, get_id is sent to a listener, the listener first checks whether an ID interval is buffered in buffer2, if yes, service is automatically switched to buffer2 to obtain an ID when buffer1 is used up, if no, the database is requested to obtain the latest ID interval or the acquired and unused ID interval is buffered in buffer2;
and (2) executing the step, when the ID usage in the buffer2 reaches the set threshold value of 10%, sending a GET_ID notification to the monitor, wherein the monitor firstly checks whether the ID interval is cached in the buffer1, if so, automatically switching the service to the buffer1 to acquire the ID when the buffer2 is used up, and otherwise, requesting the database to acquire the latest ID interval or caching the acquired and unused ID interval in the buffer1.
4. The method for generating the distributed ID based on the database as claimed in claim 1, wherein different signaling requirements of each service are distinguished by using biz_type, and the number segments acquired by each biz_type are isolated from each other and do not affect each other.
5. A database-based distributed ID generation tool, comprising:
an ID interval acquisition module, configured to acquire an ID interval that can be used when a service generates an ID request database;
the cache establishing module is used for locally establishing two ID interval caches to store the ID interval acquired by the ID interval acquisition module;
the ID generation module is used for sequentially calling the IDs in one of the ID interval section caches when the service generates an ID request database;
the setting module is used for setting a threshold value of the ID use amount in the ID interval cache;
the threshold judging module is used for judging whether the ID usage amount in the ID interval cache reaches a set threshold;
the exhaustion judging module is used for judging whether the ID usage amount in the ID interval section buffer memory is exhausted or not;
the updating module is used for updating the unused ID interval cache when the ID usage amount in the ID interval cache reaches a set threshold value;
the returning module is used for returning to the ID generating module when the ID usage amount in the ID interval section cache does not reach the set threshold value;
the automatic switching module is used for automatically switching to another ID interval section buffer for completing updating when the ID use amount in the ID interval section buffer is used up;
and the alternate circulation module is used for alternately caching the ID interval acquired by the ID interval acquisition module by using the two ID interval caches established in the service local.
6. The distributed ID generation tool according to claim 5, wherein the buffer establishment module establishes two ID interval buffers of buffer1 and buffer2 in a service local area; the alternate circulation module alternately uses buffer1 and buffer2, and the buffer ID interval acquisition module acquires different ID intervals;
when the service generates the ID request database,
firstly, the ID generating module calls an ID in a buffer1, when the threshold judging module judges that the ID usage in the buffer1 reaches a set threshold, the updating module updates the ID interval acquired by the ID interval acquiring module into a buffer2, and when the exhaustion judging module judges that the ID in the buffer1 is exhausted, the updating module automatically switches to the buffer2 after the updating is completed through the automatic switching module;
and secondly, the ID generating module calls the ID in the buffer2, when the threshold judging module judges that the ID usage in the buffer2 reaches a set threshold, the updating module updates the ID interval acquired by the ID interval acquiring module into the buffer1, and when the exhaustion judging module judges that the ID in the buffer2 is exhausted, the updating module automatically switches to the buffer1 after the updating is completed through the automatic switching module.
7. The database-based distributed ID generation tool of claim 6 wherein the setting module sets a threshold of 10% for ID usage in the ID interval cache;
when the threshold judging module judges that the ID usage in the buffer1 reaches 10% of a set threshold, sending a GET_ID notification to a monitor, firstly checking whether an ID interval is cached in the buffer2 by the monitor, if so, automatically switching to the buffer2 to acquire the ID by the automatic switching module when the exhaustion judging module judges that the buffer1 is exhausted, and otherwise, updating the cache of the unused ID interval acquired by the ID interval acquiring module to the buffer2 by the updating module;
when the threshold judging module judges that the ID usage in the buffer2 reaches 10% of a set threshold, sending a GET_ID notification to a monitor, firstly checking whether an ID section is cached in the buffer1 by the monitor, if so, automatically switching to the buffer1 to acquire the ID by the automatic switching module when the exhaustion judging module judges that the buffer2 is exhausted, and otherwise, updating the unused ID section cache acquired by the ID section acquisition module to the buffer1 by the updating module.
8. The distributed ID generation tool according to claim 5, wherein after the ID interval acquisition module acquires a plurality of usable ID intervals, the ID intervals are distinguished by using biz_types based on different signaling requirements of each service, and the number intervals acquired by each biz_type are isolated from each other and do not affect each other.
CN202311395109.5A 2023-10-26 2023-10-26 Distributed ID generation method and tool based on database Pending CN117453818A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311395109.5A CN117453818A (en) 2023-10-26 2023-10-26 Distributed ID generation method and tool based on database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311395109.5A CN117453818A (en) 2023-10-26 2023-10-26 Distributed ID generation method and tool based on database

Publications (1)

Publication Number Publication Date
CN117453818A true CN117453818A (en) 2024-01-26

Family

ID=89579245

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311395109.5A Pending CN117453818A (en) 2023-10-26 2023-10-26 Distributed ID generation method and tool based on database

Country Status (1)

Country Link
CN (1) CN117453818A (en)

Similar Documents

Publication Publication Date Title
CN108363813B (en) Data storage method, device and system
CN108804234B (en) Data storage system and method of operation thereof
CN111949730B (en) Distributed global sequence number implementation method and sequence distributor
CN102065112A (en) Peer-to-peer (P2P) network system and method and related device for establishing the same
CN114827145B (en) Server cluster system, metadata access method and device
CN112181306A (en) Method for generating distributed ID (identity) in number segment mode
CN113094430B (en) Data processing method, device, equipment and storage medium
CN111953785B (en) Data transmission method, system and server
CN102281332A (en) Distributed cache array and data updating method thereof
US11799961B2 (en) File directory traversal method, apparatus, device, and medium
CN111694865A (en) Four-layer structure data acquisition method and device based on distributed system
CN107046551B (en) A kind of request of data, update method and related device
CN104301990A (en) Data synchronizing method and device
CN117453818A (en) Distributed ID generation method and tool based on database
CN114238518A (en) Data processing method, device, equipment and storage medium
CN103905512A (en) Data processing method and equipment
CN110795495A (en) Data processing method and device, electronic equipment and computer readable medium
CN105868210A (en) Creating method and device of unique index in distributed database
CN112328693A (en) Block synchronization method, device and storage medium
CN110278109B (en) Disaster recovery method and system
CN106775437B (en) Data synchronization method and device
CN111949725A (en) Data query method and device, electronic equipment and computer readable storage medium
CN114756385B (en) Elastic distributed training method under deep learning scene
CN107145302B (en) Method and equipment for executing file writing in distributed storage system
CN114172792B (en) Method and device for realizing sequence number generation method for ensuring high availability of service

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination