Serial number acquisition method and serial number management system

By storing serial numbers in the client cache and replenishing positions asynchronously, the server request pressure and response time are solved under the traditional model, and more efficient serial number acquisition and faster response speed are achieved.

CN119537689APending Publication Date: 2025-02-28CLP JINXIN SOFTWARE (SHANGHAI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411579931.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In high concurrency scenarios, the traditional single-response model of single-response causes the server to face huge request pressure and the response time becomes longer, especially when the network conditions are poor or the server processing speed is slow.

Method used

By storing a certain number of serial numbers in the client cache, the number of requests to the server is reduced, and when the serial number resources in the client cache are about to be exhausted, the new serial number is obtained from the server is asynchronously replenished.

Benefits of technology

It significantly reduces the number of requests to the server, reduces the pressure on the server, improves the response speed, and achieves seamless connection of serial number resources through asynchronous replenishment, avoiding waiting or blocking caused by exhaustion of serial number resources in the client cache.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537689A_ABST
    Figure CN119537689A_ABST
Patent Text Reader

Abstract

The invention provides a serial number acquisition method and a serial number management system, and the serial number acquisition method applied to a client comprises the steps: receiving a common serial number acquisition request sent by a business application; under the condition that the number segment of the common serial number in the client cache meets a preset condition, according to the number segment of the common serial number in the client cache, sending a first number of common serial numbers requested by the common serial number acquisition request to the service application; and under the condition that the number segment of the common serial number in the client cache does not meet a preset condition, sending a first number of common serial numbers requested by the common serial number acquisition request to the service application according to the number segment of the common serial number in the client cache, and sending a number segment acquisition request for requesting to acquire the first number segment to the corresponding server, and supplementing the obtained first number segment into the client cache. Therefore, the request pressure of the server can be relieved, the response speed is improved, and seamless connection of the serial number resources is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a serial number acquisition method and a serial number management system. Background Art

[0002] In the traditional single-request, single-response model, every time the client needs a new sequence number, it must initiate a request to the server. This model will cause the server to face huge request pressure in high-concurrency scenarios, and may even crash due to overload. Moreover, frequent network request and response processes may cause the client to take a long time to get the sequence number, especially when the network conditions are poor or the server processing speed is slow. Summary of the invention

[0003] The present disclosure provides a serial number acquisition method and a serial number management system to at least solve one of the technical problems in the related art to a certain extent. The technical solution of the present disclosure is as follows:

[0004] According to a first aspect of an embodiment of the present disclosure, a method for obtaining a serial number is provided, which is applied to a client and includes:

[0005] Receive common serial number acquisition requests sent by business applications;

[0006] When the common sequence number segment in the client cache meets a preset condition, sending the first number of common sequence numbers requested by the common sequence number acquisition request to the service application according to the common sequence number segment in the client cache;

[0007] When the ordinary sequence number segments in the client cache do not meet the preset conditions, the ordinary sequence number acquisition request is sent to the business application according to the ordinary sequence number segments in the client cache, and a segment acquisition request for requesting the first segment is sent to the corresponding server in parallel, so as to add the acquired first segment to the client cache.

[0008] According to a second aspect of an embodiment of the present disclosure, a method for obtaining a sequence number is provided, which is applied to a server and includes:

[0009] Receiving a number segment acquisition request sent by a client for requesting to acquire a first number segment;

[0010] In the case where the number of ordinary sequence numbers in the server cache of the server does not satisfy the number of ordinary sequence numbers requested by the number segment acquisition request, querying a digital rule self-increment table for recording generation records of ordinary sequence numbers and a self-selection table for recording generation records of self-selected sequence numbers in a database, so as to supplement the ordinary sequence numbers in the server cache according to the digital rule self-increment table and the self-selection table, so that the number of ordinary sequence numbers in the server cache after supplementation satisfies the number of ordinary sequence numbers requested by the number segment acquisition request;

[0011] According to the supplemented common serial numbers in the server cache, a third number of the first number segments requested by the number segment acquisition request is generated, and the third number of the first number segments are sent to the client.

[0012] According to a third aspect of an embodiment of the present disclosure, a serial number management system is provided, including a control end, a database, a client end, and a server end.

[0013] The control end is used to configure data rules and sequence rules, and store the configured data rules and sequence rules in the database;

[0014] The client is used to execute the method according to the embodiment of the first aspect of the present disclosure;

[0015] The server is used to execute the method as described in the embodiment of the second aspect of the present disclosure; wherein, in the case where multiple server instances are deployed on the server, each server instance is used to execute the method as described in the embodiment of the second aspect of the present disclosure, and the ordinary serial number in any of the server instances is not repeated with the ordinary serial numbers in each of the server instances other than the server instance, and any of the server instances uses a database pessimistic lock to read the generation record of the ordinary serial number recorded in the digital rule auto-increment table when querying the digital rule auto-increment table in the database for recording the generation record of the ordinary serial number.

[0016] According to a fourth aspect of an embodiment of the present disclosure, a serial number acquisition device is provided, which is applied to a client and includes:

[0017] A first receiving module, used to receive a common sequence number acquisition request sent by a business application;

[0018] A first sending module, configured to send, to the service application, a first number of ordinary sequence numbers requested by the ordinary sequence number acquisition request according to the ordinary sequence number segment in the client cache when the ordinary sequence number segment in the client cache meets a preset condition;

[0019] The first processing module is used to, when the ordinary sequence number segment in the client cache does not meet the preset condition, execute in parallel the sending of the first number of ordinary sequence numbers requested by the ordinary sequence number acquisition request to the business application and the sending of a segment acquisition request for requesting the first number segment to the corresponding server, so as to add the acquired first number segment to the client cache.

[0020] According to a fifth aspect of an embodiment of the present disclosure, a serial number acquisition device is provided, which is applied to a server, and includes:

[0021] A fourth receiving module, used for receiving a number segment acquisition request sent by a corresponding client for requesting to obtain the first number segment;

[0022] A second processing module is used for querying a digital rule self-increment table for recording generation records of ordinary sequence numbers and a self-selected table for recording generation records of self-selected sequence numbers in a database when the number of ordinary sequence numbers in the server-side cache of the server does not meet the number of ordinary sequence numbers requested by the number segment acquisition request, so as to supplement the ordinary sequence numbers in the server-side cache according to the digital rule self-increment table and the self-selected table, so that the number of ordinary sequence numbers in the server-side cache after supplementation meets the number of ordinary sequence numbers requested by the number segment acquisition request;

[0023] The third processing module is used to generate the second number of the first number segments requested by the number segment acquisition request according to the supplemented common serial numbers in the server cache, and send the second number of the first number segments to the corresponding client.

[0024] According to the sixth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement a method as described in an embodiment of the first aspect of the present disclosure, or to implement a method as described in an embodiment of the second aspect of the present disclosure.

[0025] According to the seventh aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute a method as described in an embodiment of the first aspect of the present disclosure, or to execute a method as described in an embodiment of the second aspect of the present disclosure.

[0026] According to an eighth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising: a computer program, which, when executed by a processor, implements the method described in the embodiment of the first aspect of the present disclosure, or implements the method described in the embodiment of the second aspect of the present disclosure.

[0027] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0028] In the present technical scheme, a request for obtaining an ordinary sequence number sent by a business application is received; when the ordinary sequence number segment in the client cache meets the preset conditions, the first number of ordinary sequence numbers requested by the ordinary sequence number obtaining request is sent to the business application based on the ordinary sequence number segment in the client cache; when the ordinary sequence number segment in the client cache does not meet the preset conditions, the first number of ordinary sequence numbers requested by the ordinary sequence number obtaining request is sent to the business application based on the ordinary sequence number segment in the client cache, and a segment obtaining request for requesting to obtain the first number segment is sent to the corresponding server in parallel, so as to add the obtained first number segment to the client cache. Therefore, by storing a certain number of sequence numbers in the client cache of the client, the number of requests to the server can be significantly reduced, and the request pressure on the server can be reduced. By sending sequence numbers to business applications based on the sequence numbers stored in the client cache, the response speed can be improved. By asynchronously replenishing the ordinary sequence number segments in the client cache, seamless connection of sequence number resources can be achieved, avoiding waiting or blocking caused by exhaustion of sequence number resources in the client cache; wherein, the client cache includes at least one ordinary sequence number consumption segment currently consumed and one ordinary sequence number standby segment waiting for standby, so that the client can, when the number of ordinary sequence number standby segments in the client cache is not less than the first threshold, or the number of ordinary sequence numbers in the ordinary sequence number consumption segment is not less than the second threshold, execute sending sequence numbers to the business application and requesting the corresponding server to obtain the first segment in parallel, so as to replenish the obtained first segment to the client cache, thereby ensuring that when the sequence number resources of the ordinary sequence number consumption segment are about to be exhausted, the ordinary sequence number standby segment is ready through multi-segment caching and asynchronous replenishment.

[0029] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0031] Figure 1 is a flowchart of a method for obtaining a sequence number according to the first embodiment of the present disclosure;

[0032] Figure 2 is a flowchart of a method for obtaining a sequence number according to a second embodiment of the present disclosure;

[0033] Figure 3is a flowchart of a method for obtaining a sequence number shown in the third embodiment of the present disclosure;

[0034] Figure 4 is a flowchart of a method for obtaining a sequence number according to a fourth embodiment of the present disclosure;

[0035] Figure 5 is a flowchart of a method for obtaining a sequence number according to a fifth embodiment of the present disclosure;

[0036] Figure 6 is a flowchart of a method for obtaining a sequence number according to a sixth embodiment of the present disclosure;

[0037] Figure 7 is a flowchart of a method for obtaining a sequence number according to a seventh embodiment of the present disclosure;

[0038] Figure 8 is a functional architecture diagram of a sequence number management system provided by an eighth embodiment of the present disclosure;

[0039] Fig. 9 is a schematic diagram of the distribution of common serial numbers provided in the ninth embodiment of the present disclosure;

[0040] Fig.10 is a flowchart of a sequence number acquisition process provided by the tenth embodiment of the present disclosure;

[0041] Fig.11 is a schematic diagram of a snowflake ID provided in the eleventh embodiment of the present disclosure;

[0042] Fig.12 is a schematic diagram of the relationship between the self-selected serial number and the common serial number provided in the twelfth embodiment of the present disclosure;

[0043] Fig.13 It is a flowchart of obtaining and selecting a sequence number involved in the sequence number management system provided in the thirteenth embodiment of the present disclosure;

[0044] Fig.14 is a structural diagram of a serial number acquisition device provided in the fourteenth embodiment of the present disclosure;

[0045] Fig.15 is a structural schematic diagram of a sequence number obtaining device shown in the fifteenth embodiment of the present disclosure;

[0046] Fig.16 It is a schematic structural diagram of an electronic device 1600 shown in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0047] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0048] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0049] It should be noted that in the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are all carried out with the user's consent, and are in compliance with the relevant laws and regulations and do not violate public order and good morals.

[0050] The following describes the serial number acquisition method and serial number management system of the embodiments of the present disclosure with reference to the accompanying drawings.

[0051] Figure 1 It is a flowchart of the method for obtaining a serial number shown in the first embodiment of the present disclosure.

[0052] It should be noted that the serial number acquisition method of the embodiment of the present disclosure is applied to the client.

[0053] The client refers to the client SDK (Software Development Kit).

[0054] like Figure 1 As shown, the serial number obtaining method includes the following steps:

[0055] Step 101: Receive a common sequence number acquisition request sent by a business application.

