CN111163186A - ID generation method, device, equipment and storage medium - Google Patents

ID generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN111163186A
CN111163186A CN201911416128.5A CN201911416128A CN111163186A CN 111163186 A CN111163186 A CN 111163186A CN 201911416128 A CN201911416128 A CN 201911416128A CN 111163186 A CN111163186 A CN 111163186A
Authority
CN
China
Prior art keywords
target service
service
target
server
subinterval
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911416128.5A
Other languages
Chinese (zh)
Other versions
CN111163186B (en
Inventor
叶进
周同胜
刘辉
朱礼勇
许方祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Leading Technology Co Ltd
Original Assignee
Nanjing Leading Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Leading Technology Co Ltd filed Critical Nanjing Leading Technology Co Ltd
Priority to CN201911416128.5A priority Critical patent/CN111163186B/en
Publication of CN111163186A publication Critical patent/CN111163186A/en
Application granted granted Critical
Publication of CN111163186B publication Critical patent/CN111163186B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames
    • H04L61/3015Name registration, generation or assignment
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5046Resolving address allocation conflicts; Testing of addresses

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses an ID generation method, an ID generation device, ID generation equipment and a storage medium, wherein the ID generation method is executed by a registration center and comprises the following steps: responding to the ID segment generation request of the target server, and determining a target service party to which the target server belongs; and according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval, allocating a target service ID subinterval for the target server from the target service ID interval, wherein the target service ID subinterval is used for allocating an ID number for the generated data by the target server. The embodiment of the invention realizes the targeted allocation of the service subintervals for the server according to the affiliated business party, improves the utilization rate of allocating the ID intervals for the server and avoids the waste of the ID intervals; and by distributing the ID interval for the server, the phenomenon that the generation of the data ID between the servers generates interference is avoided, and the efficiency of generating the ID for the data is improved.

Description

ID generation method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of internet, in particular to an ID generation method, an ID generation device, ID generation equipment and a storage medium.
Background
With the development of internet technology, a large amount of data is generated when a background server performs business processing, and therefore, it is generally necessary to generate a unique ID (Identity Document) to distinguish data brought by different operations, for example, a unique ID number is generated as an order identifier to distinguish orders submitted by different users.
A commonly used method for ID identification of data is to use UUID (universal unique Identifier) which includes 32 16 digits, and 36 characters which are divided into five segments by a hyphen number and have a form of 8-4-4-4-12. The UUID is generally composed of a current date and time, a clock sequence, and a globally unique machine identification number, and unique identification of generated data is achieved. Or the generation of the ID is realized by dividing the namespace, specifically, the ID field can be divided into multiple segments to separately represent information such as machines and time, and the division mode can ensure that the IDs generated by any machine on any data center platform are different at any time.
However, UUIDs are too long to be easily stored, are not friendly as primary keys and indexes when being stored in a warehouse, and affect the performance of the computer program. And no identity mark exists, so that the readability is poor. The ID generation mode by dividing the name space forces the server time to be dependent, and if the server time is asynchronous or the time callback phenomenon occurs, the ID is repeated.
Disclosure of Invention
Embodiments of the present invention provide an ID generation method, apparatus, device, and storage medium, which implement improving the efficiency of generating an ID number for data and reducing the pressure of assigning an ID number to a registry by allocating an ID segment in advance to an execution node that sends an ID segment generation request.
In a first aspect, an embodiment of the present invention provides an ID generation method, executed by a registration center, including:
responding to the ID segment generation request of the target server, and determining a target service party to which the target server belongs;
and according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval, allocating a target service ID subinterval for the target server from the target service ID interval, wherein the target service ID subinterval is used for allocating an ID number for the generated data by the target server.
In a second aspect, an embodiment of the present invention provides an ID generation method, executed by a server in a service side, including:
sending an ID segment generation request to a registration center, and acquiring a target service ID subinterval determined by the registration center; wherein the target service ID subinterval is determined by: determining a target service party to which a target server belongs; distributing a target service ID subinterval for a target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval;
and distributing an ID number for the generated data according to the target service ID subinterval.
In a third aspect, an embodiment of the present invention further provides an ID generation apparatus, executed by a registration center, including:
the target service party determining module is used for responding to the ID segment generation request of the target server and determining the target service party to which the target server belongs;
and the target service ID subinterval allocation module is used for allocating a target service ID subinterval for the target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval, and is used for allocating an ID number for the generated data by the target server.
In a fourth aspect, an embodiment of the present invention further provides an ID generation apparatus, executed by a server in a service side, including:
the target service ID subinterval acquisition module is used for sending an ID segment generation request to the registration center and acquiring a target service ID subinterval determined by the registration center; wherein the target service ID subinterval is determined by: determining a target service party to which a target server belongs; distributing a target service ID subinterval for a target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval;
and the ID distribution module is used for distributing an ID number for the generated data according to the target service ID subinterval.
In a fifth aspect, an embodiment of the present invention further provides a computer device, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the ID generation method according to any embodiment of the present invention.
In a sixth aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements an ID generation method according to any embodiment of the present invention.
The embodiment of the invention judges the target service party to which the target server generates the request for sending the ID segment based on the target server, and allocates the target service subinterval for the target server from different target service ID intervals according to the difference of the target service party. The server is allocated with the service subintervals in a targeted manner according to the affiliated business party, the utilization rate of allocating the ID intervals to the server is improved, and the waste of the ID intervals is avoided; and by distributing the ID interval for the server, the phenomenon that the generation of the data ID between the servers generates interference is avoided, and the efficiency of generating the ID for the data is improved.
Drawings
FIG. 1 is a flowchart of an ID generation method according to a first embodiment of the present invention;
FIG. 2 is a flowchart of an ID generation method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an ID generation apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an ID generation apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer device in the fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Fig. 1 is a flowchart of an ID generation method in a first embodiment of the present invention, which is applicable to a case where a server in a service party is allocated ID subintervals according to the service party to which the server belongs, so that the server allocates IDs for generated data according to the ID subintervals. The method may be performed by an ID generation apparatus, performed by a registry, and the apparatus may be implemented in software and/or hardware and may be configured in a computer device, for example, the computer device may be a device with communication and computing capabilities, such as a backend server. As shown in fig. 1, the method specifically includes:
step 101, responding to the ID segment generation request of the target server, and determining the target service party to which the target server belongs.
The registry is a service for acquiring the property of the server and further matching the generated data in the server with the ID number, and exemplarily, the registry may select redis, zookeeper and the like with distributed and cluster characteristics so as to ensure the stability of server management. The target server is a server which is provided with an ID generator to complete a certain service, and after the server generates certain service data, an ID number needs to be generated for the service data to uniquely identify the service data. For example, the service a is deployed in a server cluster formed by three servers, where a server number one generates a certain order, and an ID number needs to be generated for the order, then the server is a target server. The ID segment generation request refers to a request initiated by a target server needing to match the ID number for data generated by the target server, and the request indicates that the target server requests to allocate a segment of ID number set for the data generated by the target server to match the ID number. For example, when the server first starts generating data and needs to match an ID number for the generating data, an ID segment generation request needs to be sent to the registry. The target service party refers to a target service function party corresponding to the service data generated by the target server, and optionally, the target service party may be deployed in a cluster formed by a plurality of servers, and the cluster jointly completes the service function, so as to ensure the efficiency of completing the service function.
Specifically, when receiving an ID segment generation request of a target server, the registry determines a completed service function according to information carried in the request sent by the target server, that is, determines a target service party corresponding to the server. Illustratively, when the target server sends a request to the registry, the information of the service party to which the target server belongs is extracted according to the local information in the server, and the information of the service party is sent to the registry together with the request, so that when the registry acquires the ID segment generation request, the target service party to which the target server belongs can be determined.
And 102, allocating a target service ID subinterval for the target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval, wherein the target service ID subinterval is used for allocating an ID number for the generated data by the target server.
The target service ID interval refers to a corresponding ID value interval which is allocated by the registration center for different service parties, and an ID segment generation request sent by a server corresponding to the service requests allocation in the service ID interval. Illustratively, when a service party is newly added, a service ID interval is pre-divided for the service party, so that the service party is allocated with an ID segment when a server of the subsequent service party sends an ID segment generation request. The currently registered ID information is ID information that the server under the service currently has registered in the target service ID interval, and includes ID interval information already allocated to the server in the target service ID interval. The target service ID subinterval refers to an ID interval assigned to a target server identified in the target service ID interval for the server to provide a range of ID values for the data assignment ID it generates. The ID number is an ID value determined in a subinterval by data generated for a target service ID subinterval after the target server determines the subinterval.
Specifically, a target service ID interval corresponding to the service party information is found according to the determined service party information, ID interval information already registered in the target service ID interval is determined, and ID interval information not registered is determined. A target service ID subinterval assigned to the target server is determined from the determined unregistered ID interval information. Optionally, a subinterval including at least two ID numbers is randomly selected from the unregistered ID intervals, and is allocated to the target server as a target service ID subinterval. Illustratively, when an ID segment generation request of the server a is received, it is determined that a target service party corresponding to the server a is a billing service party, and a service ID interval corresponding to the billing service party is determined to be 500 plus 1000 in information stored in the registration center, which indicates that ID assignment of generated data related to the billing service party is all in the service ID interval, thereby avoiding ID number repetition caused by ID value determination confusion among different services. And determining that the allocated ID interval in the service ID interval is 500-600, selecting the target service ID sub-interval allocated to the server A in the unallocated ID interval 601-1000. The server a determines a target service ID sub-interval for assigning ID numbers to the data it generates, which may be assigned sequentially according to the size of the value of the ID numbers in the target service ID sub-interval.
Different target service ID intervals are distributed for different service parties, disorder of ID values among services is avoided, the service parties can be judged according to the ID values of data, and data management is improved. According to the information in the target service ID interval corresponding to the server, the target service ID subinterval is distributed to the server, on one hand, the efficiency of distributing the ID number to the generated data is improved by distributing the ID subinterval, the work of distributing the ID number to the single data is transferred to the server, and the pressure of a registration center is reduced; and on the other hand, the subintervals are determined in the corresponding service ID intervals according to the service party corresponding to the server, so that the ID number distribution among the services is not interfered with each other, and the problem that the registration center is stressed too much to influence the ID distribution requests of other services due to frequent ID distribution of a certain service request is avoided. According to the embodiment of the invention, the work of ID number allocation is deployed on different servers, and the servers only need to apply for the ID subintervals from the registration center, so that frequent requests from the servers to the registration center are avoided, and the pressure of the registration center is reduced; and the ID distribution can be clustered and distributed, so that the efficiency and accuracy of distributing the ID for generating data are improved, the disorder of ID distribution is avoided, the distributed ID number has the globally unique characteristic, and the data can be conveniently stored as an index.
In a possible embodiment, optionally, allocating a target service ID subinterval for a target server from a target service ID interval according to the target service ID interval of the target service party and current registered ID information of the target service ID interval, includes:
determining the maximum value of the current registered ID according to the current registered ID information of the target service ID interval, and determining the starting point value of a target service ID subinterval;
determining the length of a corresponding preset service ID subinterval according to the target service party;
and determining the target service ID subinterval according to the starting value of the target service ID subinterval and the length of a preset service ID subinterval.
The preset service ID subinterval length refers to the number of ID numbers of subintervals allocated to the server, for example, the preset service ID subinterval length is 1000, which means that the number of ID numbers in the target service ID subinterval allocated to the server is 1000.
Specifically, on the basis of the above technical solution, the maximum value of the currently registered ID in the target service ID interval corresponding to the target server is determined, a result of adding 1 to the maximum value of the currently registered ID is used as the starting point value of the target service ID subinterval, and a result of adding 1 to the maximum value of the currently registered ID indicates the minimum value of the unregistered ID numbers in the target service ID interval. The method and the device realize the allocation of the ID values to the servers according to the monotonically increasing sequence and ensure that the generated data on the servers are allocated with the ID values according to the monotonically increasing characteristic. And determining the length of a corresponding preset service ID subinterval according to a target service party to which the server belongs, adding a starting point value of the target service ID subinterval, and determining a final point value of the target service ID subinterval, thereby determining the range of the target service ID subinterval and distributing the range to the target server.
The length of the service ID subinterval allocated to the server is determined according to the service party, so that the number of IDs allocated to different servers can be conveniently adjusted according to the service adaptability of the service party, and for the service party with large service volume, a longer ID subinterval can be allocated to the server, thereby avoiding the problem that the server frequently initiates an ID segment generation request to a registration center to influence the efficiency of the registration center; for the service side with small service volume, a shorter ID sub-interval can be allocated to the server, so that the occupation of ID resources is avoided.
On the basis of the foregoing technical solutions, optionally, before determining a target service party to which the target server belongs in response to the ID segment generation request of the target server, the method further includes:
and determining a service ID interval of the service party according to the service throughput of the service party.
The service throughput refers to the number of data successfully transmitted in a unit time of a service party, and optionally, the service throughput of the service party may be identified by using an average throughput of the service party over a period of time.
Specifically, the service throughput of each service party is predetermined, and service ID intervals with different ranges are allocated to different service parties according to the size of the service throughput. Illustratively, there are three parties registered in the registry: the throughputs of the three service parties are respectively service C, service B and service A from large to small, the service ID interval predetermined for the service C is 1-10000, the service ID interval determined for the service B is 10001-15000, and the service ID interval determined for the service A is 15001-16000. Service ID intervals are pre-allocated to service parties according to service throughput, mutual interference and confusion of ID allocation among services are avoided, and the accuracy of ID allocation for generated data is improved. Here, the relationship between the service throughput and the size of the service ID interval is not limited, and the service ID interval range may be set according to the actual service requirement.
In a possible embodiment, optionally, the method further includes:
and sending the association relation between the service party and the service ID interval to a server in the existing service party for indicating the server to check the service party.
Specifically, the information of the service ID interval allocated to each service party is stored in the registration center, and the registration center sends the stored information of the service party and the service ID interval corresponding to the service party to all subordinate servers, so that the servers verify the identities of the servers according to the locally stored information of the subordinate target service parties, and determine whether the servers belong to the service parties registered in the registration center. Optionally, the association relationship between the service party and the service ID interval is sent to a server in the existing service party according to a preset time interval, so as to instruct the server to verify the service party. For example, the registry sends the association between the service party and the service ID interval to all servers every minute. The server may verify its own identity according to the association relationship sent by the registration center, so as to verify the update condition of the service party of the registration center in time, for example, after the registration center deletes an original service party, the server to which the original service party belongs does not receive the update information, and the server may verify its own identity according to whether the information of the target service party exists in the association relationship periodically issued by the registration center. The accuracy of the server for sending the ID segment generation request to the registration center is improved, and the efficiency of the registration center for issuing the ID segment is improved.
In a possible embodiment, optionally, the method further includes: the incidence relation between the service party and the service ID interval in the registration center can be modified according to the service requirement.
Specifically, when the service extension causes the corresponding service ID interval to need to be extended, the service ID interval corresponding to the service party stored in the registration center is modified, and when the service ID interval is issued to the server, the information in the server belonging to the service party is modified, thereby ensuring the flexibility of setting the service ID interval.
The embodiment of the invention judges the target service party to which the target server generates the request for sending the ID segment based on the target server, and allocates the target service subinterval for the target server from different target service ID intervals according to the difference of the target service party, thereby achieving the effect of non-interference between services. The server is allocated with the service subintervals in a targeted manner according to the affiliated business party, the utilization rate of allocating the ID intervals to the server is improved, and the waste of the ID intervals is avoided; and by distributing the ID interval for the server, the phenomenon that the generation of the data ID between the servers generates interference is avoided, and the efficiency of generating the ID for the data is improved.
Example two
Fig. 2 is a flowchart of an ID generation method in the second embodiment of the present invention, and this embodiment is applicable to a case where a server assigns a unique ID to generated data according to an ID subinterval generated by a registry. The method may be performed by an ID generation apparatus, performed by a server in a business side. As shown in fig. 2, the method includes:
step 201, an ID segment generation request is sent to the registry, and a target service ID subinterval determined by the registry is acquired.
Wherein the target service ID subinterval is determined as follows: determining a target service party to which a target server belongs; and distributing a target service ID subinterval for the target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval.
Specifically, when the server needs to assign an ID to the data it generates, it may send an ID segment generation request to the registry, so as to obtain the ID segment belonging to the server for the server to assign an ID number to the generated data. And after the ID segment generation request is sent, acquiring a target service ID subinterval determined by the registration center according to the issuing rule. The specific following rules may refer to example one. The server sends the ID segment generation request once to obtain one ID subinterval, so that the efficiency of allocating the stage ID number is improved, and the server is prevented from frequently sending the request to the registration center due to ID generation. Illustratively, when the server is started for the first time, an ID segment generation request is sent to the registration center, so that the problem that the ID distribution is not timely due to re-request distribution when data generation occurs is avoided, and the subsequent business process is influenced.
On the basis of the foregoing technical solutions, optionally, after the obtaining of the target service ID subinterval determined by the registration center, the method further includes:
and if the used ID proportion in the target service ID subinterval reaches a preset proportion threshold, sending a new ID segment generation request to the registration center, wherein the new ID segment generation request is used for indicating the registration center to allocate a new service ID subinterval.
The used ID ratio is a ratio of the number of ID numbers already allocated to the generated data to the number of all ID numbers in the target service ID subinterval. Illustratively, the ID number of the target service ID subinterval ranges from 1 to 1000, and the ID numbers that have been allocated are from 1 to 100, so the proportion of used IDs is 10%. The preset proportion threshold is a preset threshold, the size of the preset proportion threshold is 0-1, the preset proportion threshold is used for judging the ID number usage in the target service ID subinterval, and the preset proportion threshold can be set according to an empirical value.
Specifically, the used ID ratio value in the target service ID subinterval is monitored, and if the used ID ratio value is greater than the preset ratio threshold, the server sends a new ID segment generation request to the registration center, where the new ID segment generation request is used to request a new service ID subinterval for reservation. For example, the preset percentage threshold may be 10%, that is, when the ID number in the target service ID subinterval is used by 10%, the server sends a new ID segment generation request to the registry.
The problem that the server ID is not distributed timely when the connection fault between the server and the registration center occurs is solved. And when the used ID proportion of the new service ID subinterval reaches a preset proportion threshold value, sending an ID segment generation request to the registration center again. The absence of service ID subintervals for the servers is avoided. And the acquisition of the reserved service ID subinterval is determined by using the idle time of the server, so that the acquisition efficiency of the ID subinterval is improved. When the server sends an ID segment generation request to the registration center, if the registration center is in a busy state and cannot respond to the request in time, the effect of reserving the service ID subinterval can be reflected, the reserved service ID subinterval is used for standby of the server, if the request is not responded to in time by the registration center, ID distribution of the server is not influenced, disaster tolerance performance is improved, the server and the registration center can bear larger concurrency, and efficiency is improved.
And step 202, distributing an ID number to the generated data according to the target service ID subinterval.
Specifically, after the server acquires the target service ID subinterval, the starting point value and the end point value of the ID subinterval are determined, and an ID number is selected from the subinterval for distribution for the generated data. Illustratively, the data are distributed from the ID value of the starting point of the ID subinterval according to the time sequence of the generated data, for example, if the starting point value of the target service ID subinterval is 1 and the end point value is 1000, the ID number distributed to the server when generating the first data is 1, and so on, the characteristics of monotone increasing and global uniqueness of ID number distribution are ensured.
In a possible embodiment, optionally, the method further includes:
acquiring an association relation between a service party and a service ID interval issued by a registration center;
if the target service party is successfully matched with the association relation, the verification is successful, and the qualification of sending the ID segment generation request to the registration center is obtained.
Specifically, the server obtains the association relationship between all service parties issued by the registration center and the service ID interval, matches the association relationship according to the information of the service party to which the server belongs, and determines whether the information of the service party corresponding to the server exists, and if the information of the service party corresponding to the server exists, the server indicates that the server belongs to the service party registered in the registration center, the server may send an ID segment generation request to the registration center; if the server does not exist, the service party to which the server belongs is not registered in the registration center, and the ID segment generation request cannot be sent to the registration center.
The identity of the server is verified by acquiring the verification information periodically issued by the registration center, so that the state of the server is updated, and the problem that the server irrelevant to service requests an ID segment from the registration center to cause ID segment distribution errors is avoided; the interference that a server carrying a service party and a service ID interval are not matched sends a request to the registration center is avoided, the accuracy and the matching degree of an ID segment generation request acquired by the registration center are improved, and the ID generation accuracy is further improved.
The embodiment of the invention allocates the ID number for the generated data based on the target service subinterval allocated by the registration center for the target server from different target service ID intervals according to different target service parties to which the server belongs. The server is allocated with the service subintervals in a targeted manner according to the affiliated business party, the utilization rate of allocating the ID intervals to the server is improved, and the waste of the ID intervals is avoided; and by distributing the ID interval for the server, the phenomenon that the generation of the data ID between the servers generates interference is avoided, and the efficiency of generating the ID for the data is improved. When the used ID proportion of the subintervals reaches the preset proportion threshold value, the new service subintervals are requested to be allocated, so that the flexibility of subinterval allocation is realized, and the problem of influencing ID allocation is avoided.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an ID generation apparatus in a third embodiment of the present invention, executed by a registry, and this embodiment is applicable to a case where an ID subinterval is allocated to a server in a business party according to a business party to which the server belongs, so that the server allocates an ID to generated data according to each ID subinterval. As shown in fig. 3, the apparatus includes:
a target service party determining module 310, configured to determine a target service party to which a target server belongs in response to an ID segment generation request of the target server;
and a target service ID subinterval allocation module 320, configured to allocate, according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval, a target service ID subinterval for the target server from the target service ID interval, and configured to allocate, by the target server, an ID number to the generated data.
The embodiment of the invention judges the target service party to which the target server generates the request for sending the ID segment based on the target server, and allocates the target service subinterval for the target server from different target service ID intervals according to the difference of the target service party. The server is allocated with the service subintervals in a targeted manner according to the affiliated business party, the utilization rate of allocating the ID intervals to the server is improved, and the waste of the ID intervals is avoided; and by distributing the ID interval for the server, the phenomenon that the generation of the data ID between the servers generates interference is avoided, and the efficiency of generating the ID for the data is improved.
Optionally, the target service ID subinterval allocating module 320 is specifically configured to:
determining the maximum value of the current registered ID according to the current registered ID information of the target service ID interval, and determining the starting point value of a target service ID subinterval;
determining the length of a corresponding preset service ID subinterval according to the target service party;
and determining the target service ID subinterval according to the starting value of the target service ID subinterval and the length of a preset service ID subinterval.
Optionally, the apparatus further comprises:
and the service ID interval determining module is used for determining the service ID interval of the service party according to the service throughput of the service party.
Optionally, the apparatus further comprises:
and the incidence relation sending module is used for sending the incidence relation between the service party and the service ID interval to a server in the existing service party and indicating the server to verify the service party.
The ID generation device provided in the embodiment of the present invention may execute the ID generation method provided in any embodiment of the present invention, and has functional modules and advantageous effects corresponding to the execution of the ID generation method.
Example four
Fig. 4 is a schematic structural diagram of an ID generation apparatus according to a fourth embodiment of the present invention, which is applicable to a case where a server assigns a unique ID to generated data according to an ID subinterval generated by a registry. Executed by a server in a service side, as shown in fig. 4, the apparatus includes:
a target service ID subinterval obtaining module 410, configured to send an ID segment generation request to the registry, and obtain a target service ID subinterval determined by the registry; wherein the target service ID subinterval is determined by: determining a target service party to which a target server belongs; distributing a target service ID subinterval for a target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval;
and an ID allocating module 420, configured to allocate an ID number to the generated data according to the target service ID subinterval.
The embodiment of the invention allocates the ID number for the generated data based on the target service subinterval allocated by the registration center for the target server from different target service ID intervals according to different target service parties to which the server belongs. The server is allocated with the service subintervals in a targeted manner according to the affiliated business party, the utilization rate of allocating the ID intervals to the server is improved, and the waste of the ID intervals is avoided; and by distributing the ID interval for the server, the phenomenon that the generation of the data ID between the servers generates interference is avoided, and the efficiency of generating the ID for the data is improved.
Optionally, the apparatus further comprises:
and the ID segment generation request sending module is used for sending a new ID segment generation request to the registration center if the used ID proportion in the target service ID subinterval reaches a preset proportion threshold, and is used for indicating the registration center to allocate a new service ID subinterval.
Optionally, the apparatus further includes a target service party checking module, specifically configured to:
acquiring an association relation between a service party and a service ID interval issued by a registration center;
if the target service party is successfully matched with the association relation, the verification is successful, and the qualification of sending the ID segment generation request to the registration center is obtained.
The ID generation device provided in the embodiment of the present invention may execute the ID generation method provided in any embodiment of the present invention, and has functional modules and advantageous effects corresponding to the execution of the ID generation method.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention. FIG. 5 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in FIG. 5 is only an example and should not bring any limitations to the functionality or scope of use of embodiments of the present invention.
As shown in FIG. 5, computer device 12 is in the form of a general purpose computing device. The components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory device 28, and a bus 18 that couples various system components including the system memory device 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory device bus or memory device controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such 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.
Computer device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system storage 28 may include computer system readable media in the form of volatile storage, such as Random Access Memory (RAM)30 and/or cache storage 32. Computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, and commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Storage 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in storage 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with computer device 12, and/or with any devices (e.g., network card, modem, etc.) that enable computer device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, computer device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with the other modules of computer device 12 via bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by running programs stored in the system storage device 28, for example, implementing an ID generation method provided by an embodiment of the present invention, executed by a registry, and includes:
responding to the ID segment generation request of the target server, and determining a target service party to which the target server belongs;
and according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval, allocating a target service ID subinterval for the target server from the target service ID interval, wherein the target service ID subinterval is used for allocating an ID number for the generated data by the target server.
Or the ID generation method provided in the embodiment of the present invention is executed by a server in a service side, and includes:
sending an ID segment generation request to a registration center, and acquiring a target service ID subinterval determined by the registration center; wherein the target service ID subinterval is determined by: determining a target service party to which a target server belongs; distributing a target service ID subinterval for a target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval;
and distributing an ID number for the generated data according to the target service ID subinterval.
EXAMPLE six
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements an ID generation method provided in an embodiment of the present invention, where the ID generation method is executed by a registration center, and the method includes:
responding to the ID segment generation request of the target server, and determining a target service party to which the target server belongs;
and according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval, allocating a target service ID subinterval for the target server from the target service ID interval, wherein the target service ID subinterval is used for allocating an ID number for the generated data by the target server.
Or the ID generation method provided in the embodiment of the present invention is executed by a server in a service side, and includes:
sending an ID segment generation request to a registration center, and acquiring a target service ID subinterval determined by the registration center; wherein the target service ID subinterval is determined by: determining a target service party to which a target server belongs; distributing a target service ID subinterval for a target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval;
and distributing an ID number for the generated data according to the target service ID subinterval.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (11)

1. An ID generation method, performed by a registry, the method comprising:
responding to the ID segment generation request of the target server, and determining a target service party to which the target server belongs;
and according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval, allocating a target service ID subinterval for the target server from the target service ID interval, wherein the target service ID subinterval is used for allocating an ID number for the generated data by the target server.
2. The method of claim 1, wherein allocating a target service ID subinterval for a target server from a target service ID interval according to the target service ID interval of the target service party and current registered ID information of the target service ID interval comprises:
determining the maximum value of the current registered ID according to the current registered ID information of the target service ID interval, and determining the starting point value of a target service ID subinterval;
determining the length of a corresponding preset service ID subinterval according to the target service party;
and determining the target service ID subinterval according to the starting value of the target service ID subinterval and the length of a preset service ID subinterval.
3. The method of claim 1, wherein before determining the target service party to which the target server belongs in response to the ID field generation request of the target server, further comprising:
and determining a service ID interval of the service party according to the service throughput of the service party.
4. The method of claim 1, further comprising:
and sending the association relation between the service party and the service ID interval to a server in the existing service party for indicating the server to check the service party.
5. An ID generation method, performed by a server in a business side, the method comprising:
sending an ID segment generation request to a registration center, and acquiring a target service ID subinterval determined by the registration center; wherein the target service ID subinterval is determined by: determining a target service party to which a target server belongs; distributing a target service ID subinterval for a target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval;
and distributing an ID number for the generated data according to the target service ID subinterval.
6. The method of claim 5, wherein after obtaining the target service ID subinterval determined by the registry, the method further comprises:
and if the used ID proportion in the target service ID subinterval reaches a preset proportion threshold, sending a new ID segment generation request to the registration center, wherein the new ID segment generation request is used for indicating the registration center to allocate a new service ID subinterval.
7. The method of claim 5, further comprising:
acquiring an association relation between a service party and a service ID interval issued by a registration center;
if the target service party is successfully matched with the association relation, the verification is successful, and the qualification of sending the ID segment generation request to the registration center is obtained.
8. An ID generation apparatus, performed by a registry, comprising:
the target service party determining module is used for responding to the ID segment generation request of the target server and determining the target service party to which the target server belongs;
and the target service ID subinterval allocation module is used for allocating a target service ID subinterval for the target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval, and is used for allocating an ID number for the generated data by the target server.
9. An ID generation apparatus, executed by a server in a service side, comprising:
the target service ID subinterval acquisition module is used for sending an ID segment generation request to the registration center and acquiring a target service ID subinterval determined by the registration center; wherein the target service ID subinterval is determined by: determining a target service party to which a target server belongs; distributing a target service ID subinterval for a target server from the target service ID interval according to the target service ID interval of the target service party and the current registered ID information of the target service ID interval;
and the ID distribution module is used for distributing an ID number for the generated data according to the target service ID subinterval.
10. A computer device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the ID generation method of any of claims 1-4 or claims 5-7.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the ID generation method according to any one of claims 1 to 4 or claims 5 to 7.
CN201911416128.5A 2019-12-31 2019-12-31 ID generation method, device, equipment and storage medium Active CN111163186B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911416128.5A CN111163186B (en) 2019-12-31 2019-12-31 ID generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911416128.5A CN111163186B (en) 2019-12-31 2019-12-31 ID generation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111163186A true CN111163186A (en) 2020-05-15
CN111163186B CN111163186B (en) 2023-02-17

Family

ID=70560263

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911416128.5A Active CN111163186B (en) 2019-12-31 2019-12-31 ID generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111163186B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111917897A (en) * 2020-07-15 2020-11-10 深圳市腾讯网域计算机网络有限公司 Identification generation method, device, equipment and storage medium
CN112328598A (en) * 2020-11-09 2021-02-05 北京达佳互联信息技术有限公司 ID generation method, device, electronic equipment and storage medium
CN115002078A (en) * 2022-05-11 2022-09-02 北京奇艺世纪科技有限公司 ID generation method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106911780A (en) * 2017-02-28 2017-06-30 北京三快在线科技有限公司 Traffic ID generation method, apparatus and system
CN109104490A (en) * 2018-08-29 2018-12-28 北京达佳互联信息技术有限公司 Service identification management method, device, electronic equipment and storage medium
CN111385370A (en) * 2018-12-28 2020-07-07 广州市百果园信息技术有限公司 ID allocation method, device, storage medium and ID allocation system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106911780A (en) * 2017-02-28 2017-06-30 北京三快在线科技有限公司 Traffic ID generation method, apparatus and system
CN109104490A (en) * 2018-08-29 2018-12-28 北京达佳互联信息技术有限公司 Service identification management method, device, electronic equipment and storage medium
CN111385370A (en) * 2018-12-28 2020-07-07 广州市百果园信息技术有限公司 ID allocation method, device, storage medium and ID allocation system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111917897A (en) * 2020-07-15 2020-11-10 深圳市腾讯网域计算机网络有限公司 Identification generation method, device, equipment and storage medium
CN111917897B (en) * 2020-07-15 2024-03-05 深圳市腾讯网域计算机网络有限公司 Identification generation method, device, equipment and storage medium
CN112328598A (en) * 2020-11-09 2021-02-05 北京达佳互联信息技术有限公司 ID generation method, device, electronic equipment and storage medium
CN112328598B (en) * 2020-11-09 2024-01-09 北京达佳互联信息技术有限公司 ID generation method, ID generation device, electronic equipment and storage medium
CN115002078A (en) * 2022-05-11 2022-09-02 北京奇艺世纪科技有限公司 ID generation method and device
CN115002078B (en) * 2022-05-11 2024-04-09 北京奇艺世纪科技有限公司 ID generation method and device

Also Published As

Publication number Publication date
CN111163186B (en) 2023-02-17

Similar Documents

Publication Publication Date Title
CN111163186B (en) ID generation method, device, equipment and storage medium
US10282120B2 (en) Method, apparatus and system for inserting disk
CN113127168A (en) Service distribution method, system, device, server and medium
CN111385370B (en) ID allocation method, device, storage medium and ID allocation system
CN109819023B (en) Distributed transaction processing method and related product
CN108733802B (en) Identification code generation and analysis method and device, storage medium and electronic equipment
CN103369038A (en) PaaS (platform as a service) management platform and method
CN112989313A (en) Identification registration method and device, electronic equipment and storage medium
CN113361913A (en) Communication service arranging method, device, computer equipment and storage medium
CN112087401A (en) Method and device for realizing service quality in distributed storage
CN110290228B (en) Internet protocol IP address allocation method and device
CN109582439B (en) DCN deployment method, device, equipment and computer readable storage medium
CN112148467A (en) Dynamic allocation of computing resources
CN112202935B (en) NAT address pool management method and device
CN109104506B (en) Method and device for determining domain name resolution rule and computer readable storage medium
CN109005071B (en) Decision deployment method and scheduling equipment
CN113722729B (en) Authority management method, device, terminal, server and storage medium
CN108696557B (en) Information processing system, method and device
CN113158173B (en) Account number allocation method, medium, device and computing equipment
CN111294220A (en) Network isolation configuration method and device based on nginx
CN114004527A (en) Processing method, device and equipment for product distribution and storage medium
CN114666180A (en) Distribution method and device of simulation ECU (electronic control Unit) nodes, electronic equipment and storage medium
CN113347046A (en) Network access method and device
CN113760940A (en) Quota management method, device, equipment and medium applied to distributed system
CN112667642A (en) Information generation method and device and electronic equipment

Legal Events

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