CN115174527A - Serial number processing method and device, computing equipment and storage medium - Google Patents

Serial number processing method and device, computing equipment and storage medium Download PDF

Info

Publication number
CN115174527A
CN115174527A CN202210815076.4A CN202210815076A CN115174527A CN 115174527 A CN115174527 A CN 115174527A CN 202210815076 A CN202210815076 A CN 202210815076A CN 115174527 A CN115174527 A CN 115174527A
Authority
CN
China
Prior art keywords
sequence number
target slot
slot
target
allocation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210815076.4A
Other languages
Chinese (zh)
Other versions
CN115174527B (en
Inventor
梁宇轩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210815076.4A priority Critical patent/CN115174527B/en
Publication of CN115174527A publication Critical patent/CN115174527A/en
Application granted granted Critical
Publication of CN115174527B publication Critical patent/CN115174527B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

The application discloses a serial number processing method, which is executed by a service unit, wherein a changeable incidence relation exists between the service unit and at least one slot position, and each slot position in the at least one slot position is provided with a corresponding client side, and the method comprises the following steps: receiving a processing request aiming at a serial number, wherein the processing request is from a target client corresponding to a target slot position in at least one slot position; acquiring latest version information aiming at the target slot position from the serial number storage area; in response to the fact that the latest version information of the target slot position is not matched with the current version information of the target slot position, updating the current version information of the target slot position and distribution information related to distribution of a sequence number corresponding to the target slot position based on the latest version information of the target slot position and historical distribution information of the sequence number; the processing request is processed based on a corresponding sequence number of the target slot held by the service unit and allocation information related to allocation of the sequence number corresponding to the target slot.

Description

Serial number processing method and device, computing equipment and storage medium
Technical Field
The present application relates to the field of data communication technologies, and in particular, to a serial number processing method and apparatus, a computing device, a computer-readable storage medium, and a computer program product.
Background
In the field of communications, clients often need to acquire an incremented sequence number or read a sequence number once assigned. Particularly in a distributed system, the serial number can mark the service executed by a certain server, and the service state can be shared after marking, so that different servers can cooperatively complete huge calculation tasks through the serial number. Since a server usually needs a plurality of servers to provide such services, how to allocate the stored unassigned serial numbers to the clients in an ascending order under the condition that the plurality of servers work together, and how to quickly and accurately transmit the allocated serial numbers to the clients is an urgent problem to be solved.
The existing technology for serial number distribution and reading adopts a method of setting a plurality of servers, and different servers are assigned to each client by using the hash value of each client according to a remainder calculation mode, so that load balance among a plurality of servers is realized. For example, once a server is down, servers need to be reassigned to all clients, which results in that all information related to serial numbers of corresponding clients stored by the servers is lost, which is unacceptable for most application scenarios. Furthermore, because data is not necessarily up-to-date between servers, it is difficult for these servers to ensure that the assigned sequence numbers are incremented.
Disclosure of Invention
In view of the above, the present application provides serial number processing methods and apparatus, computing devices, computer-readable storage media, and computer program products, which desirably mitigate or overcome some or all of the above-identified deficiencies and other potential deficiencies.
According to a first aspect of the present application, there is provided a serial number processing method, which is performed by a service unit, where there is a changeable association relationship between the service unit and at least one slot, each of the at least one slot has a corresponding client, and the service unit holds current version information for each slot and allocation information related to allocation of a serial number corresponding to each slot, where the method includes: receiving a processing request for a sequence number, wherein the processing request for the sequence number is from a target client corresponding to a target slot position in the at least one slot position; acquiring latest version information for the target slot from a serial number storage area, wherein the serial number storage area comprises the latest version information for the target slot and historical allocation information of a corresponding serial number, the latest version information of the target slot indicates a plurality of serial numbers which are recorded in the serial number storage area and are extracted latest for the target slot for allocation, and the historical allocation information indicates information which is recorded in the serial number storage area and is related to historically allocated serial numbers for the target slot; updating current version information of the target slot and distribution information related to distribution of a sequence number corresponding to the target slot based on latest version information of the target slot and historical distribution information of the sequence number in response to the fact that latest version information of the target slot does not match with the current version information of the target slot, wherein the current version information indicates a plurality of sequence numbers which are stored by the service unit and extracted for the target slot at the latest time; processing the processing request for the sequence number based on a corresponding sequence number of the target slot held by the service unit and allocation information related to allocation of the sequence number corresponding to the target slot.
According to a first aspect of the present application, there is provided a serial number processing apparatus having an alterable association relationship with at least one slot, each of the at least one slot having a corresponding client, the apparatus holding current version information for each slot and allocation information related to allocation of a serial number corresponding to each slot, the apparatus comprising: a receive module configured to receive a processing request for a sequence number from a target client corresponding to a target slot of the at least one slot; an obtaining module configured to obtain latest version information for the target slot from a serial number storage area, wherein the serial number storage area includes the latest version information for the target slot and historical allocation information of corresponding serial numbers, the latest version information of the target slot indicates a plurality of serial numbers recorded in the serial number storage area, which are extracted latest for the target slot, for allocation, and the historical allocation information indicates information on historically allocated serial numbers recorded in the serial number storage area for the target slot; a matching module configured to update current version information of the target slot and allocation information related to allocation of a sequence number corresponding to the target slot based on the latest version information of the target slot and historical allocation information of sequence numbers in response to a mismatch between the latest version information of the target slot and the current version information of the target slot, wherein the current version information indicates a plurality of sequence numbers held by the apparatus that were last extracted for the target slot; a processing module configured to process the processing request for a sequence number based on a corresponding sequence number of the target slot held by the apparatus and allocation information related to allocation of the sequence number corresponding to the target slot.
According to a third aspect of the present application, there is provided a computing device comprising a memory and a processor, wherein the memory has stored therein a computer program which, when executed by the processor, causes the processor to perform the steps of the time-shift playing method implemented by a first party or a second party according to some embodiments of the present application.
According to a fourth aspect of the present application, there is provided a computer-readable storage medium having stored thereon computer-readable instructions which, when executed, implement a time-shift playing method implemented by a first party or a second party according to some embodiments of the present application.
According to a fifth aspect of the present application, a computer program product is provided, comprising computer instructions which, when executed by a processor, implement the steps of a time-shift play method implemented by a first party or a second party according to some embodiments of the present application.
In a serial number processing method and apparatus according to some embodiments of the present application, wherein there is a changeable association between a service unit and at least one slot, each of the at least one slot having a corresponding client, the service unit holds current version information for each slot and allocation information related to allocation of a serial number corresponding to each slot, the method and apparatus have at least the following advantages: firstly, the service unit and the slot position are in a changeable incidence relation, so that the corresponding relation between the client and the service unit can be adjusted, namely the load of the service unit is adjusted, and the connection between the client and the service unit corresponding to other slot positions is not influenced when the incidence relation is changed, so that the load of the service unit can be reasonably adjusted, the effect of load balancing is achieved, and the availability and disaster tolerance capability of the whole service units are guaranteed; secondly, after a processing request aiming at the serial number is received, the latest version information of the target slot position is firstly obtained and then matched, so that the target slot position can be ensured to be the latest version when each processing request aiming at the serial number is processed, the serial number distributed to the client side can be ensured to be increased incrementally, the serial number can be ensured to be processed quickly, and the processing efficiency is improved.
These and other advantages of the present application will become apparent from and elucidated with reference to the embodiments described hereinafter.
Drawings
Embodiments of the present application will now be described in more detail and with reference to the accompanying drawings, in which:
FIG. 1 illustrates an exemplary application scenario of a serial number processing method according to some embodiments of the present application;
FIG. 2 illustrates an exemplary flow diagram of a serial number processing method according to some embodiments of the present application;
FIG. 3 illustrates a schematic diagram of a matching process of a serial number processing method according to some embodiments of the present application;
FIG. 4 illustrates a schematic diagram of an association of serial number processing methods according to some embodiments of the present application;
FIG. 5 illustrates a schematic diagram of recording assignment information for a transmitted serial number according to some embodiments of the present application;
FIG. 6 illustrates an exemplary flow diagram of a serial number processing method according to some embodiments of the present application;
FIG. 7 illustrates a schematic diagram of a request queue of a sequence number processing method according to some embodiments of the present application;
FIG. 8 illustrates a storage diagram of a serial number storage area of a serial number processing method according to some embodiments of the application;
FIG. 9 illustrates a schematic diagram of a serial number processing method applied in a distributed system according to some embodiments of the present application;
FIG. 10A shows a schematic diagram of a serial number processing method according to some embodiments of the present application;
FIG. 10B shows a schematic diagram of a serial number processing method according to some embodiments of the present application;
FIG. 11 illustrates a schematic diagram of a serial number processing architecture in a distributed system according to some embodiments of the present application;
FIG. 12 shows a block diagram of an exemplary architecture of a serial number processing apparatus 1200 according to some further embodiments of the present application;
fig. 13 illustrates an example system that includes an example computing device that represents one or more systems and/or devices that can implement the various methods described herein.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The same reference numerals denote the same or similar parts in the drawings, and thus, a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flowcharts shown in the figures are illustrative only and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one element from another. Thus, a first component discussed below may be termed a second component without departing from the teachings of the present concepts. As used herein, the term "and/or" and similar terms include all combinations of any, multiple, and all of the associated listed items.
It will be appreciated by those skilled in the art that the drawings are merely schematic representations of exemplary embodiments, and that the blocks or processes shown in the drawings are not necessarily required to practice the present application and are, therefore, not intended to limit the scope of the present application.
Before describing embodiments of the present application in detail, some relevant concepts are explained first for clarity.
Artificial Intelligence (AI) is a theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and expand human Intelligence, perceive the environment, acquire knowledge and use the knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technique of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence. Artificial intelligence is the research of the design principle and the realization method of various intelligent machines, so that the machines have the functions of perception, reasoning and decision making.
The artificial intelligence technology is a comprehensive subject and relates to the field of extensive technology, namely the technology of a hardware level and the technology of a software level. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
The sequence number is as follows: refers to a string of numbers that uniquely identify an object. In distributed systems, it is often necessary to assign sequence numbers to keep the data of the storage and service areas incremented synchronously. For example, order numbers may be identified by serial numbers, etc.
Slot (Slot): the virtual space has a corresponding relationship with a client and is used for recording processing data of the corresponding client. The common slot position in the distributed system is a hash slot, and the corresponding mode is that a hash value is calculated for a client, then the hash value is subjected to remainder operation relative to the number of the hash slots, and finally the corresponding relation between the client and the hash slot is established according to the remainder. When a slot is associated with a particular server, it means that the server opens up the appropriate memory space for the slot to serve the client corresponding to the slot.
A service unit: the basic unit for providing computing services may be, for example, a server.
Fig. 1 illustrates an exemplary application scenario 100 of a serial number processing method according to some embodiments of the present application. The application scenario 100 may include a client 101, a network 102, a service unit 103, and a storage unit 104, where the service unit 103 is communicatively coupled with the client 101 through the network 102 and may communicate with the storage unit 104. In this embodiment only one client 101 is shown, but this is not limiting and there may be multiple clients communicatively coupled together with the service unit 103 at the same time.
In this embodiment, the service unit 103 is set to have an alterable association relationship with at least one slot, each of the at least one slot having a corresponding client, and the service unit 103 holds current version information for each slot and allocation information related to allocation of a sequence number corresponding to each slot. For example, the service unit 103 may be associated with ten thousand slots. In this embodiment, the explanation is given by taking an example in which only one client 101 corresponding to one slot initiates a request.
In this embodiment, the client 101 transmits a processing request for a sequence number, which may be an allocation request for a sequence number or a read request for a sequence number, to the service unit 103 through the network 102. Network 102 may be, for example, a Wide Area Network (WAN), a Local Area Network (LAN), a wireless network, a public telephone network, an intranet, and any other type of network known to those skilled in the art.
The service unit 103 receives a processing request for a sequence number from the client 101 via the network 102, and refers to a slot corresponding to the client 101 as a target slot, and the client 101 may also be referred to as a target client.
The service unit 103 then acquires latest version information for the target slot from the storage unit 104, wherein the storage unit 104 includes the latest version information for the target slot and historical allocation information of the corresponding sequence number, the latest version information of the target slot indicates a plurality of sequence numbers recorded in the storage unit 104 that are newly extracted for allocation for the target slot, and the historical allocation information indicates information on historically allocated sequence numbers recorded in the storage unit 104 for the target slot.
After acquiring the latest version information for the target slot, in response to that the latest version information of the target slot does not match the current version information of the target slot, the service unit 103 updates the current version information of the target slot and the distribution information related to the distribution of the sequence number corresponding to the target slot based on the latest version information of the target slot and the historical distribution information of the sequence number, where the current version information indicates a plurality of sequence numbers stored in the service unit 103 and extracted for the target slot at the latest time.
The last service unit 103 processes the processing request for the sequence number based on the corresponding sequence number of the target slot held thereon and allocation information related to allocation of the sequence number corresponding to the target slot. For example, for an allocation request for a sequence number, an incremented sequence number is allocated to the client; for a read request for a sequence number, allocation information of the sequence number to be read is transmitted to the client.
In the application scenario shown in fig. 1, the serial number processing method according to some embodiments of the present application is implemented on the service unit 103, but this is only illustrative and not restrictive, and the serial number processing method according to some embodiments of the present application may also be implemented on other subjects with sufficient computing resources and computing capabilities, for example, on the client 101 with sufficient computing resources and computing capabilities. Of course, it is also possible to implement part on the service unit 103 and part on the client 101, which is not limiting.
As understood by those of ordinary skill in the art, examples of the service unit 103 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a CDN, and a big data and artificial intelligence platform. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
The client 101 may be any type of mobile computing device, including a mobile computer (e.g., a Personal Digital Assistant (PDA), a laptop computer, a notebook computer, a tablet computer, a netbook, etc.), a mobile phone (e.g., a cellular phone, a smartphone, etc.), a wearable computing device (e.g., a smart watch, a headset device, including smart glasses, etc.), or other type of mobile device. In some embodiments, the client 101 may also be a stationary computing device, such as a desktop computer, a gaming console, a smart television, and so forth. Further, where the application scenario 100 includes multiple clients 101, the multiple clients 101 may be the same or different types of computing devices.
As shown in fig. 1, the client 101 may include a display screen and a terminal application that may interact with a terminal user via the display screen. The terminal application may be a native application, a Web page (Web) application, or an applet (Lite App, e.g., a cell phone applet, a WeChat applet) that is a lightweight application. In the case where the terminal application is a local application that needs to be installed, the terminal application may be installed in the client 101. In the case where the terminal application is a Web application, the terminal application can be accessed through a browser. In the case that the terminal application is an applet, the terminal application can be directly opened on the client 101 by searching relevant information of the terminal application (such as a name of the terminal application), scanning a graphic code of the terminal application (such as a barcode, a two-dimensional code, and the like), and the like, without installing the terminal application.
Fig. 2 illustrates a flow diagram of a serial number processing method according to some embodiments of the present application. The illustrated method 200 may be implemented on a service unit (e.g., may be implemented on the service unit 103 shown in fig. 1). In some embodiments, the serial number processing method according to some embodiments of the present application may be performed directly on the client 101 in case the client 101 has sufficient computing resources and computing power. In other embodiments, the serial number processing method according to some embodiments of the present application may also be performed by the service unit 103 and the client 101 in combination. As shown in fig. 2, a serial number processing method according to some embodiments of the present application may include steps S201-S204.
Note that in this implementation, there is a modifiable association between the service unit and at least one slot, each of the at least one slot having a corresponding client, and the service unit holds current version information for each slot and allocation information related to allocation of a sequence number corresponding to each slot. By way of example, such modifiable associations may be established in advance automatically according to a consistent hashing technique, or manually. The client corresponding to each slot position may be one client or multiple clients. The allocation information associated with the allocation of the serial number corresponding to each slot refers to the client and object to which the serial number is allocated, e.g., the target slot corresponds to serial number 100, serial number 100 may be allocated to client 0X12345, and specifically to a message "good morning! ", the message is the object to which the serial number is assigned, which may be marked with a numeric identification 123456, when the client identification 0X12345 and the identification 123456 of the message constitute the assignment information for the serial number 100.
In step S201, a processing request for a sequence number is received, wherein the processing request for the sequence number is from a target client corresponding to a target slot of the at least one slot. After the target client corresponds to the target slot, the sent processing request aiming at the sequence number is routed to the service unit which has an association relation with the target slot. The processing request for the sequence number includes an allocation request for the sequence number aiming at acquiring a new unallocated incremented sequence number and a read request for the sequence number aiming at reading allocation information of an already allocated sequence number.
In step S202, latest version information for the target slot is acquired from the sequence number storage area, where the sequence number storage area includes the latest version information for the target slot and historical allocation information of the corresponding sequence number, the latest version information of the target slot indicates a plurality of sequence numbers recorded in the sequence number storage area that are newly extracted for allocation for the target slot, and the historical allocation information indicates information on historically allocated sequence numbers for the target slot recorded in the sequence number storage area.
The latest version information may be a separate identifier, updated by incrementing the identifier. Since the sequence number is incremented, it can also be directly characterized by the sequence number, as long as it can indicate or be associated with a plurality of sequence numbers recorded in the sequence number storage area that are newly extracted for the target slot for allocation. The serial number storage area refers to a device or space for persistently storing data including not only the latest version information for the at least one slot and the historical allocation information of the corresponding serial number, but also the latest version information for other slots and the historical allocation information of the corresponding serial number, so that the latest version information of any slot and the historical allocation information of the corresponding serial number can be acquired therefrom. In the service unit, the target slot is composed of two parts, the first part is the information related to the historically allocated sequence number for the target slot, and the second part is the sequence number extracted from the sequence number storage area for allocation. As an example, when receiving an assignment request for sequence numbers from step S201, the service unit selects one unassigned sequence number from among the sequence numbers used for assignment to assign. These sequence numbers for allocation thus include a part of the allocated sequence numbers and a part of the sequence numbers that have not been allocated, depending on the number of allocation requests for the sequence numbers. It should be noted that the latest version information for the target slot recorded in the serial number storage area is not necessarily recorded after the service unit extracts a plurality of serial numbers, and may be recorded after other service units extract a plurality of serial numbers, so that the allocation information of the corresponding serial number for the target slot recorded in the serial number storage area is the allocation information of the most complete serial number.
In step S203, in response to that the latest version information of the target slot does not match the current version information of the target slot, the current version information of the target slot and the distribution information related to the distribution of the sequence number corresponding to the target slot are updated based on the latest version information of the target slot and the historical distribution information of the sequence number, wherein the current version information indicates a plurality of sequence numbers that are held by the service unit and that were extracted for the target slot most recently.
The latest version information of the target slot does not match the current version information of the target slot, meaning that the target slot stored on the service unit is not the latest version of the target slot, and therefore the historically allocated sequence number related information for the target slot thereon is incomplete and the sequence number for allocation thereon has been allocated. Thus, if the service unit does not update the current version information of the target slot and the allocation information related to the allocation of the sequence number corresponding to the target slot, the allocated sequence number is not incremented or the allocation information of the sequence number that the target client desires to read is not read. To ensure that the sequence number assigned to the target client is incremented, it is necessary to update the current version information of the target slot. Since the service unit has a faster processing efficiency than the sequence number storage area, in order to improve the processing efficiency, it is necessary to update the allocation information on the allocation of the sequence number corresponding to the target slot onto the service unit.
In step S204, a processing request for the sequence number is processed based on the corresponding sequence number of the target slot held by the service unit and the allocation information on the allocation of the sequence number corresponding to the target slot. After the current version information of the target slot position and the distribution information related to the distribution of the serial number corresponding to the target slot position are updated, the processing request aiming at the serial number from the target client side can be accurately and quickly processed.
In a serial number processing method according to some embodiments of the present application, wherein there is a changeable association between a service unit and at least one slot, each of the at least one slot having a corresponding client, the service unit holding current version information for each slot and allocation information related to allocation of a serial number corresponding to each slot, the method and apparatus have at least the following advantages: firstly, the service unit and the slot position are in a changeable incidence relation, so that the corresponding relation between the client and the service unit can be adjusted, namely the load of the service unit is adjusted, and the connection between the client and the service unit corresponding to other slot positions is not influenced when the incidence relation is changed, so that the load of the service unit can be reasonably adjusted, the effect of load balancing is achieved, and the availability and disaster tolerance capability of the whole service units are guaranteed; secondly, after a processing request aiming at the serial number is received, the latest version information of the target slot position is firstly obtained and then matched, so that the target slot position can be ensured to be the latest version when each processing request aiming at the serial number is processed, the serial number distributed to the client side can be ensured to be increased incrementally, the serial number can be ensured to be processed quickly, and the processing efficiency is improved.
To explain step S203 in more detail, fig. 3 shows a schematic diagram of a matching process of a serial number processing method according to some embodiments of the present application, in which slot 1 is a target slot. In fig. 3, the sequence number storage area stores latest version information of each slot and history allocation information of the corresponding sequence number. The latest version information and the current version information of the target slot are both represented by the minimum sequence number and the maximum sequence number of the extracted sequence numbers. The mapping table indicates allocation information of the allocated sequence numbers recorded when the service unit allocates the sequence numbers.
First, the slot 1 and the service unit 1 have an association relationship, and the sequence number for allocation of the slot 1 extracted by the service unit 1 at the last time is a sequence number between 100 and 200, so the service unit 1 stores the current version information of which the base value is 100 and the maximum value is 200 for the slot 1. In this case, if the client 1 corresponding to the slot 1 transmits a processing request for the sequence number, the processing request for the sequence number by the client 1 is routed to the service unit 1, and the service unit 1 reads the latest version information of the slot 1 and the history allocation information of the corresponding sequence number from the sequence number storage area as indicated by an arrow 1.1. The latest version information of the slot position 1 recorded in the serial number storage area is the serial number of 100-200, so the latest version information of the slot position 1 is matched with the current version information of the slot position 1, updating is not needed, and the service unit 1 directly processes a processing request aiming at the serial number from the client 1 according to a plurality of locally stored serial numbers used for distribution of the slot position 1 and distribution information related to distribution of the serial number corresponding to the slot position 1.
Assuming that service unit 1 is down, slot 1 is re-associated to service unit 2, and the current version information of slot 1 stored by service unit 2 is a sequence number between 50 and 100. In this case, if client 1 corresponding to slot 1 transmits a processing request for the sequence number, the processing request for the sequence number by client 1 is routed to service unit 2, and service unit 2 reads the latest version information of slot 1 and the history allocation information of the corresponding sequence number from the sequence number storage area as indicated by arrow 2.1. The latest version information of the slot 1 recorded in the sequence number storage area is the sequence number of 100-200, so that the latest version information of the slot 1 is not matched with the current version information of the slot 1 and needs to be updated, the service unit 2 acquires a plurality of sequence numbers which are extracted from the sequence number storage area for the slot 1 latest for allocation and information related to historically allocated sequence numbers for the slot 1 according to an arrow 2.2, at this time, the mapping table is emptied, and the service unit 2 processes a processing request for the sequence number from the client 1 according to the plurality of updated sequence numbers for allocation of the slot 1 and allocation information related to allocation of the sequence number corresponding to the slot 1.
To further illustrate the association between service units and slots, fig. 4 illustrates a schematic diagram of an association of a serial number processing method according to some embodiments of the present application. Fig. 4 shows clients 1-3 and service units 1-5, which service units 1-5 may be integrated as a service area of a distributed system. Since the service unit 1 and the slot 1 have an association relationship (shown by a solid arrow) that can be changed, and the client 1 is a client corresponding to the slot 1, when the client 1 wants to issue a processing request for the serial number, the processing request for the serial number is routed to the service unit 1, that is, the service unit 1 provides a service for the processing request for the serial number of the client 1. Similarly, a processing request by client 2-3 for the sequence number will be routed to service unit 2 associated with slot 2 (shown by the solid arrow).
In some embodiments, in response to receiving the association request including information related to another slot, an association is established with the another slot, and a processing request for the sequence number from a client corresponding to the another slot is processed, wherein the another slot is different from the at least one slot. As shown in fig. 3, an association command may be issued to the service unit 2, where the association command includes information related to slot 1, and then the service unit 2 may process a processing request for the serial number for the client 1 corresponding to slot 1 after receiving the association command. The processing request of the client 1 for the sequence number will be routed to the service unit 2 (illustrated by the dashed arrow).
The changeable incidence relation can flexibly adjust the loads on different service units to be in a proper degree. In addition, when one service unit fails, for example, the service unit is down, the network is jittered, or other service units are added, partial redistribution of the clients can be realized without affecting the slot positions of which the association relationship is not changed, so that the overall availability and disaster tolerance of a plurality of service units are improved.
In some embodiments, another slot has an alterable association with another service unit, and the service unit implementing the method and the other service unit are part of a service cluster that includes a plurality of service units that are mapped to a hash ring organized in a clockwise direction throughout a hash value space. For example, in a hash ring organized in a clockwise direction through the hash value space, the other service unit is located at a first position in the hash ring, and the service unit implementing the method is located at a second position immediately clockwise in the hash ring. Therefore, when the other service unit stops service, for example, goes down, the processing requests from the clients corresponding to the slots associated with the other service unit are rerouted to the service unit at the second position immediately clockwise according to the consistent hashing technique, that is, the service unit implementing the method processes the processing requests. This allows for seamless interfacing of the sequence number processing services.
In addition, the update operation of step S203 may be performed from two configurations of the slot, respectively. In some embodiments, in response to the latest version information of the target slot not matching the current version information of the target slot, updating the current version information of the target slot and the allocation information related to the allocation of the sequence number corresponding to the target slot based on the latest version information of the target slot and the historical allocation information of the sequence number includes: aiming at the serial number on the service unit, updating the serial numbers aiming at the target slot position and stored by the service unit by utilizing the serial numbers indicated by the latest version information of the target slot position; and supplementing allocation information related to allocation of the sequence number corresponding to the target slot based on historical allocation information of the sequence number of the target slot with respect to the allocation information on the service unit.
Because the association between the target slot and the service unit is alterable, the current version information for the target slot in the service unit may be outdated and the historical allocation information for the sequence number of the target slot may not be complete. In the update operation, therefore, the current version information for the target slot may be updated in accordance with the latest version information in the sequence number storage area, and the historical allocation information for the sequence number missing from the target slot may be downloaded from the sequence number storage area and stored in the service unit.
In the specific processing procedure after the update, the processing is distinguished according to the content of the processing request for the sequence number. In some embodiments, the processing request for a sequence number is an allocation request for a sequence number, and the allocation request for a sequence number is for requesting allocation of a sequence number to an object on the target client. In this case, processing the processing request for the sequence number based on the corresponding sequence number of the target slot held by the service unit and allocation information related to allocation of the sequence number corresponding to the target slot includes: the smallest unallocated sequence number among the corresponding sequence numbers of the target slots held by the service unit is first transmitted to the target client, and then allocation information of the transmitted sequence number, which indicates an object to which the transmitted sequence number is allocated on the target client, is recorded. The object here may be business content such as an order number or the like. That is, each time the service unit transmits the smallest unallocated sequence number for the client corresponding to the target slot, in conjunction with the update operation of the previous step S203, it can be ensured that the transmitted sequence number is incremented with respect to the target client.
In some further embodiments, the processing request for the sequence number is a read request for the sequence number, and wherein the read request includes a target sequence number, the read request for the sequence number for reading an object on a target client to which the target sequence number has been assigned. In this case, processing the processing request for the sequence number based on the corresponding sequence number of the target slot held by the service unit and allocation information related to allocation of the sequence number corresponding to the target slot includes: first, allocation information of a target sequence number is retrieved from allocation information related to allocation of a sequence number corresponding to a target slot, and then the allocation information of the target sequence number is transmitted to a target client.
Since the allocation information related to the allocation of the sequence number corresponding to the target slot has been supplemented in step S203 or the service unit itself has stored the complete allocation information related to the allocation of the sequence number corresponding to the target slot, the service unit can directly process the read request for the sequence number.
When processing an allocation request for a sequence number, it is necessary to record allocation information of the transmitted sequence number. Fig. 5 illustrates a schematic diagram of recording assignment information of transmitted serial numbers according to some embodiments of the present application.
In fig. 5, the service unit is associated with slot 1, slot 2, etc., wherein the specific data related to slot 1 is shown on the right side of fig. 5: the service unit stores a base value and a maximum value of slot 1, the base value being a minimum sequence number among a plurality of sequence numbers extracted from the sequence number storage area by the service unit, the maximum value being a maximum sequence number among a plurality of sequence numbers extracted from the sequence number storage area by the service unit, the sequence numbers between the base value and the maximum value being sequence numbers that can be used for allocation at the time of initial extraction. The service unit also stores a mapping table of slot 1, where "client" refers to a client identifier, "offset value" refers to an offset size of the assigned serial number relative to the base value, the assigned serial number is obtained by adding the offset value to the base value, and "object" indicates an object of a specific assigned client. For example, if the client N has issued an assignment request for a serial number to a service unit, the base value in the service unit is 100, and the service unit assigns the serial number 100 to the object 1 of the client N, then its assignment information is described as: offset value =0, client N, object 1. The allocation information can be written into the sequence number storage area for persistent storage.
In addition, the current version information of the service unit for the target slot can also be embodied by the base value and the maximum value in fig. 5 without additionally setting a special identifier. For example, when the base value is 100 and the maximum value is 200, the current version information indicates that the plurality of sequence numbers held by the service unit and extracted for the target slot most recently are sequence numbers 100 to 200. In this case, the update operation of step S203 may be extended as follows.
In some embodiments, the latest version information of the target slot includes a smallest sequence number and a largest sequence number of a plurality of sequence numbers recorded in a sequence number storage area that are newly extracted for allocation for the target slot. In this case, in response to that the latest version information of the target slot does not match the current version information of the target slot, updating, by using a plurality of sequence numbers indicated by the latest version information of the target slot, a plurality of sequence numbers stored by the service unit for the target slot, including: in response to that the minimum sequence number of the plurality of sequence numbers which are recorded in the sequence number storage area and are extracted for the target slot position latest for allocation is different from the minimum sequence number of the plurality of sequence numbers which are stored by the service unit and are extracted for the target slot position latest for allocation, taking the plurality of sequence numbers which are extracted for the target slot position latest for allocation as the sequence number corresponding to the target slot position; or in response to that the largest sequence number of the plurality of sequence numbers which are recorded in the sequence number storage area and are newly extracted for the target slot position and used for allocation is not the same as the largest sequence number of the plurality of sequence numbers which are stored by the service unit and are newly extracted for the target slot position, taking the plurality of sequence numbers which are newly extracted for the target slot position and used for allocation as the sequence number corresponding to the target slot position.
That is, as long as the minimum sequence number (e.g., the base value in fig. 5) and the maximum sequence number (e.g., the maximum value in fig. 5) of the plurality of sequence numbers that the service unit holds and that have been extracted for the target slot at the last time are different, the sequence number that the service unit holds and that is for the target slot may be directly updated according to the plurality of sequence numbers that are extracted for allocation in the sequence number storage area and that have been extracted for the target slot at the last time. After re-extraction, these sequence numbers are all unassigned sequence numbers, and can be used to process an assignment request for sequence numbers from a target client. By using the method in this embodiment to re-extract the sequence number, the sequence number that has already been allocated can be prevented from being allocated again, thereby avoiding the dangerous phenomenon of sequence number reduction.
Since the sequence numbers for allocation on the service units are limited, multiple sequence numbers need to be extracted after allocation is completed. Fig. 6 illustrates an exemplary flow diagram of a serial number processing method according to some embodiments of the present application.
In step S601, in response to the corresponding sequence numbers of the target slots saved by the service unit being fully allocated, the allocation information of the corresponding sequence numbers of the target slots saved by the service unit is written into the sequence number storage area. Since the current version information of the target slot is the same as the latest version information, these allocated sequence numbers are the sequence numbers of the latest generated historical allocation and exist only on the service unit, and therefore, it is necessary to supplement the allocation information of these sequence numbers to the sequence number storage area to realize persistent storage.
In step S602, a plurality of unallocated sequence numbers are extracted from the sequence number storage area for the target slot, wherein the corresponding plurality of unallocated sequence numbers of the target slot are each greater than a historically allocated sequence number for the target slot. After the corresponding sequence numbers of the target slot are all allocated, it is necessary to continue to extract a plurality of unallocated sequence numbers in order to process a subsequent allocation request for a sequence number. To ensure that the allocated sequence number is incremented relative to the target client, the corresponding plurality of unallocated sequence numbers of the target slot should each be greater than a historically allocated sequence number for the target slot. As an example, the sequence number storage area may provide the smallest unassigned sequence number to the service unit at a time.
In step S603, the latest version information of the target slot in the serial number storage area and the service unit is updated based on the extracted plurality of unallocated serial numbers. After extracting the plurality of unallocated sequence numbers, the latest version information in the sequence number storage area indicating that the plurality of sequence numbers for allocation, which are newly extracted for the target slot and recorded in the sequence number storage area, have been changed and should be updated.
After the service unit has allocated the locally saved sequence number, by the implementation in steps S601-S603, it is ensured that the latest version information for the target slot and the historical allocation information of the corresponding sequence number in the sequence number storage area remain up to date, thereby ensuring that the allocated sequence number is incremented regardless of the change in the association between the target slot and the service unit.
To further reduce the access pressure to the serial number storage area, a more centralized approach may be taken. In some embodiments, writing allocation information of the corresponding sequence number of the target slot maintained by the service unit to the sequence number storage area in response to the corresponding sequence number of the target slot maintained by the service unit being fully allocated comprises: firstly, responding to the situation that the corresponding serial numbers of the target slot positions stored by the service unit are all distributed, and writing the distribution information of the corresponding serial numbers of the target slot positions stored by the service unit into a request queue, wherein the request queue has a space for storing the distribution information of a preset number of serial numbers; all allocation information in the request queue is then written to the sequence number storage area in response to the request queue having stored a predetermined number of allocation information for the sequence number.
The request queue is a buffer queue before accessing the serial number storage area, write (write) requests for allocation information of each serial number are placed in the request queue in time sequence, and after a predetermined number of requests are reached, the requests are transmitted to the serial number storage area together, and the allocation information of each serial number is written in a centralized manner. Obviously, the number of write requests for which the request queue can accommodate allocation information for the corresponding sequence number of the target slot should be greater than the number of corresponding sequence numbers for the target slot. For example, the number of corresponding sequence numbers for the target slot is 100 sequence numbers, and the request queue may be predetermined to accommodate allocation information of 300 sequence numbers.
FIG. 7 illustrates a schematic diagram of a request queue for a sequence number processing method according to some embodiments of the present application. As shown in the figure, the service unit has an association relationship with both slot 1 and slot 2, and after allocating a sequence number to an allocation request of the sequence number, the service unit stores allocation information of the sequence number into a request queue. For example, the request queue of slot 1 may be predetermined to accommodate allocation information of 300 sequence numbers, such as a, B, C, etc. in the request queue shown in fig. 7, and the request queue of slot 2 may be predetermined to accommodate allocation information of 400 sequence numbers, such as E, F, etc. in the request queue shown in fig. 7. In the request queues of slot 1 and slot 2, as long as one of the request queues is full, all the requests in the request queue are written into the sequence number storage area together, that is, the service unit writes the allocation information of the allocated sequence number in units of slot.
In a distributed system, a single storage unit cannot usually meet the requirements of a business, so a plurality of storage units are often configured. Since the association between the service unit and the slot is alterable, it is possible for each service unit to access one storage unit to extract multiple sequence numbers for allocation to the target slot. It is necessary to ensure that the written data, including the latest version information of the target slot and the historical allocation information of the corresponding sequence number, is unified over the plurality of storage units.
In some embodiments, the sequence number storage area includes a plurality of storage units, and the latest version information for the target slot is stored on more than half of the plurality of storage units. That is, when the storage of the latest version information of the target slot and the historical allocation information of the corresponding sequence number is completed on half of the storage units, it is determined that the latest version information of the target slot and the historical allocation information of the corresponding sequence number have been completely stored in the sequence number storage area, and consistent storage is achieved among the storage units. If one storage unit is added or one storage unit is damaged, the reading and writing of the latest version information of the target slot position on the whole serial number storage area and the historical allocation information of the corresponding serial number are not influenced. As an example, the PAXOS protocol may be used between various memory units to synchronize data. In the PAXOS protocol, when data is written, more than half of the total number of memory cells need to be written each time, and when data is read, the data is read out each time it needs to be determined that the read data is stored on more than half of the total number of memory cells.
Fig. 8 illustrates a storage diagram of a serial number storage area of a serial number processing method according to some embodiments of the application. The serial number storage area includes a storage unit a and a storage unit B, and other storage units. When storage unit a is connected to the service unit, then a write request by the service unit for the latest version information of the target slot occurs in storage unit a. After completing the write operation at storage unit a, the service unit continues to synchronize the written content to other storage units, e.g., storage unit B, such that the latest version information for the target slot is stored on more than half of the storage units. If a read request of the service unit for the latest version information of the target slot occurs in the storage unit a, the service unit receives the latest version information of the target slot from each storage unit, and takes the latest version information in which the repetition rate exceeds half of the total number as the latest version information of the target slot, thereby ensuring the consistency of the stored latest version information of each slot.
Fig. 9 shows a schematic diagram of a serial number processing method applied in a distributed system according to some embodiments of the present application. As shown in fig. 9, in the distributed system, each service unit provides services according to a mapping relationship in a hash table (HashTable). The hash table comprises hash values of the clients, remainders between the hash values and the total number of the slots, and association relations between the slots and the service units. For example, there are 5 slots, and for a client with a hash value of 100001, the remainder of 5 is 1, and the client corresponds to slot 1, and assuming that there is an association relationship between slot 1 and service unit 1, the processing request for the serial number by the client with a hash value of 100001 will be routed to service unit 1.
And for the sequence number storage area, persistent storage is provided according to the storage mode of a Write Ahead Log (WAL). In the WAL storage scheme, a plurality of write operations are not directly written to a file stored persistently in a storage unit, but are first collectively written to another temporary file called WAL. When writing the WAL file, if one of the write operations fails, for example, the storage unit is powered off, and the write operation in the WAL is ignored, the write operation is cancelled; if the write operation successfully writes to the WAL file, it will be written to the persisted file of the storage unit at some later time. Thus, persistent storage can be realized for each write operation.
Fig. 10A illustrates a schematic diagram of a serial number processing method according to some embodiments of the present application. As shown in FIG. 10A, client 1-2 corresponds to slot 1, such that processing requests by client 1-2 for the sequence number are routed to service unit s1, which is associated with slot 1, and client 3-4 corresponds to slot 2, such that processing requests by client 3-4 for the sequence number are routed to service unit s1, which is also associated with slot 2. If the network load is large and the client 3-4 is not connected with the service unit s1, the association relationship of the slot position 2 can be automatically changed, and the association relationship between the slot position 2 and the service unit s2 is established.
However, when the network load is too large and each service unit is fully loaded, the action of re-establishing the association will waste network resources and cannot solve the connection problem of the client 3-4, and at this time, the association between the slot 2 and the service unit s1 may not be changed, and the client 3-4 is required to retry to connect the service unit s1, thereby avoiding the waste of network resources, as shown in fig. 10B.
Fig. 11 illustrates a schematic diagram of a serial number processing architecture in a distributed system according to some embodiments of the present application. As shown in fig. 11, the serial number processing architecture is composed of two parts: the service unit cluster comprises 4 service units, and the serial number storage area comprises 3 storage units, which jointly provide a serial number processing function for the client.
In the illustrated architecture, a client may issue a processing request for a sequence number to a cluster of service units. And determining to which service unit of the service units s1-s4 the processing request of the client for the serial number is routed according to the corresponding relation between the client and the slot and the incidence relation between the slot and the service unit, wherein the routed service unit processes the processing request for the serial number for the client. On each service unit s1-s4, according to the mapping relationship of each service unit, the relevant data of the associated slot is stored on each service unit. For example, the service unit s1 has an association relationship with the slot 1, the slot 2, and the like, and the service unit 1 stores current version information, a mapping table, and a request queue for the slot 1-2, where the current version information is identified by an allocated quota base value and a maximum value. After the sequence numbers of the slots for distribution are completely distributed, the sequence numbers are stored in a request queue, namely, the distribution information in the mapping table is transferred to the request queue, and then a plurality of sequence numbers for distribution are extracted from the sequence number storage area. When the allocation information of the sequence numbers buffered in the request queue is full, the allocation information is written into the sequence number storage area and is ensured to be written onto at least two storage units. The consistency of data is kept among the storage units through PAXOS protocol.
Fig. 12 illustrates an exemplary block diagram of a serial number processing apparatus 1200 according to some embodiments of the present application. The apparatus 1200 has a changeable association relationship with at least one slot, each of the at least one slot has a corresponding client, the apparatus holds current version information for each slot and allocation information related to allocation of a sequence number corresponding to each slot, and the apparatus 1200 includes: the device comprises a receiving module 1201, an obtaining module 1202, a matching module 1203 and a processing module 1204. The receiving module 1201 is configured to receive a processing request for a sequence number from a target client corresponding to a target slot of the at least one slot. The obtaining module 1202 is configured to obtain latest version information for the target slot from a sequence number storage area, wherein the sequence number storage area includes the latest version information for the target slot and historical allocation information of a corresponding sequence number, the latest version information of the target slot indicates a plurality of sequence numbers recorded in the sequence number storage area that are latest extracted for allocation for the target slot, and the historical allocation information indicates information about historically allocated sequence numbers recorded in the sequence number storage area for the target slot. The matching module 1203 is configured to update, in response to that the latest version information of the target slot does not match the current version information of the target slot, the current version information of the target slot and allocation information related to allocation of a sequence number corresponding to the target slot based on the latest version information of the target slot and historical allocation information of the sequence number, wherein the current version information indicates a plurality of sequence numbers held by the apparatus and extracted last for the target slot. The processing module 1204 is configured to process the processing request for the sequence number based on a corresponding sequence number of the target slot held by the apparatus and allocation information related to allocation of the sequence number corresponding to the target slot
It should be noted that the various modules described above may be implemented in software or hardware or a combination of both. Several different modules may be implemented in the same software or hardware configuration, or one module may be implemented by several different software or hardware configurations.
In a serial number processing apparatus according to some embodiments of the present application, wherein there is an alterable association between the apparatus and at least one slot, each of the at least one slot having a corresponding client, the apparatus maintains current version information for each slot and allocation information relating to allocation of a serial number corresponding to each slot, the method and apparatus have at least the following advantages: firstly, the device and the slot positions are in a changeable incidence relation, so that the corresponding relation between a client and the device can be adjusted, namely the load of the device is adjusted, thereby achieving the effect of load balancing, and the connection between the client corresponding to other slot positions and the device is not influenced when the incidence relation is changed, thereby reasonably adjusting the load of the device, and ensuring the overall availability and disaster tolerance of a plurality of devices; secondly, after a processing request aiming at the serial number is received, the latest version information of the target slot position is firstly obtained and then matched, so that the target slot position can be ensured to be the latest version when each processing request aiming at the serial number is processed, the serial number distributed to the client side can be ensured to be increased incrementally, the serial number can be ensured to be processed quickly, and the processing efficiency is improved.
Fig. 13 illustrates an example system 1300 that includes an example computing device 1310 that represents one or more systems and/or devices that can implement the various methods described herein. The computing device 1310 may be, for example, a server of a service provider, a device associated with a server, a system on a chip, and/or any other suitable computing device or computing system. The serial number processing apparatus 1200 described above with reference to fig. 12 may take the form of a computing device 1310. Alternatively, the serial number processing apparatus 1200 may be implemented as a computer program in the form of an application 1316.
The illustrated example computing device 1310 includes a processing system 1311, one or more computer-readable media 1312, and one or more I/O interfaces 1313, communicatively coupled to each other. Although not shown, the computing device 1310 may also include a system bus or other data and command transfer system that couples the various components to one another. A system bus can include any one or combination of different bus structures, such as a memory bus or memory controller, a peripheral bus, a universal serial bus, and/or a processor or local bus that utilizes any of a variety of bus architectures. Various other examples are also contemplated, such as control and data lines.
Processing system 1311 represents functionality to perform one or more operations using hardware. Thus, the processing system 1311 is illustrated as including the hardware elements 1314, which may be configured as processors, functional blocks, and so on. This may include implementation in hardware as an application specific integrated circuit or other logic device formed using one or more semiconductors. The hardware element 1314 is not limited by the material from which it is formed or the processing mechanism employed therein. For example, a processor may be comprised of semiconductor(s) and/or transistors (e.g., electronic Integrated Circuits (ICs)). In such a context, processor-executable instructions may be electronically-executable instructions.
Computer-readable medium 1312 is illustrated as including memory/storage 1315. Memory/storage 1315 represents memory/storage capacity associated with one or more computer-readable media. The memory/storage 1315 may include volatile media (such as Random Access Memory (RAM)) and/or nonvolatile media (such as Read Only Memory (ROM), flash memory, optical disks, magnetic disks, and so forth). The memory/storage 1315 may include fixed media (e.g., RAM, ROM, a fixed hard drive, etc.) as well as removable media (e.g., flash memory, a removable hard drive, an optical disk, and so forth). Computer-readable medium 1312 may be configured in various other ways, which are described further below.
One or more I/O interfaces 1313 represent functionality that allows a user to enter commands and information to computing device 1310 using various input devices and optionally also allows information to be presented to the user and/or other components or devices using various output devices. Examples of input devices include a keyboard, a cursor control device (e.g., a mouse), a microphone (e.g., for voice input), a scanner, touch functionality (e.g., capacitive or other sensors configured to detect physical touch), a camera (e.g., motion that may not involve touch may be detected as gestures using visible or invisible wavelengths such as infrared frequencies), and so forth. Examples of output devices include a display device, speakers, a printer, a network card, a haptic response device, and so forth. Accordingly, the computing device 1310 may be configured in various ways to support user interaction, as described further below.
Computing device 1310 also includes applications 1316. The application 1316 may be, for example, a software instance of the serial number processing apparatus 1200 and implement the techniques described herein in combination with other elements in the computing device 1310.
A computer program product is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computing device to execute the time-shift playing method implemented by the first party or the second party provided in the various alternative implementations described above.
Various techniques may be described herein in the general context of software hardware elements or program modules. Generally, these modules include routines, programs, objects, elements, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The terms "module," "functionality," and "component" as used herein generally represent software, firmware, hardware, or a combination thereof. The features of the techniques described herein are platform-independent, meaning that the techniques may be implemented on a variety of computing platforms having a variety of processors.
An implementation of the described modules and techniques may be stored on or transmitted across some form of computer readable media. Computer readable media can include a variety of media that can be accessed by computing device 1310. By way of example, and not limitation, computer-readable media may comprise "computer-readable storage media" and "computer-readable signal media".
"computer-readable storage medium" refers to a medium and/or device, and/or a tangible storage apparatus, capable of persistently storing information, as opposed to mere signal transmission, carrier wave, or signal per se. Accordingly, computer-readable storage media refer to non-signal bearing media. Computer-readable storage media include hardware such as volatile and nonvolatile, removable and non-removable media and/or storage devices implemented in a method or technology suitable for storage of information such as computer-readable instructions, data structures, program modules, logic elements/circuits or other data. Examples of computer readable storage media may include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical storage, hard disks, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or other storage devices, tangible media, or an article of manufacture suitable for storing the desired information and accessible by a computer.
"computer-readable signal medium" refers to a signal bearing medium configured to transmit instructions to the hardware of computing device 1310, such as via a network. Signal media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave, data signal or other transport mechanism. Signal media also includes any information delivery media. The term "modulated data signal" means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media.
As before, the hardware elements 1314 and the computer-readable medium 1312 represent instructions, modules, programmable device logic, and/or fixed device logic implemented in hardware form that, in some embodiments, may be used to implement at least some aspects of the techniques described herein. The hardware elements may include integrated circuits or systems-on-chips, application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs), complex Programmable Logic Devices (CPLDs), and other implementations in silicon or components of other hardware devices. In this context, a hardware element may serve as a processing device to perform program tasks defined by instructions, modules, and/or logic embodied by the hardware element, as well as a hardware device to store instructions for execution, such as the computer-readable storage medium described previously.
Combinations of the foregoing may also be used to implement the various techniques and modules herein. Thus, software, hardware, or program modules and other program modules may be implemented as one or more instructions and/or logic embodied on some form of computer-readable storage medium and/or by one or more hardware elements 1314. The computing device 1310 may be configured to implement particular instructions and/or functions corresponding to software and/or hardware modules. Thus, implementing modules as modules executable by the computing device 1310 as software may be implemented, at least in part, in hardware, for example, using the processing system's computer-readable storage media and/or hardware elements 1314. The instructions and/or functions may be executable/operable by one or more articles of manufacture (e.g., one or more computing devices 1310 and/or processing system 1311) to implement the techniques, modules, and examples described herein.
In various implementations, the computing device 1310 may take on a variety of different configurations. For example, the computing device 1310 may be implemented as a computer-like device including a personal computer, a desktop computer, a multi-screen computer, a laptop computer, a netbook, and so forth. The computing device 1310 may also be implemented as a mobile device class device including mobile devices such as a mobile phone, portable music player, portable gaming device, a tablet computer, a multi-screen computer, and so on. Computing device 1310 may also be implemented as a television-like device that includes devices with or connected to a generally larger screen in a casual viewing environment. These devices include televisions, set-top boxes, game consoles, etc.
The techniques described herein may be supported by these various configurations of computing device 1310 and are not limited to specific examples of the techniques described herein. The functionality may also be implemented in whole or in part on the "cloud" 1320 using a distributed system, such as through the platform 1322 as described below.
Cloud 1320 includes and/or is representative of platform 1322 for resources 1324. The platform 1322 abstracts underlying functionality of hardware (e.g., servers) and software resources of the cloud 1320. The resources 324 may include applications and/or data that may be used when executing computer processes on servers remote from the computing device 1310. Resources 1324 may also include services provided over the internet and/or over a subscriber network such as a cellular or Wi-Fi network.
The platform 1322 may abstract resources and functionality to connect the computing device 1310 with other computing devices. The platform 1322 may also be used to abstract a hierarchy of resources to provide a corresponding level of hierarchy encountered for the demand of the resources 1324 implemented via the platform 1322. Thus, in interconnected device embodiments, implementation of functions described herein may be distributed throughout the system 1300. For example, the functionality may be implemented in part on the computing device 1310 and through the platform 1322 that abstracts the functionality of the cloud 1320.
The present disclosure provides a computer-readable storage medium having computer-readable instructions stored thereon which, when executed, implement any of the methods described above.
The present disclosure provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read by a processor of the computing device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computing device to perform any of the methods provided in the various alternative implementations described above.
It should be noted that some embodiments of the present application may involve the acquisition of business data (e.g., order numbers, messages, etc.) and the like. It will be appreciated that when embodiments of the present application relating to business data acquisition are applied to a particular product or technology, relevant user permission or consent needs to be obtained and relevant data collection, use and handling needs to comply with relevant laws and regulations and standards in relevant countries and regions.
It will be appreciated that for clarity, embodiments of the application have been described with reference to different functional units. However, it will be apparent that the functionality of each functional unit may be implemented in a single unit, in a plurality of units or as part of other functional units without detracting from the application. For example, functionality illustrated to be performed by a single unit may be performed by a plurality of different units. Thus, references to specific functional units are only to be seen as references to suitable units for providing the described functionality rather than indicative of a strict logical or physical structure or organization. Thus, the present application may be implemented in a single unit or may be physically and functionally distributed between different units and circuits.
Although the present application has been described in connection with some embodiments, it is not intended to be limited to the specific form set forth herein. Rather, the scope of the present application is limited only by the accompanying claims. Additionally, although individual features may be included in different claims, these may possibly advantageously be combined, and the inclusion in different claims does not imply that a combination of features is not feasible and/or advantageous. The order of features in the claims does not imply any specific order in which the features must be worked. Furthermore, in the claims, the word "comprising" does not exclude other elements, and the terms "a" or "an" do not exclude a plurality. Reference signs in the claims are provided merely as a clarifying example and shall not be construed as limiting the scope of the claims in any way.