[0056] Among them, the common sequence number is relative to the self-selected sequence number. All the sequence numbers that are not generated based on the self-selected characters input by the user are common sequence numbers. For example, assuming that the current value of the common sequence number in the common sequence number generation record is 1000, if the user inputs 8, then based on the user input 8, 1008, 1018, and 1028 generated are self-selected sequence numbers. If 30 common sequence numbers need to be generated at this time, since the current value of the common sequence number in the common sequence number generation record is 1000, 1001, 1002, ..., 1007, 1009, 1010, ..., 1017, 1019, 1020, ..., 1027, 1029, 1030, ..., 1033 are common sequence numbers. Furthermore, if the above three self-selected serial numbers are generated based on the 8 input by the user this time, then the 1038, 1048, etc. generated subsequently may be ordinary serial numbers or self-selected serial numbers (for example, the current value of the ordinary serial number in the ordinary serial number generation record is 1030, and the user enters 8 again).

[0057] Among them, the business application refers to the APP (Application) on the same physical device as the client (client SDK).

[0058] The common sequence number acquisition request carries the number of the requested common sequence numbers.

[0059] In the embodiment of the present disclosure, the business application can send a request to obtain a common sequence number to the client when it needs to obtain a common sequence number. Correspondingly, the client can receive the request to obtain a common sequence number sent by the business application.

[0060] In order to reduce the number of requests to the server, reduce the request pressure on the server, and improve the response speed, as a possible implementation method, the client can obtain the ordinary sequence number from the server and store it in the client cache. When receiving the ordinary sequence number acquisition request sent by the business application, it can be determined whether there is an ordinary sequence number segment in the client cache. If the ordinary sequence number segment exists in the client cache, the ordinary sequence number can be directly obtained from the client cache and sent to the business application.

[0061] It should be noted that the common sequence number segment determined in this step refers to a segment composed of common sequence numbers, and the number of common sequence numbers that compose the segment is not limited. In other words, as long as there is a segment composed of common sequence numbers in the client cache, no matter how many common sequence numbers the segment is composed of, it can be determined that there is a common sequence number segment in the client cache; and when there is no segment composed of common sequence numbers in the client cache (it can also be understood that there is no common sequence number in the client cache), it can be determined that there is no common sequence number segment in the client cache.

[0062] As a possible implementation, the client can send a common sequence number acquisition request to the corresponding server when there is no common sequence number segment in the client cache, so as to send the first number of common sequence numbers requested by the common sequence number acquisition request to the business application based on the acquired common sequence numbers. The number of acquired common sequence numbers must be greater than the first number.

[0063] The first number may be any value, such as 1, 5, 8, etc.

[0064] The corresponding server is determined based on the server address filled in the client configuration file. In the present disclosure, one or more server addresses can be configured in the client configuration file so that the client can obtain the serial number from the corresponding server based on the configured server address.

[0065] It can be understood that if there is no ordinary sequence number segment in the client cache, it means that there is no ordinary sequence number in the client cache. This situation mostly means that the client has not obtained any ordinary sequence number from the corresponding server. At this time, the client can send an ordinary sequence number acquisition request to the corresponding server to obtain the ordinary sequence number from the corresponding server, and based on the obtained ordinary sequence number, send the first number of ordinary sequence numbers requested by the ordinary sequence number acquisition request to the business application.

[0066] In order to reduce the number of requests to the server and relieve the request pressure on the server, the client can request multiple common serial numbers at a time. Optionally, when there is no common serial number segment in the client cache, the client can send a segment acquisition request for requesting to obtain the first segment to the corresponding server, so as to send the first number of common serial numbers requested by the common serial number acquisition request to the business application based on the acquired first segment.

[0067] Among them, the first number segment is composed of any number of common serial numbers.

[0068] Among them, the client requests one or more first number segments from the corresponding server at a time, and only needs to ensure that the number of ordinary serial numbers obtained is greater than the first number.

[0069] It should be noted that when the client requests multiple first number segments from the corresponding server at one time, there is a certain consumption order between the multiple first number segments obtained, wherein the first number segment at the front of the consumption order is an ordinary sequence number consumption segment currently consumed in the client cache, and at least one first number segment that is not at the front of the consumption order is at least one ordinary sequence number standby segment waiting for backup in the client cache. After an ordinary sequence number consumption segment currently consumed is consumed, the ordinary sequence number standby segment at the front of the consumption order among at least one ordinary sequence number standby segment waiting for backup will be determined as an ordinary sequence number consumption segment currently consumed, that is, after the ordinary sequence number consumption segment is consumed, the ordinary sequence number standby segment at the front of the consumption order among the ordinary sequence number standby segments will be started. Therefore, by means of multi-segment caching, it can be ensured that when the sequence resources of the ordinary sequence number consumption segment are about to be exhausted, the ordinary sequence number standby segment at the front of the consumption order among the ordinary sequence number standby segments is ready, so as to achieve seamless switching of sequence resources and avoid response delays.

[0070] As a possible implementation method, the client can send a segment acquisition request for obtaining multiple first number segments to the corresponding server when there is no ordinary sequence number segment in the client cache; store the obtained multiple first number segments in the client cache; according to the consumption order among the multiple first number segments stored in the client cache, according to the arrangement order of the ordinary sequence numbers in at least one first number segment before the consumption order, determine a first number of ordinary sequence numbers from at least one first number segment before the consumption order, and send the determined first number of ordinary sequence numbers to the business application.

[0071] Step 102: When the common sequence number segment in the client cache meets a preset condition, a first number of common sequence numbers requested by a common sequence number acquisition request is sent to a service application according to the common sequence number segment in the client cache.

[0072] The first number may be any value, such as 1, 5, 8, etc.

[0073] As a possible implementation method, if there is an ordinary sequence number segment in the client cache, before the client sends the first number of ordinary sequence numbers to the business application based on the ordinary sequence number segment in the client cache, it also needs to determine whether the ordinary sequence number segment in the client cache meets the preset conditions, so as to make up for the position in time when the ordinary sequence number segment in the client cache does not meet the preset conditions. If the ordinary sequence number segment in the client cache meets the preset conditions, it is only necessary to send the first number of ordinary sequence numbers to the business application based on the ordinary sequence number segment in the client cache.

[0074] Among them, the client cache includes a common sequence number consumption segment currently consumed and at least one common sequence number backup segment waiting for backup, and the preset condition is that the number of common sequence number backup segments in the client cache is not less than a first threshold, or the number of common sequence numbers in the common sequence number consumption segment is not less than a second threshold.

[0075] The first threshold and the second threshold are used to determine whether it is necessary to supplement the ordinary sequence number segment in the client cache. The first threshold refers to the number of ordinary sequence number spare segments in the client cache, which can be 1, 2, 3, etc. The second threshold refers to the number of ordinary sequence numbers in the ordinary sequence number consumption segment, which can be 3, 5, 10, etc.

[0076] Step 103, when the ordinary sequence number segment in the client cache does not meet the preset conditions, execute in parallel the ordinary sequence number segment in the client cache, send the first number of ordinary sequence numbers requested by the ordinary sequence number acquisition request to the business application, and send a segment acquisition request for requesting to obtain the first number segment to the corresponding server, so as to add the acquired first number segment to the client cache.

[0077] The corresponding server is determined based on the server address filled in the client configuration file. In the present disclosure, one or more server addresses can be configured in the client configuration file so that the client can obtain the serial number from the corresponding server based on the configured server address.

[0078] The first number segment added to the client cache is a new common sequence number standby number segment in the client cache, and the consumption order of the first number segment is lower than the consumption order of the common sequence number standby number segment existing in the client cache;

[0079] After the common serial number consumption number segment is consumed, the common serial number backup number segment with the earliest consumption order in the common serial number backup number segment is activated.

[0080] To improve processing efficiency, in an embodiment of the present disclosure, when the ordinary sequence number segments in the client cache do not meet preset conditions, the client can simultaneously execute two operations: sending a first number of ordinary sequence numbers to the business application based on the ordinary sequence number segments existing in the client cache, and replenishing the ordinary sequence number segments in the client cache (i.e., sending a segment acquisition request for requesting the first segment to the corresponding server to replenish the acquired first segment to the client cache).

[0081] Therefore, asynchronous replenishment can be used to ensure that when a common sequence number consumption segment currently consumed in the client cache is about to be exhausted, or the number of common sequence number backup segments in the client cache does not meet the set value, the client can promptly replenish the first segment from the corresponding server to the client cache, thereby achieving seamless connection of sequence number resources and avoiding waiting or blocking due to exhaustion of sequence number resources in the client cache.

[0082] The sequence number acquisition method of the disclosed embodiment receives a common sequence number acquisition request sent by a business application; when the common sequence number segment in the client cache meets the preset conditions, the first number of common sequence numbers requested by the common sequence number acquisition request is sent to the business application according to the common sequence number segment in the client cache; when the common sequence number segment in the client cache does not meet the preset conditions, the first number of common sequence numbers requested by the common sequence number acquisition request is sent to the business application according to the common sequence number segment in the client cache, and a segment acquisition request for requesting to obtain the first segment is sent to the corresponding server in parallel, so as to supplement the obtained first segment to the client cache. Thus, by storing a certain number of sequence numbers in the client cache of the client, the number of requests to the server can be significantly reduced, and the request pressure on the server can be reduced. By sending sequence numbers to business applications based on the sequence numbers stored in the client cache, the response speed can be improved. By asynchronously replenishing the common sequence number segments in the client cache, the seamless connection of sequence number resources can be achieved, and waiting or blocking caused by exhaustion of sequence number resources in the client cache can be avoided.

[0083] It should be noted that in the present disclosure, the client can also obtain a self-selected serial number from the corresponding server. Figure 2 This process is described below.

[0084] Figure 2 It is a flowchart of the method for obtaining a serial number shown in the second embodiment of the present disclosure.

[0085] Similarly, the serial number acquisition method of the embodiment of the present disclosure is also applied to the client.

[0086] like Figure 2 As shown, the serial number obtaining method includes the following steps:

[0087] Step 201: Receive a common sequence number acquisition request sent by a business application.

[0088] Step 202: When the ordinary sequence number segment in the client cache meets a preset condition, a first number of ordinary sequence numbers requested by an ordinary sequence number acquisition request is sent to a service application according to the ordinary sequence number segment in the client cache.

[0089] Step 203, when the ordinary sequence number segment in the client cache does not meet the preset conditions, execute in parallel the first number of ordinary sequence numbers requested by the ordinary sequence number acquisition request sent to the business application based on the ordinary sequence number segment in the client cache, and send a segment acquisition request for requesting to obtain the first number segment to the corresponding server, so as to add the acquired first number segment to the client cache.

[0090] Step 204: Receive a request for obtaining a self-selected sequence number sent by a business application.

[0091] The request for obtaining the self-selected serial number carries the self-selected characters input by the user, and the self-selected characters may be numbers, letters, symbols, and the like.

[0092] In the disclosed embodiment, the service application may send a request to obtain a self-selected sequence number to the client when it needs to obtain a self-selected sequence number. Accordingly, the client may receive the request to obtain a self-selected sequence number sent by the service application.

[0093] Step 205, sending a self-selected serial number acquisition request to the corresponding server to obtain from the corresponding server the first self-selected serial number including the self-selected characters carried in the self-selected serial number acquisition request.

[0094] In the disclosed embodiment, after receiving the self-selected serial number acquisition request sent by the business application, the business application will send the self-selected serial number acquisition request to the corresponding server to obtain the first self-selected serial number containing the self-selected characters carried in the self-selected serial number acquisition request from the corresponding server.

