CN116881247A - Service identifier generation method, device, computer equipment and storage medium - Google Patents

Service identifier generation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116881247A
CN116881247A CN202310672719.9A CN202310672719A CN116881247A CN 116881247 A CN116881247 A CN 116881247A CN 202310672719 A CN202310672719 A CN 202310672719A CN 116881247 A CN116881247 A CN 116881247A
Authority
CN
China
Prior art keywords
server
service
data center
time stamp
bit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310672719.9A
Other languages
Chinese (zh)
Inventor
董志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202310672719.9A priority Critical patent/CN116881247A/en
Publication of CN116881247A publication Critical patent/CN116881247A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0647Synchronisation among TDM nodes
    • H04J3/065Synchronisation among TDM nodes using timestamps
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to a service identification generation method, a device, a computer device, a storage medium and a computer program product. The method comprises the following steps: receiving a plurality of service requests at intervals of a preset receiving time period, and acquiring receiving time stamps corresponding to the service requests; analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server; and determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request. The method can ensure the uniqueness and the order of the generated service identifiers.

Description

Service identifier generation method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of distributed systems, and in particular, to a service identifier generating method, apparatus, computer device, storage medium, and computer program product.
Background
In distributed systems, there are often scenarios that require the use of globally unique service identities, such as order numbers, transaction serial numbers, etc. In the existing service identifier generation method, UUIDs (Universally Unique Identifier, universal unique identifier) are often used as service identifiers in order to prevent service identifier collision, but UUIDs are relatively long and unordered, and many service scenes need overall ordered service identifiers, and moreover, the adoption of random service identifiers in a relational database seriously affects the system performance. Therefore, there is a need for a service identifier generation method capable of ensuring the uniqueness and the order of service identifiers.
Disclosure of Invention
Based on this, it is necessary to provide a service identifier generating method, apparatus, computer device, computer readable storage medium and computer program product capable of ensuring the uniqueness and the order of service identifiers, aiming at the problem that the conventional service identifier generating method cannot ensure the uniqueness and the order of service identifiers at the same time.
In a first aspect, the present application provides a service identifier generating method. The method comprises the following steps:
receiving a plurality of service requests at intervals of a preset receiving time period, and acquiring receiving time stamps corresponding to the service requests;
analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server;
and determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
In one embodiment, the preset initial identifier comprises a multibit character; determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current timestamp and the receiving timestamp corresponding to each service request, wherein the method comprises the following steps:
Determining a server bit in a preset initial identifier, wherein the server bit is used for representing the number of a data center and the number of a server;
determining a time bit of a preset initial mark, wherein the time bit is used for representing a current time stamp;
determining a serial number bit of a preset initial identifier, wherein the serial number bit is determined according to receiving time stamps corresponding to a plurality of service requests;
and determining the service identification corresponding to each service request according to the server bit, the time bit and each serial number bit.
In one embodiment, the current timestamp acquisition process includes:
acquiring the current time of the system by adopting an independent clock module;
and determining the current time stamp according to the reference time of the independent clock module and the current time of the system.
In one embodiment, determining the serial number bit of the preset initial identifier includes:
comparing the current receiving time stamp with the last receiving time stamp aiming at each receiving time stamp in the receiving time stamps corresponding to the service requests;
under the condition that the current receiving time stamp is equal to the last receiving time stamp, the serial number bit of the preset initial mark is automatically increased;
and under the condition that the current receiving time stamp is not equal to the last receiving time stamp, updating the serial number bit of the preset initial identifier to a preset value.
In one embodiment, analyzing each service request to obtain the number of the data center and the number of the server includes:
analyzing each service request to obtain a plurality of analyzed request data;
under the condition that any analyzed request data is empty, controlling the number information stored in the database to be self-increased, and reading the self-increased number information; according to the self-increased number information, the number of the data center and the number of the server are obtained;
and under the condition that any analyzed request data is not empty, acquiring the number of the data center and the number of the server according to the corresponding analyzed request data.
In one embodiment, obtaining the number of the data center and the number of the server according to the corresponding parsed request data includes:
taking the first data in the corresponding analyzed request data as the number of a data center;
and taking the second data in the corresponding parsed request data as the serial number of the server.
In a second aspect, the application further provides a service identifier generating device. The device comprises:
the acquisition module is used for receiving a plurality of service requests at intervals of a preset receiving time period and acquiring receiving time stamps corresponding to the service requests;
The analysis module is used for analyzing each service request to obtain the number of the data center and the number of the server, and the data center and the server are used for responding to each service request; each data center comprises at least one server;
the determining module is used for determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
receiving a plurality of service requests at intervals of a preset receiving time period, and acquiring receiving time stamps corresponding to the service requests;
analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server;
and determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
receiving a plurality of service requests at intervals of a preset receiving time period, and acquiring receiving time stamps corresponding to the service requests;
analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server;
and determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
receiving a plurality of service requests at intervals of a preset receiving time period, and acquiring receiving time stamps corresponding to the service requests;
analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server;
And determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
The service identifier generating method, the device, the computer equipment, the storage medium and the computer program product are used for receiving a plurality of service requests at intervals of preset receiving time periods, acquiring receiving time stamps corresponding to the service requests respectively, analyzing the service requests to obtain the serial numbers of the data centers and the serial numbers of the servers, wherein the data centers and the servers are used for responding to the service requests, each data center comprises at least one server, and determining the service identifier corresponding to the service request according to the preset initial identifier, the serial number of the data center, the serial number of the server, the current time stamp and the receiving time stamp corresponding to the service request respectively. According to the scheme, the corresponding receiving time stamp in the received service requests is obtained, and the service identifier corresponding to each service request is obtained based on the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the corresponding receiving time stamp of the service requests, so that the uniqueness of the service identifier is ensured, and meanwhile, the ordering of the service identifier is ensured.
Drawings
FIG. 1 is an application environment diagram of a method of service identification generation in one embodiment;
FIG. 2 is a flow diagram of a method for generating service identifiers in one embodiment;
FIG. 3 is a schematic flow chart illustrating a sub-process of step 206 in one embodiment;
FIG. 4 is a flow chart illustrating the steps of obtaining a current timestamp in one embodiment;
FIG. 5 is a schematic flow chart illustrating a sub-process of step 306 in one embodiment;
FIG. 6 is a schematic flow chart illustrating a sub-process of step 204 in one embodiment;
FIG. 7 is a schematic flow chart of step 606 in one embodiment;
FIG. 8 is a block diagram of a service identifier generating device in one embodiment;
fig. 9 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The service identifier generating method provided by the embodiment of the application can be applied to an application environment shown in figure 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The terminal 102 receives a plurality of service requests every preset receiving time period, and obtains receiving time stamps corresponding to the service requests; analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server; and determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a service identifier generating method is provided, and the method is applied to the terminal 102 in fig. 1 for illustration, and includes the following steps:
step 202, receiving a plurality of service requests at intervals of a preset receiving time period, and obtaining receiving time stamps corresponding to the service requests.
The service request is a request related to a service, and can be a service data request, a service resource request and the like. The terminal receives a plurality of service requests every preset receiving time period. The service request is initiated untimely, and the terminal acquires the service request by adopting a method of timing receiving. And a plurality of service requests are included in each preset receiving time period, and the service requests received in the current preset receiving time period are acquired at the expiration time of each preset receiving time period. Illustratively, the preset reception period may be 1 second, 2 seconds, 5 seconds, or the like. The reception timestamp is a timestamp at which the terminal received the service request.
Step 204, analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center includes at least one server.
The service request is often stored in a form or text, and the service request is analyzed to obtain various service data carried in the service request. In some embodiments, the file type of the saved service request is KML (Keyhole Markup Language, markup language) type, and correspondingly, a DOM (Document Object Model ) parser may be used to parse each service request to obtain the number of the data center and the number of the server. In other embodiments, the file type of the service request is a JSON (JavaScript Object Notation, javaScript object notation, a lightweight data exchange format) type, and accordingly, a JSON parser may be used to parse each service request to obtain the number of the data center and the number of the server.
A data center is a physical facility that contains a centralized computing infrastructure, which typically includes servers, storage devices, and network devices. Each data center includes at least one server. The data center and the server are used for responding to each service request and providing support of data storage, calculation, transmission, exchange and the like for each service request. Each data center comprises a corresponding number, and each server comprises a corresponding number, which is used for distinguishing different data centers from different servers.
Step 206, determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current timestamp and the receiving timestamp corresponding to each service request.
Wherein, the preset initial identifier refers to an identifier with a preset format. In some embodiments, the character string initially identified as a 64-bit binary representation is preset. The terminal initializes the initial identifier, and the obtained initialized initial identifier is used as a preset initial identifier. For example, a character string composed of 64-bit 0 is preset as an initial identification.
The current timestamp is a timestamp for determining a service identifier corresponding to each service request. The current time stamp can be acquired by adopting a clock module in the terminal or an independent clock module to obtain the current time stamp.
The service identifier corresponding to each service request is a number for distinguishing each different service request. According to the preset initial identification, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request, the service identification corresponding to each service request is determined, repeated numbering of the service requests can be avoided, service identification generation is carried out based on the time stamps, and the ordering of the service identifications is improved.
In the service identifier generating method, the service identifiers corresponding to the service requests are determined according to the preset initial identifier, the number of the data center, the number of the server, the current timestamp and the receiving timestamp corresponding to the service requests. According to the scheme, the corresponding receiving time stamp in the received service requests is obtained, and the service identifier corresponding to each service request is obtained based on the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the corresponding receiving time stamp of the service requests, so that the uniqueness of the service identifier is ensured, and meanwhile, the ordering of the service identifier is ensured.
In one embodiment, as shown in FIG. 3, the preset initial identifier comprises a multibit character; determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current timestamp and the receiving timestamp corresponding to each service request, wherein the method comprises the following steps:
Step 302, determining a server bit in a preset initial identifier, wherein the server bit is used for representing the number of a data center and the number of a server.
Step 304, determining a time bit of the preset initial identifier, wherein the time bit is used for representing the current timestamp.
Step 306, determining a serial number bit of the preset initial identifier, where the serial number bit is determined according to the receiving time stamps corresponding to the service requests.
Step 308, determining the service identifier corresponding to each service request according to the server bit, the time bit and each serial number bit.
The preset initial identifier comprises a plurality of characters, wherein the characters comprise server bits, time bits and serial number bits. The server bits include multibit characters, and the server bits are used to characterize the number of the data center and the number of the server. The time bits include a multi-bit character and are used to characterize the current timestamp. The sequence number bits include a multibit character and are determined based on the respective receive timestamps of the plurality of service requests.
And the terminal determines the server position in the preset initial identifier according to the number of the data center and the number of the server. Specifically, the number of the data center may be added to the first 5 bits of the server bits, and the number of the server may be added to the last 5 bits of the server bits. And determining a time bit of the preset initial mark according to the current time stamp. Specifically, the current timestamp may be added to the time bit. And determining serial number bits of a preset initial identifier according to the corresponding receiving time stamps of the service requests. In particular, a receive timestamp may be added to the sequence number bits.
And combining and splicing the server bit, the time bit and each serial number bit to obtain service identifiers corresponding to each service request.
In this embodiment, the server bit, the time bit and the serial number bit in the preset initial identifier are determined, so that the server bit, the time bit and each serial number bit are spliced and combined to obtain the service identifier corresponding to each service request. Because the data center and the server responding to each service request are different, the server position determined according to the number of the data center and the number of the server is different, the time position is determined by the current time stamp, the serial number is determined according to the receiving time stamp corresponding to each service request, and the ordering of the service identification is ensured.
In one embodiment, as shown in fig. 4, the current time stamp acquisition process includes:
step 402, obtaining the current time of the system by using an independent clock module.
Step 404, determining a current time stamp according to the reference time of the independent clock module and the current time of the system.
The independent clock module is independent of the terminal and is used for acquiring the current time of the system. The independent clock module is connected with the terminal, and the terminal acquires the current time of the system acquired by the independent clock module.
Before the independent clock module collects the current time of the system, the independent clock module needs to be calibrated, and the calibrated independent clock module is obtained. And acquiring the current time of the system by adopting the calibrated independent clock module.
The reference time refers to the starting time of the calibrated independent clock module, and greenwich time 1970, 01 month, 01 day, 00 minutes and 00 seconds are generally adopted as the reference time. And subtracting the reference time from the current time of the system, and taking the obtained time difference as the current time stamp.
In this embodiment, the current time of the system is obtained by using an independent clock module, and the current timestamp is determined according to the reference time of the independent clock module and the current time of the system. The method for determining the current time stamp by adopting the independent clock module ensures the accuracy of the current time stamp, avoids the repeated problem of the generated service identifier when the clock of the terminal or the server is subjected to callback and other adjustment under the scenes of some tests and the like, and ensures the uniqueness of the generated service identifier.
In one embodiment, as shown in fig. 5, determining the serial number bit of the preset initial identifier includes:
step 502, for each of the reception timestamps corresponding to the plurality of service requests, comparing the current reception timestamp with the last reception timestamp.
Step 504, in the case that the current receiving time stamp is equal to the last receiving time stamp, the serial number bit of the preset initial identifier is increased automatically.
Step 506, updating the serial number bit of the preset initial identifier to a preset value when the current receiving timestamp is not equal to the last receiving timestamp.
The current receiving timestamp is any receiving timestamp in the receiving timestamps corresponding to the service requests, namely the receiving timestamp corresponding to any current task request in the task requests. The last reception time stamp is a time stamp of a time preceding the current reception time stamp. The sequence number bit is used to characterize the respective receiving sequence of each service request.
Comparing the current receiving time stamp with the last receiving time stamp aiming at each receiving time stamp in the receiving time stamps corresponding to the service requests, and under the condition that the current receiving time stamp is equal to the last receiving time stamp, automatically increasing the serial number bit of the preset initial mark, thereby ensuring that the corresponding serial number is increased when the service requests are received under the same time stamp, and ensuring that the serial number is not repeated.
And under the condition that the current receiving time stamp is not equal to the last receiving time stamp, updating the serial number bit of the preset initial identifier to a preset value. Because the receiving time stamp is changed, the corresponding current time stamp is also changed, the time bit of the preset initial mark is changed, and the serial number bit is updated to the preset value, thereby ensuring the sequence of the serial numbers under each time stamp, avoiding the repeatability of the service mark and improving the sequence of the service mark.
In this embodiment, by comparing the current reception timestamp with the last reception timestamp for each of the reception timestamps corresponding to the plurality of service requests, when the current reception timestamp is equal to the last reception timestamp, the sequence number bit of the preset initial identifier is automatically increased, so that when the plurality of service requests are received under the same timestamp, the corresponding sequence number is increased, and the sequence number is ensured not to be repeated. And updating the serial number bit of the preset initial identifier to a preset value under the condition that the current receiving time stamp is not equal to the last receiving time stamp. The sequence of the serial numbers under each time stamp is guaranteed, and the sequence of the service identification is improved while the repeatability of the service identification is avoided.
In one embodiment, as shown in fig. 6, analyzing each service request to obtain the number of the data center and the number of the server, including:
step 602, analyzing each service request to obtain a plurality of analyzed request data.
Step 604, controlling the number information stored in the database to be self-increased and reading the self-increased number information under the condition that any one of the analyzed request data is empty; and acquiring the number of the data center and the number of the server according to the self-increased number information.
Step 606, in the case that any parsed request data is not null, the number of the data center and the number of the server are obtained according to the corresponding parsed request data.
And determining an analysis method according to the type of the service request storage file. And analyzing each service request by adopting a corresponding analysis method to obtain a plurality of analyzed request data. Under the condition that any analyzed request data is empty, controlling the number information stored in the database to be self-increased, and reading the self-increased number information; and acquiring the number of the data center and the number of the server according to the self-increased number information. The number of the data center and the number of the server are not contained in the analyzed request data corresponding to the service request, the terminal determines the numbers of the data center and the server in a database data self-increasing mode, and therefore the problems that the numbers are repeated, the individual data center and the server frequently respond to the service request, and other data centers and servers cannot respond are avoided, and the utilization rate of the data center and the server is improved.
And under the condition that any analyzed request data is not empty, determining the number of the data center and the number of the server in the corresponding analyzed request data.
In this embodiment, by analyzing each service request, in the case that any analyzed request data is empty, the numbers of the data center and the server are determined by adopting a database data self-increasing mode, so that the problems that the numbers are repeated, individual data centers and servers frequently respond to the service requests, and other data centers and servers cannot respond are avoided, and the utilization rate of the data centers and the servers is improved. And under the condition that any one of the analyzed request data is not empty, acquiring the number of the data center and the number of the server according to the corresponding analyzed request data, and avoiding the repetition of the generated service identifier.
In one embodiment, as shown in fig. 7, obtaining the number of the data center and the number of the server according to the corresponding parsed request data includes:
step 702, taking the first data in the corresponding parsed request data as the number of the data center.
Step 704, taking the second data in the corresponding parsed request data as the number of the server.
The parsed request data includes a plurality of data bits, and the plurality of data bits are divided into first data and second data. And taking the first data in the corresponding analyzed request data as the serial number of the data center and the second data in the corresponding analyzed request data as the serial number of the server. For example, 1-5 bits of the parsed request data are used as the number of the data center, and 6-10 bits of the parsed request data are used as the number of the server.
In this embodiment, the number of the server may be obtained by using the first data in the corresponding parsed request data as the number of the data center and the second data in the corresponding parsed request data as the number of the server. The serial number of the data center and the serial number of the server can be determined from the analyzed request data corresponding to the service request, so that the uniqueness of the service identification is ensured.
In order to describe the service identifier generating method and effect in detail, the following description will use a most detailed embodiment:
and generating a scene aiming at the service identification in the distributed server, wherein the service identification is a service serial number. The terminal receives a plurality of service requests every preset receiving time period, and obtains receiving time stamps corresponding to the service requests.
The terminal analyzes each service request to obtain the number of the data center and the number of the server, and the data center and the server are used for responding to each service request; each data center includes at least one server. Specifically, each service request is analyzed to obtain a plurality of analyzed request data, and under the condition that any one of the analyzed request data is empty, the number information stored in the database is controlled to be self-increased, and the self-increased number information is read; and acquiring the number of the data center and the number of the server according to the self-increased number information. When any one of the parsed request data is not empty, the first data in the corresponding parsed request data is used as the number of the data center, and the second data in the corresponding parsed request data is used as the number of the server.
The preset initial identification comprises a multi-bit character, and in some embodiments, the preset initial identification comprises a 64-bit binary character. Wherein, bit 1 represents a symbol bit, bits 2-39 represent server bits, bits 40-49 represent time bits, and bits 50-64 represent sequence number bits. The terminal determines a server bit in a preset initial identifier, wherein the server bit is used for representing the number of the data center and the number of the server. And determining a time bit of the preset initial mark, wherein the time bit is used for representing the current time stamp. And determining a serial number bit of the preset initial identifier, wherein the serial number bit is determined according to the corresponding receiving time stamp of each service request. Specifically, for each of the reception timestamps corresponding to each of the plurality of service requests, the current reception timestamp is compared with the last reception timestamp. And under the condition that the current receiving time stamp is not equal to the last receiving time stamp, updating the serial number bit of the preset initial identifier to a preset value.
And the terminal determines the service identifier corresponding to each service request according to the server bit, the time bit and each serial number bit. The current time stamp obtaining process comprises the following steps: and acquiring the current time of the system by adopting the independent clock module, and determining the current time stamp according to the reference time of the independent clock module and the current time of the system.
According to the service identifier generation method, the service requests are received every other preset receiving time period, the receiving time stamps corresponding to the service requests are obtained, the service requests are analyzed to obtain the numbers of the data centers and the numbers of the servers, the data centers and the servers are used for responding to the service requests, each data center comprises at least one server, and the service identifier corresponding to the service requests is determined according to the preset initial identifier, the numbers of the data centers, the numbers of the servers, the current time stamp and the receiving time stamp corresponding to the service requests. According to the scheme, the corresponding receiving time stamp in the received service requests is obtained, and the service identifier corresponding to each service request is obtained based on the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the corresponding receiving time stamp of the service requests, so that the uniqueness of the service identifier is ensured, and meanwhile, the ordering of the service identifier is ensured. Meanwhile, the numbers of the data center and the server in the prior art are often configured manually, and the numbers of the data center and the server are automatically obtained by analyzing the service request and the database data self-increasing method, so that the repeatability of the server position is greatly avoided.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a service identifier generating device for realizing the service identifier generating method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the service identifier generating device or devices provided below may refer to the limitation of the service identifier generating method hereinabove, and will not be described herein.
In one embodiment, as shown in fig. 8, there is provided a service identifier generating apparatus 100, including: an acquisition module 120, a parsing module 140, and a determination module 160, wherein:
the obtaining module 120 is configured to receive a plurality of service requests every a preset receiving period, and obtain receiving timestamps corresponding to the plurality of service requests respectively;
the parsing module 140 is configured to parse each service request to obtain a number of the data center and a number of the server, where the data center and the server are configured to respond to each service request; each data center comprises at least one server;
the determining module 160 is configured to determine a service identifier corresponding to each service request according to a preset initial identifier, a number of the data center, a number of the server, a current timestamp, and a reception timestamp corresponding to each of the plurality of service requests.
The service identifier generating device receives a plurality of service requests at intervals of preset receiving time periods, acquires receiving time stamps corresponding to the service requests, analyzes the service requests to obtain numbers of data centers and numbers of servers, wherein each data center is used for responding to the service requests, and each data center comprises at least one server, and determines service identifiers corresponding to the service requests according to preset initial identifiers, the numbers of the data centers, the numbers of the servers, the current time stamps and the receiving time stamps corresponding to the service requests. According to the scheme, the corresponding receiving time stamp in the received service requests is obtained, and the service identifier corresponding to each service request is obtained based on the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the corresponding receiving time stamp of the service requests, so that the uniqueness of the service identifier is ensured, and meanwhile, the ordering of the service identifier is ensured.
In one embodiment, the preset initial identification comprises a multibit character; the determining module 160 is further configured to determine, according to the preset initial identifier, the number of the data center, the number of the server, the current timestamp, and the receiving timestamps corresponding to the service requests, a service identifier corresponding to each service request: determining a server bit in a preset initial identifier, wherein the server bit is used for representing the number of a data center and the number of a server; determining a time bit of a preset initial mark, wherein the time bit is used for representing a current time stamp; determining a serial number bit of a preset initial identifier, wherein the serial number bit is determined according to receiving time stamps corresponding to a plurality of service requests; and determining the service identification corresponding to each service request according to the server bit, the time bit and each serial number bit.
In one embodiment, the determining module 160 is further configured to: acquiring the current time of the system by adopting an independent clock module; and determining the current time stamp according to the reference time of the independent clock module and the current time of the system.
In one embodiment, the determining module 160 is further configured to determine a sequence number bit of the preset initial identifier: comparing the current receiving time stamp with the last receiving time stamp aiming at each receiving time stamp in the receiving time stamps corresponding to the service requests; under the condition that the current receiving time stamp is equal to the last receiving time stamp, the serial number bit of the preset initial mark is automatically increased; and under the condition that the current receiving time stamp is not equal to the last receiving time stamp, updating the serial number bit of the preset initial identifier to a preset value.
In one embodiment, each service request is parsed to obtain the number of the data center and the number of the server, and the parsing module 140 is further configured to: analyzing each service request to obtain a plurality of analyzed request data; under the condition that any analyzed request data is empty, controlling the number information stored in the database to be self-increased, and reading the self-increased number information; according to the self-increased number information, the number of the data center and the number of the server are obtained; and under the condition that any analyzed request data is not empty, acquiring the number of the data center and the number of the server according to the corresponding analyzed request data.
In one embodiment, according to the corresponding parsed request data, the number of the data center and the number of the server are obtained, and the parsing module 140 is further configured to: taking the first data in the corresponding analyzed request data as the number of a data center; and taking the second data in the corresponding parsed request data as the serial number of the server.
The above-mentioned respective modules in the service identification generating device may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure thereof may be as shown in fig. 9. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a service identification generation method.
It will be appreciated by persons skilled in the art that the architecture shown in fig. 9 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements are applicable, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
receiving a plurality of service requests at intervals of a preset receiving time period, and acquiring receiving time stamps corresponding to the service requests; analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server; and determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
In one embodiment, the processor when executing the computer program further performs the steps of:
The preset initial mark comprises a plurality of characters; determining a server bit in a preset initial identifier, wherein the server bit is used for representing the number of a data center and the number of a server; determining a time bit of a preset initial mark, wherein the time bit is used for representing a current time stamp; determining a serial number bit of a preset initial identifier, wherein the serial number bit is determined according to receiving time stamps corresponding to a plurality of service requests; and determining the service identification corresponding to each service request according to the server bit, the time bit and each serial number bit.
In one embodiment, the processor when executing the computer program further performs the steps of:
acquiring the current time of the system by adopting an independent clock module; and determining the current time stamp according to the reference time of the independent clock module and the current time of the system.
In one embodiment, the processor when executing the computer program further performs the steps of:
comparing the current receiving time stamp with the last receiving time stamp aiming at each receiving time stamp in the receiving time stamps corresponding to the service requests; under the condition that the current receiving time stamp is equal to the last receiving time stamp, the serial number bit of the preset initial mark is automatically increased; and under the condition that the current receiving time stamp is not equal to the last receiving time stamp, updating the serial number bit of the preset initial identifier to a preset value.
In one embodiment, the processor when executing the computer program further performs the steps of:
analyzing each service request to obtain a plurality of analyzed request data; under the condition that any analyzed request data is empty, controlling the number information stored in the database to be self-increased, and reading the self-increased number information; according to the self-increased number information, the number of the data center and the number of the server are obtained; and under the condition that any analyzed request data is not empty, acquiring the number of the data center and the number of the server according to the corresponding analyzed request data.
In one embodiment, the processor when executing the computer program further performs the steps of:
taking the first data in the corresponding analyzed request data as the number of a data center; and taking the second data in the corresponding parsed request data as the serial number of the server.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving a plurality of service requests at intervals of a preset receiving time period, and acquiring receiving time stamps corresponding to the service requests; analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server; and determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
In one embodiment, the computer program when executed by the processor further performs the steps of:
the preset initial mark comprises a plurality of characters; determining a server bit in a preset initial identifier, wherein the server bit is used for representing the number of a data center and the number of a server; determining a time bit of a preset initial mark, wherein the time bit is used for representing a current time stamp; determining a serial number bit of a preset initial identifier, wherein the serial number bit is determined according to receiving time stamps corresponding to a plurality of service requests; and determining the service identification corresponding to each service request according to the server bit, the time bit and each serial number bit.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring the current time of the system by adopting an independent clock module; and determining the current time stamp according to the reference time of the independent clock module and the current time of the system.
In one embodiment, the computer program when executed by the processor further performs the steps of:
comparing the current receiving time stamp with the last receiving time stamp aiming at each receiving time stamp in the receiving time stamps corresponding to the service requests; under the condition that the current receiving time stamp is equal to the last receiving time stamp, the serial number bit of the preset initial mark is automatically increased; and under the condition that the current receiving time stamp is not equal to the last receiving time stamp, updating the serial number bit of the preset initial identifier to a preset value.
In one embodiment, the computer program when executed by the processor further performs the steps of:
analyzing each service request to obtain a plurality of analyzed request data; under the condition that any analyzed request data is empty, controlling the number information stored in the database to be self-increased, and reading the self-increased number information; according to the self-increased number information, the number of the data center and the number of the server are obtained; and under the condition that any analyzed request data is not empty, acquiring the number of the data center and the number of the server according to the corresponding analyzed request data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
taking the first data in the corresponding analyzed request data as the number of a data center; and taking the second data in the corresponding parsed request data as the serial number of the server.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
receiving a plurality of service requests at intervals of a preset receiving time period, and acquiring receiving time stamps corresponding to the service requests; analyzing each service request to obtain the number of the data center and the number of the server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server; and determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
In one embodiment, the computer program when executed by the processor further performs the steps of:
the preset initial mark comprises a plurality of characters; determining a server bit in a preset initial identifier, wherein the server bit is used for representing the number of a data center and the number of a server; determining a time bit of a preset initial mark, wherein the time bit is used for representing a current time stamp; determining a serial number bit of a preset initial identifier, wherein the serial number bit is determined according to receiving time stamps corresponding to a plurality of service requests; and determining the service identification corresponding to each service request according to the server bit, the time bit and each serial number bit.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring the current time of the system by adopting an independent clock module; and determining the current time stamp according to the reference time of the independent clock module and the current time of the system.
In one embodiment, the computer program when executed by the processor further performs the steps of:
comparing the current receiving time stamp with the last receiving time stamp aiming at each receiving time stamp in the receiving time stamps corresponding to the service requests; under the condition that the current receiving time stamp is equal to the last receiving time stamp, the serial number bit of the preset initial mark is automatically increased; and under the condition that the current receiving time stamp is not equal to the last receiving time stamp, updating the serial number bit of the preset initial identifier to a preset value.
In one embodiment, the computer program when executed by the processor further performs the steps of:
analyzing each service request to obtain a plurality of analyzed request data; under the condition that any analyzed request data is empty, controlling the number information stored in the database to be self-increased, and reading the self-increased number information; according to the self-increased number information, the number of the data center and the number of the server are obtained; and under the condition that any analyzed request data is not empty, acquiring the number of the data center and the number of the server according to the corresponding analyzed request data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
taking the first data in the corresponding analyzed request data as the number of a data center; and taking the second data in the corresponding parsed request data as the serial number of the server.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. A method for generating a service identifier, the method comprising:
receiving a plurality of service requests at intervals of a preset receiving time period, and acquiring receiving time stamps corresponding to the service requests;
analyzing each service request to obtain the number of a data center and the number of a server, wherein the data center and the server are used for responding to each service request; each data center comprises at least one server;
And determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
2. The method of claim 1, wherein the pre-set initial identification comprises a multibit character; the determining the service identifier corresponding to each service request according to the preset initial identifier, the number of the data center, the number of the server, the current timestamp and the receiving timestamp corresponding to each service request, includes:
determining a server bit in the preset initial identifier, wherein the server bit is used for representing the number of the data center and the number of the server;
determining a time bit of the preset initial identifier, wherein the time bit is used for representing a current time stamp;
determining a serial number bit of the preset initial identifier, wherein the serial number bit is determined according to receiving time stamps corresponding to a plurality of service requests;
and determining the service identifier corresponding to each service request according to the server bit, the time bit and each serial number bit.
3. The method according to claim 1 or 2, wherein the current time stamp obtaining process comprises:
Acquiring the current time of the system by adopting an independent clock module;
and determining a current time stamp according to the reference time of the independent clock module and the current time of the system.
4. The method of claim 2, wherein the determining the sequence number bits of the preset initial identity comprises:
comparing the current receiving time stamp with the last receiving time stamp aiming at each receiving time stamp in the receiving time stamps corresponding to the service requests;
under the condition that the current receiving time stamp is equal to the last receiving time stamp, the serial number bit of the preset initial mark is automatically increased;
and under the condition that the current receiving time stamp is not equal to the last receiving time stamp, updating the serial number bit of the preset initial mark to a preset value.
5. The method of claim 1, wherein the parsing each service request to obtain the number of the data center and the number of the server comprises:
analyzing each service request to obtain a plurality of analyzed request data;
under the condition that any analyzed request data is empty, controlling the number information stored in the database to be self-increased, and reading the self-increased number information; acquiring the number of the data center and the number of the server according to the self-increased number information;
And under the condition that any analyzed request data is not empty, acquiring the number of the data center and the number of the server according to the corresponding analyzed request data.
6. The method according to claim 5, wherein the obtaining the number of the data center and the number of the server according to the corresponding parsed request data includes:
taking the first data in the corresponding analyzed request data as the number of a data center;
and taking the second data in the corresponding parsed request data as the serial number of the server.
7. A service identification generating device, the device comprising:
the acquisition module is used for receiving a plurality of service requests at intervals of a preset receiving time period and acquiring receiving time stamps corresponding to the service requests;
the analysis module is used for analyzing each service request to obtain the number of the data center and the number of the server, and the data center and the server are used for responding to each service request; each data center comprises at least one server;
the determining module is used for determining the service identifier corresponding to each service request according to a preset initial identifier, the number of the data center, the number of the server, the current time stamp and the receiving time stamp corresponding to each service request.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202310672719.9A 2023-06-07 2023-06-07 Service identifier generation method, device, computer equipment and storage medium Pending CN116881247A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310672719.9A CN116881247A (en) 2023-06-07 2023-06-07 Service identifier generation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310672719.9A CN116881247A (en) 2023-06-07 2023-06-07 Service identifier generation method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116881247A true CN116881247A (en) 2023-10-13

Family

ID=88265122

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310672719.9A Pending CN116881247A (en) 2023-06-07 2023-06-07 Service identifier generation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116881247A (en)

Similar Documents

Publication Publication Date Title
US20210365421A1 (en) Data analysis method, computer device and storage medium
CN110213614B (en) Method and device for extracting key frame from video file
CN111008246A (en) Database log synchronization method and device, computer equipment and readable storage medium
CN112860706A (en) Service processing method, device, equipment and storage medium
CN112784112A (en) Message checking method and device
CN109359109B (en) Data processing method and system based on distributed stream computing
CN114928574A (en) Information sending method, information sending device, electronic equipment and computer readable medium
CN113468196B (en) Method, apparatus, system, server and medium for processing data
CN111857981A (en) Data processing method and device
CN112347355A (en) Data processing method, device, server and storage medium
CN110297945B (en) Data information processing method and system based on XBRL
CN110222046B (en) List data processing method, device, server and storage medium
CN111124883A (en) Test case library introduction method, system and equipment based on tree form
CN113111078B (en) Resource data processing method and device, computer equipment and storage medium
CN114968917A (en) Method and device for rapidly importing file data
CN115795187A (en) Resource access method, device and equipment
CN116881247A (en) Service identifier generation method, device, computer equipment and storage medium
CN113778996A (en) Large data stream data processing method and device, electronic equipment and storage medium
CN114490402A (en) Method and device for checking validity of message field
CN117216164A (en) Financial data synchronous processing method, apparatus, device, medium and program product
CN111294321B (en) Information processing method and device
CN110019352B (en) Method and apparatus for storing data
CN114218293A (en) Data query method and device based on incremental algorithm and storage medium
CN116795835A (en) Correlation query method and device
CN115629958A (en) Universal field level automatic checking method and device for different service interfaces

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