Identity Generation Method, Apparatus, Electronic Device, and Storage Medium
By determining the program identifier when the application is online and obtaining available machine identifiers, and generating the identifiers using the SnowFlake algorithm, the problems of high cost and high performance overhead in the existing technology of identification generation methods in elastic container environments are solved, and efficient identification generation and global uniqueness are achieved.
Patent Information
- Application Number
- CN202111266310.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-28
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-10-28
AI Technical Summary
The identification generation method in the prior art cannot be applied to an elastic container environment, resulting in high operating and maintenance costs and large performance overhead, and insufficient applicability.
When the target instance of the application is online, the program identification is determined and the available machine identification corresponding to the identification is obtained. The SnowFlake algorithm is used to generate the identification related to the target instance, and the available machine identification is directly determined to save the performance overhead of the remote calling algorithm.
It effectively improves the efficiency of identity generation, reduces operation and maintenance costs, and ensures the generation of global unique identity in a distributed application environment.
Smart Images

Figure CN114116142B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular to artificial intelligence technologies such as deep learning and cloud computing. Specifically, it relates to an identifier generation method, apparatus, electronic device, and storage medium. Background Art
[0002] Artificial intelligence is a discipline that studies how to make a computer simulate certain thinking processes and intelligent behaviors of humans (such as learning, reasoning, thinking, planning, etc.). It has both hardware-level technologies and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, and several major directions such as machine learning, deep learning, big data processing technology, and knowledge graph technology.
[0003] The identifier generation methods in related technologies cannot be applied to elastic container environments and require high operation and maintenance costs, resulting in large performance overheads for the identifier generation methods and insufficient wide applicability. Summary of the Invention
[0004] The present disclosure provides an identifier generation method, apparatus, electronic device, storage medium, and computer program product.
[0005] According to a first aspect of the present disclosure, there is provided an identifier generation method, including: when a target instance of an application program goes online, determining a program identifier of the application program; obtaining an available machine identifier corresponding to the program identifier; and generating an identifier related to the target instance according to the available machine identifier.
[0006] According to a second aspect of the present disclosure, there is provided an identifier generation apparatus, including: a first determination module for determining a program identifier of the application program when a target instance of the application program goes online; an obtaining module for obtaining an available machine identifier corresponding to the program identifier; and a generation module for generating an identifier related to the target instance according to the available machine identifier.
[0007] According to a third aspect of the present disclosure, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the identifier generation method as in the first aspect.
[0008] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the identifier generation method as in the first aspect.
[0009] According to a fifth aspect of the present disclosure, there is provided a computer program product including a computer program which, when executed by a processor, implements the steps of the identification generation method as in the first aspect.
[0010] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0012] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure;
[0013] Figure 2 is a schematic diagram of the composition of the identifier of the SnowFlake algorithm according to the embodiment of the present disclosure;
[0014] Figure 3 is a schematic diagram according to the second embodiment of the present disclosure;
[0015] Figure 4 is a schematic diagram of the process of going live with an instance according to the embodiment of the present disclosure;
[0016] Figure 5 is a schematic diagram of the process of taking an instance offline according to the embodiment of the present disclosure;
[0017] Figure 6 is a schematic diagram according to the third embodiment of the present disclosure;
[0018] Figure 7 is a schematic diagram according to the fourth embodiment of the present disclosure;
[0019] Figure 8 shows a schematic block diagram of an example electronic device for implementing the identifier generation method according to the embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] The following describes exemplary embodiments of the present disclosure with reference to the drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, descriptions of well-known functions and structures are omitted for clarity and conciseness in the following description.
[0021] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure.
[0022] Among them, it should be noted that the execution subject of the identifier generation method in this embodiment is an identifier generation device, which can be implemented in software and / or hardware, and can be configured in an electronic device, which can include but is not limited to a terminal, a server, etc.
[0023] The embodiments of the present disclosure relate to the fields of artificial intelligence technologies such as deep learning and cloud computing.
[0024] Among them, Artificial Intelligence, abbreviated as AI in English, is a new technical science that studies, develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence.
[0025] Deep learning is to learn the internal laws and representation levels of sample data, and the information obtained during these learning processes is very helpful for the interpretation of data such as text, images, and sounds. The ultimate goal of deep learning is to enable machines to have the ability to analyze and learn like humans, and be able to recognize data such as text, images, and sounds.
[0026] Cloud computing refers to a technical system that accesses an elastic and scalable shared physical or virtual resource pool through a network. The resources can include servers, operating systems, networks, software, applications, and storage devices, etc., and the resources can be deployed and managed in a on-demand and self-service manner. Through cloud computing technology, it can provide efficient and powerful data processing capabilities for the application of technologies such as artificial intelligence and blockchain, and model training.
[0027] As Figure 1 shown, the identifier generation method includes:
[0028] S101: When the target instance of the application program goes online, determine the program identifier of the application program.
[0029] Among them, during the running of the application program, each time the application program is opened, a new application program process can be started, and this application program process can be called an application instance. For a distributed application program, during its running, it can support starting multiple application instances simultaneously. Among them, among the multiple application instances, the application instance for which the identifier is currently to be generated can be called the target instance.
[0030] Among them, the process of starting a new program process can be called the process of the application instance going online.
[0031] That is to say, the identifier generation method described in the embodiments of the present disclosure can be used to generate a globally unique identifier corresponding to the application instance when the application instance of the application program is started.
[0032] Among them, the program identifier can be used to identify a unique application, and the identifier can be, for example, a time identifier, a number identifier, a function identifier, etc., and there is no limitation on this.
[0033] In some embodiments, when the target instance of the application goes online, the program identifier of the application can be determined. It can be to determine the time identifier of the application and use this time identifier as the program identifier of the application. For example, the time when the target instance of the application goes online can be monitored, and the monitored time can be used as the program identifier of the application. Or any other possible method can also be adopted to determine the program identifier of the application when the target instance of the application goes online, and there is no limitation on this.
[0034] S102: Obtain the available machine identifier corresponding to the program identifier.
[0035] Among them, the machine identifier can be used to assist in generating the globally unique identifier of the application instance during the execution of the subsequent identifier generation method.
[0036] In some embodiments, obtaining the available machine identifier corresponding to the program identifier can be to read multiple pre-stored machine identifiers from a pre-constructed database (this database can be used to store multiple machine identifiers) according to the program identifier, and use the read multiple machine identifiers as the available machine identifiers.
[0037] In other embodiments, obtaining the available machine identifier corresponding to the program identifier can also be to obtain the network address of the available machine corresponding to the program identifier, register the corresponding machine identifier according to the obtained network address of the available machine, and use it as the available machine identifier. Or, any other possible method can also be adopted to obtain the available machine identifier corresponding to the program identifier, and then the identifier related to the target instance can be generated based on the available machine identifier. For details, please refer to the subsequent embodiments.
[0038] S103: Generate an identifier related to the target instance according to the available machine identifier.
[0039] After obtaining the available machine identifier corresponding to the program identifier in the embodiments of the present disclosure, an identifier related to the target instance can be generated according to the available machine identifier.
[0040] Among them, the identifier related to the target instance can be used to uniquely identify the target instance. This identifier can be, for example, a time identifier, a number identifier, a function identifier, and there is no limitation on this.
[0041] In the embodiments of the present disclosure, an identifier related to a target instance may be generated according to an available machine identifier. It may be to generate an identifier related to the target instance by combining the available machine identifier with an identifier generation algorithm deployed inside the target instance, or alternatively, any other possible method may be used to implement the step of generating an identifier related to the target instance according to the available machine identifier, and no limitation is imposed thereon.
[0042] Among them, the identifier generation algorithm may specifically be, for example, the SnowFlake algorithm, the Universally Unique Identifier (UUID) algorithm, or any other algorithm that can be used to generate a globally unique identifier, and no limitation is imposed thereon.
[0043] In the embodiments of the present disclosure, the SnowFlake algorithm may be used to generate an identifier related to the target instance. Among them, the identifier generated by the SnowFlake algorithm is a 64-bit long integer identifier (Identity, ID), as Figure 2 shown, Figure 2 is a schematic diagram of the composition of the identifier of the SnowFlake algorithm according to the embodiments of the present disclosure. The 64 bits can be assigned different fields. 1 bit is a fixed identifier, 41 bits are the current machine timestamp, 10 bits are the machine identifier bits, and 12 bits are the increment sequence bits. Among them, the machine identifier bits need to be manually configured to ensure that the SnowFlake algorithm running on different machine nodes can generate different unique identifiers.
[0044] In the embodiments of the present disclosure, the SnowFlake algorithm may be embedded inside the application program instance to ensure that in the environment of a distributed application program, when program instance automatic migration, program instance number expansion and contraction occur, each program instance can independently use the snowflake algorithm, avoiding conflicts when each application program instance uses the algorithm, so as to ensure that each application program instance can have a corresponding globally unique identifier.
[0045] In this embodiment, when the target instance of the application program goes online, the program identifier of the application program is determined, the available machine identifier corresponding to the program identifier is obtained, and an identifier related to the target instance is generated according to the available machine identifier. Since the available machine identifier is directly determined according to the program identifier of the application program, the performance overhead generated by remotely calling the algorithm for determining the available machine identifier related to the identifier generation can be effectively saved, and the identifier generation efficiency can be effectively improved.
[0046] Figure 3 is a schematic diagram according to the second embodiment of the present disclosure.
[0047] As Figure 3 shown, the identifier generation method includes:
[0048] S301: Determine multiple sorting positions respectively corresponding to multiple machine identifiers.
[0049] In the embodiments of the present disclosure, the multiple machine identifiers may be sorted according to a certain arrangement rule (for example: random arrangement, which is not limited herein), and correspondingly, the multiple machine identifiers may have different sorting positions according to different arrangement orders, and the sorting positions may be used to describe the position information of the machine identifiers.
[0050] Among them, determining multiple sorting positions respectively corresponding to multiple machine identifiers may be, when sorting the multiple machine identifiers, sequentially numbering the multiple machine identifiers according to the arrangement order of the machine identifiers, and then determining multiple sorting positions corresponding to the multiple machine identifiers based on the sequential numbers, which is not limited herein.
[0051] S302: Determine multiple occupancy states respectively corresponding to multiple machine identifiers.
[0052] In the embodiments of the present disclosure, after determining multiple sorting positions respectively corresponding to multiple machine identifiers, multiple occupancy states respectively corresponding to the multiple machine identifiers may be determined.
[0053] Among them, the occupancy state may be used to describe the occupancy situation of the multiple machine identifiers, and the occupancy situation may be specifically, for example, unoccupied, occupied, etc., which is not limited herein.
[0054] In the embodiments of the present disclosure, determining multiple occupancy states respectively corresponding to multiple machine identifiers may be sequentially traversing the multiple machine identifiers according to the arrangement order of the machine identifiers. If it is determined that the machine identifier is occupied by other program instances, the machine identifier may be marked as occupied. If it is determined that the machine identifier is not occupied by other instances, the machine identifier may be marked as unoccupied, which is not limited herein.
[0055] S303: Write the corresponding multiple machine identifiers into the identifier data table in order according to the multiple sorting positions respectively, and use the occupancy state to mark the corresponding machine identifiers in the identifier data table.
[0056] Among them, the identifier data table may be used to store multiple machine identifiers and multiple occupancy states respectively corresponding to the multiple machine identifiers. The identifier data table may be constructed in a database for storing machine identifiers, or may also be constructed in any other possible database, which is not limited herein.
[0057] In an embodiment of the present disclosure, after determining multiple sorting positions and multiple occupancy states corresponding to multiple machine identifiers, the multiple machine identifiers and the occupancy states corresponding to the machine identifiers can be written into the identification data identifier according to the sorting positions of the data identifiers, so that during the execution of the subsequent identification generation method, instances of the application program can more conveniently call the machine identifiers.
[0058] S304: Perform an association process on the program identifier and the identification data table.
[0059] In an embodiment of the present disclosure, after determining the program identifier of the application program and the identification data table, an association process can be performed on the program identifier and the identification data table. The association process can be specifically, for example, data association, call relationship association, etc., and is not limited thereto.
[0060] In an embodiment of the present disclosure, when performing an association process on the program identifier and the identification data table, multiple program identifiers can be respectively associated with unique identification data tables, that is, a unique association relationship is determined between the program identifier and the identification data table. Then, multiple program identifiers can determine the unique identification data tables associated with them according to the unique association relationship. Thus, targeted queries can be made in the identification data table according to multiple program identifiers, avoiding logical conflicts caused by querying the same identification data table simultaneously. In addition, by performing an association process on the program identifier and the identification data table, it is also possible to support each instance to query the identification data table associated with the program identifier without interference, thereby effectively saving the query time of the identification data table and effectively assisting in improving the identification generation efficiency.
[0061] S305: When the target instance of the application program goes online, determine the program identifier of the application program.
[0062] The description of S305 can be specifically the above embodiment and will not be elaborated here.
[0063] S306: Obtain multiple machine identifiers according to the program identifier.
[0064] In an embodiment of the present disclosure, after performing an association process on the read program identifier and the identification data table, when obtaining multiple machine identifiers according to the program identifier, it can be to determine the identification data table associated with it according to the program identifier, and use all or part of the machine identifiers stored in the identification data table as multiple machine identifiers, and is not limited thereto.
[0065] For example, assume that the above has performed an association process on the program identifier A and the identification data table A. When obtaining multiple machine identifiers according to the program identifier, it can be to determine the identification data table A associated with the program identifier A and obtain all or part of the machine identifiers in the identification data table A.
[0066] S307: Determine multiple occupancy states respectively corresponding to multiple machine identifiers.
[0067] In the embodiments of the present disclosure, after obtaining multiple machine identifiers in the identifier data table associated with the program identifier according to the program identifier, multiple occupancy states respectively corresponding to the multiple machine identifiers can be determined, that is, the multiple occupancy states respectively corresponding to the multiple machine identifiers recorded in the identifier data table can be determined respectively, and there is no limitation thereto.
[0068] S308: Determine the unoccupied machine identifiers from the multiple occupancy states and use them as available machine identifiers.
[0069] In some embodiments, the unoccupied machine identifiers are determined from the multiple occupancy states and used as available machine identifiers. The availability is to query the occupancy states of the multiple machine identifiers stored in the identifier data table, and randomly select one or more machine identifiers from the multiple machine identifiers whose occupancy states are unoccupied among the queried machine identifiers, and use them as available machine identifiers.
[0070] Alternatively, a corresponding monitoring device can also be used to monitor the occupancy states of the machine identifiers in the identifier data table in real time. If the monitoring device monitors that the occupancy state of a certain machine identifier in the identifier data table is unoccupied, then this machine identifier can be used as an available machine identifier, and there is no limitation thereto.
[0071] Optionally, in some embodiments, to determine the unoccupied machine identifiers from the multiple occupancy states and use them as available machine identifiers, the machine identifiers in the identifier data table can be traversed in order, and the occupancy state corresponding to the traversed machine identifier is determined. Then, the machine identifier whose occupancy state is unoccupied and is traversed first is used as the available machine identifier. Since the machine identifiers in the identifier data table are traversed in order, the repeated traversal of the machine identifiers can be avoided, effectively avoiding the resource waste caused by repeated traversal. Since the machine identifier whose occupancy state is unoccupied and is traversed first is used as the available machine identifier, the traversal of the machine identifiers with a later sorting position can be avoided, and the acquisition efficiency of the machine identifiers can be effectively improved while ensuring the acquisition effect of the available machine identifiers.
[0072] Among them, the currently available machine identifier can be referred to as the available machine identifier. The available machine identifier can specifically be, for example, a machine identifier with an unoccupied occupancy state, and there is no limitation thereto.
[0073] That is to say, in the embodiments of the present disclosure, it can be combined together Figure 4 to make a specific explanation of the embodiments of the present disclosure. Figure 4 is a schematic diagram of the online process according to the examples of the embodiments of the present disclosure, such as Figure 4As shown, multiple machine identifiers in the identification data table can be traversed in the order of arrangement of the machine identifiers in the identification data table, and multiple occupancy statuses corresponding to the machine identifiers in the identification data table are requested to be queried. When the first occupancy status in the identification data table that is queried is unoccupied, the machine identifier can be obtained, and the machine identifier can be used as the available machine identifier.
[0074] In this embodiment, by obtaining multiple machine identifiers and determining multiple occupancy statuses respectively corresponding to the multiple machine identifiers, since the unoccupied machine identifier is determined from the multiple occupancy statuses as the available machine identifier, it can be ensured that the machine identifier is not called by other application instances, effectively avoiding the occurrence of repeated calls to the machine identifier. Thus, when performing the subsequent identification generation method based on the available machine identifier, the identification generation effect can be effectively assisted and improved.
[0075] S309: Adjust the occupancy status of the available machine identifier in the identification data table from unoccupied to occupied.
[0076] After the unoccupied machine identifier is determined from the multiple occupancy statuses and used as the available machine identifier in the embodiments of the present disclosure, the occupancy status of the available machine identifier in the identification data table can be adjusted from unoccupied to occupied. Since the occupancy status of the available machine identifier in the identification data table is adjusted from unoccupied to occupied, it can avoid repeated calls to the machine identifier by other application instances, and can also effectively avoid resource conflicts caused by repeated calls, effectively ensuring that the generated identifier can have global uniqueness.
[0077] S310: Generate an identifier related to the target instance according to the available machine identifier.
[0078] In the embodiments of the present disclosure, as described above Figure 4 As shown, after obtaining the available machine identifier from the identification data table, the target instance can generate an identifier related to the target instance in combination with the SnowFlake algorithm inside it, and thus complete the online process of the target instance.
[0079] S311: When the target instance goes offline, restore the occupancy status of the available machine identifier in the identification data table from occupied to unoccupied.
[0080] In the embodiments of the present disclosure, it can be combined together Figure 5 to make a specific explanation of the embodiments of the present disclosure. Figure 5 is a schematic flowchart of the instance offline according to the embodiments of the present disclosure. As Figure 5As shown, when the target instance goes offline, the target instance can access the identity data table again, restore the occupancy status of the machine identity in the identity data table it used before from occupied to unoccupied, so as to release the machine identity for other newly added instances to use, thereby effectively meeting the usage requirements of newly added instances for machine identities and effectively improving the reusability of machine identities.
[0081] In this embodiment, by determining multiple sorting positions respectively corresponding to multiple machine identities, determining multiple occupancy statuses respectively corresponding to multiple machine identities, then writing the corresponding multiple machine identities into the identity data table in order according to the multiple sorting positions respectively, using the occupancy status to mark the status of the corresponding machine identity in the identity data table, and performing an association process on the program identity and the identity data table, thereby avoiding logical conflicts caused by querying the same identity data table at the same time, effectively saving the query time of the identity data table, effectively assisting in improving the identity generation efficiency, and when the target instance of the application program goes online, determining the program identity of the application program, then obtaining multiple machine identities according to the program identity, determining multiple occupancy statuses respectively corresponding to the multiple machine identities, and then determining the unoccupied machine identity from the multiple occupancy statuses as the available machine identity, so as to ensure that the machine identity is not called by other application instances, effectively avoiding the occurrence of repeated calls to the machine identity, so that when performing the subsequent identity generation method based on the available machine identity, effectively assisting in improving the identity generation effect, and then adjusting the occupancy status of the available machine identity in the identity data table from unoccupied to occupied, generating an identity related to the target instance according to the available machine identity, and when the target instance goes offline, restoring the occupancy status of the available machine identity in the identity data table from occupied to unoccupied to release the machine identity for other newly added instances to use, thereby effectively meeting the usage requirements of newly added instances for machine identities and effectively improving the reusability of machine identities.
[0082] Figure 6 is a schematic diagram according to the third embodiment of the present disclosure.
[0083] As Figure 6 shown, the identity generation device 60 includes:
[0084] A first determination module 601, configured to determine the program identity of the application program when the target instance of the application program goes online;
[0085] An acquisition module 602, configured to acquire available machine identities corresponding to the program identity; and
[0086] A generation module 603, configured to generate an identity related to the target instance according to the available machine identity.
[0087] In some embodiments of the present disclosure, as Figure 7As shown Figure 7 is a schematic diagram according to the fourth embodiment of the present disclosure. The identification generation device 70 includes: a first determination module 701, an acquisition module 702, and a generation module 703. Among them, the acquisition module 702 includes:
[0088] an acquisition sub-module 7021, configured to acquire a plurality of machine identifications according to the program identification;
[0089] a first determination sub-module 7022, configured to determine a plurality of occupancy states respectively corresponding to the plurality of machine identifications;
[0090] a second determination sub-module 7023, configured to determine an unoccupied machine identification from the plurality of occupancy states as the available machine identification.
[0091] In some embodiments of the present disclosure, the identification generation device 70 further includes:
[0092] a second determination module 704, configured to determine a plurality of sorting positions respectively corresponding to the plurality of machine identifications before determining the program identification of the application program when the target instance of the application program goes online;
[0093] a third determination module 705, configured to determine a plurality of occupancy states respectively corresponding to the plurality of machine identifications;
[0094] a marking module 706, configured to sequentially write the corresponding plurality of machine identifications into the identification data table according to the plurality of sorting positions, and perform status marking on the corresponding machine identifications in the identification data table by using the occupancy state; and
[0095] a processing module 707, configured to perform an association process on the program identification and the identification data table.
[0096] In some embodiments of the present disclosure, the occupancy state includes: the unoccupied,
[0097] wherein, the second determination sub-module 7023 is specifically configured to:
[0098] sequentially traverse the machine identifications in the identification data table, and determine the occupancy state corresponding to the traversed machine identifications;
[0099] take the machine identification with the occupancy state of the unoccupied as the available machine identification that is traversed first.
[0100] In some embodiments of the present disclosure, the occupancy state includes: occupied. The identification generation device 70 further includes:
[0101] A first recovery module 708, configured to, after obtaining the available machine identifier corresponding to the program identifier, adjust the occupancy status of the available machine identifier in the identifier data table from unoccupied to occupied.
[0102] In some embodiments of the present disclosure, the identifier generation device 70 further includes:
[0103] A second recovery module 709, configured to, after adjusting the occupancy status of the available machine identifier in the identifier data table from unoccupied to occupied, when the target instance goes offline, restore the occupancy status of the available machine identifier in the identifier data table from occupied to unoccupied.
[0104] It can be understood that the identifier generation device 70 in this embodiment Figure 7 and the identifier generation device 60 in the above embodiment, the first determination module 701 and the first determination module 601 in the above embodiment, the acquisition module 702 and the acquisition module 602 in the above embodiment, and the generation module 703 and the generation module 603 in the above embodiment may have the same functions and structures.
[0105] It should be noted that the foregoing explanation of the identifier generation method also applies to the identifier generation device in this embodiment.
[0106] In this embodiment, when the target instance of the application program goes online, the program identifier of the application program is determined, the available machine identifier corresponding to the program identifier is obtained, and an identifier related to the target instance is generated according to the available machine identifier. Since the available machine identifier is directly determined according to the program identifier of the application program, the performance overhead generated by remotely calling the algorithm for determining the available machine identifier can be effectively saved, and the identifier generation efficiency can be effectively improved.
[0107] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0108] Figure 8 A schematic block diagram of an exemplary electronic device for implementing the identifier generation method according to an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as, for example, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0109] As Figure 8 shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0110] Multiple components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, an optical disc, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0111] The computing unit 801 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 801 executes the various methods and processes described above, such as the identity generation method. For example, in some embodiments, the identity generation method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the identity generation method described above can be executed. Alternatively, in other embodiments, the computing unit 801 can be configured to execute the identity generation method in any other appropriate manner (e.g., by means of firmware).
[0112] The various embodiments of the systems and techniques described above in this specification can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from, and transmits data and instructions to, a storage system, at least one input device, and at least one output device.
[0113] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or server.
[0114] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0115] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and a pointing device (e.g., a mouse or a trackball), by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input received from the user can be in any form (including acoustic input, speech input, or tactile input).
[0116] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), the Internet, and blockchain network.
[0117] A computer system can include a client and a server. The client and the server are generally far from each other and usually interact through a communication network. The client-server relationship is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS"). The server can also be a server of a distributed system, or a server combined with blockchain.
[0118] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitation is made herein.
[0119] The above specific embodiments do not constitute a limitation to the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present disclosure shall be included within the protection scope of the present disclosure.
Claims
1. A method for generating an identifier, characterized in that, The method includes: When the target instance of the application goes online, determining the program identifier corresponding to the target instance; According to the unique association relationship between the program identifier and the identifier data table, obtaining the available machine identifier corresponding to the target instance; wherein, the way to determine the unique association relationship includes: before determining the program identifier corresponding to the target instance, determining the sorting position and occupancy status corresponding to each machine identifier, writing the corresponding machine identifier into the identifier data table according to the sorting position, using the occupancy status to perform status marking on the corresponding machine identifier in the identifier data table, and performing an association process on the program identifier and the identifier data table to obtain the unique association relationship; According to the available machine identifier, combining with the identifier generation algorithm deployed in the target instance, generating the identifier related to the target instance.
2. The method according to claim 1, characterized in that, The way to determine the available machine identifier further includes: According to the program identifier, obtaining multiple machine identifiers; Determining the multiple occupancy statuses corresponding to the multiple machine identifiers respectively; Determining the unoccupied machine identifier from the multiple occupancy statuses and using it as the available machine identifier.
3. The method according to claim 2, characterized in that, The occupancy status includes: the unoccupied, Wherein, determining the unoccupied machine identifier from the multiple occupancy statuses and using it as the available machine identifier includes: Sequentially traversing the machine identifiers in the identifier data table and determining the occupancy status corresponding to the traversed machine identifier; Taking the machine identifier with the occupancy status of the unoccupied as the available machine identifier when it is traversed first.
4. The method according to claim 3, characterized in that, The occupancy status includes: occupied. After obtaining the available machine identifier corresponding to the program identifier, it further includes: Adjusting the occupancy status of the available machine identifier in the identifier data table from the unoccupied to the occupied.
5. The method according to claim 4, wherein After adjusting the occupancy status of the available machine identifier in the identifier data table from the unoccupied to the occupied, it further includes: When the target instance goes offline, restoring the occupancy status of the available machine identifier in the identifier data table from the occupied to the unoccupied.
6. An identification generation device, characterized in that, The device includes: A first determination module, configured to determine the program identifier corresponding to the target instance when the target instance of the application goes online; An acquisition module, configured to obtain the available machine identifier corresponding to the target instance according to the unique association relationship between the program identifier and the identifier data table; wherein, the way to determine the unique association relationship includes: before determining the program identifier corresponding to the target instance, determining the sorting position and occupancy status corresponding to each machine identifier, writing the corresponding machine identifier into the identifier data table according to the sorting position, using the occupancy status to perform status marking on the corresponding machine identifier in the identifier data table, and performing an association process on the program identifier and the identifier data table to obtain the unique association relationship A generation module, configured to generate the identifier related to the target instance according to the available machine identifier, combining with the identifier generation algorithm deployed in the target instance.
7. The device according to claim 6, characterized in that, The way to determine the available machine identifier further includes: According to the program identifier, obtaining multiple machine identifiers; Determine a plurality of occupancy states respectively corresponding to the plurality of machine identifiers; Determine the unoccupied machine identifiers from the plurality of occupancy states and use them as the available machine identifiers.
8. The device according to claim 7, characterized in that The occupancy state includes: the unoccupied, wherein, determining the unoccupied machine identifiers from the plurality of occupancy states and using them as the available machine identifiers includes: Sequentially traverse the machine identifiers in the identifier data table and determine the occupancy state corresponding to the traversed machine identifier; Use the machine identifier with the occupancy state of the unoccupied, which is traversed first, as the available machine identifier.
9. The device according to claim 8, characterized in that The occupancy state includes: occupied, and also includes: After obtaining the available machine identifier corresponding to the program identifier, adjust the occupancy state of the available machine identifier in the identifier data table from the unoccupied to the occupied.
10. The device according to claim 9, characterized in that It further includes: After adjusting the occupancy state of the available machine identifier in the identifier data table from the unoccupied to the occupied, when the target instance goes offline, restore the occupancy state of the available machine identifier in the identifier data table from the occupied to the unoccupied.
11. An electronic device, comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the method according to any one of claims 1-5.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5.
13. A computer program product, comprising a computer program which, when executed by a processor, implements the steps of the method according to any one of claims 1-5.
Citation Information
Patent Citations
Globally unique identifier generation method and device and computer readable storage medium
CN112073554A