[0095] It should be noted that the number of the first self-selected serial numbers containing the self-selected characters carried in the self-selected serial number acquisition request obtained by the client from the corresponding server may be one or more, and this is not limited in the embodiments of the present disclosure.

[0096] Step 206: Send the first self-selected sequence number to the business application.

[0097] It should be noted that the execution process of steps 201 to 203 can be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0098] The serial number acquisition method of the disclosed embodiment receives a self-selected serial number acquisition request sent by a business application; sends the self-selected serial number acquisition request to a corresponding server to obtain a first self-selected serial number containing the self-selected characters carried in the self-selected serial number acquisition request from the corresponding server; sends the first self-selected serial number to the business application, thereby allowing the user to customize part of the characters in the serial number, making the generated serial number more personalized and in line with user expectations, thereby improving the user experience.

[0099] It should be noted that in the present disclosure, after sending multiple self-selected sequence numbers to the business application, the client can also interact with the corresponding server according to the selection operation of the business application selecting a target self-selected sequence number from the multiple self-selected sequence numbers to determine whether the selection is successful. Figure 3 This process is described below.

[0100] Figure 3 It is a flowchart of the method for obtaining a serial number shown in the third embodiment of the present disclosure.

[0101] Similarly, the serial number acquisition method of the embodiment of the present disclosure is also applied to the client.

[0102] like Figure 3 As shown, the serial number obtaining method includes the following steps:

[0103] Step 301: Receive a common sequence number acquisition request sent by a business application.

[0104] Step 302: When the common sequence number segment in the client cache meets a preset condition, a first number of common sequence numbers requested by a common sequence number acquisition request is sent to a service application according to the common sequence number segment in the client cache.

[0105] Step 303, when the ordinary sequence number segment in the client cache does not meet the preset conditions, execute in parallel the first number of ordinary sequence numbers requested by the ordinary sequence number acquisition request sent to the business application based on the ordinary sequence number segment in the client cache, and send a segment acquisition request for requesting to obtain the first number segment to the corresponding server to add the acquired first number segment to the client cache.

[0106] Step 304: Receive a request for obtaining a self-selected sequence number sent by a business application.

[0107] Step 305: Send a self-selected serial number acquisition request to the corresponding server to obtain the first self-selected serial number including the self-selected characters carried in the self-selected serial number acquisition request from the corresponding server.

[0108] It should be noted that, in the embodiment of the present disclosure, the number of first self-selected serial numbers including the self-selected characters carried in the self-selected serial number acquisition request obtained by the client from the corresponding server is multiple.

[0109] Step 306: Send the first self-selected sequence number to the business application.

[0110] Step 307: Send a selection request to the corresponding server according to a selection operation of selecting a second self-selected sequence number from a plurality of first self-selected sequence numbers in accordance with the business application.

[0111] The selection request carries a second self-selected sequence number.

[0112] The second self-selected serial number is one or more self-selected serial numbers among the plurality of first self-selected serial numbers.

[0113] In the disclosed embodiment, after the client sends multiple first self-selected serial numbers to the business application, it can select a second self-selected serial number from the multiple first self-selected serial numbers according to the selection operation of the business application, and send a selection request carrying the second self-selected serial number to the corresponding server to find out whether the second self-selected serial number can be selected.

[0114] Step 308: Receive a selection response sent by the corresponding server, and feed back the execution result of the selected operation to the business application based on the selection response.

[0115] In the disclosed embodiment, upon receiving a selection response sent by the corresponding server to indicate a successful selection, the client may feedback a successful selection to the business application to complete the selection of the self-selected sequence number; or, upon receiving a selection response sent by the corresponding server to indicate a failed selection, the client may feedback a failed selection to the business application, at which point the user may re-select a self-selected sequence number from each of the multiple first self-selected sequence numbers except the second self-selected sequence number.

[0116] It should be noted that the execution process of steps 301 to 306 can be implemented in any manner in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0117] The serial number acquisition method of the disclosed embodiment sends a selection request to a corresponding server according to a selection operation of selecting a second self-selected serial number from a plurality of first self-selected serial numbers by a business application; wherein the selection request carries the second self-selected serial number; receives a selection response sent by the corresponding server, and based on the selection response, feeds back the execution result of the selection operation to the business application, thereby, the client can send a selection request carrying the second self-selected serial number to the corresponding server according to the selection operation of selecting a second self-selected serial number from a plurality of first self-selected serial numbers by the business application, so as to know whether the second self-selected serial number can be selected.

[0118] The above embodiment is described from the perspective of the client. In order to more clearly illustrate the sequence number acquisition process, the embodiment of the present disclosure provides a possible implementation of a sequence number acquisition method described from the perspective of the server. Figure 4 It is a flowchart of the method for obtaining a serial number shown in the fourth embodiment of the present disclosure.

[0119] like Figure 4 As shown, the serial number obtaining method includes the following steps:

[0120] Step 401: Receive a number segment acquisition request sent by a corresponding client for requesting to acquire a first number segment.

[0121] Among them, the relevant explanation of the first number segment can be found in the description of each embodiment of the present disclosure, and will not be repeated here.

[0122] It should be noted that the number of first number segments requested by the number segment acquisition request sent by the corresponding client may be one or more, and this is not limited in the embodiments of the present disclosure.

[0123] In the disclosed embodiment, the corresponding client can send a number segment acquisition request for requesting to obtain the first number segment to the server when it needs to obtain the common serial number. Correspondingly, the server can receive the number segment acquisition request for requesting to obtain the first number segment sent by the corresponding client.

[0124] Step 402, when the number of ordinary serial numbers in the server cache does not meet the number of ordinary serial numbers requested by the number segment acquisition request, query the digital rule self-increment table for recording the generation records of ordinary serial numbers and the self-selected table for recording the generation records of self-selected serial numbers in the database, so as to supplement the ordinary serial numbers in the server cache according to the digital rule self-increment table and the self-selected table, so that the number of ordinary serial numbers in the server cache after supplementation meets the number of ordinary serial numbers requested by the number segment acquisition request.

[0125] Among them, the digital rule auto-increment table is used to record the generation records of common serial numbers, and the current value of the common serial number can be checked.

[0126] Among them, the self-selected table is used to record the generation records of the self-selected serial numbers, and you can check the self-selected serial numbers that have been used and the self-selected serial numbers that have been generated but not yet used.

[0127] In the disclosed embodiment, when the server receives a number segment acquisition request sent by the corresponding client to request the first number segment, it will first determine whether the number of ordinary serial numbers in the server cache meets the number of ordinary serial numbers requested by the number segment acquisition request, so as to make up for the position in time if the number of ordinary serial numbers requested by the number segment acquisition request is not met.

[0128] Optionally, if the number of ordinary serial numbers in the server cache does not meet the number of ordinary serial numbers requested by the number segment acquisition request, the server may query the digital rule auto-increment table for recording the generation records of ordinary serial numbers and the self-selected table for recording the generation records of self-selected serial numbers in the database, and then generate ordinary serial numbers based on the queried digital rule auto-increment table and the self-selected table to supplement the server cache, so that the number of ordinary serial numbers in the supplemented server cache meets the number of ordinary serial numbers requested by the number segment acquisition request.

[0129] Step 403: Generate a second number of first number segments requested by the number segment acquisition request according to the supplemented common sequence number in the server cache, and send the second number of first number segments to the corresponding client.

[0130] It should be noted that in the embodiment of the present disclosure, when the number of ordinary serial numbers in the server cache does not meet the number of ordinary serial numbers requested by the number segment acquisition request, the server directly generates the second number of first number segments requested by the number segment acquisition request based on the ordinary serial numbers in the server cache, and sends them to the client.

[0131] It should be noted that in the disclosed embodiment, after the server sends the generated second number of first number segments to the client, it can also make an asynchronous replenishment judgment. As a possible implementation method, the server can determine whether the number of ordinary serial numbers in the server cache meets the third threshold after sending the second number of first number segments to the corresponding client; if the number of ordinary serial numbers in the server cache does not meet the third threshold, query the digital rule self-increment table and the self-selection table in the database to generate ordinary serial numbers according to the digital rule self-increment table and the self-selection table to supplement the server cache, so that the number of ordinary serial numbers in the server cache after replenishment is the set number.

[0132] The third threshold is used to determine whether it is necessary to supplement the common sequence number in the server cache. The third threshold can be any value less than the set number, such as 3, 5, 10, etc.

[0133] The serial number acquisition method of the embodiment of the present disclosure receives a number segment acquisition request for requesting to obtain a first number segment sent by a corresponding client; when the number of ordinary serial numbers in the server cache of the server does not meet the number of ordinary serial numbers requested by the number segment acquisition request, queries a database for a digital rule self-increment table for recording the generation records of ordinary serial numbers and a self-selected table for recording the generation records of self-selected serial numbers, so as to supplement the ordinary serial numbers in the server cache according to the digital rule self-increment table and the self-selected table, so that the number of ordinary serial numbers in the supplemented server cache meets the number of ordinary serial numbers requested by the number segment acquisition request; generates a second number of first number segments requested by the number segment acquisition request according to the supplemented ordinary serial numbers in the server cache, and sends the second number of first number segments to the corresponding client, thereby, by generating ordinary serial numbers according to the digital rule self-increment table and the self-selected table to supplement the server cache when the number of ordinary serial numbers in the server cache of the server does not meet the number of ordinary serial numbers requested by the number segment acquisition request, the uniqueness of the ordinary serial numbers in the supplemented server cache can be effectively guaranteed.

[0134] It should be noted that in the present disclosure, the server can generate a batch of common serial numbers after startup and store them in the server cache. Figure 5 This process is described below.

[0135] Figure 5 It is a flowchart of the serial number acquisition method shown in the fifth embodiment of the present disclosure.

[0136] like Figure 5 As shown, the serial number obtaining method includes the following steps:

[0137] Step 501, in response to the server starting up, load the data rules and sequence rules configured by the management and control end from the database, and query the digital rule auto-increment table in the database.

[0138] The data rule is used to indicate a rule of at least one data type, and the at least one data type includes a string, an enumeration, a date, a number, and a placeholder.

[0139] The sequence rules include sequence number generation rules and sequence number encoding rules. The sequence number generation rules are used to indicate the basic information and generation logic of the sequence number, and the sequence number arrangement rules are used to indicate the arrangement method of the sequence number.

[0140] Among them, the digital rule auto-increment table is used to record the generation records of common serial numbers, and the current value of the common serial number can be checked.

[0141] In the disclosed embodiment, after startup, the server can load data rules and sequence rules from the database and query the digital rule auto-increment table in the database to generate a serial number based on at least one of them.

[0142] Step 502, generating a second number segment according to at least one of a data rule, a sequence rule and a digital rule auto-increment table, and storing the second number segment in a server cache.

[0143] The second number segment is composed of any number of common serial numbers.

[0144] As a possible implementation method, when the digital rule auto-increment table is empty, the second number segment is generated according to the data rules and sequence rules; when the digital rule auto-increment table is not empty, the starting value and step size of the ordinary serial number to be generated are determined according to the generation record of the ordinary serial number recorded in the digital rule auto-increment table, so as to generate the second number segment according to the starting value and step size of the ordinary serial number to be generated.

[0145] That is to say, when the server generates an ordinary serial number for the first time, it generates the serial number based on the data rules and sequence rules. When it is not the first time to generate an ordinary serial number, it can directly generate the ordinary serial number based on the generation record of the ordinary serial number recorded in the digital rule auto-increment table.

