CN117692425A - Global unique identification processing method and device, storage medium and electronic equipment - Google Patents

Global unique identification processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN117692425A
CN117692425A CN202211080854.6A CN202211080854A CN117692425A CN 117692425 A CN117692425 A CN 117692425A CN 202211080854 A CN202211080854 A CN 202211080854A CN 117692425 A CN117692425 A CN 117692425A
Authority
CN
China
Prior art keywords
identifier
machine
target
rendering
identification
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
CN202211080854.6A
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.)
Tencent Technology Beijing Co Ltd
Original Assignee
Tencent Technology Beijing 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 Tencent Technology Beijing Co Ltd filed Critical Tencent Technology Beijing Co Ltd
Priority to CN202211080854.6A priority Critical patent/CN117692425A/en
Publication of CN117692425A publication Critical patent/CN117692425A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a global unique identification processing method, a global unique identification processing device, a storage medium and electronic equipment, and can be applied to the field of cloud technology. The method comprises the following steps: under the condition that a global unique identifier generation request is received, determining a preset machine identifier interval; generating a target machine identifier by accessing an identifier management library, wherein the identifier management library is used for recording the machine identifier currently occupied by each node in the distributed identifier generation system; obtaining a target machine identifier which is not recorded in the identifier management library and belongs to the machine identifier section of the preset machine identifier section under the condition that the generation operation is successfully executed; and acquiring a time stamp identifier and a sequence identifier, and fusing the time stamp identifier, the target machine identifier and the sequence identifier to obtain a global unique identifier. The method and the device can ensure the strong uniqueness of the generated globally unique identifier.

Description

