Identifier generation method and device, equipment, medium and program product

By determining the target server from multiple stateful servers in a stateless container cluster, and using its timestamp, auto-increment serial number, and container serial number to generate a component identifier, the large resource footprint in a stateless container cluster in high concurrency scenarios is solved. The problem of low logo generation efficiency is solved, and efficient logo generation and resource utilization are achieved.

CN119363702APending Publication Date: 2025-01-24CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411324316.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In high concurrency scenarios, due to the need to maintain a large amount of connection information in a stateless container cluster, physical resources are occupied and identification generation efficiency is low.

Method used

By determining the target server from multiple stateful servers, and using the timestamp, auto-increment serial number and container serial number of the target server when executing the container service to generate component identification, the connection maintenance with the client is reduced and the efficiency of identification generation is improved. efficiency.

Benefits of technology

Effectively reduce business processes, reduce physical occupation resources, improve the efficiency of identification generation, and achieve automated identification generation in a state -free container cluster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119363702A_ABST
    Figure CN119363702A_ABST
Patent Text Reader

Abstract

The invention provides an identifier generation method which can be applied to the technical field of cloud computing. The identifier generation method comprises the following steps: in response to a received identifier generation request for a stateless component in a client, determining a target server from a plurality of stateful servers deployed in a stateless container cluster, each stateful server providing a container service for generating a component identifier; determining a timestamp when the target server side executes the container service, a self-increasing serial number generated when the target server side processes the identifier generation request, and a container serial number for operating the container service in the target server side, the container serial number being generated by utilizing stateful resource service in a stateless container cluster when the target server side is deployed; and generating a component identifier corresponding to the stateless component in the stateless container cluster according to the timestamp, the container serial number and the self-increasing serial number. The invention further provides an identifier generation device and equipment, a storage medium and a program product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of cloud computing, and in particular to an identifier generation method, apparatus, device, medium and program product. Background Art

[0002] In a stateless container cluster environment, since service instances in the client are dynamically generated and destroyed with the workload, it is necessary to assign a component identifier to each stateless component in advance so that the client can perform subsequent data tracking and other operations in the stateless container cluster based on the component identifier. In the related art, a connection pool is established between the client and the server to maintain the corresponding connection information. In the process of generating the component identifier, a request is initiated to the server based on the connection information in the connection pool to generate the component identifier.

[0003] In the process of realizing the concept of the present disclosure, the inventors found that there are at least the following problems in the related technology: in a high concurrency scenario, as the business volume increases, more and more connection information needs to be maintained, resulting in a large amount of physical resources being occupied, and the efficiency of generating identifiers by analyzing the connection information is low. Summary of the invention

[0004] In view of the above problems, the present disclosure provides a method, apparatus, device, medium and program product for generating an identifier.

[0005] According to a first aspect of the present disclosure, a method for generating an identifier is provided, comprising: in response to a received identifier generation request for a stateless component in a client, determining a target server from a plurality of stateful servers deployed in a stateless container cluster, wherein each of the stateful servers is provided with a container service for generating a component identifier; determining a timestamp when the target server executes the container service, a self-incrementing serial number generated by the target server when processing the identifier generation request, and a container serial number of the target server running the container service, wherein the container serial number is generated by using a stateful resource service in the stateless container cluster when deploying the target server; and generating a component identifier corresponding to the stateless component in the stateless container cluster according to the timestamp, the container serial number and the self-incrementing serial number.

[0006] According to an embodiment of the present disclosure, the method further includes: determining a configuration field generated when the target server is deployed in the stateless container cluster; based on the configuration field, using the stateful resource service to assign the container serial number to the container in the target server.

[0007] According to an embodiment of the present disclosure, the above-mentioned determining the target server from multiple stateful servers deployed in the stateless container cluster includes: utilizing the load balancer in the above-mentioned stateless container cluster to determine the target server from the multiple stateful servers according to a preset selection strategy.