[0146] It should be noted that even if multiple server instances for producing serial numbers are deployed, in the disclosed embodiment, since each server instance shares a digital rule auto-increment table to record the ordinary serial numbers produced by each of them, and when a server instance produces a serial number, the database pessimistically reads the digital rule auto-increment table using select for update. At this time, other server instances cannot grab the lock, thereby ensuring the uniqueness of the second number segment generated by each server instance.

[0147] In order to avoid the common serial numbers in the generated second number segment from being duplicated with the selected self-selected serial numbers with unmarked filtering marks recorded in the self-selected table in the database for recording the generation records of the self-selected serial numbers, as a possible implementation method, before storing the second number segment in the server cache, the self-selected table in the database can be queried to delete the common serial numbers in the second number segment that are duplicated with any selected self-selected serial numbers with unmarked filtering marks recorded in the self-selected table.

[0148] Step 503: Receive a number segment acquisition request sent by a corresponding client for requesting to acquire a first number segment.

[0149] Step 504, when the number of ordinary serial numbers in the server cache does not meet the number of ordinary serial numbers requested by the number segment acquisition request, query the digital rule self-increment table and the self-selection table in the database to replenish the second number segment in the server cache according to the digital rule self-increment table and the self-selection table, so that the number of ordinary serial numbers in the second number segment after replenishment meets the number of ordinary serial numbers requested by the number segment acquisition request.

[0150] As a possible implementation method, when the number of common sequence numbers in the server cache does not meet the number of common sequence numbers requested by the segment acquisition request, query the digital rule self-increment table to determine the starting value and step length of the common sequence number to be generated according to the generation record of the common sequence number recorded in the digital rule self-increment table; generate the common sequence number according to the starting value and step length of the common sequence number to be generated, and query the self-selection table to determine whether the generated common sequence number is the same as any selected self-selected sequence number that is not marked with a filter and annotated in the self-selection table; add the common sequence numbers that are not repeated to the second segment in the server cache, so that the number of common sequence numbers in the second segment after the replenishment meets the number of common sequence numbers requested by the segment acquisition request. In this way, the common sequence numbers added to the second segment are neither the same as the common sequence numbers generated previously, nor the same as the selected self-selected sequence numbers that are not marked with a filter and annotated.

[0151] It should be noted that in order to make the records in the digital rule auto-increment table and the self-selected table authentic and valid, the server needs to update the records in the digital rule auto-increment table and the self-selected table in a timely manner when generating a common serial number to add to the second number segment in the server cache.

[0152] As a possible implementation method, the digital rule self-increment table is updated according to the common serial numbers that are not repeated and added to the second number segment; the self-selected serial numbers that are not marked with filtering and annotated selected self-selected serial numbers recorded in the self-selected table and are repeated with the generated common serial numbers are marked with filtering and annotated. Thus, timely updating the digital rule self-increment table can ensure that the next time a common serial number is generated, the generated common serial numbers are not repeated; timely marking and filtering the repeated self-selected serial numbers can reduce the number of comparisons to determine whether the generated common serial number is repeated with any of the selected self-selected serial numbers that are not marked with filtering and annotated recorded in the self-selected table after the next common serial number is generated, thereby improving processing efficiency.

[0153] Step 505: Generate a second number of first number segments requested by the number segment acquisition request according to the second number segment after the replenishment, and send the second number of first number segments to the corresponding client.

[0154] It should be noted that step 505 and the execution process of step 505 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0155] The serial number acquisition method of the disclosed embodiment, in response to the server startup, loads the data rules and sequence rules configured by the control end from the database, and queries the digital rule auto-increment table in the database; generates a second number segment according to at least one of the data rules, sequence rules and digital rule auto-increment table, and stores the second number segment in the server cache; receives a number segment acquisition request sent by the corresponding client for requesting to obtain the first number segment; when the number of ordinary serial numbers in the server cache does not meet the number of ordinary serial numbers requested by the number segment acquisition request, queries the digital rule auto-increment table and the self-selection table in the database to obtain the second number segment according to the digital rule auto-increment table and The self-selected table replenishes the second number segment in the server cache so that the number of ordinary serial numbers in the second number segment after the replenishment meets the number of ordinary serial numbers requested by the number segment acquisition request; based on the second number segment after the replenishment, the second number segment requested by the number segment acquisition request is generated, and the second number segment is sent to the corresponding client. Therefore, after the server is started, the second number segment is generated and stored in the server cache, the response speed can be improved, and the ordinary serial number is generated according to the digital rule self-increment table and the self-selected table to supplement the second number segment in the server cache, which can effectively ensure the uniqueness of the ordinary serial numbers supplemented into the second number segment.

[0156] and Figure 2 Corresponding to the embodiment shown, the embodiment of the present disclosure provides a possible implementation of a method for obtaining a sequence number described from the perspective of a server. Figure 6 It is a flowchart of the serial number acquisition method shown in the sixth embodiment of the present disclosure.

[0157] like Figure 6 As shown, the serial number obtaining method includes the following steps:

[0158] Step 601: Receive a number segment acquisition request sent by a corresponding client for requesting to acquire a first number segment.

[0159] Step 602, when the number of ordinary serial numbers in the server cache does not meet the number of ordinary serial numbers requested by the number segment acquisition request, query the digital rule self-increment table for recording the generation records of ordinary serial numbers and the self-selected table for recording the generation records of self-selected serial numbers in the database, so as to supplement the ordinary serial numbers in the server cache according to the digital rule self-increment table and the self-selected table, so that the number of ordinary serial numbers in the server cache after supplementation meets the number of ordinary serial numbers requested by the number segment acquisition request.

[0160] Step 603: Generate a second number of first number segments requested by the number segment acquisition request according to the supplemented common sequence number in the server cache, and send the second number of first number segments to the corresponding client.

[0161] Step 604: Receive a request for obtaining a self-selected sequence number sent by the corresponding client.

[0162] The request for obtaining the self-selected serial number carries the self-selected characters input by the user, and the self-selected characters may be numbers, letters, symbols, and the like.

[0163] In the disclosed embodiment, the business application can send a self-selected sequence number acquisition request to the client when it needs to obtain the self-selected sequence number. Correspondingly, the client can receive the self-selected sequence number acquisition request sent by the business application and send the self-selected sequence number acquisition request to the corresponding server. Correspondingly, the server can receive the self-selected sequence number acquisition request sent to the corresponding server.

[0164] Step 605, query the digital rule self-increment table and the self-selected place-filling table in the database for recording the place-filling information of the self-selected serial number, so as to generate the first self-selected serial number containing the self-selected characters carried in the self-selected serial number acquisition request according to the digital rule self-increment table and the self-selected place-filling table.

[0165] Among them, the self-selected filling table is used for the filling information of the self-selected serial number, including the encoding of the self-selected sequence, the user input value, the generated serial number and other information.

[0166] As a possible implementation method, in response to receiving a self-selected serial number acquisition request sent by a client, a number rule self-increment table is queried to determine the starting value of the self-selected serial number to be generated based on the generation record of the ordinary serial number recorded in the number rule self-increment table; a self-selected place-filling table is queried to determine the place-filling value of the self-selected serial number to be generated based on the place-filling record of the self-selected serial number recorded in the self-selected place-filling table; and a first self-selected serial number containing the self-selected characters carried in the self-selected serial number acquisition request is generated based on the starting value and the place-filling value of the self-selected serial number to be generated.

[0167] Step 606: Send the first self-selected sequence number to the corresponding client, and update the self-selected list according to the first self-selected sequence number.

[0168] In the disclosed embodiment, in addition to sending the generated first self-selected sequence number to the client, the server also needs to update the generated first self-selected sequence number to the self-selected table in real time.

[0169] It should be noted that the execution process of step 601 to step 603 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0170] The serial number acquisition method of the embodiment of the present disclosure receives a self-selected serial number acquisition request sent by a corresponding client; queries a digital rule self-increment table and a self-selected place-filling table in a database for recording place-filling information of the self-selected serial number, so as to generate a first self-selected serial number including the self-selected characters carried in the self-selected serial number acquisition request according to the digital rule self-increment table and the self-selected place-filling table; sends the first self-selected serial number to the corresponding client, and updates the self-selected table according to the first self-selected serial number, thereby ensuring the uniqueness and continuity of the self-selected serial number through the digital rule self-increment table, avoiding serial number duplication or jump, and ensuring the integrity and standardization of the self-selected serial number in a specific format (such as fixed length) through the self-selected place-filling table, avoiding data confusion caused by inconsistent serial number formats.

[0171] and Figure 3 Corresponding to the embodiment shown, the embodiment of the present disclosure provides a possible implementation of a method for obtaining a sequence number described from the perspective of a server. Figure 7 It is a flowchart of the method for obtaining a serial number shown in the seventh embodiment of the present disclosure.

[0172] like Figure 7 As shown, the serial number obtaining method includes the following steps:

[0173] Step 701, sending a first self-selected sequence number to a corresponding client, and updating a self-selected list according to the first self-selected sequence number.

[0174] Step 702, when the number of ordinary serial numbers in the server cache does not meet the number of ordinary serial numbers requested by the number segment acquisition request, query the digital rule self-increment table for recording the generation records of ordinary serial numbers and the self-selected table for recording the generation records of self-selected serial numbers in the database, so as to supplement the ordinary serial numbers in the server cache according to the digital rule self-increment table and the self-selected table, so that the number of ordinary serial numbers in the server cache after supplementation meets the number of ordinary serial numbers requested by the number segment acquisition request.

[0175] Step 703: Generate a second number of first number segments requested by the number segment acquisition request according to the supplemented common sequence number in the server cache, and send the second number of first number segments to the corresponding client.

[0176] Step 704: Receive a request for obtaining a self-selected sequence number sent by the corresponding client.

[0177] Step 705, query the digital rule self-increment table and the self-selected place-filling table in the database for recording the place-filling information of the self-selected serial number, so as to generate the first self-selected serial number containing the self-selected characters carried in the self-selected serial number acquisition request according to the digital rule self-increment table and the self-selected place-filling table.

[0178] Step 706, sending the first self-selected sequence number to the corresponding client, and updating the self-selected list according to the first self-selected sequence number.

[0179] Step 707: Receive a selection request sent by the corresponding client.

[0180] The selection request carries a second self-selected sequence number.

[0181] The second self-selected serial number is one or more self-selected serial numbers among the plurality of first self-selected serial numbers.

[0182] In the disclosed embodiment, after sending multiple first self-selected sequence numbers to the business application, the client can select a second self-selected sequence number from the multiple first self-selected sequence numbers according to the selection operation of the business application, and send a selection request carrying the second self-selected sequence number to the corresponding server to learn whether the second self-selected sequence number can be selected. Correspondingly, the server can receive the selection request sent by the corresponding client.

[0183] Step 708: query the number rule self-increment table to determine whether the second self-selected sequence number carried in the selected request exists in the number rule self-increment table.

[0184] In the embodiment of the present disclosure, when the server receives a selection request sent by the client, it can determine whether the second self-selected sequence number carried in the selection request is available by querying the digital rule self-increment table.

[0185] Step 709, when the second self-selected sequence number does not exist in the digital rule self-increment table, query the self-selected table, and when the second self-selected sequence number recorded in the self-selected table is not selected, send a selection response to the corresponding client to indicate a successful selection, and mark the second self-selected sequence number recorded in the self-selected table as selected.