Claims (14)

1. A method of processing a sequence number, the method being performed by a service unit having a modifiable association with at least one slot, each of the at least one slot having a corresponding client, the service unit holding current version information for each slot and allocation information relating to allocation of a sequence number corresponding to each slot, the method comprising:
receiving a processing request for a sequence number, wherein the processing request for the sequence number is from a target client corresponding to a target slot position in the at least one slot position;
acquiring latest version information for the target slot from a serial number storage area, wherein the serial number storage area comprises the latest version information for the target slot and historical allocation information of a corresponding serial number, the latest version information of the target slot indicates a plurality of serial numbers which are recorded in the serial number storage area and are extracted latest for the target slot for allocation, and the historical allocation information indicates information which is recorded in the serial number storage area and is related to historically allocated serial numbers for the target slot;
updating current version information of the target slot and distribution information related to distribution of a sequence number corresponding to the target slot based on latest version information of the target slot and historical distribution information of the sequence number in response to the fact that latest version information of the target slot does not match with the current version information of the target slot, wherein the current version information indicates a plurality of sequence numbers which are stored by the service unit and extracted for the target slot at the latest time;
processing the processing request for the sequence number based on a corresponding sequence number of the target slot held by the service unit and allocation information related to allocation of the sequence number corresponding to the target slot.
2. The method of claim 1, wherein the updating the current version information of the target slot and the allocation information related to the allocation of the sequence number corresponding to the target slot based on the latest version information of the target slot and historical allocation information of the sequence number in response to the latest version information of the target slot not matching the current version information of the target slot comprises:
in response to the latest version information of the target slot not matching the current version information of the target slot, then:
updating a plurality of sequence numbers, which are stored by the service unit and aim at the target slot position, by using a plurality of sequence numbers indicated by the latest version information of the target slot position; and
supplementing allocation information related to allocation of a sequence number corresponding to the target slot based on historical allocation information of the sequence number of the target slot.
3. The method of claim 2, wherein the processing request for sequence number is an allocation request for sequence number, and the allocation request for sequence number is for requesting allocation of a sequence number to an object on the target client;
wherein the processing request for a sequence number based on the corresponding sequence number of the target slot held by the service unit and allocation information related to allocation of the sequence number corresponding to the target slot comprises:
transmitting the minimum unallocated serial number in the corresponding serial numbers of the target slot positions stored by the service unit to the target client;
recording assignment information for the transmitted sequence number, the assignment information indicating that the transmitted sequence number is assigned to the object on the target client.
4. The method of claim 2, wherein the processing request for sequence number is a read request for sequence number, and wherein the read request includes a target sequence number, the read request for sequence number to read an object on the target client to which the target sequence number has been assigned;
wherein the processing request for a sequence number based on the corresponding sequence number of the target slot held by the service unit and allocation information related to allocation of the sequence number corresponding to the target slot comprises:
retrieving allocation information of the target sequence number from allocation information related to allocation of a sequence number corresponding to the target slot;
and transmitting the distribution information of the target serial number to the target client.
5. The method of claim 2, further comprising: in response to the corresponding sequence numbers of the target slots maintained by the service unit being fully allocated, then:
writing the distribution information of the corresponding serial number of the target slot position stored by the service unit into the serial number storage area;
extracting a plurality of unallocated sequence numbers from the sequence number storage area for the target slot position, wherein the plurality of unallocated sequence numbers corresponding to the target slot position are all greater than the historically allocated sequence numbers for the target slot position;
updating latest version information of the target slot in the sequence number storage area and the service unit based on the extracted plurality of unallocated sequence numbers.
6. The method of claim 5, wherein the writing, to the sequence number storage area, allocation information for the corresponding sequence number of the target slot maintained by the service unit in response to the corresponding sequence number of the target slot maintained by the service unit being fully allocated comprises:
in response to the corresponding sequence numbers of the target slot saved by the service unit being all allocated, writing allocation information of the corresponding sequence numbers of the target slot saved by the service unit into the request queue, the request queue having a space for storing allocation information of a predetermined number of sequence numbers;
in response to the request queue having stored a predetermined number of allocation information for sequence numbers, writing all of the allocation information in the request queue to the sequence number storage area.
7. The method of claim 2, wherein the latest version information of the target slot comprises a smallest sequence number and a largest sequence number of a plurality of sequence numbers recorded in the sequence number store that are most recently extracted for allocation for the target slot;
and wherein the updating the plurality of sequence numbers stored by the service unit for the target slot with the plurality of sequence numbers indicated by the latest version information of the target slot in response to the latest version information of the target slot not matching the current version information of the target slot comprises:
in response to that the minimum sequence number of the plurality of sequence numbers which are recorded in the sequence number storage area and are newly extracted for the target slot position and used for allocation is not the same as the minimum sequence number of the plurality of sequence numbers which are stored in the service unit and are newly extracted for the target slot position, taking the plurality of sequence numbers which are newly extracted for the target slot position and used for allocation as the sequence number corresponding to the target slot position; or
And in response to that the largest sequence number of the plurality of sequence numbers which are recorded in the sequence number storage area and are extracted for the target slot most recently for allocation is not the same as the largest sequence number of the plurality of sequence numbers which are stored by the service unit and are extracted for the target slot most recently, taking the plurality of sequence numbers which are extracted for the target slot most recently for allocation as the sequence number corresponding to the target slot.
8. The method of claim 1, wherein the sequence number storage area comprises a plurality of storage units, and latest version information for the target slot and historical allocation information for a corresponding sequence number are stored on more than half of the plurality of storage units.
9. The method of claim 1, further comprising:
in response to receiving an association request including information related to another slot, establishing an association with the other slot, and processing a processing request for a sequence number from a client corresponding to the other slot, wherein the other slot is different from the at least one slot.
10. The method of claim 9, wherein the another slot has an alterable association with another service unit, and the service unit and the another service unit are part of a service cluster that includes a plurality of service units that are mapped to a hash ring organized in a clockwise direction throughout a hash value space.
11. A serial number processing apparatus, the apparatus having an alterable association relationship with at least one slot, each of the at least one slot having a corresponding client, the apparatus holding current version information for each slot and allocation information related to allocation of a serial number corresponding to each slot, comprising:
a receiving module configured to receive a processing request for a sequence number, wherein the processing request for the sequence number is from a target client corresponding to a target slot of the at least one slot;
an obtaining module configured to obtain latest version information for the target slot from a sequence number storage area, where the sequence number storage area includes the latest version information for the target slot and historical allocation information of a corresponding sequence number, the latest version information of the target slot indicates a plurality of sequence numbers recorded in the sequence number storage area, which are extracted latest for the target slot, for allocation, and the historical allocation information indicates information about historically allocated sequence numbers recorded in the sequence number storage area for the target slot;
a matching module configured to update current version information of the target slot and allocation information related to allocation of a sequence number corresponding to the target slot based on the latest version information of the target slot and historical allocation information of sequence numbers in response to a mismatch between the latest version information of the target slot and the current version information of the target slot, wherein the current version information indicates a plurality of sequence numbers held by the apparatus that were last extracted for the target slot;
a processing module configured to process the processing request for a sequence number based on a corresponding sequence number of the target slot held by the apparatus and allocation information related to allocation of the sequence number corresponding to the target slot.
12. A computing device comprising a memory and a processor, the memory having stored therein a computer program that, when executed by the processor, causes the processor to perform the steps of the method of any of claims 1-10.
13. A storage medium having stored thereon a computer program which, when executed by a processor, causes the processor to carry out the method of any one of claims 1-10.
14. 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 to 10.
CN202210815076.4A 2022-07-12 2022-07-12 Sequence number processing method and device, computing equipment and storage medium Active CN115174527B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210815076.4A CN115174527B (en) 2022-07-12 2022-07-12 Sequence number processing method and device, computing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210815076.4A CN115174527B (en) 2022-07-12 2022-07-12 Sequence number processing method and device, computing equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115174527A true CN115174527A (en) 2022-10-11
CN115174527B CN115174527B (en) 2024-02-13