[0008] According to an embodiment of the present disclosure, the above method also includes: sending the generated component identifier to the above load balancer, so as to use the above load balancer to return the component identifier to the above client, wherein data transmission between the above target server and the above client is carried out by using a short connection.

[0009] According to an embodiment of the present disclosure, the above method also includes: in response to identification generation requests received from multiple clients, using the above load balancer to distribute each of the above identification generation requests to the corresponding stateful server to generate a component identifier in the above stateful server.

[0010] According to an embodiment of the present disclosure, the component identifier corresponding to the stateless component in the stateless container cluster is generated according to the timestamp, the container serial number and the auto-increment serial number, including: converting the timestamp into a forty-four-bit binary serial number at the millisecond level; converting the container serial number into a five-bit binary serial number; converting the auto-increment serial number into a fourteen-bit binary serial number; and combining a preset one-bit fixed serial number, the forty-four-bit binary serial number, the five-bit binary serial number and the fourteen-bit binary serial number in sequence to obtain a sixty-four-bit binary component identifier.

[0011] According to an embodiment of the present disclosure, the method further includes: when it is determined based on the resource occupancy data that the container in the target server needs to be expanded, the number of containers in the target server is modified to add new containers in the target server according to the modified number of containers; and using the stateful resource service to assign corresponding container serial numbers to the newly added containers.

[0012] The second aspect of the present disclosure provides an identification generation device, including: a service determination module, which is used to determine a target server from multiple stateful servers deployed in a stateless container cluster in response to a received identification generation request for a stateless component in a client, wherein each of the above-mentioned stateful servers is provided with a container service for generating a component identification; a serial number determination module, which is used to determine a timestamp when the above-mentioned target server executes the above-mentioned container service, and an auto-increment serial number generated by the above-mentioned target server when processing the above-mentioned identification generation request, and a container serial number of the above-mentioned target server running the above-mentioned container service, wherein the above-mentioned container serial number is generated by using a stateful resource service in the above-mentioned stateless container cluster when deploying the above-mentioned target server; an identification generation module, which is used to generate a component identification corresponding to the above-mentioned stateless component in the above-mentioned stateless container cluster according to the above-mentioned timestamp, the above-mentioned container serial number and the above-mentioned auto-increment serial number.

[0013] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.

[0014] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the above computer program or instructions are executed by a processor.

[0015] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor.

[0016] According to an embodiment of the present disclosure, in the environment of a stateless container cluster, a stateful server is used to generate a component identifier for a stateless component in a client. Since the client's request in a stateless container cluster is independent, the server will not save any information about the client's request. Therefore, the server does not need to establish a connection with the client in advance before generating the identifier, which effectively reduces the business process, reduces the physical occupied resources, and improves the efficiency of identifier generation. In the process of generating the component identifier, since the container serial number used to generate the component identifier is automatically generated when the server is deployed, and is not statically configured when the server is running, the automatic generation of the identifier can be achieved in the stateless container cluster, which effectively improves the efficiency of identifier generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0018] Figure 1A diagram schematically illustrates an application scenario of a method, apparatus, device, medium, and program product for generating an identifier according to an embodiment of the present disclosure;

[0019] Figure 2 A flowchart of a method for generating an identifier according to an embodiment of the present disclosure is schematically shown;

[0020] Figure 3 A schematic diagram of multiple concurrent scenarios of a method for generating an identifier according to an embodiment of the present disclosure is schematically shown;

[0021] Figure 4 A schematic diagram of data transmission of a method for generating an identifier according to an embodiment of the present disclosure is shown;

[0022] Figure 5 A schematic diagram schematically shows a component identification in an identification generation method according to an embodiment of the present disclosure;

[0023] Figure 6 A schematic diagram of a server container in a method for generating an identifier according to an embodiment of the present disclosure is schematically shown;

[0024] Figure 7 A flowchart of a method for generating an identifier according to another embodiment of the present disclosure is schematically shown;

[0025] Figure 8 A structural block diagram of an identification generating device according to an embodiment of the present disclosure is schematically shown; and

[0026] Fig. 9 A block diagram of an electronic device suitable for implementing the identification generation method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0027] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0028] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0029] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0030] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0031] In the embodiments of the present disclosure, the collection, updating, analysis, processing, use, transmission, provision, disclosure, storage, etc. of the data involved (for example, including but not limited to user personal information) are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information and network security.

[0032] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0033] An embodiment of the present disclosure provides an identifier generation method, comprising: in response to a received identifier generation request for a stateless component in a client, determining a target server from multiple stateful servers deployed in a stateless container cluster, wherein each stateful server provides a container service for generating a component identifier; determining a timestamp when the target server executes the container service, a self-incrementing serial number generated by the target server when processing the identifier generation request, and a container serial number of the container service running in the target server, wherein the container serial number is generated by using a stateful resource service in the stateless container cluster when deploying the target server; and generating a component identifier corresponding to the stateless component in the stateless container cluster according to the timestamp, the container serial number and the self-incrementing serial number.

[0034] Figure 1 The application scenario diagram of the identification generation method, apparatus, device, medium and program product according to the embodiments of the present disclosure is schematically shown.

[0035] like Figure 1As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0036] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0037] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0038] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.

[0039] It should be noted that the identification generation method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the identification generation device provided in the embodiment of the present disclosure can generally be set in the server 105. The identification generation method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the identification generation device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.

[0040] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0041] The following will be based on Figure 1 The scene described by Figure 2~Figure 6 The identification generation method of the disclosed embodiment is described in detail.

[0042] Figure 2 The flowchart of the identification generation method according to the embodiment of the present disclosure is schematically shown.

[0043] like Figure 2 As shown, this embodiment includes operations S210 to S230.

[0044] In operation S210, in response to a received request for generating an identifier of a stateless component in a client, a target server is determined from a plurality of stateful servers deployed in a stateless container cluster, wherein each stateful server provides a container service for generating a component identifier.

[0045] In operation S220, determine the timestamp of the target server when executing the container service, the self-incrementing serial number generated by the target server when processing the identifier generation request, and the container serial number of the container service running in the target server, wherein the container serial number is generated by using the stateful resource service in the stateless container cluster when deploying the target server.

[0046] In operation S230, a component identifier corresponding to the stateless component in the stateless container cluster is generated according to the timestamp, the container sequence number, and the auto-increment sequence number.

[0047] According to an embodiment of the present disclosure, in an environment of a stateless container cluster, since service instances (i.e., stateless components) in the client are dynamically generated and destroyed with the workload, it is necessary to assign a fixed component identifier to each stateless component in advance so that the client can perform subsequent data tracking and other operations in the stateless container cluster based on the component identifier.

[0048] According to an embodiment of the present disclosure, multiple stateful servers are deployed in a stateless container cluster. When a client requests to generate a component identifier, a corresponding identifier generation request is initiated. After receiving the identifier generation request, the stateless container cluster determines the target server from multiple stateful servers to process the identifier generation request. In the stateless container cluster, each client request is independent, and the server does not save any information about the client requester. Therefore, in the process of obtaining the component identifier, the server does not need to establish a connection with the client in advance.

[0049] According to an embodiment of the present disclosure, a stateful container service for generating component identifiers is provided in the target server. Stateful container services refer to services that need to maintain their state, such as databases, storage services, etc. When the target server executes the container service to process the identifier generation request, it obtains the timestamp of the currently executing container service and the container serial number of the container executing the container service in the target server. The container serial number is also the server identification number, and the server identification number is generated after orchestration by the stateful resource service (StatefulSet, stateful set controller, abbreviated as sts) of the stateless container cluster. The target server does not know what the container serial number is before deployment, and the container serial number is automatically generated during the deployment process.

[0050] According to an embodiment of the present disclosure, a self-incrementing sequence number generated by a target server when processing an identifier generation request is determined. A self-incrementing sequence number generally refers to a counter that can ensure safe self-incrementing operations in a multi-threaded environment, and the counter is incremented by one after an operation is performed. The self-incrementing operation of such a counter is atomic, which means that at any time, only one thread can modify the value of the counter, thereby avoiding race conditions and data inconsistency problems.

[0051] According to an embodiment of the present disclosure, the timestamp, container sequence number and auto-increment sequence number are combined to generate a component identifier corresponding to the stateless component in the stateless container cluster, that is, a globally unique identifier in the distributed system. A globally unique identifier is used in a distributed system to ensure that each object or entity has a unique identifier. This identifier is unpredictable and will not be repeated throughout the system. Globally unique means that it is used in databases, network protocols, and distributed systems to track and reference objects without being confused with other objects.

[0052] According to an embodiment of the present disclosure, in the environment of a stateless container cluster, a stateful server is used to generate a component identifier for a stateless component in a client. Since the client's request in a stateless container cluster is independent, the server will not save any information about the client's request. Therefore, the server does not need to establish a connection with the client in advance before generating the identifier, which effectively reduces the business process, reduces the physical occupied resources, and improves the efficiency of identifier generation. In the process of generating the component identifier, since the container serial number used to generate the component identifier is automatically generated when the server is deployed, and is not statically configured when the server is running, the automatic generation of the identifier can be achieved in the stateless container cluster, which effectively improves the efficiency of identifier generation.

[0053] According to an embodiment of the present disclosure, the identifier generation method also includes: determining a configuration field generated when deploying the target server in the stateless container cluster; based on the configuration field, using a stateful resource service to assign a container sequence number to the container in the target server.

[0054] According to an embodiment of the present disclosure, a stateful resource service is a workload API (Application Programming Interface) object for managing stateful applications in a stateless container cluster, which allows management of a set of Pods (containers) and maintains a persistent container serial number for each container. These containers are all created based on the same container specifications, but they are not interchangeable. Each container has a persistent identifier, that is, the container serial number, which remains unchanged even after rescheduling. Stateful resource services are suitable for applications that require persistent storage or a stable, unique network identity. Stateful resource services can manage stateful containers, ensuring the order of containers, network identification, volume mounting, etc.

[0055] According to an embodiment of the present disclosure, the configuration field of a container is used to define the properties and settings of a container in a stateless container cluster. In a stateful resource service in a stateless container cluster, the automatically generated container serial number is not directly displayed in the configuration field (yaml file) of the container, but the identifier in the configuration field can be referenced through some built-in mechanisms. These identifiers are mainly used to ensure that each container has a unique and persistent container serial number that remains unchanged even after the container is recreated.

[0056] According to an embodiment of the present disclosure, when deploying a target server in a stateless container cluster, a configuration file for defining container resources in the target server is determined. After navigating to the directory where the configuration file is located, run the configuration file to implement the deployment of the service. When assigning container serial numbers according to the configuration file, the stateless container cluster will first assign a sequence-based index number to each container in the target server, and this index number will increase from 0. This index number is a unique identifier inside the stateful resource service. Even if the container is deleted or recreated, as long as it is within the management of the stateful service, the same index number will be maintained.

[0057] According to an embodiment of the present disclosure, the identifier associated with the stateful resource service in the configuration file is combined with the index number to generate a container serial number. The corresponding container serial number is automatically assigned to it during the server deployment process instead of statically configuring the container serial number for it during the server runtime, making the component identification generation process more suitable for multi-concurrency scenarios and effectively improving the component identification generation efficiency.

[0058] Figure 3 A schematic diagram of multiple concurrent scenarios of the identification generation method according to an embodiment of the present disclosure is schematically shown.

[0059] According to an embodiment of the present disclosure, determining a target server from multiple stateful servers deployed in a stateless container cluster includes: utilizing a load balancer in the stateless container cluster to determine the target server from multiple stateful servers according to a preset selection strategy.

[0060] like Figure 3 As shown, the client 310 sends the identification generation request to the load balancer 320, and the load balancer selects the target server from multiple stateful servers 330 according to the preset selection strategy. And forwards the identification generation request to the target server. Among them, since there is no persistent data storage between each service instance in the stateless container cluster, each service instance is the same and interchangeable. Therefore, in a stateless container cluster, any service instance can process any request because they do not rely on specific state information. It can be seen that the preset selection strategy can be set to a random strategy to select the target server.

[0061] According to an embodiment of the present disclosure, when selecting a target server, the data processing status of each stateful server may be determined, thereby allocating the identification generation request to an idle stateful server to improve processing efficiency.

[0062] According to an embodiment of the present disclosure, the identifier generation method also includes: in response to identifier generation requests received from multiple clients, using a load balancer to distribute each identifier generation request to a corresponding stateful server to generate a component identifier in the stateful server.

[0063] like Figure 3 As shown, in a multi-concurrency scenario, after receiving the identification generation request sent by multiple clients 310, the load balancer 320 is used to implement the random response of the stateful server 330, which greatly adapts to the server response of the high-concurrency scenario. Figure 4 A data transmission diagram of the identification generation method according to an embodiment of the present disclosure is schematically shown.

[0064] According to an embodiment of the present disclosure, the identifier generation method also includes: sending the generated component identifier to the load balancer, so as to use the load balancer to return the component identifier to the client, wherein data transmission between the target server and the client is performed using a short connection.

[0065] like Figure 4As shown, after the target server 410 generates the component identifier, it sends the component identifier to the load balancer 420, and the load balancer 420 returns the component identifier to the client 430. The target server and the client use the communication protocol TCP (Transmission Control Protocol) short connection mode for data transmission. The number of connectable clients is not limited by the number of TCP communication protocol connections, and the number of concurrent requests is not limited by the number of TCP connections. The QPS (query rate per second) of a single service can reach more than 10,000 times / s.

[0066] According to an embodiment of the present disclosure, after the stateless component in the client is destroyed, subsequent data tracking and other operations can be performed in the stateless container cluster based on the component identifier. If the component identifier received by the client is missing or incomplete, the identifier generation request can be initiated again. The load balancer can still distribute the component identifier request corresponding to the client to the target server to directly obtain the component identifier, or it can distribute the component identifier request to the remaining stateful servers to regenerate the component identifier.

[0067] According to an embodiment of the present disclosure, when a component identifier is regenerated, since the timestamp and the auto-increment number have changed, it can be determined whether to continue to use the timestamp and auto-increment number when the request was first initiated based on the communication status between the client and the stateful server. If the communication status is stable and there is no network disconnection, the generation is still based on the timestamp and auto-increment number of the first request, thereby reducing the waste of resources and maximizing the number of times the component identifier is generated. If the communication status is unstable and the network connection is poor, it is necessary to regenerate the component identifier based on the latest timestamp and auto-increment number to improve the availability of the component identifier.

[0068] Figure 5 A schematic diagram of component identification in an identification generation method according to an embodiment of the present disclosure is schematically shown.

[0069] According to an embodiment of the present disclosure, a component identifier corresponding to a stateless component in a stateless container cluster is generated based on a timestamp, a container sequence number and an auto-increment sequence number, including: converting the timestamp into a forty-four-bit binary sequence number at the millisecond level; converting the container sequence number into a five-bit binary sequence number; converting the auto-increment sequence number into a fourteen-bit binary sequence number; and combining a preset one-bit fixed sequence number, a forty-four-bit binary sequence number, a five-bit binary sequence number and a fourteen-bit binary sequence number in sequence to obtain a sixty-four-bit binary component identifier.

[0070] like Figure 5As shown, the 44 bits in the component identifier represent the timestamp, with a precision of milliseconds, and the maximum time range that can be represented is 2526 years. The specific calculation method is as follows: (1<<44) / (1000*3600*24*365)+1970=2527.844560 years. The 5 bits in the component identifier represent the container sequence number, and the maximum number of containers that can be represented is 32: 1<<5=32. The 14 bits in the component identifier represent the auto-increment sequence number of the container service, which ranges from [0,16383]: 1<<14-1=16383. The preset fixed sequence number is 0.

[0071] According to an embodiment of the present disclosure, in a 64-bit component identifier, the minimum unit of the timestamp is milliseconds, the time precision is finer, and setting the number of bits of the timestamp to 44 effectively extends the time range for generating the component identifier.

[0072] Figure 6 A schematic diagram of a server container in a method for generating an identifier according to an embodiment of the present disclosure is schematically shown.

[0073] According to an embodiment of the present disclosure, the identifier generation method also includes: when it is determined based on resource occupancy data that the container in the target server needs to be expanded, the number of containers in the target server is modified to add new containers in the target server according to the modified number of containers; and using a stateful resource service to assign corresponding container serial numbers to the newly added containers.

[0074] According to the embodiments of the present disclosure, the stateful server is defined by the stateful resource service of the stateless container cluster, and is deployed and operated in the form of container components with different container serial numbers, so that different servers have different server identifiers. Figure 6 As shown, the target server 610 includes three containers, and the container numbers are 0, 1, and 2. When it is determined according to the resource occupancy data that the containers in the target server need to be horizontally expanded, the number of containers can be adjusted to achieve the dynamic expansion and contraction capability of the target server. Specifically, the number of service instances can be adjusted using a stateful set controller to expand the container.

[0075] For example, a 3-container stateful server is set up in business A. As the business volume increases, it is expanded to a 6-container stateful server. By dynamically implementing the scaling of containers in the stateful server, the QPS upper limit of the system response can be easily increased. The concurrent response capability of the server can be dynamically orchestrated and expanded with the number of instances of the stateful container service, without any requirements or restrictions on the client, which greatly increases the number of concurrent requests QPS, making the scaling and operation of the server more convenient.

[0076] According to an embodiment of the present disclosure, in the process of horizontally expanding the container in the stateful server, the container can be expanded based on the expansion rules set in the stateful server configuration file. After the expansion is completed, the resources in the stateful server are updated.

[0077] According to the embodiments of the present disclosure, as the business volume increases, a new stateful server can also be deployed in the stateless cluster to achieve vertical expansion of the stateless container cluster. After the expansion is completed, a container sequence number is assigned to each container in the new stateful server according to the configuration file generated when the new stateful server is deployed.

[0078] Figure 7 The following schematically shows a flow chart of a method for generating an identifier according to another embodiment of the present disclosure.

[0079] like Figure 7 As shown, this embodiment includes operations S710 to S760.

[0080] In operation S710 , the client sends an identifier generation request to the load balancer.

[0081] In operation S720, the load balancer determines a target server from a plurality of stateful servers deployed in the stateless container cluster according to a preset selection strategy, and forwards the identifier generation request to the target server.

[0082] In operation S730, the target server receives the identifier generation request, obtains the timestamp when the container service is executed, the self-incrementing serial number generated when processing the identifier generation request, and the container serial number of the container service.

[0083] In operation S740, a component identifier corresponding to the stateless component in the stateless container cluster is generated according to the timestamp, the container sequence number, and the auto-increment sequence number.

[0084] In operation S750, the target server returns the component identifier to the load balancer.

[0085] In operation S760, the load balancer returns the component identification to the requesting client.

[0086] According to the embodiments of the present disclosure, by sending the identification generation request to the load balancer, the load balancer is allowed to uniformly distribute, so that the generation of the identification is suitable for high-concurrency request (multiple caller requests) scenarios. The load balancer is used to achieve random response of the server, which greatly adapts to the server response of high-concurrency scenarios.

[0087] Based on the above identification generation method, the present disclosure also provides an identification generation device. Figure 8 The device is described in detail.

[0088] Figure 8 The structural block diagram of the identification generating device according to the embodiment of the present disclosure is schematically shown.

[0089] like Figure 8 As shown, the identifier generating device 800 of this embodiment includes a service determining module 810 , a sequence number determining module 820 and an identifier generating module 830 .

[0090] The service determination module 810 is used to determine the target server from multiple stateful servers deployed in the stateless container cluster in response to the received request for generating the identifier of the stateless component in the client, wherein each stateful server provides a container service for generating the component identifier. In one embodiment, the service determination module 810 can be used to perform the operation S210 described above, which will not be repeated here.

[0091] The serial number determination module 820 is used to determine the timestamp of the target server when executing the container service, the self-incrementing serial number generated by the target server when processing the identifier generation request, and the container serial number of the container service running in the target server, wherein the container serial number is generated by using the stateful resource service in the stateless container cluster when deploying the target server. In one embodiment, the serial number determination module 820 can be used to perform the operation S220 described above, which will not be repeated here.

[0092] The identification generation module 830 is used to generate a component identification corresponding to the stateless component in the stateless container cluster according to the timestamp, the container sequence number and the auto-increment sequence number. In one embodiment, the identification generation module 830 can be used to perform the operation S230 described above, which will not be repeated here.

[0093] According to an embodiment of the present disclosure, the identifier generating device 800 further includes a field determination module and a sequence number allocation module.

[0094] The field determination module is used to determine the configuration fields generated when deploying the target server in the stateless container cluster.

[0095] The sequence number allocation module is used to allocate container sequences to containers in the target server using the stateful resource service based on the configuration field.

[0096] According to an embodiment of the present disclosure, the service determination module 810 includes a service determination submodule.

[0097] The service determination submodule is used to utilize the load balancer in the stateless container cluster to determine the target server among multiple stateful servers according to a preset selection strategy.

[0098] According to an embodiment of the present disclosure, the identification generating device 800 further includes an identification transmission module.

[0099] The identification transmission module is used to send the generated component identification to the load balancer, so that the load balancer can be used to return the component identification to the client, wherein data transmission between the target server and the client is carried out by using a short connection.

[0100] According to an embodiment of the present disclosure, the identifier generating device 800 further includes an identifier allocating module.

[0101] The identification allocation module is used to respond to the identification generation requests sent by multiple clients, and use the load balancer to allocate each identification generation request to the corresponding stateful server to generate a component identification in the stateful server.

[0102] According to an embodiment of the present disclosure, the identifier generation module 830 includes a time sequence submodule, a container sequence submodule, a self-increment sequence submodule and an identifier generation submodule.

[0103] The time series submodule is used to convert the timestamp into a forty-four-bit binary serial number at the millisecond level.

[0104] The container sequence submodule is used to convert the container serial number into a five-digit binary serial number.

[0105] The auto-increment sequence submodule is used to convert the auto-increment sequence number into a fourteen-digit binary sequence number.

[0106] The identification generation submodule is used to sequentially combine a preset one-bit fixed serial number, a forty-four-bit binary serial number, a five-bit binary serial number and a fourteen-bit binary serial number to obtain a sixty-four-bit binary component identification.

[0107] According to an embodiment of the present disclosure, the identifier generating device 800 further includes a container expansion module and a container allocation module.

[0108] The container expansion module is used to modify the number of containers in the target server when it is determined according to the resource usage data that the containers in the target server need to be expanded, so as to add new containers in the target server according to the modified number of containers.

[0109] The container allocation module is used to allocate corresponding container serial numbers to newly added containers by using stateful resource services.

[0110] According to an embodiment of the present disclosure, any multiple modules of the service determination module 810, the sequence determination module 820 and the identification generation module 830 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the service determination module 810, the sequence determination module 820 and the identification generation module 830 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the service determination module 810, the sequence determination module 820 and the identification generation module 830 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.

[0111] Fig. 9 A block diagram of an electronic device suitable for implementing the identification generation method according to an embodiment of the present disclosure is schematically shown.

[0112] like Fig. 9 As shown, the electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 to a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include an onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0113] In RAM 903, various programs and data required for the operation of electronic device 900 are stored. Processor 901, ROM 902 and RAM 903 are connected to each other via bus 904. Processor 901 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 902 and / or RAM 903. It should be noted that the program can also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in one or more memories.

[0114] According to an embodiment of the present disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to the bus 904. The electronic device 900 may further include one or more of the following components connected to the input / output (I / O) interface 905: an input portion 906 including a keyboard, a mouse, etc.; an output portion 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 908 including a hard disk, etc.; and a communication portion 909 including a network interface card such as a LAN card, a modem, etc. The communication portion 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the input / output (I / O) interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage portion 908 as needed.

[0115] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0116] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 902 and / or RAM 903 described above and / or one or more memories other than ROM 902 and RAM 903.

[0117] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the identification generation method provided by the embodiment of the present disclosure.

[0118] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 901. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0119] In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and downloaded and installed through the communication part 909, and / or installed from a removable medium 911. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0120] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.

[0121] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).

[0122] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0123] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.

[0124] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A method for generating an identifier, characterized in that: The method comprises: In response to a received request for generating an identifier of a stateless component in a client, a target server is determined from a plurality of stateful servers deployed in a stateless container cluster, wherein each of the stateful servers provides a container service for generating a component identifier; Determine a timestamp when the target server executes the container service, a self-incrementing serial number generated by the target server when processing the identifier generation request, and a container serial number of the target server running the container service, wherein the container serial number is generated by using a stateful resource service in the stateless container cluster when deploying the target server; A component identifier corresponding to the stateless component in the stateless container cluster is generated according to the timestamp, the container sequence number and the self-increment sequence number.

2. The method according to claim 1, characterized in that The method further comprises: Determine a configuration field generated when deploying the target server in the stateless container cluster; Based on the configuration field, the container sequence number is allocated to the container in the target server using the stateful resource service.

3. The method according to claim 1, characterized in that The determining of the target server from a plurality of stateful servers deployed in the stateless container cluster includes: The load balancer in the stateless container cluster is utilized to determine a target server from among the plurality of stateful servers according to a preset selection strategy.

4. The method according to claim 3, characterized in that: The method further comprises: The generated component identifier is sent to the load balancer, so that the load balancer returns the component identifier to the client, wherein data is transmitted between the target server and the client in a short connection manner.

5. The method according to claim 3, characterized in that: The method further comprises: In response to receiving multiple identification generation requests sent by clients, the load balancer is used to distribute each identification generation request to a corresponding stateful server to generate a component identification in the stateful server.

6. The method according to claim 1, characterized in that The generating a component identifier corresponding to the stateless component in the stateless container cluster according to the timestamp, the container sequence number and the self-increment sequence number includes: Converting the timestamp into a forty-four-bit binary serial number at the millisecond level; Converting the container serial number into a five-digit binary serial number; Converting the self-incrementing sequence number into a fourteen-digit binary sequence number; The preset one-bit fixed serial number, the forty-four-bit binary serial number, the five-bit binary serial number and the fourteen-bit binary serial number are sequentially combined to obtain a sixty-four-bit binary component identifier.

7. The method according to claim 1, characterized in that The method further comprises: When it is determined according to the resource occupancy data that the capacity of the container in the target server needs to be expanded, modifying the number of containers in the target server, so as to add new containers in the target server according to the modified number of containers; The stateful resource service is used to assign a corresponding container serial number to the newly added container.

8. A device for generating an identification, characterized in that: The device comprises: A service determination module, configured to determine a target server from a plurality of stateful servers deployed in a stateless container cluster in response to a received request for generating an identifier of a stateless component in a client, wherein each of the stateful servers provides a container service for generating a component identifier; A serial number determination module, used to determine the timestamp of the target server when executing the container service, the self-increment serial number generated by the target server when processing the identifier generation request, and the serial number of the container running the container service in the target server, wherein the container serial number is generated by using the stateful resource service in the stateless container cluster when deploying the target server; An identification generation module is used to generate a component identification corresponding to the stateless component in the stateless container cluster according to the timestamp, the container sequence number and the self-increment sequence number.

9. An electronic device, comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.