[0186] If the second self-selected sequence number does not exist in the digital rule self-increment table, it means that the second self-selected sequence number is available. At this time, the server also needs to query the self-selected table to further verify the availability of the second self-selected sequence number. Specifically, the server can further determine whether the second self-selected sequence number is available based on whether the second self-selected sequence number recorded in the self-selected table is not selected. If the second self-selected sequence number recorded in the self-selected table is not selected, it means that the second self-selected sequence number is available. At this time, in addition to sending a selection response to the client to indicate a successful selection, the server also needs to mark the second self-selected sequence number recorded in the self-selected table as selected.

[0187] Step 710: When there is a second self-selected sequence number in the digital rule self-increment table, a selection response indicating a selection failure is sent to the client.

[0188] If the second self-selected sequence number does not exist in the digital rule self-increment table, it means that the second self-selected sequence number is unavailable. At this time, the server sends a selection response to the client to indicate that the selection failed.

[0189] It should be noted that the execution process of step 701 to step 706 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0190] The serial number acquisition method of the disclosed embodiment receives a selection request sent by a corresponding client; queries a digital rule self-increment table to determine whether there is a second self-selected serial number carried in the selection request in the digital rule self-increment table; if the second self-selected serial number does not exist in the digital rule self-increment table, queries the self-selection table, and if the second self-selected serial number recorded in the self-selection table is not selected, sends a selection response indicating a successful selection to the corresponding client, and marks the second self-selected serial number recorded in the self-selection table as selected; if the second self-selected serial number exists in the digital rule self-increment table, sends a selection response indicating a failed selection to the client, thereby effectively preventing the same self-selected serial number from being reused by querying the digital rule self-increment table and the self-selection table to verify the availability of the second self-selected serial number.

[0191] In order to implement the above embodiments, the present disclosure also proposes a serial number management system.

[0192] The serial number management system includes: control end, database, client end, and server end.

[0193] The control end is used to configure data rules and sequence rules, and store the configured data rules and sequence rules in the database;

[0194] Client, used to implement the above Figures 1 to 3 The serial number acquisition method provided by the embodiment;

[0195] The server is used to implement the above Figures 4 to 7 The serial number acquisition method provided in the embodiment; wherein, in the case where multiple server instances are deployed on the server, each server instance is used to implement the above Figures 4 to 7 The embodiment provides a method for obtaining serial numbers, and the common serial numbers in any server instance do not repeat the common serial numbers in server instances other than the server instance, and any server instance uses a database pessimistic lock to read the generation records of the common serial numbers recorded in the digital rule auto-increment table when querying the digital rule auto-increment table in the database for recording the generation records of the common serial numbers.

[0196] In order to clearly illustrate the serial number management system of the present disclosure, the present disclosure embodiment provides the following Figure 8 The functional architecture diagram of the serial number management system is shown in FIG. Figure 8 As shown, the control end includes the control end front end and the control end back end, among which the technical personnel of the business side of the bank can configure and view the sequence design parameters through the control end front end. The following is an explanation of the functional architecture diagram:

[0197] Control side:

[0198] 1. Rule definition: includes functions such as adding, modifying, querying, and deleting rules of type string / enumeration / date / number / placeholder.

[0199] (1) String: fixed value of string;

[0200] (2) Enumeration: Set the initial value, step size, and fields included in the enumeration library;

[0201] (3) Date: defines the standard format of the date (for example: yyyyMMdd);

[0202] (4) Numbers: Set the initial value, step size, maximum value, and number padding strategy (fill the number with 0 if the number is insufficient);

[0203] (5) Placeholder: The main function of the placeholder is to take the place of business parameters. When returning the sequence, the business parameters are replaced. The placeholder here can be set to a fixed length and automatically adapt.

[0204] 2. Sequence design: used for sequence rule design and management in the sequence center, where the generation rules and arrangement rules of the sequence are designed.

[0205] (1) The sequence generation rules are mainly divided into the following two parts:

[0206] Basic sequence information: sequence name, sequence code, application name (name of the application using the sequence);

[0207] Specific rules for the sequence: server cache quantity, client acquisition quantity, server replenishment threshold (percentage of sequence numbers remaining), client replenishment threshold (percentage of sequence numbers remaining), sequence recycling switch, and sequence callback method (daily, monthly, or yearly).

[0208] (2) Sequence arrangement: The sequence rule elements added in the rule definition are arranged and combined to form sequence rules that meet business requirements. It should be noted that when arranging digital rules, a strategy to reach the maximum value needs to be selected. Currently supported strategies include: continuous growth, restart, and maximum value error.

[0209] 3. Sequence usage record: Sequence number generation record query is a registration record of sequence number calls by different applications. If the operation and maintenance personnel want to check the entire sequence number call process, they can use the sequence number generation record query function to view the detailed records of the sequence number call end and the generation server. The records displayed on the page can query the server / client information (ip+port) of the current sequence, the start / end information of the corresponding sequence, the generation time, and the generation quantity through the sequence name. And through the detailed information of the current sequence, you can view the corresponding rule information of the sequence number generation.

[0210] Client (Serial SDK)

[0211] 1. Serial number generation: The management and design of serial number rule templates and sequence generation rules are completed by the sequence control end to perform unified management of sequence design. When adding sequence rules, select the sequence generation type, and select the sequence generation type as local generation. After adding, the sequence will be stored in the database (control end database). If the sequence generation type is local generation, after the sequence is added and published, the sequence arrangement rules and generation rules will be synchronized to the cache of the sequence local client through interface calls. After the sequence local client obtains the sequence arrangement rules and sequence production rules, they will be stored in the database. After obtaining the update, the sequence client will periodically pull the arrangement rules and generation rules of the sequence with the generation type of local generation, and update the rules in the database.

[0212] 2. Serial number placeholder replacement: However, if the business application needs to splice the information provided by the business into the serial number when generating the serial number, then the serial number needs to provide placeholder replacement capability. The application can pass the replacement business information to the serial number center when generating the serial number. When generating the serial number, in addition to the fixed type of serial number, the serial number center also needs to replace the placeholder with the business information before returning it.

[0213] 3. Generate a check code: If the serial number marks the source, you can specify the check digit when the serial number is generated. Then, when the serial number is obtained, the specified algorithm will be used to generate the check digit of the specified number and spliced ​​to the end of the serial number.

[0214] 4. Dual-segment cache: The serial number from the server is stored in the JVM cache; it supports a dual-segment cache structure. When the remaining amount of the segment 1 cache reaches the threshold, the cache filling of the segment 2 is triggered. After the resources of the segment 1 are used up, they are obtained from the segment 2 cache.

[0215] 5. Asynchronous replenishment: Asynchronous serial number replenishment is to obtain a new batch of serial numbers through asynchronous means and add them to the client cache. Application systems often need to ensure business continuity and low latency when they are highly concurrency, because the client obtains the serial number from the server each time through remote calls. If the synchronous method is used, the business continuity and low latency characteristics cannot be guaranteed. After the application integrates the serial SDK, the obtained number segments will be stored in the cache for the application system to retrieve. When the serial number in the cache is called, it will determine whether the replenishment conditions are met based on the number of remaining segments stored in the cache, the remaining segments and the threshold set by the system. If the replenishment conditions are met, the system will automatically trigger the service to generate a new batch of serial numbers stored in the SDK in an asynchronous manner, and ensure that the serial numbers are sufficient when the application retrieves the serial numbers.

[0216] 6. Asynchronous cache switching of daily sequence numbers: When the sequence number generation rule is switched by day, the sequence client will initiate an asynchronous request to the server when the current sequence is consumed to the second one, obtain the sequence of the next day, and delete the sequence n-2 days ago.

[0217] Server:

[0218] 1. Global sequence generation: Serial number generation is based on the sequence rules configured on the serial number control platform and the arrangement of the sequence rules to generate the serial number. The server provides the serial number customer customized rules (fixed characters, letter prefixes and suffixes, date format, enumeration values, and step size settings, etc.) based on the sequence rules configured on the control platform (fixed strings, enumerations, dates, numbers, special characters, etc.) and the sequence designer, and composes different serial numbers according to different rules to meet different scenarios.

[0219] 2. Self-selected sequence generation: The self-selected sequence can be obtained through the common sequence interface or the self-selected sequence interface. The sequences obtained by the two interfaces are not repeated. The self-selected sequence interface is obtained by inputting the specified parameters to obtain the sequence with the last number as the specified parameter.

[0220] 3. Cancel self-selection: that is, cancel the self-selected sequence, which means changing the data status of the selected self-selected sequence so that it can continue to be obtained as a self-selected sequence.

[0221] 4. Server cache: The server cache is to generate a serial number and put it into the cache each time, and obtain it from the cache first when obtaining it. The purpose is to prevent a temporary failure of the database or network during generation. There is always a cached number segment that can provide services to the outside world normally. As long as the database is restored within a cache delivery cycle, it will not affect the availability of the entire sequence service.

[0222] 5. Asynchronous replenishment on the server side: When the consumption of the sequence numbers cached on the server side reaches the threshold, the asynchronous replenishment mechanism on the server side will be triggered to replenish the cached sequence on the server side.

[0223] 6. Sequence number callback: Sequence number callback means that when the sequence number is generated to the next day or next month, the sequence number must be generated from the beginning. The typical usage scenario is that during the batch business transactions at the end of the day, the system often needs to use the current transaction date as a parameter to generate the sequence number. When using the sequence, the business system requires the sequence number to start from the beginning after the next day or to continue the generation of the sequence number of the previous day when executing the next day. The batch execution time at the end of the day is mostly executed every other day. In this scenario, the sequence number needs to be generated according to different dates. The sequence number management center provides a sequence number callback function. The system needs to specify the callback mode when designing the sequence. Through the callback mode, the sequence can be regenerated after a certain time node is specified. After the date is called back, the sequence number can continue to be generated in the order of the last generation. The sequence callback mode includes daily, monthly, and yearly.

[0224] 7. Maximum sequence number processing: Both server-side generated sequence numbers and local generated sequence numbers are supported. When the sequence number reaches the maximum value, it supports reset or error reporting.

[0225] 8. Serial number placeholder assembly: When generating serial numbers, in addition to several fixed-format sequence rules, you can also pass in replacement business information parameters to the serial number center, replace the serial number placeholder according to the needs, and then return the serial number. Currently, the serial number generated by the sequence center is assembled into a serial number according to the arrangement and combination of dates, numbers, enumerations, etc., but if the business application needs to splice the information provided by the business into the serial number when generating the serial number, then the serial number needs to provide placeholder replacement capabilities. When generating the serial number, the application can pass in the replacement business information to the serial number center. When generating the serial number, in addition to the fixed type of serial number, the serial number center also needs to replace the placeholder with the business information before returning it.

[0226] 9. Rule Engine: It is a sequence rule engine object composed of sequence producer (class responsible for sequence production), sequence training object, sequence code and tenant ID. It is mainly responsible for loading sequence rules and generating sequences.

[0227] Figure 8 In the example, the interaction between the control end, server end, client end, and database is as follows:

[0228] 1. The control end calls the server interface through RPC (Remote Procedure Call Protocol) to define rules and design sequences, and saves the configuration parameters to the database.

[0229] Define an RPC interface on the server side for receiving rule definitions and sequence designs.

[0230] In order to adapt to the distributed deployment of the server and the unification of sequence number generation rules, after the sequence design is completed, the basic information, generation rules, and sequence arrangement rules of the sequence are stored in the database. The sequence server will refresh the rules in the local cache regularly.

[0231] 2. The management and control end integrates 4A (Authentication, Authorization, Audit, and Account) for authentication and authority control.

[0232] The authority management module is a shared module for each system, including "system dictionary", "system resources", "authority management", "audit log" and other functional sub-modules, which are used for the allocation and management of multiple roles, multiple modules and multiple authorities in the entire PaaS control console. Among them, "system dictionary" provides the mapping relationship of attribute values ​​displayed on the front-end and back-end pages; "system resources" provides resource information management of organizations, users and page menus; "authority management" manages roles, associates roles with users and authorizes them.

[0233] Specifically, the "system dictionary" contains information such as dictionary code, dictionary name, description, dictionary item name, dictionary item value, dictionary item order, dictionary item description, etc., including dictionary addition, editing, deletion, search, and dictionary item addition, editing, deletion, etc.

[0234] "System Resources-Organization" contains information such as the organization name, organization abbreviation, organization type, description, etc., and includes functions such as adding new organizations, editing, deleting, and searching.

[0235] "System Resources-User Management" contains some basic information such as name, account, company name, department name, gender, status, etc., and includes functions such as adding users, editing, deleting, searching, and viewing details.

[0236] The menu directory level information and the button information corresponding to the menu page in "System Resources-Menu Management" include the functions of adding a new menu directory level, modifying a menu directory level, deleting a menu directory level, adding a new button, editing a button, deleting a button, etc.

[0237] "Authorization Management - Role Management" contains basic information about roles, such as role name, role code, role type, description, etc., including functions such as adding roles, editing, deleting, searching, and authorizing.

[0238] "Authorization Management - Role User" contains the user name, work number, company name, department information and other information of all users under this role, including associated users, deleted users, search and other functions.

[0239] The "Audit Log" contains user operation information such as user functions, buttons, operation results, access IP, operation time, etc., including functional points such as search.

[0240] 3. After the server is started, the sequence configuration parameters and rule engine initialization will be refreshed regularly, and the initialization sequence number will be asynchronously generated and loaded into the server cache.

[0241] Initialization of sequence configuration parameters: When the sequence server is started, it will actively initialize the basic sequence information, generation rules, and sequence arrangement rules, and load the above information from the database into the local JVM cache, which will make sequence generation faster and eliminate the need to obtain rules from the database every time a sequence is generated.

[0242] Sequence rule engine: It is a sequence rule engine object composed of sequence producer (class responsible for sequence production), sequence training object, sequence code and tenant ID. It is mainly responsible for loading sequence rules and generating sequences.

[0243] Sequence rule engine initialization: When the sequence server is started, the basic sequence information, generation rules, and sequence arrangement rules are initialized, and the sequence engine object is created.

[0244] Sequence rule timed refresh: A timed task is configured on the sequence server, with the default parameter being once a minute. The sequence generation rules, sequence arrangement rules, and sequence rule engine in the local cache are refreshed regularly to prevent the server from failing to change in time after the rules on the control side change, thereby generating incorrect sequence rules.

[0245] 4. The client integrates the sequence SDK, and the sequence generation interface can be called to obtain the sequence, and asynchronous replenishment and double-segment caching are possible.

[0246] As an example, the common sequence number distribution diagram is as follows Fig. 9 As shown, after the server is started, each server will cache a number segment that is not repeated with other servers, for example, Fig. 9The server 1 cache number segment is: 1, 2, 3, ..., 5000, and the server 2 cache number segment is: 5001, 5002, 5003, ..., 10000. Each client will obtain the sequence number from the corresponding server and place it in the client cache. The client cache will place the sequence numbers of both ends. When the first segment of sequence numbers is consumed, the second segment of sequence numbers will be started. When the second segment of sequence numbers is consumed to the set threshold, asynchronous replenishment will be triggered, and another segment will be added to the client cache.

[0247] The instructions are as follows:

[0248] 1. When multiple server instances are deployed, the select for update database will be used to pessimistically read the sequence generation record table when generating the sequence. After the current instance is generated, the data in the sequence generation record table will be modified and the lock will be released. When one instance generates a sequence, other instances cannot grab the lock, thereby ensuring the uniqueness of the number segment.

[0249] 2. In the client configuration file, there will be a server address configured to ensure that the serial number is obtained from the same server. The server address can also be filled in multiple times.

[0250] As an example, the sequence number acquisition process is as follows Fig.10 As shown, after the server is started, a batch of common sequence numbers will be generated and placed in the server cache; the business application requests the common sequence number from the client, and the client determines whether there is a sequence (common sequence number segment) in the client cache. If the sequence cache exists, it will first make a replenishment judgment. If the number of remaining common sequence numbers is equal to or lower than the threshold, asynchronous replenishment will be triggered to perform asynchronous replenishment of the sequence. At the same time, the common sequence number is returned to the business application. If the sequence does not exist, the sequence is first obtained from the corresponding server and placed in the client cache, and then the common sequence number is returned to the business application; the client requests the sequence from the corresponding server, and the server first determines whether there are enough common sequence numbers in the server cache. If there are enough, it will directly obtain them from the server cache, otherwise it will be replenished synchronously; after the common sequence number is taken away from the server, it will make a judgment on asynchronous replenishment, and asynchronous replenishment will be performed if the replenishment conditions are met.

[0251] The instructions are as follows:

[0252] 1. When the server starts, it will load the sequence generation rules, and then generate the corresponding number of sequences according to the server cache quantity configuration in the sequence generation rules.

[0253] 2. Relationship between business applications and clients: Business applications refer to specific business applications, and clients refer to serial client SDKs. During the business application code writing phase, the serial client SDK will be integrated in the form of reference pom. When the business application requests a serial number, it will directly request the serial number from the client SDK. If the client SDK does not have a serial number, the client SDK will initiate a request to the server to obtain the serial number, and then return it to the client, and finally return it to the business application through the client interface.

[0254] 3. Sequence acquisition and margin call process

[0255] (1) The client receives a sequence number request;

[0256] (2) Determine whether there is a sequence in your own JVM cache;

[0257] (3) If the sequence exists, the margin call threshold is verified first. If the number of remaining sequences is equal to or lower than the threshold, asynchronous margin call is triggered and the sequence is asynchronously margined. At the same time, the sequence number is returned to the business application;

[0258] (4) If the sequence does not exist, the system first obtains the sequence from the server, then puts it into the client cache, and finally returns the sequence number to the business application;

[0259] 4. Server-side synchronous replenishment: When the server receives the client's request, it will first determine whether its own sequence number is sufficient and whether it can meet the request. If it cannot meet the request, it will generate a sequence number and then return the sequence.

[0260] 5. Asynchronous margin replenishment on the server side:

[0261] (1) After the sequence server returns the sequence to the client, it will perform a threshold judgment on its own cached sequence. If the number of remaining sequence numbers is equal to or lower than the threshold, asynchronous margin call is triggered;

[0262] (2) Scheduled task replenishment: A scheduled task will check the number of sequences in the server cache. If the number of remaining sequences is equal to or lower than the threshold, asynchronous replenishment is triggered.

[0263] As an example, the server can use the snowflake algorithm to generate the serial number. The schematic diagram of the snowflake ID is as follows: Fig.11 As shown, the allocation instructions are:

[0264] Number of digits: In IPv4 environment, 10 digits will be added, and in IPv6 environment, 32 digits will be added. After the expansion, the ID length in IPv4 environment is about 28 digits, and the ID length in IPv6 environment is about 50 digits;

[0265] 4-bit clock ID: The number of clock callbacks allowed within 1ms is 16 (2 to the power of 4)

[0266] 6 reserved bits: The original snowflake algorithm 6-bit machine ID is reserved for subsequent expansion.

[0267] Therefore, the server-side workid allocation is adopted to optimize the snowflake algorithm structure, which can support 5000+ nodes.

[0268] As an example, the relationship between the optional sequence number and the ordinary sequence number is as follows Fig.12 As shown, the server caches a segment for common serial numbers. When a self-selected serial number is requested, the server will generate an additional self-selected serial number, which is not repeated with the common serial number. When the common serial number in the server cache needs to be replenished, the newly generated common serial number is not repeated with the self-selected serial number. The server produces serial numbers that are not repeated by relying on the pessimistic lock of the database. When multiple server instances are deployed, the database pessimistically reads the sequence generation record table using select for update when generating a sequence. After the current instance is generated, the data in the sequence generation record table will be modified and the lock will be released. When one instance generates a sequence, other instances cannot grab the lock, thereby ensuring the uniqueness of the segment.

[0269] As an example, the process of obtaining and selecting serial numbers involved in the serial number management system is as follows: Fig.13 The description is as follows:

[0270] 1. Database table description

[0271] (1) Digital rule auto-increment table: used to record the generation records of digital rules in the sequence, so that the specific position of the digital rule generation can be checked.

[0272] (2) Self-selected filling table: records the filling status of the self-selected sequence, including the code of the self-selected sequence, user input value, generated serial number and other information.

[0273] (3) Self-selected table: The storage location of the selected self-selected sequence information. It will be queried when generating the sequence, and the selected sequence will be removed from the generated sequence.

[0274] 2. When the server generates a common sequence, querying the digital rule auto-increment table has the following two functions:

[0275] (1) In order to obtain the starting position for the generation of this batch of sequences, the value of the current sequence segment in the auto-increment table is increased by 1, which is the starting value of the sequence generated this time.

[0276] (2) To utilize the pessimistic lock of database select for update to prevent the repeated generation of the same number segment.

[0277] 3. The purpose of querying the self-selected table after the sequence is generated is to remove the serial numbers selected by the self-selected table in the generated sequence to prevent duplicate numbers.

[0278] 4. Deploy multiple instances on the server side, and link multiple instances to the same database to ensure the uniformity of sequence generation rules. Perform auto-increment table queries when generating sequences, use pessimistic locks to prevent sequence duplication, and then perform auto-select table queries to remove duplicate serial numbers.

[0279] 5. The purpose of updating the auto-increment record is to record the generation position of the serial number and the current number segment of the sequence, so as to calculate the starting position and the ending position when generating next time, so as to achieve repeated generation of the sequence.

[0280] 6. In the process of selecting the self-selected sequence number, judging whether the self-selected sequence number can be unlocked is to query the self-selected table and remove the selected self-selected sequence. The lock here refers to the database select for update pessimistic lock, which is locked when generating a sequence query digital rule self-increment table.

[0281] In summary, the technical method disclosed in the present invention has the following advantages:

[0282] 1. Application of automatic primary key generation technology: The component uses automatic primary key generation technology to ensure that each data record can automatically obtain a unique identifier without manual intervention. This not only simplifies the data insertion process, but also greatly improves the efficiency and accuracy of data processing. The automatic primary key generation mechanism makes data tracking and management more convenient, and also avoids data problems caused by primary key conflicts.

[0283] 2. Application of distributed sequence algorithm (snowflake algorithm): The component adopts a distributed sequence algorithm, which can generate a globally unique sequence number in a distributed environment. This algorithm ensures that each data record or operation can obtain a unique sequence number between multiple nodes and clusters. This not only helps to uniquely identify data, but also greatly facilitates data integration, sorting and cross-system interaction. The globally unique sequence number enhances the manageability of data and the scalability of the system.

[0284] 3. High availability across clusters and computer rooms: The solution can meet the needs of high availability scenarios such as across clusters and computer rooms. Whether the data is stored in a single cluster or scattered across multiple clusters or computer rooms, this component can provide stable and reliable lock services. This design ensures the stability and fault tolerance of the system under high availability requirements, thereby ensuring the continuous operation of key businesses and reducing the risk of service interruption due to single point failures.

[0285] 4. Guarantee of data consistency: The component ensures data consistency in concurrent operations through complex synchronization mechanisms and globally unique serial numbers. It effectively prevents data conflicts and duplications, and ensures data accuracy and integrity. In a distributed environment, ensuring data consistency is crucial, as it directly affects the reliability of the system and the correctness of the business. Through the powerful data consistency guarantee function of the distributed lock component, we have simplified the complexity of data tracking and positioning, and improved the overall maintainability of the system.

[0286] 5. Flexibility and scalability: The components are designed as modular and scalable architectures that can easily adapt to different business needs and system scales. This flexibility allows the components to be easily integrated into existing systems while being customized and expanded according to business needs. As the business develops and the system scales, the distributed lock components can seamlessly adapt to these changes without large-scale changes or reconstruction.

[0287] With the above Figures 1 to 3 Corresponding to the sequence number acquisition method provided in the embodiment, the present disclosure also provides another sequence number acquisition device. Figures 1 to 3 The serial number acquisition method provided in the embodiment corresponds to the serial number acquisition method, so the implementation of the serial number acquisition method is also applicable to the serial number acquisition device provided in the embodiment of the present disclosure, and will not be described in detail in the embodiment of the present disclosure.

[0288] Fig.14 It is a structural diagram of a serial number acquisition device shown in the fourteenth embodiment of the present disclosure.

[0289] like Fig.14 As shown, the serial number obtaining device 1400 includes: a first receiving module 1410 , a first sending module 1420 and a first processing module 1430 .

[0290] The first receiving module 1410 is used to receive a common sequence number acquisition request sent by a business application;

[0291] The first sending module 1420 is used to send a first number of ordinary sequence numbers requested by the ordinary sequence number acquisition request to the service application according to the ordinary sequence number segment in the client cache when the ordinary sequence number segment in the client cache meets the preset condition;

[0292] The first processing module 1430 is used to, when the ordinary sequence number segment in the client cache does not meet the preset conditions, execute in parallel to send a first number of ordinary sequence numbers requested by an ordinary sequence number acquisition request to a business application based on the ordinary sequence number segment in the client cache, and send a segment acquisition request for requesting to obtain the first number segment to a corresponding server, so as to add the acquired first number segment to the client cache.

[0293] As a possible implementation method of the embodiment of the present disclosure, the client cache includes a common sequence number consumption segment currently consumed and at least one common sequence number backup segment waiting for backup, and the preset condition is that the number of common sequence number backup segments in the client cache is not less than a first threshold, or the number of common sequence numbers in the common sequence number consumption segment is not less than a second threshold.

[0294] As a possible implementation of the embodiment of the present disclosure, the first number segment added to the client cache is a new common sequence number standby number segment in the client cache, and the consumption order of the first number segment is lower than the consumption order of the common sequence number standby number segment existing in the client cache;

[0295] After the common serial number consumption number segment is consumed, the common serial number backup number segment with the earliest consumption order in the common serial number backup number segment is activated.

[0296] As a possible implementation of the embodiment of the present disclosure, the above-mentioned device further includes:

[0297] The second receiving module is used to receive a self-selected sequence number acquisition request sent by a business application;

[0298] A second sending module is used to send a self-selected serial number acquisition request to a corresponding server to obtain a first self-selected serial number including the self-selected characters carried in the self-selected serial number acquisition request from the corresponding server;

[0299] The third sending module is used to send the first self-selected sequence number to the business application.

[0300] As a possible implementation of the embodiment of the present disclosure, the first self-selected sequence number is multiple; the above device also includes:

[0301] A fourth sending module, configured to send a selection request to a corresponding server end according to a selection operation of selecting a second self-selected sequence number from a plurality of first self-selected sequence numbers according to a business application; wherein the selection request carries the second self-selected sequence number;

[0302] The third receiving module is used to receive the selected response sent by the corresponding server, so as to feed back the execution result of the selected operation to the business application based on the selected response.

[0303] The sequence number acquisition device of the disclosed embodiment receives a common sequence number acquisition request sent by a business application; when the common sequence number segment in the client cache meets the preset conditions, the first number of common sequence numbers requested by the common sequence number acquisition request is sent to the business application according to the common sequence number segment in the client cache; when the common sequence number segment in the client cache does not meet the preset conditions, the first number of common sequence numbers requested by the common sequence number acquisition request is sent to the business application according to the common sequence number segment in the client cache, and a segment acquisition request for requesting to obtain the first segment is sent to the corresponding server in parallel, so as to supplement the obtained first segment to the client cache. Thus, by storing a certain number of sequence numbers in the client cache of the client, the number of requests to the server can be significantly reduced, and the request pressure on the server can be reduced. By sending sequence numbers to business applications based on the sequence numbers stored in the client cache, the response speed can be improved. By asynchronously replenishing the common sequence number segments in the client cache, the seamless connection of sequence number resources can be achieved, and waiting or blocking caused by exhaustion of sequence number resources in the client cache can be avoided.

[0304] With the above Figures 4 to 7 Corresponding to the sequence number acquisition method provided in the embodiment, the present disclosure also provides another sequence number acquisition device. Figures 4 to 7 The serial number acquisition method provided in the embodiment corresponds to the serial number acquisition method, so the implementation of the serial number acquisition method is also applicable to the serial number acquisition device provided in the embodiment of the present disclosure, and will not be described in detail in the embodiment of the present disclosure.

[0305] Fig.15 It is a structural diagram of the serial number acquisition device shown in the fifteenth embodiment of the present disclosure.

[0306] like Fig.15 As shown, the serial number obtaining device 1500 includes: a fourth receiving module 1510 , a second processing module 1520 and a third processing module 1530 .

[0307] The fourth receiving module 1510 is used to receive a number segment acquisition request sent by a corresponding client for requesting to acquire the first number segment;

[0308] The second processing module 1520 is used to query the digital rule self-increment table for recording the generation records of the ordinary sequence numbers and the self-selection table for recording the generation records of the self-selected sequence numbers in the database when the number of ordinary sequence numbers in the server cache does not meet the number of ordinary sequence numbers requested by the number segment acquisition request, so as to supplement the ordinary sequence numbers in the server cache according to the digital rule self-increment table and the self-selection table, so that the number of ordinary sequence numbers in the server cache after supplementation meets the number of ordinary sequence numbers requested by the number segment acquisition request;

[0309] The third processing module 1520 is used to generate a second number of first number segments requested by the number segment acquisition request according to the supplemented common sequence number in the server cache, and send the second number of first number segments to the corresponding client.

[0310] As a possible implementation of the embodiment of the present disclosure, the above-mentioned device further includes:

[0311] The fourth processing module is used to load the data rules and sequence rules configured by the management and control end from the database in response to the server starting, and query the digital rule auto-increment table in the database;

[0312] The fifth processing module is used to generate a second number segment according to at least one of the data rule, the sequence rule and the digital rule self-increment table, and store the second number segment in the server cache.

[0313] As a possible implementation of the embodiment of the present disclosure, the second processing module 1520 is further configured to:

[0314] According to the digital rule self-increment table and the self-selection table, the second number segment in the server cache is replenished so that the number of ordinary serial numbers in the second number segment after replenishment meets the number of ordinary serial numbers requested by the number segment acquisition request.

[0315] As a possible implementation of the embodiment of the present disclosure, the second processing module 1520 is further configured to:

[0316] According to the generation record of the common serial number recorded in the digital rule self-increment table, the starting value and step length of the common serial number to be generated are determined;

[0317] Generate a common sequence number according to the starting value and step length of the common sequence number to be generated;

[0318] According to the optional table, determine whether the generated common serial number is the same as any selected optional serial number that is not marked with a filter mark and recorded in the optional table;

[0319] The non-duplicate common serial numbers are added to the second number segment, so that the number of common serial numbers in the second number segment after the replenishment satisfies the number of common serial numbers requested by the number segment acquisition request.

[0320] As a possible implementation of the embodiment of the present disclosure, the above-mentioned device further includes:

[0321] An updating module, used for updating the digital rule auto-increment table according to the common serial number with no duplicate numbers added to the second number segment;

[0322] The marking module is used to mark and filter the selected self-selected serial numbers that are not marked and filtered in the self-selected list and have the same number as the generated common serial number.

[0323] As a possible implementation of the embodiment of the present disclosure, the fifth processing module is further configured to:

[0324] When the digital rule auto-increment table is empty, the second number segment is generated according to the data rule and sequence rule;

[0325] When the digital rule self-increment table is not empty, the starting value and step size of the ordinary serial number to be generated are determined according to the generation record of the ordinary serial number recorded in the digital rule self-increment table, so as to generate the second number segment according to the starting value and step size of the ordinary serial number to be generated.

[0326] As a possible implementation of the embodiment of the present disclosure, the above-mentioned device further includes:

[0327] The first query module is used to query the optional table in the database to delete the common serial numbers in the second number segment that are the same as any selected optional serial number recorded in the optional table but not marked with filtering.

[0328] As a possible implementation of the embodiment of the present disclosure, the above-mentioned device further includes:

[0329] A determination module, used to determine whether the number of common sequence numbers in the server cache meets a third threshold;

[0330] The sixth processing module is used to query the digital rule auto-increment table and the self-selection table in the database when the number of ordinary serial numbers in the server cache does not meet the third threshold, so as to generate ordinary serial numbers according to the digital rule auto-increment table and the self-selection table to supplement the server cache, so that the number of ordinary serial numbers in the server cache after supplementation is the set number.

[0331] As a possible implementation of the embodiment of the present disclosure, the above-mentioned device further includes:

[0332] A fifth receiving module, used to receive a self-selected sequence number acquisition request sent by a corresponding client;

[0333] The seventh processing module is used to query the digital rule self-increment table and the self-selected place-filling table in the database for recording the place-filling information of the self-selected serial number, so as to generate the first self-selected serial number containing the self-selected characters carried in the self-selected serial number acquisition request according to the digital rule self-increment table and the self-selected place-filling table;

[0334] The eighth processing module is used to send the first self-selected sequence number to the corresponding client and update the self-selected list according to the first self-selected sequence number.

[0335] As a possible implementation of the embodiment of the present disclosure, the seventh processing module is further configured to:

[0336] Query the digital rule self-increment table to determine the starting value of the self-selected serial number to be generated according to the generation record of the common serial number recorded in the digital rule self-increment table;

[0337] Query the self-selected filling table to determine the filling value of the self-selected serial number to be generated according to the filling record of the self-selected serial number recorded in the self-selected filling table;

[0338] According to the starting value and the filling value of the self-selected serial number to be generated, a first self-selected serial number including the self-selected characters carried in the self-selected serial number acquisition request is generated.

[0339] As a possible implementation of the embodiment of the present disclosure, the above-mentioned device further includes:

[0340] A sixth receiving module, used to receive a selection request sent by a corresponding client;

[0341] A first query module is used to query the digital rule self-increment table to determine whether the second self-selected sequence number carried in the selected request exists in the digital rule self-increment table;

[0342] The second query module is used for querying the self-selection table when the second self-selection sequence number does not exist in the digital rule self-increment table, and when the second self-selection sequence number recorded in the self-selection table is not selected, sending a selection response indicating successful selection to the corresponding client, and marking the second self-selection sequence number recorded in the self-selection table as selected;

[0343] The fifth sending module is used to send a selection response indicating a selection failure to the corresponding client when there is a second self-selected sequence number in the digital rule self-increment table.