Family

ID=83492991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210815076.4A Active CN115174527B (en) 2022-07-12 2022-07-12 Sequence number processing method and device, computing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115174527B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105229721A (en) * 2013-05-23 2016-01-06 指尖翻动公司 When client device is in the lock state to the dynamic arrangements of the content presented
CN105468718A (en) * 2015-11-18 2016-04-06 腾讯科技(深圳)有限公司 Data consistency processing method, device and system
CN106254215A (en) * 2016-08-09 2016-12-21 腾讯科技(深圳)有限公司 Data processing method and device
CN106506663A (en) * 2016-11-22 2017-03-15 北京科摩仕捷科技有限公司 A kind of number distributing method, server and system
US20180212857A1 (en) * 2017-01-26 2018-07-26 International Business Machines Corporation Proactive channel agent
CN110351313A (en) * 2018-04-02 2019-10-18 武汉斗鱼网络科技有限公司 Data cache method, device, equipment and storage medium
CN111414379A (en) * 2020-03-20 2020-07-14 深圳前海微众银行股份有限公司 Serial number generation method, device, equipment and computer readable storage medium
CN111444207A (en) * 2020-03-24 2020-07-24 广州虎牙科技有限公司 Node data changing method and device, storage medium and server
CN111722918A (en) * 2019-03-21 2020-09-29 北京沃东天骏信息技术有限公司 Service identification code generation method and device, storage medium and electronic equipment
CN112988770A (en) * 2021-02-08 2021-06-18 腾讯科技(深圳)有限公司 Method and device for updating serial number, electronic equipment and storage medium
CN113742308A (en) * 2021-09-15 2021-12-03 京东科技信息技术有限公司 Method and device for storing log
CN113886455A (en) * 2021-08-26 2022-01-04 拉卡拉支付股份有限公司 Global unique serial number generation method and device, electronic equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105229721A (en) * 2013-05-23 2016-01-06 指尖翻动公司 When client device is in the lock state to the dynamic arrangements of the content presented
CN105468718A (en) * 2015-11-18 2016-04-06 腾讯科技(深圳)有限公司 Data consistency processing method, device and system
CN106254215A (en) * 2016-08-09 2016-12-21 腾讯科技(深圳)有限公司 Data processing method and device
CN106506663A (en) * 2016-11-22 2017-03-15 北京科摩仕捷科技有限公司 A kind of number distributing method, server and system
US20180212857A1 (en) * 2017-01-26 2018-07-26 International Business Machines Corporation Proactive channel agent
CN110351313A (en) * 2018-04-02 2019-10-18 武汉斗鱼网络科技有限公司 Data cache method, device, equipment and storage medium
CN111722918A (en) * 2019-03-21 2020-09-29 北京沃东天骏信息技术有限公司 Service identification code generation method and device, storage medium and electronic equipment
CN111414379A (en) * 2020-03-20 2020-07-14 深圳前海微众银行股份有限公司 Serial number generation method, device, equipment and computer readable storage medium
CN111444207A (en) * 2020-03-24 2020-07-24 广州虎牙科技有限公司 Node data changing method and device, storage medium and server
CN112988770A (en) * 2021-02-08 2021-06-18 腾讯科技(深圳)有限公司 Method and device for updating serial number, electronic equipment and storage medium
CN113886455A (en) * 2021-08-26 2022-01-04 拉卡拉支付股份有限公司 Global unique serial number generation method and device, electronic equipment and storage medium
CN113742308A (en) * 2021-09-15 2021-12-03 京东科技信息技术有限公司 Method and device for storing log