Global unique identification processing method and device, storage medium and electronic equipment
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a global unique identification processing method, a global unique identification processing device, a storage medium and electronic equipment.
Background
The global unique identifier is almost a rigid requirement under various business scenes, and as business scope is expanded, the number of business service objects is increased, and the requirement amount for the global unique identifier is also increased. In order to meet the number requirement of processing the globally unique identifiers, the related technology adopts an identifier generation system comprising a plurality of identifier generation nodes to automatically generate the globally unique identifiers, and in order to generate the globally unique identifiers with strong uniqueness, different nodes should provide different machine identifiers, but the related technology generally has difficulty in meeting the requirement of the strong uniqueness of the machine identifiers, and does not have a matched design of a corresponding machine identifier management maintenance scheme, so that the generation management of the machine identifiers is called a short board for the performance of the processing scheme of the toggle globally unique identifiers.
Disclosure of Invention
In order to solve at least one technical problem described above, embodiments of the present application provide a global unique identifier processing method, apparatus, storage medium, and electronic device.
In one aspect, an embodiment of the present application provides a global unique identifier processing method, which is applied to a target node, where the target node is any node in a distributed identifier generating system, and the method includes:
Under the condition that a global unique identifier generation request is received, determining a preset machine identifier interval;
generating a target machine identifier by accessing an identifier management library, wherein the identifier management library is used for recording the machine identifier currently occupied by each node in the distributed identifier generation system;
under the condition that the generating operation is successfully executed, a target machine identifier is obtained, wherein the target machine identifier is a machine identifier which is not recorded in the identifier management library and belongs to the preset machine identifier section;
and acquiring a time stamp identifier and a sequence identifier, and fusing the time stamp identifier, the target machine identifier and the sequence identifier to obtain a global unique identifier.
In another aspect, an embodiment of the present application provides a globally unique identifier processing apparatus, where the apparatus is applied to a target node, where the target node is any node in a distributed identifier generating system, and the apparatus includes:
the interval determining module is used for determining a preset machine identification interval under the condition of receiving a global unique identification generation request;
the machine identifier generation module is used for generating a target machine identifier by accessing an identifier management library, wherein the identifier management library is used for recording the machine identifier currently occupied by each node in the distributed identifier generation system;
The machine identification acquisition module is used for acquiring a target machine identification which is not recorded in the identification management library and belongs to the machine identification section of the preset machine identification section under the condition that the generation operation is successfully executed;
and the global unique identifier generation module is used for acquiring the timestamp identifier and the sequence identifier, and fusing the timestamp identifier, the target machine identifier and the sequence identifier to obtain the global unique identifier.
In another aspect, embodiments of the present application provide a computer readable storage medium having at least one instruction or at least one program stored therein, where the at least one instruction or at least one program is loaded and executed by a processor to implement a globally unique identification processing method as described above.
In another aspect, an embodiment of the present application provides an electronic device including at least one processor, and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor, and the at least one processor implements a globally unique identification processing method by executing the instructions stored in the memory.
In another aspect, embodiments of the present application provide a computer program product comprising a computer program or instructions which, when executed by a processor, implement a globally unique identification processing method as described above.
The embodiment of the application provides a global unique identifier processing method, a device, a storage medium and electronic equipment, and the scheme can be applied to an identifier generation system comprising multiple nodes, so that the work erID (target machine identifier) of the global unique identifier generated by each node is ensured not to conflict, that is, the strong uniqueness of the global unique identifier generated by each node is ensured. The recovery mechanism of the work erID can be further arranged to ensure that the work erID can be recovered in a delayed manner under the condition that the node is down, so that the work erID is not wasted, and the work erID conflict caused by the down is not generated. The workerID of each node is dynamic and not a set of variables, which promotes flexibility and scalability of the solution.
Drawings
In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or of the related art, the following description will briefly explain the drawings required to be used in the embodiments or the related art, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort to those skilled in the art.
FIG. 1 is a schematic diagram of globally unique identifiers generated by a snowflake algorithm provided by an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a possible implementation framework of the globally unique identification processing method provided in an embodiment of the present application;
FIG. 3 is a flowchart of a method for processing globally unique identifiers according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for generating an identifier according to an embodiment of the present application;
FIG. 5 is a timing diagram of generating a globally unique identifier in a distributed identifier generation system provided by an embodiment of the present application;
FIG. 6 is a flow chart of a scripting operation provided by an embodiment of the present application;
FIG. 7 is a state diagram of a script operation provided by an embodiment of the present application;
FIG. 8 is a schematic diagram of execution interactions in a cloud rendering scenario provided by an embodiment of the present application
Fig. 9 is a schematic diagram of execution interaction of a virtual article interaction scenario provided in an embodiment of the present application;
FIG. 10 is a block diagram of a globally unique identification processing device provided by an embodiment of the present application;
fig. 11 is a schematic hardware structure of an apparatus for implementing the method provided in the embodiment of the present application.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the embodiments of the present application, are within the scope of the embodiments of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the embodiments of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In order to make the objects, technical solutions and advantages disclosed in the embodiments of the present application more apparent, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the present application embodiments and are not intended to limit the present application embodiments.
The terms "first" and "second" are used below for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present embodiment, unless otherwise specified, the meaning of "plurality" is two or more. In order to facilitate understanding of the technical solutions and the technical effects produced by the embodiments of the present application, the embodiments of the present application first explain related terms:
cloud technology (Cloud technology): the hosting technology is used for integrating hardware, software, network and other series resources in a wide area network or a local area network to realize calculation, storage, processing and sharing of data. The cloud computing business model application-based network technology, information technology, integration technology, management platform technology, application technology and the like can be collectively called to form a resource pool, and the resource pool is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the high development and application of the internet industry, each article possibly has an own identification mark in the future, the identification mark needs to be transmitted to a background system for logic processing, data with different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
The intelligent transportation system (Intelligent Traffic System, ITS), also called intelligent transportation system (Intelligent Transportation System), is a comprehensive transportation system which uses advanced scientific technology (information technology, computer technology, data communication technology, sensor technology, electronic control technology, automatic control theory, operation study, artificial intelligence, etc.) effectively and comprehensively for transportation, service control and vehicle manufacturing, and enhances the connection among vehicles, roads and users, thereby forming a comprehensive transportation system for guaranteeing safety, improving efficiency, improving environment and saving energy.
The intelligent vehicle-road cooperative system (Intelligent Vehicle Infrastructure Cooperative Systems, IVICS), which is simply called a vehicle-road cooperative system, is one development direction of an Intelligent Transportation System (ITS). The vehicle-road cooperative system adopts advanced wireless communication, new generation internet and other technologies, carries out vehicle-road dynamic real-time information interaction in an omnibearing manner, develops vehicle active safety control and road cooperative management on the basis of full-time idle dynamic traffic information acquisition and fusion, fully realizes effective cooperation of human-vehicle roads, ensures traffic safety, improves traffic efficiency, and forms a safe, efficient and environment-friendly road traffic system.
Globally unique identification (IDentity Document, ID): an ID can be understood as an identification number, also called a serial number or account number, which is a relatively unique code in a system, and is equivalent to an "identity" tag. In a particular instance, the identification number is generally invariant, and different identities are provided with different identification numbers, i.e. the identification number is a string of characters with uniqueness and invariance. Of course, the particular method of how the identification number is generated need not be limited to uniqueness, but need only ensure uniqueness and invariance. In a specific service application, the concept of global unique identification is emphasized more, that is, because a large number of concurrent situations may need to be faced in the service application, but it is also required to ensure that the identification numbers generated by different identification generating nodes at different times are different, and that a plurality of identification numbers generated by the same identification generating node at the same time are also different, that is, the identification numbers have uniqueness in the global, so that the identification numbers are global unique identifications. The globally unique identifier may be used in a number of scenarios, such as in an e-commerce scenario, where the globally unique identifier may be used as an identification number for the item or where the globally unique identifier may be used as an identification number for the order. For another example, in an instant messaging scenario, the globally unique identification may be used as an identification number for a message or an identification number for an event. In summary, to ensure concurrency, multiple ID generation nodes are often required to provide an ID generation service, and the generated IDs belong to a global unique identifier, that is, it is ensured that IDs generated by any node at any time are different, and different IDs generated by the same node at the same time are also different.
ID generator: in the embodiment of the application, a process or service for generating the globally unique identifier is referred to as an ID generator, and the ID generator may also be understood as a certain node in the identifier generating system or be located in the certain node. Of course, the ID generator may operate in various forms of processes, threads, services, micro-services, applets, and the like, which are not limited by the embodiments of the present application.
Snowflake algorithm: an algorithm for generating a distributed globally unique identifier, the generated ID is called snowflag IDs or snowflags. Is an algorithm used to generate globally unique identifications, which is more commonly adopted by many internet companies. Referring to FIG. 1, a diagram of globally unique identifiers generated by a snowflake algorithm is shown. The global unique identifier is mainly a global ID generated by a 64-bit long type, and a time stamp is introduced to keep the self-increment attribute for the ID.
Wherein, 64 bits are divided into four parts:
the first part is 1bit, which is not used and has no meaning;
the second part is 41 bits, which constitute a time stamp;
the third part is 10 bits, the work machine identification, the inside is divided into two parts, 5 bits refer to the machine room number, representing at most 32 machine rooms, 5 bits refer to the ID of the machine, representing at most 25 machines. The work machine identifier is used in the related art as a second part of the snowflake algorithm, and is represented by a workerID. For distinguishing work machines to ensure that globally unique identifications generated by different machines are not identical. The working machine identifier generally occupies 10 bits, can be distributed for 1024 nodes, and has the need of adjusting the bit number. The allocation and reclamation of the workerID is the key to ensuring the validity of the snowflake algorithm.
The fourth part is 12 bits, and the identification of the part is represented by SeqID in the related technology, and represents that different globally unique identifications are generated in the same millisecond, and globally unique identifications generated in the same millisecond are distinguished. SeqID is used to ensure that the globally unique identities generated by the same machine at the same time are not identical. Typically, the time stamp is in the order of milliseconds, and SeqID occupies 12 bits, that is, the same machine generates 4096 SeqID at most every millisecond, and if the time stamp exceeds the time stamp, the same SeqID is generated to collide. For example, the same machine room, the same machine, different globally unique identities generated at the same millisecond, and the differences between these globally unique identities are distinguished by the last 12 bits, i.e. the SeqID, differences.
In general, snowflake algorithms ensure that the generated globally unique identifier is incremented in time and that the system used to generate the globally unique identifier does not have a duplicate globally unique identifier. In the actual use process, the snowflake algorithm is continuously improved and developed so as to meet the requirement of strong uniqueness, but the related technology can only basically ensure global uniqueness at present and cannot ensure absolute global uniqueness, that is, the actual implementation effect is difficult to meet the requirement of uniqueness.
Redis (Remote Dictionary Server), remote dictionary service. Is a database storing key-value pairs. Expiration times may also be set for key-value pairs. Can be used for managing records, expiration, duration and the like of key value pairs.
Lua: is a lightweight and compact scripting language designed to provide flexible extension and customization functionality for applications by being flexibly embedded in the application. Lua is written in standard C language and is open in source code form, and may be compiled and run in various operating systems and platforms, which are mainly applied to the scene of embedded application programs, thereby providing flexible expansion and customization functions for application programs. The Lua script can be easily called by the C/C++ code, and can also be used for calling the function of the C/C++ in reverse, so that the Lua can be widely applied in application programs. Not only as an extension script, but also as a common configuration file, and is easier to understand and maintain. Lua is written by a standard C, the code is concise and graceful, a complete Lua interpreter is 200k, and the running speed of Lua is fast, so that Lua is the best choice as an embedded script. The foregoing Redis may execute a Lua script in addition to the read and write commands.
The RPC is known as Remote Procedure Call, remote procedure call. Remote, by which is meant requiring network communication, may be understood invoking a method on a remote machine. The purpose of RPC is to make the invocation of remote methods as indiscriminate as the invocation of local methods. The RPC framework aims to enable remote service call to be simpler and transparent, the RPC framework is responsible for shielding the details of serialization, transmission mode and communication of the bottom layer, a developer only needs to know who provides what remote service interface at what position when in use, and the details of communication and the call process of the bottom layer do not need to be concerned. The RPC framework is used as a basic component of architecture micro-service, can greatly reduce the cost of architecture micro-service and improve the research and development efficiency of a caller and a service provider. In a typical RPC usage scenario, components such as service discovery, load, fault tolerance, network transmission, serialization are mainly included, where the "RPC protocol" indicates how services are serialized and network transmitted, which is also the core function of the RPC. The RPC framework may be responsible for starting up a process, closing a process, sending a request to a process, etc., and is used in many business frameworks.
In a computer operating environment, generating a globally unique identification is almost all business-just-needed, e.g., generating a user ID, an order ID, an item ID, etc. The snowflake algorithm is an excellent global unique identification processing thought, so that modified or fine-tuned variant snowflake algorithm is adopted in a plurality of technical schemes. The improvement of snowflake algorithm by the related art is mainly focused on the improvement of time callback and the improvement of SeqID exhaustion. Time callback refers to a problem related to a timestamp in a snowflake algorithm, for example, if an ID is generated at time a, and 10 seconds pass to time B, but machine time is callback to time a, then IDs generated at time a are possibly generated, and conflicts are generated, which creates a time callback problem. In order to overcome the technical problem, various variational snowflake algorithms capable of solving time callback are proposed in the related art. SeqID exhaustion means that each time node can only produce 2≡12=4096 IDs, if a large number of ID generation demands emerge for a short period, the number of generated IDs may exceed the number, and ID collision is inevitable, which is SeqID exhaustion. In order to solve this technical problem, the related art also proposes a technical solution to solve the SeqID depletion problem by time control.
However, there is little technical research on the allocation and reclamation control of the snowflake algorithm, which is critical to generating globally unique identifiers, and it is desirable to make each workerID unique and recyclable. Otherwise, the workerIDs between different machines are the same, and conflicting IDs are generated. With the increase of service complexity and service magnitude, a large-magnitude identifier is often required to be generated, so that a large generation pressure is generated by generating a plurality of globally unique identifiers in a multi-node concurrent mode, and the problem of distribution and recovery control of the workerID of each node is further highlighted and needs to be solved.
In order to ensure that the generation of global unique identifiers by different nodes does not conflict, a qualified variant snowflake algorithm must ensure that the non-conflicting workerID is allocated, and meanwhile, the workerID is correctly recovered when the node is down. However, the related art has not provided an effective method for this. For example, for a cluster application, the conventional approach to have different machines automatically generate different machine workerids is to configure each machine separately, but doing so is detrimental to the cluster level expansion and the operation process is very complex. There are also methods, for example, a method of performing a hash operation on a network address and a network port number where a node is located and then performing a modulo operation according to the hash operation to obtain a workerID, but the workerID generated by the method has a probability conflict, and cannot ensure that a unique workerID is generated.
In view of this, the embodiments of the present application provide a global unique identifier processing method, which may be applied to an identifier generating system including multiple nodes, to ensure that the workerids of the global unique identifiers generated by each node do not collide, that is, to ensure strong uniqueness of the global unique identifiers generated by each node. By setting the recovery mechanism of the work erID, the work erID can be recovered in a delayed manner under the condition that the node is down, so that the work erID is not wasted, and the work erID conflict caused by the down is not generated.
The embodiment of the application can be applied to public cloud, private cloud or mixed cloud scenes, for example, each global unique identifier generated in the application can be stored in the public cloud, the private cloud or the mixed cloud, or each node for generating the global unique identifier can be arranged in the public cloud, the private cloud or the mixed cloud. A Private Cloud (Private Cloud) is a Cloud infrastructure created with software and hardware resources within a firewall for organizations or departments within an enterprise to share resources within a data center. Public clouds (Public clouds) generally refer to clouds that third party providers provide to users that can use, and are generally available over the Internet, and may be free or low cost, with the core attribute of the Public clouds being shared resource services. There are many examples of such clouds that can provide services throughout the open public network today. HybrID Cloud (HybrID Cloud) fuses Public Cloud (Public Cloud) and Private Cloud (Private Cloud), which are the main modes and development directions of Cloud computing in recent years. Private clouds are mainly for enterprise users, and for safety reasons, enterprises prefer to store data in the private clouds, but at the same time wish to obtain computing resources of public clouds, in which case hybrid clouds are increasingly adopted, and mix and match the public clouds and the private clouds to obtain the best effect.
Referring to fig. 2, fig. 2 is a schematic diagram of one possible implementation framework of the method for processing a globally unique identifier according to the embodiment of the present disclosure, as shown in fig. 2, the implementation framework may at least include a client 10 and a globally unique identifier processing server 20, where the client 10 and the globally unique identifier processing server 20 communicate through a network 30, and the client 10 may issue a globally unique identifier generating request. The globally unique identification processing server 20 may be any node in the system for distributed identification generation. The globally unique identifier processing server 20 may determine a preset machine identifier interval when receiving the globally unique identifier generation request; generating a target machine identifier by accessing an identifier management library, wherein the identifier management library is used for recording the machine identifier currently occupied by each node in the distributed identifier generation system; obtaining a target machine identifier which is not recorded in the identifier management library and belongs to the machine identifier section of the preset machine identifier section under the condition that the generation operation is successfully executed; and acquiring a time stamp identifier and a sequence identifier, and fusing the time stamp identifier, the target machine identifier and the sequence identifier to obtain a global unique identifier.
The globally unique identifier processing server 20 may be located in a cloud environment, and may be any node in the distributed identifier generating system, that is, the distributed identifier generating system may be also laid out in the cloud environment, where any node may provide the foregoing globally unique identifier processing service, and as known from the foregoing, each node generates a machine identifier and a globally unique identifier by using the same method, but the machine identifier occupation situation of each node is uniformly managed by the identifier management library, so that each node has uniqueness based on the machine identifiers generated by the same method, which are different from each other. The technical scheme of the embodiment of the application has better expandability, and the distributed identifier generation system using the technical scheme of the embodiment of the application also has better expandability.
The framework of the embodiment of the invention can provide the globally unique identification processing capability required by applications in various scenes, wherein the applications comprise, but are not limited to, cloud technology, cloud games, cloud rendering, artificial intelligence, intelligent transportation, auxiliary driving, video media, intelligent communities, instant messaging and the like. The components in the framework may be terminal devices or servers. The terminal equipment comprises, but is not limited to, mobile phones, computers, intelligent voice interaction equipment, intelligent household appliances, vehicle-mounted terminals and the like.
Fig. 3 shows a flow chart of a global unique identifier processing method provided in the embodiment of the present application, where the method may be applied to a target node, where the target node is any node in a distributed identifier generating system. Embodiments of the present application provide method operational steps as described above in the embodiments or flowcharts, but may include more or fewer operational steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one way of performing the order of steps and does not represent a unique order of execution. When implemented in a system, terminal device or server product in practice, the methods illustrated in the embodiments or figures may be performed sequentially or in parallel (e.g., in a parallel processor or multithreaded environment), and may include:
s101, under the condition that a global unique identifier generation request is received, determining a preset machine identifier interval.
In some embodiments, the preset machine identification interval may be determined in response to an event that obtains a globally unique identification generation request. The embodiment of the application does not limit the scenario in which the globally unique identifier generation request is acquired. For example, in an electronic commerce scene, a new electronic commerce product is recorded, and a global unique identifier needs to be set for the electronic commerce product, so that under the condition that an electronic commerce product recording process is started, the process or a framework operated by the process can send out a global unique identifier generation request. For another example, under electronic payment, a new order is created, and a global unique identifier needs to be set for the order, so that when an order transaction process is started, the process or a framework running the process can send out a global unique identifier generating request.
S102, generating a target machine identifier by accessing an identifier management library, wherein the identifier management library is used for recording the machine identifier currently occupied by each node in the distributed identifier generation system.
Referring to fig. 4, a method flow diagram of a generating operation of a target machine identifier is shown, where the generating operation of the target machine identifier includes:
s201, determining a current machine identifier in the preset machine identifier interval.
At the beginning of the execution of the machine identification generation operation, an initial machine identification may be determined as the current machine identification, and the initial machine identification may be understood as any machine identification in a set of machine identifications (preset machine identification section) formed by various machine identifications that may be workerID. If the current machine identity is occupied, it indicates that there is another identity generating node that is already generating a globally unique identity based on the current machine identity, if the target node also uses the current machine identity to generate a globally unique identity, a conflict is likely to occur, and the uniqueness of the globally unique identity is violated, so for steps S202 to S205, an unoccupied machine identity is to be generated as the target machine identity.
In the embodiment of the application, the occupied machine identifications can be managed by using an identification management library, taking a distributed identification generation system as an example, the machine identifications occupied by all nodes in the system are managed in the identification management library, the identification management library records not only all occupied machine identifications but also the remaining holding time of each occupied machine identification, and the machine identifications can be recovered based on the remaining holding time.
S202, inquiring the identification management library based on the current machine identification.
In step S202, the identifier management library may be queried to obtain the occupancy status of the current machine identifier. In a specific embodiment, the identity management library may be built based on Redis. And directly judging the occupation condition of the current machine identifier through SETNX operation supported by Redis. SETNX represents Set if not exists, i.e., key (value) is not present to set value, otherwise it is not set, perfectly meeting the requirements of the embodiments of the present application. Specifically, the current machine identifier may be set in the identifier management library through the SETNX operation, if the operation is successful, it is indicated that the current machine identifier is not occupied, so that the current machine identifier may be directly used as the target machine identifier, that is, the execution result of the machine identifier generating operation is directly obtained (step S203), and the purpose of recording the current machine identifier in the identifier management library as the "occupied" machine identifier is achieved, because the target machine identifier is generated to be occupied and needs to be set in the Redis.
S203, under the condition that the query result is empty, judging that the generation operation is successfully executed, and determining the current machine identifier as the target machine identifier.
S204, judging that the generation operation fails to be executed under the condition that the query result is not null and all machine identifications in the preset machine interval are queried.
Specifically, when the query result is not null and all the machine identifications in the preset machine interval are queried, an error message may also be generated. If the machine identification interval is preset, the machine identifications which are not inquired are not existed, and all the machine identifications are occupied by other nodes, in this case, the target node cannot ensure to generate a unique global unique identification by using any machine identification, only can send error information, and the target node cannot provide the generation service of the global unique identification.
S205, under the condition that the query result is not null and the machine identifier which is not queried exists in the preset machine interval, updating the current machine identifier based on the machine identifier which is not queried, and repeatedly executing the step of querying the identifier management library based on the current machine identifier until the generation operation is successfully executed or the generation operation is failed to be executed.
If the current machine identifier is already occupied, only the inquiry can be carried out to determine whether other unoccupied machine identifiers exist, namely, the inquiry method is to find the machine identifier which is not inquired, take the machine identifier as a new current machine identifier and repeatedly execute inquiry operation. The preset machine identification interval is not limited in this embodiment, and may be considered as an interval formed by the foregoing machine identification set.
The identifier management library is also used for recording the remaining holding time corresponding to the machine identifier currently occupied by each node. In the case where the current machine identity is unoccupied, the current machine identity may be determined as the target machine identity. Determining a target duration corresponding to the target machine identifier; and setting the remaining holding time corresponding to the target machine identifier in the identifier management library based on the target duration, wherein the identifier management library is used for generating and storing a target machine identifier management record according to the target machine identifier and the remaining holding time corresponding to the target machine identifier. According to the foregoing, the execution purpose of the generation of the target machine identification management record can be directly achieved through the SETNX operation, that is, the generation of the target machine identification and the generation of the target machine identification management record are completed simultaneously through the execution of the SETNX operation, so that the execution efficiency is remarkably improved. Of course, if the SETNX operation fails, step S204 or step S205 is performed.
The target machine identifier which is not occupied by any node can be generated by executing steps S201 to S205, and the global unique identifier generated based on the target machine identifier is not the same as the global unique identifier generated by any other node, so that the strong uniqueness of the global unique identifier is ensured from the aspect of ensuring the uniqueness of the machine identifier.
If each node occupies the machine identifier in Redis whether it is in existence or not, the machine identifier will have a risk of exhaustion, and therefore, in the embodiment of the present application, the recovery of the machine identifier is also performed. Specifically, if the target node successfully generates the target machine identifier, the target node generates a timing task, wherein the triggering time interval of the timing task is smaller than the target duration; and the timing task is used for resetting the target machine identification management record based on the target duration time at a timing under the condition that the target node survives. And when the timing task is triggered, the target node updates the remaining holding time corresponding to the target machine identifier in the identifier management library, and the identifier management library is used for deleting the identifier record corresponding to the target machine identifier when the remaining holding time reaches a preset value. Wherein the target duration characterizes a minimum duration of time that the target machine identity is held by the target node, and the remaining holding time characterizes how long the target node can also hold the target machine identity.
For example, when the node 1 (target node) starts to generate the target machine identifier A1, the remaining holding time of the A1 is set to 24 hours (target duration), the remaining holding time gradually decreases in a countdown manner with the lapse of time, and when the remaining holding time is still 12 hours, the timing task of the node 1 arrives, and the remaining holding time of the A1 can be updated to 24 hours again, and the running period of the timing task is shorter than the target duration of the target machine identifier, so that the A1 can be ensured not to be recycled in the lifetime of the node 1. However, if the node 1 is down, the remaining holding time of the A1 cannot be updated, and obviously, the remaining holding time is reduced until reaching a preset value, for example, 0, and then released by the identifier management library, that is, the target machine identifier A1 originally occupied by the node 1 is recovered, so that the target machine identifier can be used by other nodes.
That is, if the target node survives, the corresponding remaining holding time is updated for the target machine identifier occupied by the target node at intervals by means of a timing task, and in the remaining holding time, the identifier management library does not delete the target machine identifier of the target node, and naturally, other nodes cannot generate the globally unique identifier by using the target machine identifier in the target node, so as to ensure that the globally unique identifier does not conflict because different nodes use the same machine identifier. After the target node is down, the remaining holding time of the target machine identifier occupied by the target node cannot be updated to the identifier management library, and under the condition that the remaining holding time reaches a preset value, the identifier management library can delete the target machine identifier management record of the target machine identifier of the target node, which is equivalent to releasing the target machine identifier, and other nodes can use the target machine identifier to generate a global unique identifier. Obviously, when other nodes can use the target machine identifier, the original target node occupying the target machine identifier is down, and it is impossible to generate a new globally unique identifier based on the target machine identifier, which ensures that no globally unique identifier conflict occurs.
S103, under the condition that the generation operation is successfully executed, a target machine identifier is obtained, wherein the target machine identifier is a machine identifier which is not recorded in the identifier management library and belongs to the preset machine identifier section.
The target machine identifier in the embodiment of the present application may be considered as a result of the successful execution of step S102, that is, if the machine identifier generating operation is successfully executed, the target machine identifier may be generated.
S104, acquiring a time stamp identifier and a sequence identifier, and fusing the time stamp identifier, the target machine identifier and the sequence identifier to obtain a global unique identifier.
As can be seen from the foregoing, the global unique identifier generated based on the snowflake algorithm needs three parts of content including 41 bits of timestamp information, 10 bits of work machine id (i.e. the target machine identifier generated in the embodiment of the present application) and 12 bits of sequence identifier, in step S102, the target machine identifier is generated, which may be the work machine id, but the timestamp information and the sequence identifier are also absent, so that in step S104, the timestamp identifier and the sequence identifier are obtained, respectively as the timestamp information and the sequence identifier, on the basis of obtaining the timestamp identifier, the target machine identifier and the sequence identifier, the timestamp identifier, the target machine identifier and the sequence identifier are sequentially connected, so as to obtain the global unique identifier conforming to the snowflake algorithm, and the sequential connection of the three identifiers based on the snowflake algorithm is one implementation mode of the fusion scheme in the embodiment of the present application. The time stamp information is main information for guaranteeing the increment performance of the globally unique identification generated based on the snowflake algorithm. 41 bits store a millisecond time stamp, 2≡41/(1000×60×60×24×365) =69, which can be used for 69 years. The last 12-bit sequence identity can be distinguished by this incremented sequence number at the same millisecond time stamp. That is, for the same machine, 2≡12=4096 non-repeated sequence identifications can be generated under the same millisecond time stamp. The specific method for generating the timestamp identifier and the sequence identifier in the embodiment of the present application is not described in detail.
As can be seen from fig. 1, the timestamp identifier, the target machine identifier, and the sequence identifier are sequentially spliced, and a global unique identifier can be obtained based on a splicing result.
In a specific implementation scenario, the target node interacts with an application component, where the application component includes a remote procedure call system, and before determining the preset machine identification interval when the global unique identification generation request is received, the method further includes: under the condition that a starting process notification is received, judging that the global unique identification generation request is acquired, wherein the starting process notification is from the remote procedure call system; the generating operation of the target machine identifier through the access identifier management library comprises the following steps: and transmitting a script file to the identification management library, wherein the script file is used for executing target machine identification generation operation through interaction with the identification management library.
In the embodiment of the application, the script type is not limited, and in consideration of the powerful performance of the Lua script, the execution speed of the method in the embodiment of the application can be improved by using the Lua script, and the cross-platform capability of the method in the embodiment of the application is improved.
Specifically, please refer to fig. 5, which illustrates a timing diagram for generating a globally unique identification in a distributed identification generation system. The method of the embodiment of the application can be implemented by any node (target node) in the distributed identity generation system, and the target node is interacted with a framework and a Redis respectively to complete the method of the embodiment of the application, wherein the framework is the remote procedure call system, and the Redis is the identity management library. The various components referred to in FIG. 5 may be adapted to various operating systems, without limitation to the operating environment and operating framework, such as may be running in a micro-service architecture. Of course, the application is not limited to the identifier management library, and may be a relational database, such as Mysql, besides Redis. Mysql is a relational database management system that keeps data in different tables rather than placing all data in one large warehouse, which increases speed and flexibility.
Firstly, if the framework starts a process, the framework can send a process starting notification to a target node, and the target node can judge that a global unique identifier generation request is acquired, so that a script file is sent to an identifier management library, wherein the script file is used for executing the machine identifier generation operation through interaction with the identifier management library. Specifically, if the generation is successful, the script feeds back the generated target machine identification (WorkerID) to the target node and triggers the Redis to record the target machine identification, otherwise, the script feeds back error information to the target node.
After generating the target machine identifier (WorkerID), the target node may also send a notification to the framework, and then the framework may request the target node to generate a globally unique identifier, and then the target node may acquire a Timestamp identifier (Timestamp) and a sequence identifier (SeqID), and based on the target machine identifier, the sequence identifier and the Timestamp identifier, the globally unique identifier may be spliced, and the globally unique identifier may be fed back to the framework.
The remaining holding time of the target machine identification may be updated to the Redis in response to the triggering of the timing task during the lifetime of the target node, so that the Redis maintains or reclaims the target machine identification according to the remaining holding time.
In a specific embodiment, as shown in FIG. 6, a flow chart of the scripting operation is shown. The script file is used for executing the following operations:
s301, determining a machine identification interval and an initial machine identification, wherein the initial machine identification is the leftmost machine identification in the machine identification interval.
In one embodiment, the Lua script may search for 1024 machine identifications in the machine identification interval [0,1023] in sequence, and return an error if both are occupied. Otherwise, the first unoccupied machine identifier is set as the target machine identifier, and the corresponding remaining holding time is set. The remaining holding time is set to release the target machine identifier occupied by the down node in the case that the target node is down.
S302, determining the initial machine identification as the current machine identification.
I.e. the current machine identification is set to 0.
S303, inquiring whether the current machine identifier is occupied or not in an identifier management library.
S304, performing self-increasing operation on the current machine identifier under the condition that the current machine identifier is occupied and the machine identifier which is not queried exists in the machine identifier interval; and repeatedly executing the operation of inquiring whether the current machine identifier is occupied in the identifier management library.
S305, determining the current machine identifier as the target machine identifier under the condition that the current machine identifier is unoccupied.
S306, generating error information when the current machine identifier is occupied and the current machine identifier is larger than the rightmost machine identifier in the machine identifier interval.
Specifically, please refer to fig. 7, which illustrates a state diagram of the script operation. The steps are to sequentially detect whether 0-1023 is allocated or not, if the current machine identifier x is not allocated, taking x as a target machine identifier, allocating the target machine identifier to a target node and setting the target node as an occupied state, and recording the identifier in an identifier management library and setting corresponding remaining holding time.
If the current machine identity x has been assigned, the current machine identity=x+1 is set. It is then checked whether the current machine identification is greater than 1023. If the machine identifier is more than 1023, an error is returned to-1, and the machine identifiers representing 0-1023 are all occupied. If the machine identification is less than or equal to 1023, continuing to sequentially detect whether the current machine identification is allocated.
Further, the target node periodically updates the remaining holding time of the target machine identifier to the identifier management library in an operating state; and the target node stops periodically updating the remaining holding time of the target machine identifier to the identifier management library in the downtime state. The aim of the operation is to facilitate the label management library to recycle the machine labels occupied by the down target nodes in time.
The method and the device can be applied to cloud rendering scenes, the target nodes interact with application components in the cloud rendering scenes, the application components comprise cloud rendering service components, rendering task databases and graphic rendering components, and the cloud rendering service components bear tasks of bidirectional interaction with clients and the target nodes in the cloud rendering scenes.
The cloud rendering service component is configured to send the global unique identifier generation request to the target node and receive the global unique identifier fed back by the target node when receiving a video rendering request from a client. The cloud rendering service component is further configured to generate a rendering task based on the global unique identifier, and trigger the graphics rendering component to execute the rendering task. And under the condition that the generation of the rendering task is successful, the cloud rendering service component is further used for generating a rendering task record in the rendering task database, setting the state of the rendering task record as a progress state, and feeding back the globally unique identifier to the client. The cloud rendering service component is further configured to extract the globally unique identifier in the rendering task state query request when the rendering task state query request from the client is acquired. The cloud rendering service component is further configured to query the rendering task database based on the global unique identifier, obtain a state of a rendering task record corresponding to the global unique identifier, and feed back the state to the client.
Please refer to fig. 8, which illustrates an execution interaction diagram of an embodiment of the present application in a cloud rendering scene, where the interaction method includes:
s401, the cloud rendering service component sends the global unique identification generation request to the target node under the condition that a video rendering request from a client is received.
S402, under the condition that the target node receives the global unique identifier generation request, generating and feeding back the global unique identifier to the cloud rendering service component.
The foregoing detailed description of the method for generating the globally unique identifier in the embodiment of the present application has been omitted herein. In fact, the technical solution of the embodiment of the present application may be implemented in each application scenario that needs to generate a globally unique identifier, and the cloud rendering scenario is not limited to the actual usage scenario of the embodiment of the present application by way of example.
S403, the cloud rendering service component generates a rendering task based on the global unique identifier and sends the rendering task to the graph rendering component.
The embodiments of the present application are not limited to graphics rendering components, for example, they may be user graphical interface components, or other components for performing rendering operations.
S404, when the generation of the rendering task is successful, the cloud rendering service component generates a rendering task record in the rendering task database, and sets the state of the rendering task record as an ongoing state.
Of course, if the generation of the rendering task fails, the cloud rendering service component may feed back to the client a result of the failure of the generation of the rendering task, and the cloud rendering cannot be performed.
S405, under the condition that the generation of the rendering task is successful, the graphic rendering component executes the cloud rendering task.
S406, under the condition that the generation of the rendering task is successful, the cloud rendering service component feeds back the global unique identification to the client.
The globally unique identifier is used by the client to query the state of the rendering task. The steps S404 to S406 are not limited in this embodiment, and may be executed concurrently or sequentially, and in the case of sequential execution, the execution order is not limited.
During execution of the rendering task, the cloud rendering service component is always in communication with the image rendering component so as to update execution progress of the rendering task in the rendering task database. The graphic rendering component is further configured to issue a completion notification to the cloud rendering component when the rendering task is executed; the cloud rendering service component is further configured to set a status of the rendering task record to a completed status when the completion notification is received.
S407, under the condition that the cloud rendering service component acquires the rendering task state query request from the client, extracting the globally unique identifier in the rendering task query request.
S408, the cloud rendering service component queries the rendering task database based on the global unique identifier to obtain the state of the rendering task record corresponding to the global unique identifier.
S409, the cloud rendering service component feeds the state back to the client.
By generating and using the technical scheme based on the embodiment of the application in the cloud rendering scene, the global unique identifier with strong uniqueness can be obtained under the cloud rendering scene, the rendering task can be generated based on the global unique identifier, and the global unique identifier can also be provided for a client for inquiring the progress of the rendering task, so that cloud rendering service with high concurrency can be provided for a large number of users, and the user viscosity is improved.
The embodiment of the application can also be applied to a virtual article interaction scene, the target node interacts with an application component under virtual article interaction, the application component comprises a virtual article service component and a virtual article management database, the virtual article service component is used for triggering the virtual article management database to verify an account associated with the virtual article transaction request under the condition that the virtual article transaction request from a client is received; and sending the global unique identifier generation request to the target node under the condition that the verification is passed; and receiving the global unique identifier fed back by the target node; the virtual article service component is further configured to use the globally unique identifier as a transaction identifier; the virtual article service component is further used for generating a virtual article transaction task according to the transaction identifier and the virtual article transaction request, and triggering the virtual article management database to execute the virtual article transaction task; and feeding back the execution result of the virtual article transaction task to the client.
Referring to fig. 9, an execution interaction schematic diagram of an embodiment of the present application in a virtual article interaction scenario is shown, where the interaction method includes:
s501. the virtual article service component receives a virtual article transaction request from a client.
The embodiment of the application is not limited to the specific content of the virtual article transaction request, and for example, virtual article transfer, virtual article payment, virtual article redemption and the like can be realized. The present application is not limited to virtual articles, and any article that is transacted by means of a network may be considered a virtual article, such as a coupon, an application-specific transaction object, such as a game piece in a game application, character equipment, a coupon in a payment application, or the like.
S502, the virtual article service component triggers the virtual article management database to verify the account associated with the virtual article transaction request.
The embodiment of the application does not limit verification content, for example, whether an account exists or not is verified, whether the account qualifies for executing the virtual article transaction or not is verified, and the like. For example, the virtual article transaction requires account a to transfer 100 virtual coins to account B, and then step S502 is required to check whether both account a and account B are present, whether both are eligible for the virtual article transaction, and whether the current balance of account a is greater than or equal to 100 virtual coins. Only if all three checks pass, the check in step S502 can be considered to pass, otherwise, the check in step S502 does not pass, and the virtual article service component can feed back the transaction failure to the client.
S503, under the condition that verification is passed, the virtual article service component sends the global unique identification generation request to the target node.
S504, the target node generates a globally unique identifier and transmits the globally unique identifier to the virtual article service component.
The foregoing detailed description of the method for generating the globally unique identifier in the embodiment of the present application has been omitted herein. In fact, the technical solution of the embodiments of the present application may be implemented in each application scenario that needs to generate a globally unique identifier, and the virtual article transaction scenario is not limited to the actual usage scenario of the embodiments of the present application by way of example.
S505, the virtual article service component takes the global unique identifier as a transaction identifier; and generating a virtual article transaction task according to the transaction identifier and the virtual article transaction request, and triggering the virtual article management database to execute the virtual article transaction task.
Using the previous example, the virtual article management database may subtract 100 from the balance of account a and add 100 to the balance of account B and feed back the result of the execution of the virtual article transaction task to the virtual article service component.
S506, the virtual article service component feeds back the execution result of the virtual article transaction task to the client.
Following the previous example, the virtual good service component may feed back to the client the success of the transfer.
By generating and using the technical scheme based on the embodiment of the application in the virtual article transaction scene, the global unique identifier with strong uniqueness can be obtained in the virtual article transaction scene, the transaction identifier can be obtained based on the global unique identifier, so that the virtual article transaction task is executed, the global unique identifier can be used for marking, storing and subsequent management of the virtual article transaction task, and therefore high concurrency virtual article transaction service can be provided for a large number of users, and the user viscosity is improved.
The method, the device, the storage medium and the electronic equipment for processing the global unique identifier can be applied to an identifier generation system comprising multiple nodes, and ensure that the workflow erID (target machine identifier) of the global unique identifier generated by each node is not in conflict, that is, the strong uniqueness of the global unique identifier generated by each node is ensured. The recovery mechanism of the work erID can be further arranged to ensure that the work erID can be recovered in a delayed manner under the condition that the node is down, so that the work erID is not wasted, and the work erID conflict caused by the down is not generated. The workerID of each node is dynamic and not a set of variables, which promotes flexibility and scalability of the solution. In addition, the embodiment of the application has the following remarkable advantages:
(1) The embodiment of the application realizes low dependence on storage in the process of automatically generating the global unique identifier, for example, a proper workerID can be finally determined by executing SETNX operation in the storage only under the event of acquiring the global unique identifier generation request, and the node can generate the global unique identifier based on the workerID after the workerID is held by the node, that is, the storage is not required to be accessed in the step of generating the global unique identifier by the node, so that the generation speed of the global unique identifier is improved.
In some embodiments, the store is accessed only when the associated process requiring globally unique identification is started and subsequently timed to report, with relatively low frequency access to the store. This has two benefits: the dependence on the outside is reduced, so that the overall reliability of the system can be improved; low dependency storage can significantly increase speed.
(2) The recovery logic is simple and clear, the worker ID can be correctly released even if the node is accidentally down, and the exhaustion risk of the worker ID is reduced; moreover, the generation of the work erID is still guaranteed not to conflict when the machine is down, namely the work erID is still occupied for a period of time after the machine is down. The new machine will occupy additional workerID and will not conflict with the original machine generated ID.
(3) The embodiment of the application has strong completeness, namely, the technical problem that the hash combined modulus can only ensure that the probability is not conflicted in the related technology is solved, and the work erID distributed in the embodiment of the application can be certainly not conflicted, but not the probability is not conflicted, so that the application is a technical scheme with strong completeness.
Referring to fig. 10, a block diagram of a global unique identifier processing apparatus in this embodiment is shown, and the apparatus is applied to a target node, where the target node is any node in a distributed identifier generating system, and the apparatus includes:
the interval determining module 101 is configured to determine a preset machine identification interval when receiving a global unique identification generation request;
the machine identifier generating module 102 is configured to perform a target machine identifier generating operation by accessing an identifier management library, where the identifier management library is configured to record a machine identifier currently occupied by each node in the distributed identifier generating system;
a machine identifier obtaining module 103, configured to obtain a target machine identifier, where the target machine identifier is a machine identifier that is not recorded in the identifier management library and belongs to the preset machine identifier section, if the generating operation is successfully performed;
The global unique identifier generating module 104 is configured to obtain a timestamp identifier and a sequence identifier, and fuse the timestamp identifier, the target machine identifier and the sequence identifier to obtain a global unique identifier.
In one embodiment, the identifier management library is further configured to record remaining holding time corresponding to a machine identifier currently occupied by each node; in case that the generating operation is successfully executed, the machine identifier generating module is configured to execute the following operations:
determining a target duration corresponding to the target machine identifier;
setting a remaining holding time corresponding to the target machine identifier in the identifier management library based on the target duration, wherein the identifier management library is used for generating and storing a target machine identifier management record according to the target machine identifier and the remaining holding time corresponding to the target machine identifier;
generating a timing task, wherein the triggering time interval of the timing task is smaller than the target duration;
and the timing task is used for resetting the target machine identification management record based on the target duration time at a timing under the condition that the target node survives.
In one embodiment, the machine identifier generating module is configured to perform the following operations:
determining a current machine identifier in the preset machine identifier interval;
querying the identity management library based on the current machine identity;
if the query result is empty, judging that the generation operation is successfully executed, and determining the current machine identifier as the target machine identifier;
judging that the generating operation fails to be executed under the condition that the query result is not null and all machine identifications in the preset machine interval are queried;
and repeatedly executing the step of querying the identifier management library based on the current machine identifier until the generation operation is successfully executed or the execution fails under the condition that the query result is not null and the machine identifier which is not queried exists in the preset machine interval, and updating the current machine identifier based on the machine identifier which is not queried.
In one embodiment, the target node interacts with an application component, where the application component includes a remote procedure call system, and the interval determining module is configured to determine that the globally unique identifier generation request is obtained when a start procedure notification is received, where the start procedure notification is from the remote procedure call system;
The machine identifier generating module is configured to perform the following operations: and transmitting a script file to the identification management library, wherein the script file is used for executing target machine identification generation operation through interaction with the identification management library.
In one embodiment, the target node interacts with application components, including a cloud rendering service component, a rendering task database, and a graphics rendering component,
the cloud rendering service component is used for sending the global unique identifier generation request to the target node and receiving the global unique identifier fed back by the target node under the condition that a video rendering request from a client is received;
the cloud rendering service component is further used for generating a rendering task based on the global unique identifier and triggering the graphic rendering component to execute the rendering task;
the cloud rendering service component is further configured to generate a rendering task record in the rendering task database, set a state of the rendering task record to a running state, and feed back the global unique identifier to the client if the rendering task is successfully generated;
the cloud rendering service component is further configured to extract the globally unique identifier in the rendering task state query request when the rendering task state query request from the client is acquired;
The cloud rendering service component is further configured to query the rendering task database based on the global unique identifier, obtain a state of a rendering task record corresponding to the global unique identifier, and feed back the state to the client.
In one embodiment, when the rendering task is performed, the graphics rendering component is further configured to issue a completion notification to the cloud rendering component;
the cloud rendering service component is further configured to set a status of the rendering task record to a completed status when the completion notification is received.
In one embodiment, the target node interacts with application components, including a virtual article service component and a virtual article management database,
the virtual article service component is used for triggering the virtual article management database to verify an account associated with the virtual article transaction request under the condition that the virtual article transaction request from the client is received; and sending the global unique identifier generation request to the target node under the condition that the verification is passed; and receiving the global unique identifier fed back by the target node;
The virtual article service component is further configured to use the globally unique identifier as a transaction identifier;
the virtual article service component is further used for generating a virtual article transaction task according to the transaction identifier and the virtual article transaction request, and triggering the virtual article management database to execute the virtual article transaction task; and feeding back the execution result of the virtual article transaction task to the client.
The device part and the method embodiment in the embodiment of the present application are based on the same inventive concept, and are not described herein in detail.
Further, fig. 11 shows a schematic diagram of a hardware structure of an apparatus for implementing the method provided by the embodiment of the present application, where the apparatus may participate in forming or including the device or the system provided by the embodiment of the present application. As shown in fig. 11, the apparatus 10 may include one or more processors 102 (shown as 102a, 102b, … …,102 n) which may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, the method may further include: a display, an input/output interface (I/O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of the I/O interface), a network interface, a power supply, and/or a camera. It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 11 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, the device 10 may also include more or fewer components than shown in FIG. 11, or have a different configuration than shown in FIG. 11.
It should be noted that the one or more processors 102 and/or other data processing circuits described above may be referred to generally herein as "data processing circuits. The data processing circuit may be embodied in whole or in part in software, hardware, firmware, or any other combination. Further, the data processing circuitry may be a single stand-alone processing module, or incorporated in whole or in part into any of the other elements in the device 10 (or mobile device). As referred to in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of the path of the variable resistor termination to interface).
The memory 104 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the above-described methods in the embodiments of the present application, and the processor 102 executes the software programs and modules stored in the memory 104, thereby performing various functional applications and data processing, that is, implementing a globally unique identification processing method as described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory located remotely from processor 102, which may be connected to device 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 106 is arranged to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communications provider of device 10. In one example, the transmission device 106 includes a network adapter (NetworkInterfaceController, NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a radio frequency (RadioFrequency, RF) module for communicating wirelessly with the internet.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the device 10 (or mobile device).
It should be noted that: the foregoing sequence of the embodiments of the present application is only for describing, and does not represent the advantages and disadvantages of the embodiments. And the foregoing description has been directed to specific embodiments of this application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
All embodiments in the embodiments of the present application are described in a progressive manner, and identical and similar parts of all embodiments are mutually referred to, and each embodiment focuses on the differences from other embodiments. In particular, for the device and server embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and references to the parts of the description of the method embodiments are only required.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The instructions in the storage medium may execute a global unique identifier processing method applied to a target node, where the target node is any node in a distributed identifier generating system, and the method includes:
under the condition that a global unique identifier generation request is received, determining a preset machine identifier interval;
generating a target machine identifier by accessing an identifier management library, wherein the identifier management library is used for recording the machine identifier currently occupied by each node in the distributed identifier generation system;
Obtaining a target machine identifier which is not recorded in the identifier management library and belongs to the machine identifier section of the preset machine identifier section under the condition that the generation operation is successfully executed;
and acquiring a time stamp identifier and a sequence identifier, and fusing the time stamp identifier, the target machine identifier and the sequence identifier to obtain a global unique identifier.
In one embodiment, the identifier management library is further configured to record remaining holding time corresponding to a machine identifier currently occupied by each node; in the case that the generating operation is successfully executed, the method further includes:
determining a target duration corresponding to the target machine identifier;
setting a remaining holding time corresponding to the target machine identifier in the identifier management library based on the target duration, wherein the identifier management library is used for generating and storing a target machine identifier management record according to the target machine identifier and the remaining holding time corresponding to the target machine identifier;
generating a timing task, wherein the triggering time interval of the timing task is smaller than the target duration;
and the timing task is used for resetting the target machine identification management record based on the target duration time at a timing under the condition that the target node survives.
In one embodiment, the generating operation of the target machine identifier by accessing the identifier management library includes:
determining a current machine identifier in the preset machine identifier interval;
querying the identity management library based on the current machine identity;
if the query result is empty, judging that the generation operation is successfully executed, and determining the current machine identifier as the target machine identifier;
judging that the generating operation fails to be executed under the condition that the query result is not null and all machine identifications in the preset machine interval are queried;
and repeatedly executing the step of querying the identifier management library based on the current machine identifier until the generation operation is successfully executed or the execution fails under the condition that the query result is not null and the machine identifier which is not queried exists in the preset machine interval, and updating the current machine identifier based on the machine identifier which is not queried.
In one embodiment, the target node interacts with an application component, the application component includes a remote procedure call system, and before determining the preset machine identification interval when the global unique identification generation request is received, the method further includes:
Under the condition that a starting process notification is received, judging that the global unique identification generation request is acquired, wherein the starting process notification is from the remote procedure call system;
the generating operation of the target machine identifier through the access identifier management library comprises the following steps:
and transmitting a script file to the identification management library, wherein the script file is used for executing target machine identification generation operation through interaction with the identification management library.
In one embodiment, the target node interacts with application components, including a cloud rendering service component, a rendering task database, and a graphics rendering component,
the cloud rendering service component is used for sending the global unique identifier generation request to the target node and receiving the global unique identifier fed back by the target node under the condition that a video rendering request from a client is received;
the cloud rendering service component is further used for generating a rendering task based on the global unique identifier and triggering the graphic rendering component to execute the rendering task;
the cloud rendering service component is further configured to generate a rendering task record in the rendering task database, set a state of the rendering task record to a running state, and feed back the global unique identifier to the client if the rendering task is successfully generated;
The cloud rendering service component is further configured to extract the globally unique identifier in the rendering task state query request when the rendering task state query request from the client is acquired;
the cloud rendering service component is further configured to query the rendering task database based on the global unique identifier, obtain a state of a rendering task record corresponding to the global unique identifier, and feed back the state to the client.
In one embodiment, the method further comprises:
the graphic rendering component is further configured to issue a completion notification to the cloud rendering component when the rendering task is executed;
the cloud rendering service component is further configured to set a status of the rendering task record to a completed status when the completion notification is received.
In one embodiment, the target node interacts with application components, including a virtual article service component and a virtual article management database,
the virtual article service component is used for triggering the virtual article management database to verify an account associated with the virtual article transaction request under the condition that the virtual article transaction request from the client is received; and sending the global unique identifier generation request to the target node under the condition that the verification is passed; and receiving the global unique identifier fed back by the target node;
The virtual article service component is further configured to use the globally unique identifier as a transaction identifier;
the virtual article service component is further used for generating a virtual article transaction task according to the transaction identifier and the virtual article transaction request, and triggering the virtual article management database to execute the virtual article transaction task; and feeding back the execution result of the virtual article transaction task to the client.
The foregoing description of the preferred embodiments is merely exemplary in nature and is not intended to limit the embodiments of the present application, but is intended to cover any modifications, equivalents, alternatives, and improvements falling within the spirit and principles of the embodiments of the present application.

Claims (11)

1. The global unique identification processing method is characterized by being applied to a target node, wherein the target node is any node in a distributed identification generation system, and the method comprises the following steps:
under the condition that a global unique identifier generation request is received, determining a preset machine identifier interval;
generating a target machine identifier by accessing an identifier management library, wherein the identifier management library is used for recording the machine identifier currently occupied by each node in the distributed identifier generation system;
Under the condition that the generating operation is successfully executed, a target machine identifier is obtained, wherein the target machine identifier is a machine identifier which is not recorded in the identifier management library and belongs to the preset machine identifier section;
and acquiring a time stamp identifier and a sequence identifier, and fusing the time stamp identifier, the target machine identifier and the sequence identifier to obtain a global unique identifier.
2. The method of claim 1, wherein the identity management library is further configured to record remaining holding times corresponding to machine identities currently occupied by nodes; in the case that the generating operation is successfully performed, the method further includes:
determining a target duration corresponding to the target machine identifier;
setting the remaining holding time corresponding to the target machine identifier in the identifier management library based on the target duration, wherein the identifier management library is used for generating and storing a target machine identifier management record according to the target machine identifier and the remaining holding time corresponding to the target machine identifier;
generating a timing task, wherein the triggering time interval of the timing task is smaller than the target duration;
And the timing task is used for resetting the target machine identification management record based on the target duration time at a timing under the condition that the target node survives.
3. The method according to claim 1 or 2, wherein the generating operation of the target machine identifier by accessing an identifier management library comprises:
determining a current machine identifier in the preset machine identifier interval;
querying the identity management library based on the current machine identity;
if the query result is empty, judging that the generation operation is successfully executed, and determining the current machine identifier as the target machine identifier;
judging that the execution of the generating operation fails under the condition that the query result is not null and all machine identifications in the preset machine interval are queried;
and under the condition that the query result is not null and the machine identifier which is not queried exists in the preset machine interval, updating the current machine identifier based on the machine identifier which is not queried, and repeatedly executing the step of querying the identifier management library based on the current machine identifier until the generation operation is successfully executed or the generation operation is failed to be executed.
4. The method of claim 1, wherein the target node interacts with an application component, the application component comprising a remote procedure call system, the method further comprising, prior to determining the preset machine identification interval upon receipt of the globally unique identification generation request:
under the condition that a starting process notification is received, judging that the global unique identification generation request is acquired, wherein the starting process notification is from the remote procedure call system;
the generating operation of the target machine identifier by accessing the identifier management library comprises the following steps:
and sending a script file to the identification management library, wherein the script file is used for executing target machine identification generation operation through interaction with the identification management library.
5. The method of claim 1, wherein the target node interacts with application components including a cloud rendering service component, a rendering task database, and a graphics rendering component,
the cloud rendering service component is used for sending the global unique identifier generation request to the target node and receiving the global unique identifier fed back by the target node under the condition that a video rendering request from a client is received;
The cloud rendering service component is further used for generating a rendering task based on the global unique identifier and triggering the graphic rendering component to execute the rendering task;
the cloud rendering service component is further configured to generate a rendering task record in the rendering task database, set a state of the rendering task record to a running state, and feed back the global unique identifier to the client if the rendering task is successfully generated;
the cloud rendering service component is further configured to extract the globally unique identifier in a rendering task state query request from the client if the rendering task state query request is acquired;
the cloud rendering service component is further configured to query the rendering task database based on the global unique identifier, obtain a state of a rendering task record corresponding to the global unique identifier, and feed back the state to the client.
6. The method of claim 5, wherein the method further comprises:
the graphic rendering component is further configured to issue a completion notification to the cloud rendering component when the rendering task is executed;
the cloud rendering service component is further configured to set a state of the rendering task record to a completion state if the completion notification is received.
7. The method of claim 1, wherein the target node interacts with an application component comprising a virtual article service component and a virtual article management database,
the virtual article service component is used for triggering the virtual article management database to verify an account associated with the virtual article transaction request under the condition that the virtual article transaction request from the client is received; and sending the global unique identification generation request to the target node under the condition that verification is passed; and receiving the globally unique identifier fed back by the target node;
the virtual article service component is further configured to use the globally unique identifier as a transaction identifier;
the virtual article service component is further used for generating a virtual article transaction task according to the transaction identifier and the virtual article transaction request, and triggering the virtual article management database to execute the virtual article transaction task; and feeding back an execution result of the virtual article transaction task to the client.
8. A globally unique identification processing apparatus, the apparatus being applied to a target node, the target node being any node in a distributed identification generation system, the apparatus comprising:
The interval determining module is used for determining a preset machine identification interval under the condition of receiving a global unique identification generation request;
the machine identifier generation module is used for generating a target machine identifier by accessing an identifier management library, wherein the identifier management library is used for recording the machine identifier currently occupied by each node in the distributed identifier generation system;
the machine identification acquisition module is used for acquiring a target machine identification which is not recorded in the identification management library and belongs to the machine identification section of the preset machine identification section under the condition that the generation operation is successfully executed;
and the global unique identifier generation module is used for acquiring the timestamp identifier and the sequence identifier, and fusing the timestamp identifier, the target machine identifier and the sequence identifier to obtain the global unique identifier.
9. A computer readable storage medium having stored therein at least one instruction or at least one program loaded and executed by a processor to implement a globally unique identification processing method according to any of claims 1 to 7.
10. An electronic device comprising at least one processor, and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the at least one processor implementing a globally unique identification processing method as claimed in any one of claims 1 to 7 by executing the instructions stored by the memory.
11. A computer program product comprising a computer program or instructions which, when executed by a processor, implements a globally unique identification processing method as claimed in any one of claims 1 to 7.
CN202211080854.6A 2022-09-05 2022-09-05 Global unique identification processing method and device, storage medium and electronic equipment Pending CN117692425A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211080854.6A CN117692425A (en) 2022-09-05 2022-09-05 Global unique identification processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211080854.6A CN117692425A (en) 2022-09-05 2022-09-05 Global unique identification processing method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117692425A true CN117692425A (en) 2024-03-12

Family

ID=90128841

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211080854.6A Pending CN117692425A (en) 2022-09-05 2022-09-05 Global unique identification processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117692425A (en)

Similar Documents

Publication Publication Date Title
CN111091429A (en) Electronic bill identification distribution method and device and electronic bill generation system
CN110069346B (en) Method and device for sharing resources among multiple processes and electronic equipment
CN110888858B (en) Database operation method and device, storage medium and electronic device
EP3062544B1 (en) Method, node and system for managing resources of machine type communication application
CN116566984B (en) Routing information creation method and device of k8s container cluster and electronic equipment
CN113691635A (en) Method and device for calling micro service, electronic equipment and readable storage medium
CN115562757A (en) Data processing method, configuration center system, electronic device, and storage medium
CN101699436A (en) Method, device and system for resource management
US20240118935A1 (en) Pod deployment method and apparatus
CN108540408B (en) Openstack-based distributed virtual switch management method and system
CN114565502A (en) GPU resource management method, scheduling method, device, electronic equipment and storage medium
CN114710549A (en) Dynamic management method, system and service node of network card in container platform
WO2018068655A1 (en) License management method and system
CN111124618B (en) Resource deployment method, device, storage medium and equipment
CN110324722B (en) Method, device, equipment and storage medium for acquiring data in live broadcast room
CN112698930A (en) Method, device, equipment and medium for obtaining server identification
CN109815202B (en) Log editing method and related device
CN102118422A (en) Peer node of RELOAD peer network as well as method and system for updating configuration of peer node
CN117692425A (en) Global unique identification processing method and device, storage medium and electronic equipment
CN103731501A (en) Mobile-terminal-based multi-people cooperative management method and system for backlogs
CN110935168B (en) Distributed ID generation method, device and equipment for global uniform architecture
CN113660353A (en) Method, device, equipment and medium for managing Provisioner address based on Bluetooth Mesh
CN113010600B (en) Data management system, method, related device and medium based on block chain
US20120072599A1 (en) Thin client system, management server, client environment management method and program
CN113055211B (en) Method for instantiating network service and network function virtualization orchestrator

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