[0344] The serial number acquisition device of the embodiment of the present disclosure receives a number segment acquisition request sent by a corresponding client to request to obtain a first number segment; when the number of ordinary serial numbers in the server cache of the server does not meet the number of ordinary serial numbers requested by the number segment acquisition request, queries a digital rule self-increment table for recording the generation records of ordinary serial numbers and a self-selected table for recording the generation records of self-selected serial numbers in the database, so as to supplement the ordinary serial numbers in the server cache according to the digital rule self-increment table and the self-selected table, so that the number of ordinary serial numbers in the supplemented server cache meets the number of ordinary serial numbers requested by the number segment acquisition request; generates a second number of first number segments requested by the number segment acquisition request according to the supplemented ordinary serial numbers in the server cache, and sends the second number of first number segments to the corresponding client, thereby, by generating ordinary serial numbers according to the digital rule self-increment table and the self-selected table to supplement the server cache when the number of ordinary serial numbers in the server cache of the server does not meet the number of ordinary serial numbers requested by the number segment acquisition request, the uniqueness of the ordinary serial numbers in the supplemented server cache can be effectively guaranteed.

[0345] In an exemplary embodiment, an electronic device is also provided.

[0346] Among them, electronic equipment includes:

[0347] processor;

[0348] a memory for storing processor-executable instructions;

[0349] The processor is configured to execute instructions to implement the serial number acquisition method proposed in any of the aforementioned embodiments.

[0350] As an example, Fig.16 is a schematic diagram of the structure of an electronic device 1600 shown in an exemplary embodiment of the present disclosure, such as Fig.16 As shown, the electronic device 1600 may further include:

[0351] The memory 1610 and the processor 1620, a bus 1630 connecting different components (including the memory 1610 and the processor 1620), the memory 1610 stores a computer program, and when the processor 1620 executes the program, the serial number acquisition method described in the embodiment of the present disclosure is implemented.

[0352] Bus 1630 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0353] The electronic device 1600 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 1600, including volatile and non-volatile media, removable and non-removable media.

[0354] Memory 1610 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 1640 and / or cache memory 1650. Server 1600 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 1660 may be used to read and write non-removable, non-volatile magnetic media ( Fig.16 not shown, often referred to as a "hard drive packager"). Although Fig.16Not shown in the figure, a disk driver package for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk driver package for reading and writing a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each driver package can be connected to the bus 1630 via one or more data medium interfaces. The memory 1610 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.

[0355] A program / utility 1680 having a set (at least one) of program modules 1670 may be stored, for example, in the memory 1610, such program modules 1670 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 1670 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0356] The electronic device 1600 may also communicate with one or more external devices 1690 (e.g., keyboard, pointing device, display 1691, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1600, and / or may communicate with any device that enables the electronic device 1600 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via an input / output (I / O) interface 1692. Furthermore, the electronic device 1600 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) via a network adapter 1693. As shown, the network adapter 1693 communicates with other modules of the electronic device 1600 via a bus 1630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1600, including but not limited to: microcode, device driver package, redundant processing unit, external disk driver package array, RAID system, tape driver package, and data backup storage system, etc.

[0357] The processor 1620 executes various functional applications and data processing by running the programs stored in the memory 1610 .

[0358] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the serial number acquisition method of the embodiment of the present disclosure, and will not be repeated here.

[0359] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to complete the serial number acquisition method proposed in any of the above embodiments. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0360] In an exemplary embodiment, a computer program product is also provided, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the serial number acquisition method proposed in any of the above embodiments is implemented.

[0361] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0362] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for obtaining a sequence number, characterized in that: Applied to the client, including: Receive common serial number acquisition requests sent by business applications; When the common sequence number segment in the client cache meets a preset condition, sending the first number of common sequence numbers requested by the common sequence number acquisition request to the service application according to the common sequence number segment in the client cache; When the ordinary sequence number segments in the client cache do not meet the preset conditions, the ordinary sequence number acquisition request is sent to the business application according to the ordinary sequence number segments in the client cache, and a segment acquisition request for requesting the first segment is sent to the corresponding server in parallel, so as to add the acquired first segment to the client cache.

2. The method according to claim 1, characterized in that The client cache includes a common sequence number consumption segment currently being consumed and at least one common sequence number backup segment waiting to be used as a backup. The preset condition is that the number of common sequence number backup segments in the client cache is not less than a first threshold, or the number of common sequence numbers in the common sequence number consumption segment is not less than a second threshold.

3. The method according to claim 2, characterized in that The first number segment added to the client cache is a new common sequence number standby number segment in the client cache, and the consumption order of the first number segment is lower than the consumption order of the common sequence number standby number segment existing in the client cache; After the common sequence number consumption segment is consumed, the common sequence number backup segment with the earliest consumption order among the common sequence number backup segments is activated.

4. The method according to claim 1, characterized in that The method further comprises: Receiving a self-selected sequence number acquisition request sent by the business application; Sending the self-selected serial number acquisition request to the corresponding server to obtain a first self-selected serial number including the self-selected characters carried in the self-selected serial number acquisition request from the corresponding server; Sending the first self-selected sequence number to the business application.

5. The method according to claim 4, characterized in that The first self-selected sequence number is multiple; the method further includes: According to the selection operation of the business application selecting a second self-selected sequence number from the plurality of the first self-selected sequence numbers, sending a selection request to the corresponding server; wherein the selection request carries the second self-selected sequence number; A selection response sent by the corresponding server is received, so as to feed back the execution result of the selection operation to the business application based on the selection response.

6. A method for obtaining a sequence number, characterized in that: Applied to the server, including: Receiving a number segment acquisition request sent by a corresponding client for requesting to acquire a first number segment; In the case where the number of ordinary sequence numbers in the server cache of the server does not satisfy the number of ordinary sequence numbers requested by the number segment acquisition request, querying a digital rule self-increment table for recording generation records of ordinary sequence numbers and a self-selection table for recording generation records of self-selected sequence numbers in a database, so as to supplement the ordinary sequence numbers in the server cache according to the digital rule self-increment table and the self-selection table, so that the number of ordinary sequence numbers in the server cache after supplementation satisfies the number of ordinary sequence numbers requested by the number segment acquisition request; According to the supplemented common serial numbers in the server cache, a second number of the first number segments requested by the number segment acquisition request is generated, and the second number of the first number segments are sent to the corresponding client.

7. The method according to claim 6, characterized in that The method further comprises: In response to the server being started, the data rules and sequence rules configured by the management and control end are loaded from the database, and the digital rule auto-increment table in the database is queried; A second number segment is generated according to at least one of the data rule, the sequence rule and the digital rule self-increment table, and the second number segment is stored in the server cache.

8. The method according to claim 7, characterized in that The method of supplementing the common sequence numbers in the server cache according to the digital rule self-increment table and the self-selection table so that the number of the common sequence numbers in the server cache after supplementation satisfies the number of the common sequence numbers requested by the number segment acquisition request includes: According to the digital rule self-increment table and the self-selection table, the second number segment in the server cache is replenished so that the number of ordinary serial numbers in the second number segment after replenishment meets the number of ordinary serial numbers requested by the number segment acquisition request.

9. The method according to claim 8, characterized in that The replenishing of the second number segment in the server cache according to the digital rule self-increment table and the self-selection table, so that the number of common sequence numbers in the second number segment after replenishment meets the number of common sequence numbers requested by the number segment acquisition request, includes: Determine the starting value and step length of the common serial number to be generated according to the generation record of the common serial number recorded in the digital rule self-increment table; Generate a common sequence number according to the starting value and step size of the common sequence number to be generated; According to the self-selection table, determining whether the generated common serial number is the same as any selected self-selection serial number recorded in the self-selection table that is not marked with filtering; The non-duplicate common serial numbers are added to the second number segment, so that the number of common serial numbers in the second number segment after the replenishment satisfies the number of common serial numbers requested by the number segment acquisition request.

10. The method according to claim 9, characterized in that The method further comprises: updating the digital rule self-increment table according to the common serial numbers that are not repeated and are added to the second number segment; The selected self-selected serial numbers recorded in the self-selected table that are not marked with filtering marks and have the same number as the generated common serial number are marked with filtering marks.

11. The method according to claim 7, characterized in that Generating the second number segment according to at least one of the data rule, the sequence rule, and the digital rule self-increment table includes: When the digital rule auto-increment table is empty, generating the second number segment according to the data rule and the sequence rule; When the digital rule self-increment table is not empty, the starting value and step size of the ordinary serial number to be generated are determined according to the generation record of the ordinary serial number recorded in the digital rule self-increment table, so as to generate the second number segment according to the starting value and step size of the ordinary serial number to be generated.

12. The method according to claim 7, characterized in that Before storing the second number segment in the server cache, the method further includes: The self-selected table in the database is queried to delete the common serial numbers in the second number segment that are the same as any selected self-selected serial number recorded in the self-selected table but not marked with filtering.

13. The method according to claim 6, characterized in that After sending the second number of the first number segments to the corresponding client, the method further includes: Determining whether the number of common sequence numbers in the server cache meets a third threshold; When the number of ordinary serial numbers in the server cache does not meet the third threshold, the digital rule auto-increment table and the self-selection table in the database are queried to generate ordinary serial numbers based on the digital rule auto-increment table and the self-selection table to supplement the server cache, so that the number of ordinary serial numbers in the server cache after supplementation is the set number.

14. The method according to claim 6, characterized in that The method further comprises: Receiving a self-selected sequence number acquisition request sent by the corresponding client; Query the digital rule self-increment table and the self-selected place-filling table in the database for recording the place-filling information of the self-selected serial number, so as to generate a first self-selected serial number including the self-selected characters carried in the self-selected serial number acquisition request according to the digital rule self-increment table and the self-selected place-filling table; The first self-selected sequence number is sent to the corresponding client, and the self-selected list is updated according to the first self-selected sequence number.

15. The method according to claim 14, characterized in that The querying of the digital rule self-increment table and the self-selected place-filling table in the database to generate a first self-selected serial number containing the self-selected characters carried in the self-selected serial number acquisition request according to the digital rule self-increment table and the self-selected place-filling table includes: Query the digital rule self-increment table to determine the starting value of the self-selected serial number to be generated according to the generation record of the common serial number recorded in the digital rule self-increment table; The self-selected place-filling table is queried to determine the place-filling value of the self-selected serial number to be generated according to the place-filling record of the self-selected serial number recorded in the self-selected place-filling table; According to the starting value and the filling value of the self-selected serial number to be generated, a first self-selected serial number including the self-selected characters carried in the self-selected serial number acquisition request is generated.

16. The method according to claim 6, characterized in that The method further comprises: Receiving a selection request sent by the corresponding client; Query the digital rule self-increment table to determine whether the second self-selected sequence number carried in the selected request exists in the digital rule self-increment table; If the second self-selected sequence number does not exist in the digital rule self-increment table, query the self-selected table, and if the second self-selected sequence number recorded in the self-selected table is not selected, send a selection response indicating successful selection to the corresponding client, and mark the second self-selected sequence number recorded in the self-selected table as selected; In the case where the second self-selected sequence number exists in the digital rule self-increment table, a selection response indicating a selection failure is sent to the corresponding client.

17. A serial number management system, characterized in that: Including the control end, database, client, and server, The control end is used to configure data rules and sequence rules, and store the configured data rules and sequence rules in the database; The client is used to execute the method according to any one of claims 1 to 5; The server is used to execute the method as described in any one of claims 6-16; wherein, in the case where multiple server instances are deployed on the server, each server instance is used to execute the method as described in any one of claims 6-16, and the ordinary serial number in any of the server instances is not repeated with the ordinary serial numbers in each of the server instances other than the server instance, and any of the server instances uses a database pessimistic lock to read the generation record of the ordinary serial number recorded in the digital rule auto-increment table when querying the digital rule auto-increment table in the database for recording the generation record of the ordinary serial number.