Also Published As

Publication number Publication date
CN115174527B (en) 2024-02-13

Similar Documents

Publication Publication Date Title
CN109074362B (en) Splitting and range of motion in distributed systems
EP2998863B1 (en) Converting a serial transaction schedule to a parallel transaction schedule
KR102376713B1 (en) Composite partition functions
US10554604B1 (en) Low-load message queue scaling using ephemeral logical message topics
CN106874328B (en) Data processing method and equipment
US10594804B2 (en) Directory service discovery and/or learning
EP2618278A2 (en) Synchronizing endpoint data stores having disparate schemas
US10235223B2 (en) High-performance computing framework for cloud computing environments
CN113806300B (en) Data storage method, system, device, equipment and storage medium
EP3786802A1 (en) Method and device for failover in hbase system
US10877994B2 (en) Identifier based data replication
US11102139B1 (en) Shared queue management utilizing shuffle sharding
CN113254165B (en) Load flow distribution method and device for virtual machine and container, and computer equipment
US9684668B1 (en) Systems and methods for performing lookups on distributed deduplicated data systems
CN111984293B (en) Information processing method, device and storage medium
US11838207B2 (en) Systems for session-based routing
CN115174527A (en) Serial number processing method and device, computing equipment and storage medium
CN111444148A (en) Data transmission method and device based on MapReduce
CN110442636A (en) A kind of reading/writing method of data, device and reading and writing data equipment
CN105760338A (en) Image display method and device of thin client and electronic equipment
CN114090127A (en) Electronic device, loading method and medium of configuration file of electronic device
CN109325057B (en) Middleware management method, device, computer equipment and storage medium
US11100106B1 (en) Query engine virtualization
CN113468140A (en) Data migration processing method, electronic device and computer-readable storage medium
CN111400598A (en) Information push method, server, multi-port repeater and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40075791

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant