Method for acquiring lock of data object, network card and computing equipment
By caching lock status information on the network card and offloading concurrency control logic to the network card, the problem of high communication overhead between the processor and the network card in the DSM system is solved, and system performance and concurrency capabilities are improved.
Patent Information
- Application Number
- CN202310245128.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-07
- Publication Date
- 2024-09-10
AI Technical Summary
In a distributed shared memory (DSM) system, the PCIe DMA communication overhead between the server's processor and the network card is large, leading to system performance bottlenecks.
By caching the lock status information on the network card, it avoids obtaining the lock status information from the processor memory, searches and updates the lock status directly on the network card, reduces the communication overhead between the processor and the network card, and offloads the concurrency control logic to the network card. , to achieve a zero-participation concurrency control mechanism.
It significantly reduces the communication overhead between the server network card and the processor, increases the system's concurrent node scale, and reduces end-to-end delay jitter.
Smart Images

Figure CN118626282A
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage, and more specifically, to a method for acquiring a lock of a data object, a network card, and a computing device. Background Art
[0002] Distributed shared memory (DSM) is an important technology that has emerged in the development of parallel processing. It aims to provide users with abstract unified global memory access through distributed technology. That is, it provides a logically unified address space, and any processor can directly read and write to this address space.
[0003] In order to solve the concurrent access to shared memory in DSM, a pessimistic lock strategy is adopted to lock the data in the shared memory. In the related technical solution, the process of the client acquiring the lock is to send a request through RDMA, and then the programmable network card on the server side operates the memory in the processor on the server side through the bus and interface standard (peripheral component interface express, PCIe) DMA. Therefore, the communication overhead between the processor and the network card on the server side is relatively large.
[0004] Therefore, how to reduce the communication overhead between the server-side processor and the network card becomes a technical problem that needs to be solved urgently. Summary of the invention
[0005] The present application provides a method for acquiring a lock of a data object, a network card, and a computing device. The method can reduce the communication overhead between a network card and a processor of a server.
[0006] In a first aspect, a method for acquiring a lock of a data object is provided, the method comprising: receiving a lock request message sent by a first client through a network card in a server, the lock request message being used to request locking of a first data object, the first data object being data stored in a distributed shared memory DSM of a processor in the server, the network card communicating with the processor, responding to the lock request message based on lock status information corresponding to at least some data objects in the DSM cached by the network card, and feeding back first lock status information corresponding to the first data object to the first client, the lock status information of the first data object being used to indicate locking status of multiple clients on the first data object, the multiple clients including the first client.
[0007] In the above technical solution, the lock status information can be cached in the cache of the server's network card. When the client accesses a shared data object, the network card of the first device first searches for the lock status information of the object in the memory of the network card according to its virtual address, thereby avoiding the network card from obtaining the lock status information of the object from the processor memory, thereby reducing the communication overhead between the network card and the processor.
[0008] In combination with the first aspect, in some implementations of the first aspect, when the network card cache has the first lock state information, the first lock state information is obtained from the cache of the network card; and the first lock state information is fed back to the first client.
[0009] In combination with the first aspect, in certain implementations of the first aspect, when the network card does not cache the first lock status information, the first lock status information is obtained from the DSM of the processor through the network card, and the DSM of the processor stores the first lock status information; the first lock status information is fed back to the first client.
[0010] In combination with the first aspect, in certain implementations of the first aspect, the lock request message includes the virtual address of the first data object, and based on the virtual address of the first data object, the lock status information corresponding to at least some data objects in the DSM of the processor cached by the network card is queried to obtain the lock status information of the first data object.
[0011] In conjunction with the first aspect, in some implementations of the first aspect, the lock request message includes a lock type that the first client requests to lock the first data object, and the lock type includes an exclusive lock and a shared lock. The method further includes:
[0012] According to the lock type requested by the first client to lock the first data object, the lock state information of the first data object cached by the network card is updated.
[0013] In the above technical solution, part of the concurrency control logic for data objects can be offloaded to the server's network card, and a concurrency control mechanism with zero processor involvement can be implemented through the server's network card, which can multiply the scale of concurrent nodes of the overall system and reduce end-to-end delay jitter.
[0014] In combination with the first aspect, in certain implementations of the first aspect, the lock status information of the first data object includes a first field, a second field, and a third field, wherein the first field indicates the number of clients that currently obtain the exclusive lock of the first data object, the second field indicates the number of clients that apply for the exclusive lock of the first data object, and the third field indicates the number of clients that apply for the shared lock of the first data object.
[0015] In combination with the first aspect, in certain implementations of the first aspect, the lock type requested by the first client to lock the first data object is an exclusive lock, and based on the lock type requested by the first client to lock the first data object being the exclusive lock, the value of the second field in the lock status information of the first data object is updated.
[0016] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: if the value of the second field in the lock status information of the first data object before being updated is the same as the value of the first field, sending a success message to the first client, the success message being used to indicate that the first client has successfully acquired the exclusive lock of the first data object; or if the value of the second field in the lock status information of the first data object before being updated is different from the value of the first field, sending a failure message to the first client, the failure message being used to indicate that the first client has failed to acquire the exclusive lock of the first data object.
[0017] In combination with the first aspect, in certain implementations of the first aspect, the lock type requested by the first client to lock the first data object is a shared lock, and based on the lock type requested by the first client to lock the first data object being the shared lock, the value of the third field in the lock status information of the first data object is updated.
[0018] In combination with the first aspect, in certain implementations of the first aspect, if the lock status information of the first data object cached by the first network card is updated, the method also includes: sending a notification message to the first client, wherein the notification message is used to instruct the first client to update the received lock status information of the first data object.
[0019] In a second aspect, a method for acquiring a lock of a data object is provided, the method comprising: receiving lock status information of a first data object sent by a server, the first data object being any storage object in a distributed shared memory DSM of a processor of the server, the lock status information of the first data object being used to indicate a locking status of the first data object by multiple clients; and storing the lock status information of the first data object in a cache of the network card.
[0020] In combination with the second aspect, in some implementations of the second aspect, the method further includes: sending a lock request message to the server, where the lock request message is used to request the server to obtain lock status information of the first data object.
[0021] In combination with the second aspect, in some implementations of the second aspect, the lock request message carries the virtual address of the first data object and / or the lock type locked on the first data object.
[0022] In combination with the second aspect, in certain implementations of the second aspect, the lock status information of the first data object includes a first field, a second field, and a third field, the first field indicating the number of clients that currently have obtained an exclusive lock on the first data object, the second field indicating the number of clients that have applied for an exclusive lock on the first data object, and the third field indicating the number of clients that have applied for a shared lock on the first data object.
[0023] In combination with the second aspect, in certain implementations of the second aspect, the method also includes: receiving a notification message sent by the server, the notification message being used to indicate an update to the lock status information of the received first data object; and updating the lock status information of the first data object stored in the network card according to the notification message.
[0024] According to a third aspect, a method for acquiring a lock for a data object is provided, the method comprising: a first client sends a lock request message to a network card in a server, the lock request message being used to request locking of a first data object, the first data object being data stored in a distributed shared memory DSM of a processor in the server, the network card communicating with the processor; the server responds to the lock request message based on lock status information corresponding to at least part of the data objects in the DSM cached by the network card, and feeds back first lock status information corresponding to the first data object to the first client, the first lock status information being used to indicate locking status of the first data object by multiple clients, the multiple clients including the first client; the first client determines whether the first data object is successfully locked based on the first lock status information.
[0025] In combination with the third aspect, in certain implementations of the third aspect, when the network card cache has the first lock state information, the server obtains the first lock state information from the cache of the network card; and the server feeds back the first lock state information to the first client.
[0026] In combination with the third aspect, in certain implementations of the third aspect, when the network card does not cache the first lock status information, the server obtains the first lock status information from the DSM in the processor of the server through the network card, and the DSM of the processor of the server stores the first lock status information; the server feeds back the first lock status information to the first client.
[0027] In combination with the third aspect, in certain implementations of the third aspect, the lock request message includes the virtual address of the first data object, and the server queries the lock status information corresponding to at least part of the data objects in the DSM of the processor in the network card cache of the server based on the virtual address of the first data object to obtain the lock status information of the first data object.
[0028] In combination with the third aspect, in certain implementations of the third aspect, the lock request message includes the lock type requested by the first client to lock the first data object, and the lock type includes an exclusive lock and a shared lock. The method also includes: the server updates the lock status information of the first data object cached by the network card through the network card according to the lock type requested by the first client to lock the first data object.
[0029] In combination with the third aspect, in certain implementations of the third aspect, the lock status information of the first data object includes a first field, a second field, and a third field, wherein the first field indicates the number of clients that currently obtain the exclusive lock of the first data object, the second field indicates the number of clients that apply for the exclusive lock of the first data object, and the third field indicates the number of clients that apply for the shared lock of the first data object.
[0030] In combination with the third aspect, in certain implementations of the third aspect, the lock type requested by the first client to lock the first data object is an exclusive lock, and the first client determines that it has successfully acquired the exclusive lock of the first data object based on the fact that the value of the second field in the lock status information of the first data object is the same as the value of the first field; or the first client determines that it has failed to acquire the exclusive lock of the first data object based on the fact that the value of the second field in the lock status information of the first data object is different from the value of the first field.
[0031] In combination with the third aspect, in certain implementations of the third aspect, the first client requests that the lock type for locking the first data object be an exclusive lock, and the server updates the value of the second field in the lock status information of the first data object through the network card based on the lock type requested by the first client to be the exclusive lock.
[0032] In combination with the third aspect, in certain implementations of the third aspect, the lock type requested by the first client to lock the first data object is a shared lock, and the server updates the value of the third field in the lock status information of the first data object through the network card based on the lock type requested by the first client to lock the first data object as the shared lock.
[0033] In combination with the third aspect, in certain implementations of the third aspect, the method also includes: the server sends a success message to the first client through the network card based on the fact that the value of the second field in the lock status information of the first data object before being updated is the same as the value of the first field, and the success message is used to indicate that the first client has successfully acquired the exclusive lock of the first data object; or the server sends a failure message to the first client through the network card based on the fact that the value of the second field in the lock status information of the first data object before being updated is different from the value of the first field, and the failure message is used to indicate that the first client has failed to acquire the exclusive lock of the first data object.
[0034] In combination with the third aspect, in certain implementations of the third aspect, if the lock status information of the first data object cached by the network card of the server is updated, the method also includes: the server sends a notification message to the first client through the network card, and the notification message is used to instruct the first client to update the received lock status information of the first data object.
[0035] In a fourth aspect, a network card is provided, comprising: a receiving circuit and a control circuit, wherein the network card receiving circuit in the server is used to receive a lock request message sent by a first client, the lock request message is used to request to lock a first data object, the first data object is data stored in a distributed shared memory DSM of a processor in the server, and the network card communicates with the processor; the control circuit is used to respond to the lock request message according to lock status information corresponding to at least part of the data objects in the DSM cached by the network card, and to feed back first lock status information corresponding to the first data object to the first client, the first lock status information being used to indicate the locking status of the first data object by multiple clients, and the multiple clients including the first client.
[0036] In combination with the fourth aspect, in certain implementations of the fourth aspect, when the network card cache has the first lock status information, the control circuit is specifically used to: obtain the first lock status information from the cache of the network card; and feedback the first lock status information to the first client.
[0037] In combination with the fourth aspect, in certain implementations of the fourth aspect, when the network card does not cache the first lock status information, the control circuit is specifically used to: obtain the first lock status information from the DSM of the processor through the network card, and the DSM of the processor stores the first lock status information; and feedback the first lock status information to the first client.
[0038] In combination with the fourth aspect, in certain implementations of the fourth aspect, the lock request message includes the virtual address of the first data object, and the control circuit is specifically used to: query the lock status information corresponding to at least part of the data objects in the DSM of the processor in the network card cache according to the virtual address of the first data object, and obtain the lock status information of the first data object.
[0039] In combination with the fourth aspect, in certain implementations of the fourth aspect, the lock request message includes the lock type that the first client requests to lock the first data object, and the lock type includes an exclusive lock and a shared lock. The control circuit is also used to update the lock status information of the first data object cached by the network card according to the lock type that the first client requests to lock the first data object.
[0040] In combination with the fourth aspect, in certain implementations of the fourth aspect, the lock status information of the first data object includes a first field, a second field, and a third field, wherein the first field indicates the number of clients that currently obtain the exclusive lock of the first data object, the second field indicates the number of clients that apply for the exclusive lock of the first data object, and the third field indicates the number of clients that apply for the shared lock of the first data object.
[0041] In combination with the fourth aspect, in certain implementations of the fourth aspect, the first client requests an exclusive lock as the lock type to lock the first data object, and the control circuit is specifically used to: update the value of the second field in the lock status information of the first data object based on the type of lock requested by the first client to lock the first data object being the exclusive lock.
[0042] In combination with the fourth aspect, in certain implementations of the fourth aspect, the network card also includes: a transmitting circuit, which is used to send a success message to the first client if the updated value of the second field in the lock status information of the first data object is the same as the value of the first field, and the success message is used to indicate that the first client has successfully acquired the exclusive lock of the first data object; or the transmitting circuit is also used to send a failure message to the first client if the updated value of the second field in the lock status information of the first data object is not the same as the value of the first field, and the failure message is used to indicate that the first client has failed to acquire the exclusive lock of the first data object.
[0043] In combination with the fourth aspect, in certain implementations of the fourth aspect, the lock type requested by the first client to lock the first data object is a shared lock, and the control circuit is specifically used to: update the value of the third field in the lock status information of the first data object based on the fact that the lock type requested by the first client to lock the first data object is the shared lock.
[0044] In combination with the fourth aspect, in certain implementations of the fourth aspect, if the lock status information of the first data object cached by the first network card is updated, the transmitting circuit is also used to send a notification message to the first client, and the notification message is used to instruct the first client to update the received lock status information of the first data object.
[0045] In a fifth aspect, a network card is provided, comprising: a receiving circuit for receiving lock status information of a first data object sent by a server, the first data object being any storage object in a distributed shared memory DSM of a processor of the server, the lock status information of the first data object being used to indicate a locking status of the first data object by multiple clients; and a control circuit for storing the lock status information of the first data object in a cache of the network card.
[0046] In combination with the fifth aspect, in some implementations of the fifth aspect, the network card further includes: a transmitting circuit, configured to send a lock request message to the server, wherein the lock request message is used to request the server to obtain lock status information of the first data object.
[0047] In combination with the fifth aspect, in some implementations of the fifth aspect, the lock request message carries the virtual address of the first data object and / or the lock type for locking the first data object.
[0048] In combination with the fifth aspect, in certain implementations of the fifth aspect, the lock status information of the first data object includes a first field, a second field, and a third field, the first field indicating the number of clients that currently have obtained an exclusive lock of the first data object, the second field indicating the number of clients that have applied for an exclusive lock of the first data object, and the third field indicating the number of clients that have applied for a shared lock of the first data object.
[0049] In combination with the fifth aspect, in certain implementations of the fifth aspect, the receiving circuit is also used to receive a notification message sent by the server, and the notification message is used to indicate that the lock status information of the received first data object is updated; the control circuit is also used to update the lock status information of the first data object stored in the network card according to the notification message.
[0050] In a sixth aspect, a computing device is provided, comprising a processor and a memory, and optionally, an input / output interface, wherein the processor is used to control the input / output interface to send and receive information, the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the method in the first aspect or any possible implementation of the first aspect is executed.
[0051] Optionally, the processor may be a general-purpose processor, which may be implemented by hardware or software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated in the processor or located outside the processor and exist independently.
[0052] In a seventh aspect, a computing device is provided, comprising a processor and a memory, and optionally, an input / output interface, wherein the processor is used to control the input / output interface to send and receive information, the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the method in the second aspect or any possible implementation of the second aspect is executed.
[0053] Optionally, the processor may be a general-purpose processor, which may be implemented by hardware or software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated in the processor or located outside the processor and exist independently.
[0054] In an eighth aspect, a computing device is provided, comprising a processor and a memory, and optionally, an input / output interface, wherein the processor is used to control the input / output interface to send and receive information, the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the method in the third aspect or any possible implementation of the third aspect is executed.
[0055] Optionally, the processor may be a general-purpose processor, which may be implemented by hardware or software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated in the processor or located outside the processor and exist independently.
[0056] In a ninth aspect, a chip is provided, which obtains instructions and executes the instructions to implement the method in the above-mentioned first aspect and any one of the implementation methods of the first aspect.
[0057] Optionally, as an implementation manner, the chip includes a processor and a data interface, and the processor reads instructions stored in the memory through the data interface to execute the method in the above-mentioned first aspect and any implementation manner of the first aspect.
[0058] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the first aspect and any one of the implementation methods of the first aspect.
[0059] In a tenth aspect, a chip is provided, which obtains instructions and executes the instructions to implement the method in the above-mentioned second aspect and any one of the implementation methods of the second aspect.
[0060] Optionally, as an implementation manner, the chip includes a processor and a data interface, and the processor reads instructions stored in the memory through the data interface to execute the method in the above-mentioned second aspect and any implementation manner of the second aspect.
[0061] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the second aspect and any one of the implementation methods of the second aspect.
[0062] In an eleventh aspect, a chip is provided, which obtains instructions and executes the instructions to implement the method in the third aspect and any one of the implementation methods of the third aspect.
[0063] Optionally, as an implementation manner, the chip includes a processor and a data interface, and the processor reads instructions stored in the memory through the data interface to execute the method in the above-mentioned third aspect and any implementation manner of the third aspect.
[0064] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the third aspect and any one of the implementation methods of the third aspect.
[0065] In a twelfth aspect, a device is provided, comprising a network card as in the fourth aspect and any one of the implementation methods of the fourth aspect.
[0066] In a thirteenth aspect, a device is provided, comprising a network card as in the fifth aspect and any one of the implementation methods of the fifth aspect.
[0067] In a fourteenth aspect, a system for acquiring a lock of a data object is provided, comprising a first client and a server, the server comprising a processor and a network card as in the fourth aspect and any one of the implementations of the fourth aspect, the network card and the processor communicating with each other, the first client being used to send a lock request message to the network card in the server, the lock request message being used to request locking of a first data object, the first data object being data stored in a distributed shared memory DSM of the processor of the server; the server being used to respond to the lock request message based on lock status information corresponding to at least part of the data objects in the DSM cached by the network card, and to feed back first lock status information corresponding to the first data object to the first client, the first lock status information being used to indicate locking status of the first data object by multiple clients, the multiple clients including the first client; the first client being further used to determine whether the first data object is successfully locked based on the first lock status information.
[0068] In a fifteenth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device, the computing device executes the method in the first aspect and any one of the implementations of the first aspect.
[0069] In a sixteenth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device, the computing device executes the method in the above-mentioned second aspect and any one of the implementations of the second aspect.
[0070] In the seventeenth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device, the computing device executes the method in the third aspect and any one of the implementations of the third aspect.
[0071] In an eighteenth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method in the above-mentioned first aspect and any one of the implementations of the first aspect.
[0072] By way of example, these computer-readable storages include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), Flash memory, electrically EPROM (EEPROM), and hard drive.
[0073] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium.
[0074] In the nineteenth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method in the above-mentioned second aspect and any one of the implementations of the second aspect.
[0075] By way of example, these computer-readable storages include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), Flash memory, electrically EPROM (EEPROM), and hard drive.
[0076] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium.
[0077] In the twentieth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method in the third aspect and any one of the implementations of the third aspect.
[0078] By way of example, these computer-readable storages include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), Flash memory, electrically EPROM (EEPROM), and hard drive.
[0079] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] Figure 1 It is a schematic block diagram of a DSM system applied to an embodiment of the present application.
[0081] Figure 2 It is a schematic flowchart of a method for acquiring a lock of a data object provided in an embodiment of the present application.
[0082] Figure 3 It is a schematic flowchart of another method for acquiring a lock of a data object provided in an embodiment of the present application.
[0083] Figure 4It is a schematic diagram of lock status information provided by an embodiment of the present application.
[0084] Figure 5 It is a schematic flowchart of a method for client predicting concurrency control strategy provided in an embodiment of the present application.
[0085] Figure 6 It is a schematic block diagram of a network card 600 provided in an embodiment of the present application.
[0086] Figure 7 It is a schematic block diagram of another network card 700 provided in an embodiment of the present application.
[0087] Figure 8 It is a schematic diagram of the architecture of a computing device 1500 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0088] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0089] The present application will present various aspects, embodiments or features around a system including multiple devices, components, modules, etc. It should be understood and appreciated that each system may include additional devices, components, modules, etc., and / or may not include all devices, components, modules, etc. discussed in conjunction with the figures. In addition, combinations of these schemes may also be used.
[0090] In addition, in the embodiments of the present application, words such as "exemplary" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present concepts in a concrete way.
[0091] In the embodiments of the present application, "corresponding (corresponding, relevant)" and "corresponding (corresponding)" can sometimes be used interchangeably. It should be pointed out that when the distinction between them is not emphasized, the meanings they intend to express are consistent.
[0092] The business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person of ordinary skill in the art can appreciate that, with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0093] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0094] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0095] To facilitate understanding, relevant terms and concepts that may be involved in the embodiments of the present application are first introduced below.
[0096] 1. Distributed shared memory (DSM)
[0097] DSM is an important technology that has emerged in the development of parallel processing. It aims to provide users with abstract unified global memory access through distributed technology. Specifically, DSM is a virtual address space shared by all nodes (processors) of a distributed system, that is, it provides a logically unified address space, and any processor can directly read and write to this address space. The way a program accesses data in DSM is very similar to the way it accesses data in the virtual memory of a traditional computer. On a system with DSM, data moves between local memories of different computers in the same way as they move between the RAM and external memory of a computer.
[0098] Therefore, DSM has the advantages of scalability of distributed memory structure, and also has the advantages of good versatility, portability and easy programming of shared memory structure.
[0099] 2. Remote direct memory access (RDMA)
[0100] RDMA is a remote direct data access technology that was created to solve the delay of server-side data processing during network transmission. RDMA allows applications to bypass the kernel network protocol stack and directly transfer data to the computer's storage area through the network. It can directly access remote memory without the direct participation of the processors of both parties, and quickly move data from one system to the remote system memory without any impact on the operating system. RDMA can achieve zero copy of data transmission and eliminate the overhead of external memory copying and context switching, thereby freeing up memory bandwidth and processor cycles.
[0101] RDMA provides two types of communication primitives: unilateral primitives and bilateral primitives. Among them, unilateral primitives can complete memory reading and writing without the remote processor's perception; bilateral primitives require the participation of both processors. Currently, network protocol stacks that support RDMA technology include Infiniband, RoCE, and iWARP. The former two are supported by Mellanox with hardware technology. In particular, the latter two use the data link layer of ordinary Ethernet, so they are fully compatible with Ethernet.
[0102] 3. Exclusive lock
[0103] An exclusive lock can also be called an exclusive lock, which can only be held by one thread at a time. That is, when a thread adds an exclusive lock to a certain data, other threads cannot add any type of lock to the data. The thread that obtains the exclusive lock can both read and modify the data.
[0104] 4. Shared locks
[0105] Shared locks can be held by multiple threads. That is, when a thread adds a shared lock to a piece of data, other threads can also add shared locks to the data, but they cannot add exclusive locks to the data. The thread that obtains the shared lock can read the data, but cannot modify it.
[0106] 5. Optimistic Locking
[0107] As the name implies, optimistic locking is very optimistic. Every time you get data, you assume that others will not modify it, so you will not lock it. But when updating, you will determine whether others have updated the data during this period. You can use mechanisms such as version numbers. Optimistic locking is suitable for multi-read applications. Optimistic locking is implemented in Java by using lock-free programming. The most commonly used algorithm is compare and swap (CAS). The increment operation in the Java atomic class is implemented by CAS spin.
[0108] It should be understood that the full name of CAS is a lock-free algorithm. It realizes variable synchronization between multiple threads without using locks (no threads are blocked). Simply put, the CAS algorithm has three operands: the memory value V to be read and written, the value A to be compared, and the new value B to be written. And only when the expected value A and the memory value V are the same, the memory value V is modified to B, otherwise V is returned. This is an optimistic locking idea, which believes that no other thread will modify it before it modifies it.
[0109] 6. Pessimistic Lock
[0110] As the name implies, pessimistic locking is very pessimistic, always assuming the worst case scenario, and has strong exclusivity and exclusive characteristics. It refers to a conservative attitude towards data being modified by the outside world (including other current transactions in the system, as well as transaction processing from external systems). Therefore, during the entire data processing process, the data is locked. The implementation of pessimistic locking often relies on the locking mechanism provided by the database to ensure the maximum exclusivity of the operation. Only the locking mechanism provided by the database layer can truly guarantee the exclusivity of data access. Otherwise, even if the locking mechanism is implemented in this system, it cannot be guaranteed that the external system will not modify the data. Many such locking mechanisms are used in traditional MySQL relational databases, such as row locks, table locks, read locks, write locks, etc., which are all locked before performing operations.
[0111] The DSM system aims to provide users with abstract unified global memory access through distributed technology. This concept was first proposed in the 1990s. However, due to the low-speed network and the high latency environment it brought, as well as the relatively complex distributed consistency design at the time, this concept only experienced a short research boom. In recent years, with the emergence of low-latency and high-speed network communication technologies such as RDMA, distributed shared memory, the concept of independently abstracting and pooling memory resources, has been rediscovered and has become a hot topic in academic research.
[0112] In order to solve the concurrent access to shared memory in DSM, a pessimistic lock strategy is adopted to lock the corresponding data in the shared memory. In the related technical solution, the process of the client acquiring the lock is to send a request through RDMA, and then the programmable network card on the server side operates the memory in the processor on the server side through the bus and interface standard (peripheral component interface express, PCIe) DMA. Since the PCIeDMA communication between the network card and the processor on the server side is an important link in the critical path, and the overhead of transmitting data through PCIe DMA is high, therefore, for large amounts of data transmission, bandwidth can easily become a system bottleneck.
[0113] In view of this, an embodiment of the present application provides a method for acquiring a lock of a data object, which can reduce the PCIeDMA communication overhead between a programmable network card and a processor in a server.
[0114] For the convenience of description, the following Figure 1 , a distributed shared memory DSM system applied to an embodiment of the present application is illustrated by way of example.
[0115] Figure 1 is a schematic block diagram of a DSM system applied to an embodiment of the present application. Figure 1 As shown, the system may include a client 110 and a server 120, wherein the client 110 is the initiator of the remote data read and write request, and the server 120 is used to store and manage shared data, and receive and process the remote data read and write request sent by the client 110. The client 110 and the server 120 are interconnected through the network via RDMA.
[0116] The internal structures of the client 110 and the server 120 are described in detail below.
[0117] The client 110 includes a processor 111 and a programmable network card 112. The hardware layer of the processor 111 may include chips such as a CPU and a memory, and the software layer may include an application (APP). The processor 111 sends a remote data read and write request to the programmable network card 112 in the form of PCIeDMA, and the programmable network card 112 sends the remote data read and write request to the server 120 in the form of RDMA communication.
[0118] It should be understood that the programmable network card 112 can also be called a smart network interface card (smart NIC) or a smart network adapter. In addition to completing the network transmission function of a standard network card, the programmable network card 112 can also provide a built-in programmable and configurable hardware acceleration engine to offload part of the work of the central processing unit (CPU) to the programmable network card 112, thereby improving the performance of the application and significantly reducing the consumption of the CPU in communication, providing more CPU resources for the application.
[0119] The server 120 includes a processor 121 and a programmable network card 122. The hardware layer of the processor 121 may include chips such as a CPU and a memory. The programmable network card 122 receives a remote data read and write request sent by the client 110 in the form of RDMA communication, and operates the data stored in the memory of the processor 121 in the form of PCIeDMA.
[0120] As an example, the memory in the processor 121 may include, but is not limited to: at least one dynamic random access memory (DRAM) and at least one non-volatile memory (NVM). It should be understood that the memory in the processor 121 may also be referred to as DSM.
[0121] Combine the following Figure 2 , a method for acquiring a lock of a data object provided in an embodiment of the present application is described in detail.
[0122] Figure 2 FIG. 1 is a schematic flow chart of a method for acquiring a lock on a data object provided by an embodiment of the present application. Figure 2 As shown, the method may include steps 210-230, and steps 210-230 are described in detail below.
[0123] Step 210: The first network card receives a lock request message sent by the second device.
[0124] In the embodiment of the present application, the first network card is located on the first device, and the first device also includes a first processor. The first network card and the first processor can communicate through a bus. Figure 1 Taking the scenario shown as an example, the first device may be the server 120, the first network card may be the programmable network card 122, the first processor may be the processor 121, and the first network card and the first processor communicate via PCIeDMA.
[0125] In the embodiment of the present application, the second device may include a second network card and a second processor, and the second network card and the second processor may communicate via a bus. Figure 1 Taking the scenario shown as an example, the second device may be the client 110, the second network card may be the programmable network card 112, the second processor may be the processor 111, and the second network card and the second processor communicate with each other via PCIeDMA.
[0126] The first network card may receive a lock request message sent by the second device. For example, the first network card may receive a lock request message sent by the second network card in the second device. The lock request message is used to request the first network card to obtain a lock of a first data object, where the first data object is any storage object in the distributed shared memory DSM of the first processor.
[0127] As an example, the lock request message may include, but is not limited to: the virtual address of the first data object and the type of lock requested, wherein the type of lock may include, but is not limited to: an exclusive lock, a shared lock, and the like.
[0128] Step 220: The first network card obtains lock status information of the first data object from the first network card according to the lock request message.
[0129] In an embodiment of the present application, the lock state information of the first data object may be cached in the first network card. After receiving the lock request message sent by the second network card, the first network card may obtain the cached lock state information of the first data object from the memory of the first network card. As an example, in a possible implementation, the first network card may obtain the cached lock state information of the first data object from the memory of the first network card according to the virtual address of the first data object.
[0130] Optionally, in some embodiments, if the lock state information of the first data object is not in the memory of the first network card, the first network card may obtain the lock state information of the first data object from the first processor and store it in the memory of the first network card. Specifically, in a possible implementation, the first network card may obtain the lock state information of the first data object stored in the memory of the first processor through PCIeDMA and store it in the memory of the first network card.
[0131] Step 230: The first network card sends lock status information of the first data object to the second device.
[0132] In the above technical solution, the lock status information can be cached in the memory of the network card of the first device (also called the server). When the client accesses the shared data object, the network card of the first device first searches the memory of the network card for the lock status information of the object according to its virtual address, thereby avoiding the network card obtaining the lock status information of the object from the processor memory of the first device, thereby reducing the communication overhead between the network card of the first device and the processor of the first device.
[0133] Below Figure 1 Take the scenario shown in the figure as an example, combined with Figure 3 , a specific implementation of the method for acquiring a lock on a data object provided in an embodiment of the present application is described in detail. It should be understood that the following Figure 3 The examples are only intended to help those skilled in the art understand the embodiments of the present application, and are not intended to limit the embodiments of the present application to the following examples. Figure 3 The specific numerical values or specific scenarios shown in the examples. Figure 3 The examples given are obviously susceptible to various equivalent modifications or changes, and such modifications and changes also fall within the scope of the embodiments of the present application.
[0134] Figure 3 It is a schematic flowchart of another method for acquiring a lock of a data object provided in an embodiment of the present application. The method may include steps 310-350, and steps 310-350 are described in detail below.
[0135] Step 310: The client 110 sends a request message for a user to obtain a lock to the server 120.
[0136] In the embodiment of the present application, the client 110 may send a request message to the server 120 through the programmable network card 112, and the request message is used to request a lock. For example, the request message is used to request to obtain a lock for data object A. It should be understood that data object A can be any data object stored in the memory of the processor 121.
[0137] As an example, the request message may include, but is not limited to: the virtual address of the data object A and the type of lock requested. The type of lock may include, but is not limited to: an exclusive lock, a shared lock, and the like.
[0138] For example, in a possible implementation, the client 110 may call the atomic operation fetch_and_add to implement the above process of requesting to obtain the lock of the data object A.
[0139] Step 320: the programmable network card 122 in the server 120 searches for the lock status information of the data object A from the memory of the programmable network card 122 according to the request message.
[0140] As an example, after receiving the request message sent by the client 110 , the programmable network card 122 in the server 120 can search for lock status information corresponding to the data object A from the memory of the programmable network card 122 according to the virtual address of the data object A included in the request message.
[0141] Optionally, in some embodiments, if the memory of the programmable network card 122 does not contain the lock state information of the data object A, the programmable network card 122 may obtain the lock state information of the object A from the processor 121, and store it in the memory of the programmable network card 122. Specifically, in a possible implementation, the programmable network card 122 may obtain the lock state information of the object A stored in the memory of the processor 121 through PCIeDMA, and store it in the memory of the programmable network card 122.
[0142] In a possible implementation, a 64-bit value may be used to represent the lock status information of data object A. For example, Figure 4 As shown, the first 4 bytes of the lock status information (the first 32 bits of the lock status information, including the exclusive true field and the exclusive ticket field) represent the exclusive lock identifier, and the last 4 bytes (the last 32 bits of the lock status information, including the shared count field) represent the shared lock identifier.
[0143] The following is an explanation of each field of the lock status information.
[0144] The exclusive true field is used to store the client count currently obtaining the exclusive lock, which can also be understood as the current count. When the client holding the exclusive lock releases the lock, the programmable network card 122 in the server 120 can add 1 to the true field. As an example, the initial value of the exclusive true field can be 0.
[0145] The exclusive ticket field is used to store the total number of clients currently occupying the exclusive lock, which can also be understood as a global count. If the client 110 wants to obtain the exclusive lock through the atomic operation fetch_and_add, the programmable network card 122 in the server 120 can add 1 to the ticket field and return the old value (the value of the field before the ticket field is added by 1) as the count turn of the client 110. As an example, the initial value of the exclusive ticket field can be 0.
[0146] The shared count field is used to seize the shared lock. If the client 110 wants to obtain the shared lock through the atomic operation fetch_and_add, the programmable network card 122 in the server 120 can add 1 to the shared count field. If the client 110 wants to release the shared lock through the atomic operation fetch_and_add, the programmable network card 122 in the server 120 can subtract 1 from the shared count field. As an example, the initial value of the shared counte field can be 0.
[0147] In the above technical solution, the lock status information can be cached in the memory of the programmable network card of the server. When the client accesses the shared data object, the programmable network card of the server first searches for the lock status information of the object in the memory of the programmable network card according to its virtual address, thereby avoiding the programmable network card from obtaining the lock status information of the object from the memory of the server processor, thereby reducing the overhead of PCIe DMA communication between the server programmable network card and the server processor.
[0148] Step 330 : The programmable network card 122 in the server 120 returns the lock status information of the data object A to the client 110 .
[0149] After searching the lock status information of the data object A from the memory of the programmable network card 122 , the programmable network card 122 in the server 120 may return the lock status information of the data object A to the client 110 .
[0150] In a possible implementation, if the type of lock for data object A requested by client 110 from server 120 is an exclusive lock, the programmable network card 122 in server 120 can Figure 3 The lock state information of the data object A shown in the figure is operated, for example, the exclusive ticket field is incremented by 1, and the old value (the value of the field before the exclusive ticket field is incremented by 1) is returned to the client 110. That is, the programmable network card 122 returns to the client 110 the values of each field before the lock state information of the data object A is operated.
[0151] It should be noted that, in the implementation method in which the client 110 applies for an exclusive lock, if Figure 3 In the lock status information of data object A, the values of the exclusive ticket field and the exclusive time field are equal, and the value of the field identifying the shared lock (shared count field) is 0, which means that the exclusive lock of data object A has not been seized by other clients, and no other clients have applied for the shared lock of data object A. At this time, client 110 can successfully obtain the exclusive lock. Figure 3 If the values of the exclusive ticket field and the exclusive time field in the lock status information of the data object A shown are not equal, it means that the exclusive lock of the data object A is preempted by other clients, and it is necessary to wait for other clients to release the exclusive lock of the data object A, that is, after the values of the exclusive ticket field and the exclusive time field in the lock status information are equal, the client 110 can successfully obtain the exclusive lock.
[0152] Optionally, if the client 110 fails to acquire the exclusive lock, the programmable network card 122 may also send an acquisition failure message to the client 110 .
[0153] In another possible implementation, if the type of the lock for the data object A requested by the client 110 to the server 120 is a shared lock, the programmable network card 122 in the server 120 may Figure 3 The lock status information of the data object A shown in FIG. 1 is operated, for example, the shared count field is incremented by 1. Figure 3 The values of various fields of the lock status information of the data object A after the operation are shown are returned to the client 110 .
[0154] It should be noted that, in the implementation method in which the client 110 applies for a shared lock, if Figure 3If the values of the exclusive ticket field and the exclusive time field in the lock status information of data object A are equal, it means that the exclusive lock of data object A has not been preempted by other clients, and client 110 can successfully obtain the shared lock. Figure 3 If the values of the exclusive ticket field and the exclusive time field in the lock status information of the data object A are not equal, it means that the exclusive lock of the data object A is preempted by other clients. It is necessary to wait for other clients to release the exclusive lock of the data object A, that is, after the values of the exclusive ticket field and the exclusive time field in the lock status information are equal, the client 110 can successfully acquire the shared lock.
[0155] Optionally, if the client 110 fails to acquire the shared lock, the programmable network card 122 may also send an acquisition failure message to the client 110 .
[0156] In the above technical solution, part of the concurrency control logic of the data objects can be unloaded to the programmable network card 122 of the server 120. The programmable network card 122 can be used to implement a concurrency control mechanism with zero participation of the processor 121 of the server 120, thereby multiplying the concurrent node scale of the overall system and reducing end-to-end delay jitter.
[0157] Step 340: The client 110 determines whether it can acquire the lock based on the lock status information of the data object A.
[0158] As an example, in the embodiment of the present application, after receiving the lock status information of the data object A sent by the programmable network card 122, the client 110 can directly cache it in the memory of the programmable network card 112 of the client 110. In this way, if the client 110 wants to determine whether the data object A is locked, it does not need to check from the server 120 through the network, but can directly check the lock status information of the data object A from the local programmable network card 112 of the client 110 to determine whether the data object A is locked. When the client programmable network card 112 finds that the object accessed by the user is locked, it directly returns a failure message, thereby reducing the network communication overhead between the client 110 and the server 120.
[0159] The client 110 may obtain the lock status information of the data object A from the programmable network card 112, and determine whether it can obtain the corresponding lock according to the lock status information of the data object A. Several possible implementations are described in detail below.
[0160] In one possible implementation, if the client 110 applies for an exclusive lock of data object A, after the client 110 obtains the lock status information of data object A from the programmable network card 112, the value of the exclusiveticket field in the lock status information of data object A can be used as the client's own count turn.
[0161] For example, if the client's own count turn is the same as the value of the exclusivetime field in the lock status information of data object A, it can be understood that the exclusive lock of data object A has not been preempted by other clients, and the value of the field identifying the shared lock (shared count field) is 0, which means that the exclusive lock of data object A has not been preempted by other clients, and no other client has applied for the shared lock of data object A. At this time, client 110 can successfully obtain the exclusive lock of data object A. That is, if the value of the exclusive ticket field in the lock status information of data object A is the same as the value of the exclusivetime field, and the value of the shared count field is 0, client 110 can successfully obtain the exclusive lock of data object A.
[0162] In another example, if the count turn is different from the value of the exclusive time field in the lock status information of data object A, it can be understood that the exclusive lock of data object A is seized by other clients, and client 110 cannot successfully obtain the exclusive lock of data object A. In other words, if the value of the exclusive ticket field in the lock status information of data object A is different from the value of the exclusive time field, client 110 cannot successfully obtain the exclusive lock of data object A. Client 110 needs to wait for other clients to release the exclusive lock of data object A, and the value of the exclusive ticket field in the lock status information of data object A returned to client 110 by programmable network card 122 is the same as the value of the exclusive time field, and the value of the shared count field is 0. At this time, client 110 can successfully obtain the exclusive lock of data object A.
[0163] Optionally, in some embodiments, as an example, when the client 110 fails to acquire the lock, in order to reduce the PCIe DMA communication overhead between the client processor 111 and the local programmable network card 112, a binary exponential backoff algorithm can be used to appropriately delay the acquisition of the lock.
[0164] In another possible implementation, if the client 110 applies for a shared lock of data object A, after the client 110 obtains the lock status information of data object A from the programmable network card 112, it can determine whether the client 110 can obtain the shared lock based on whether the value of the exclusive ticket field and the value of the exclusive time field in the lock status information of data object A are the same.
[0165] For example, if the values of the exclusive ticket field and the exclusive time field in the lock status information of data object A are equal, it means that the exclusive lock of data object A has not been preempted by other clients, and the client 110 can successfully obtain the shared lock.
[0166] In another example, if the values of the exclusive ticket field and the exclusive time field in the lock status information of data object A are not equal, it means that the exclusive lock of data object A is preempted by other clients. The client 110 can successfully acquire the shared lock only after the exclusive lock of data object A is released by other clients, that is, after the values of the exclusive ticket field and the exclusive time field in the lock status information are equal.
[0167] Optionally, in some embodiments, if the lock status information of the data object A stored in the programmable network card 122 of the server 120 is updated or changed, the programmable network card 112 of the client 110 may also update the lock status information of the data object A stored therein. In this way, when the client 110 fails to obtain the lock of the data object A and wants to obtain the lock status information of the data object A again, it does not need to check the updated lock status information from the server 120 through the network to see whether it can obtain the lock of the data object A, thereby further reducing the network communication overhead between the client 110 and the server 120.
[0168] There are many ways to implement the above-mentioned update of the lock status information of the data object A stored in the programmable network card 112, which is not specifically limited in the embodiments of the present application. In one example, the programmable network card 122 of the server 120 can directly send the updated lock status information of the data object A to the client 110, and the programmable network card 112 of the client 110 stores it. In another possible implementation, the programmable network card 122 of the server 120 communicates with the corresponding client through a broadcast mechanism to update the lock status information of the data object A, and the client 110 can update the lock status information of the data object A stored in the programmable network card 112 according to the broadcast notification.
[0169] Step 350: After the client 110 obtains the lock of the data object A, it can perform read and write operations on the data object A.
[0170] In a possible implementation, if the client 110 obtains an exclusive lock of the data object A, the client 110 can perform both a read operation and a write operation on the data object A stored in the processor of the server.
[0171] In another possible implementation, if the client 110 acquires a shared lock of the data object A, the client 110 can read the data object A stored in the processor of the server, but cannot modify the data object A.
[0172] It should be understood that the above Figure 2 The method shown describes the pessimistic locking strategy (also called blocking strategy) adopted by the client 110. That is, during the entire data processing process, the data is locked and the data is locked by relying on the locking mechanism provided by the database to ensure the maximum exclusivity of the operation, thereby ensuring the exclusivity of data access.
[0173] Optionally, in some embodiments, compared to the pessimistic locking strategy, for low concurrency scenarios (scenarios with less data competition on the server side), in order to save the large performance overhead caused by the database lock mechanism, an optimistic locking strategy (also called CAS strategy) can also be adopted. That is, during the entire data processing process, the data is not locked by relying on the lock mechanism provided by the database, but is implemented based on the data version recording mechanism. The implementation of the CAS strategy is described in detail below.
[0174] Taking the CAS strategy as an example, the client calls the atomic operation compare_and_swap to send a remote data read and write request to the server, which may include the expected value and the value to be modified. The programmable network card on the server compares the expected value with the target value stored in the server's processor to see if they are consistent. If the expected value is consistent with the target value stored in the server's processor, the programmable network card on the server can modify the target value and write the value to be modified included in the request to the memory in the server's processor, that is, overwrite the target value with the value to be modified, and the data modification is successful. If the expected value is inconsistent with the target value stored in the server's processor, the data modification fails.
[0175] In the embodiment of the present application, the client can predict the data competition situation of the server (whether the data competition is fierce), thereby assisting the client to dynamically adjust the concurrency control strategy (for example, pessimistic locking strategy, optimistic locking strategy, etc.) to maximize the benefits of the entire system. Figure 1 Take the scenario shown in the figure as an example, combined with Figure 5This implementation is described in detail.
[0176] Figure 5 It is a schematic flowchart of a method for client prediction concurrency control strategy provided by an embodiment of the present application. The method may include steps 510-520, and steps 510-520 are described in detail below.
[0177] Step 510 : The client 110 trains a model according to the lock status information of the data object stored in the programmable network card 112 .
[0178] In the embodiment of the present application, the client 110 can obtain the lock state information (also referred to as history) of the stored multiple data objects from the programmable network card 112, and use the lock state information of the multiple data objects as the input information of the model. The output information of the model includes the selected concurrency control strategy (for example, pessimistic lock strategy, or optimistic lock strategy, etc.). That is, the client 110 can predict the corresponding concurrency control strategy based on the lock state information of the data object.
[0179] For example, taking the exclusive ticket field and the exclusive time field in the lock status information as an example, the exclusive time field indicates the hunger level of the current client, and the exclusive ticket field indicates the number of clients accessing the data object. Therefore, the lock status information of the data object can characterize the data competition situation on the server side. In one example, if the data competition on the server side is fierce, the failure probability of the optimistic lock strategy is high, so the pessimistic lock strategy can be selected. In another example, if the data competition on the server side is fierce, the failure probability of the optimistic lock strategy is low, so the optimistic lock strategy can be selected, thereby saving the large performance overhead brought by the database's lock mechanism.
[0180] In the embodiment of the present application, as the amount of interactive data between the client 110 and the server 120 increases, more input information can be obtained and the model can be continuously updated, thereby improving the accuracy of the model prediction.
[0181] Step 520: The client 110 performs inference and prediction based on the model to determine the corresponding concurrency control strategy.
[0182] After training the model, the client 110 can obtain the lock state information of the stored data object A from the programmable network card 112. The lock state information of the data object A is used as the input information of the model, and the output information of the model is the predicted corresponding concurrency control strategy (for example, pessimistic lock strategy, or optimistic lock strategy, etc.).
[0183] It should be noted that the embodiments of the present application specifically define the above model. In a possible implementation, the model is a light gradient boosting machine (light GBM).
[0184] Combination of the above Figures 1 to 5 , describes in detail the method for obtaining a lock on a data object provided by an embodiment of the present application, and will now be combined with Figure 6-Figure 8 , describes in detail the embodiment of the device of the present application. It should be understood that the description of the method embodiment corresponds to the description of the device embodiment, so the parts not described in detail can refer to the previous method embodiment.
[0185] Figure 6 600 is a schematic block diagram of a network card 600 provided in an embodiment of the present application. The network card 600 can be implemented by software, hardware, or a combination of both. The network card 600 provided in an embodiment of the present application can implement the embodiment of the present application. Figure 1 In the method flow shown, the network card 600 includes: a receiving circuit 610 and a control circuit 620, wherein the receiving circuit 610 is used to receive a lock request message sent by a first client through the network card in the server, and the lock request message is used to request to lock a first data object, and the first data object is data stored in a distributed shared memory DSM of a processor in the server, and the network card and the processor communicate; the control circuit 620 is used to respond to the lock request message according to lock status information corresponding to at least part of the data objects in the DSM cached by the network card, and feedback first lock status information corresponding to the first data object to the first client, and the first lock status information is used to indicate the locking status of the first data object by multiple clients, and the multiple clients include the first client.
[0186] Optionally, when the network card cache has the first lock state information, the control circuit 620 is specifically configured to: obtain the first lock state information from the cache of the network card; and feed back the first lock state information to the first client.
[0187] Optionally, when the network card does not cache the first lock state information, the control circuit 620 is specifically used to: obtain the first lock state information from the DSM of the processor through the network card, and the DSM of the processor stores the first lock state information; and feed back the first lock state information to the first client.
[0188] Optionally, the lock request message includes the virtual address of the first data object, and the control circuit 620 is specifically used to: query the lock status information corresponding to at least part of the data objects in the DSM of the processor in the network card cache according to the virtual address of the first data object, and obtain the lock status information of the first data object.
[0189] Optionally, the lock request message includes the lock type that the first client requests to lock the first data object, and the lock type includes an exclusive lock and a shared lock. The control circuit 620 is also used to update the lock status information of the first data object cached by the network card according to the lock type that the first client requests to lock the first data object.
[0190] Optionally, the lock status information of the first data object includes a first field, a second field and a third field, wherein the first field indicates the number of clients that currently obtain the exclusive lock of the first data object, the second field indicates the number of clients that apply for the exclusive lock of the first data object, and the third field indicates the number of clients that apply for the shared lock of the first data object.
[0191] Optionally, the first client requests an exclusive lock as the lock type to lock the first data object, and the control circuit 620 is specifically used to: update the value of the second field in the lock status information of the first data object according to the exclusive lock as the lock type requested by the first client to lock the first data object.
[0192] Optionally, the network card also includes: a transmitting circuit 630, which is used to send a success message to the first client if the updated value of the second field in the lock status information of the first data object is the same as the value of the first field, and the success message is used to indicate that the first client has successfully acquired the exclusive lock of the first data object; or the transmitting circuit is also used to send a failure message to the first client if the updated value of the second field in the lock status information of the first data object is not the same as the value of the first field, and the failure message is used to indicate that the first client has failed to acquire the exclusive lock of the first data object.
[0193] Optionally, the lock type requested by the first client to lock the first data object is a shared lock, and the control circuit 620 is specifically used to: update the value of the third field in the lock status information of the first data object according to the lock type requested by the first client to lock the first data object being the shared lock.
[0194] Optionally, if the lock state information of the first data object cached by the first network card is updated, the transmitting circuit 630 is further used to send a notification message to the first client, where the notification message is used to instruct the first client to update the received lock state information of the first data object.
[0195] Figure 7 700 is a schematic block diagram of a network card 700 provided in an embodiment of the present application. The network card 700 can be implemented by software, hardware, or a combination of both. The network card 700 provided in an embodiment of the present application can implement the embodiment of the present application. Figure 2According to the method flow shown, the network card 700 includes: a receiving circuit 710, used to receive lock status information of a first data object sent by a server, the first data object being any storage object in a distributed shared memory DSM of a processor of the server, and the lock status information of the first data object being used to indicate a locking status of the first data object by multiple clients; and a control circuit 720, used to store the lock status information of the first data object in a cache of the network card.
[0196] Optionally, the network card 700 further includes: a transmitting circuit 730, configured to send a lock request message to the server, wherein the lock request message is used to request the server to obtain lock status information of the first data object.
[0197] Optionally, the lock request message carries the virtual address of the first data object and / or the lock type to be locked on the first data object.
[0198] Optionally, the lock status information of the first data object includes a first field, a second field and a third field, the first field indicating the number of clients that currently obtain the exclusive lock of the first data object, the second field indicating the number of clients that apply for the exclusive lock of the first data object, and the third field indicating the number of clients that apply for the shared lock of the first data object.
[0199] Optionally, the receiving circuit 710 is also used to receive a notification message sent by the server, wherein the notification message is used to indicate that the lock status information of the received first data object is updated; the control circuit is also used to update the lock status information of the first data object stored in the network card according to the notification message.
[0200] The modules of each example described in the embodiments of the present application can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0201] In addition, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation processes are detailed in the method embodiments above, which will not be repeated here.
[0202] The method provided in the embodiment of the present application can be performed by a computing device, which can also be referred to as a computer system. It includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a processing unit, a memory and a memory control unit, and then the function and structure of the hardware are described in detail. The operating system is any one or more computer operating systems that implement business processing through a process, for example, a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a windows operating system. The application layer includes applications such as a browser, an address book, a word processing software, and an instant messaging software. In addition, optionally, the computer system is a handheld device such as a smart phone, or a terminal device such as a personal computer, and the present application is not particularly limited, as long as the method provided by the embodiment of the present application can be used. The execution subject of the method provided in the embodiment of the present application can be a computing device, or a functional module in a computing device that can call a program and execute a program.
[0203] Combine the following Figure 8 , a computing device provided in an embodiment of the present application is described in detail.
[0204] Figure 8 1 is a schematic diagram of the architecture of a computing device 1500 provided in an embodiment of the present application. The computing device 1500 may be a server or a computer or other device with computing capabilities. Figure 8 The computing device 1500 shown includes at least one processor 1510 and a memory 1520 .
[0205] It should be understood that the present application does not limit the number of processors and memories in the computing device 1500 .
[0206] The processor 1510 executes the instructions in the memory 1520, so that the computing device 1500 implements the method provided by the present application. Alternatively, the processor 1510 executes the instructions in the memory 1520, so that the computing device 1500 implements the functional modules provided by the present application, thereby implementing the method provided by the present application.
[0207] Optionally, the computing device 1500 further includes a communication interface 1530. The communication interface 1530 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1500 and other devices or a communication network.
[0208] Optionally, the computing device 1500 further includes a system bus 1540, wherein the processor 1510, the memory 1520, and the communication interface 1530 are respectively connected to the system bus 1540. The processor 1510 can access the memory 1520 through the system bus 1540. For example, the processor 1510 can read and write data or execute code in the memory 1520 through the system bus 1540. The system bus 1540 is a peripheral component interconnect express (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus 1540 is divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0209] In a possible implementation, the function of the processor 1510 is mainly to interpret the instructions (or codes) of the computer program and process the data in the computer software. The instructions of the computer program and the data in the computer software can be stored in the memory 1520 or the cache 1516.
[0210] Optionally, the processor 1510 may be an integrated circuit chip with signal processing capabilities. As an example and not a limitation, the processor 1510 is a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Among them, the general-purpose processor is a microprocessor, etc. For example, the processor 1510 is a central processing unit (CPU).
[0211] Optionally, each processor 1510 includes at least one processing unit 1512 and a memory control unit 1514 .
[0212] Optionally, the processing unit 1512 is also called a core or kernel, which is the most important component of the processor. The processing unit 1512 is manufactured from single crystal silicon using a certain production process, and all calculations, command reception, command storage, and data processing of the processor are performed by the core. The processing units run program instructions independently and use the ability of parallel computing to speed up the running speed of the program. Various processing units have a fixed logical structure. For example, the processing unit includes logical units such as a first-level cache, a second-level cache, an execution unit, an instruction-level unit, and a bus interface.
[0213] In one implementation example, the memory control unit 1514 is used to control data interaction between the memory 1520 and the processing unit 1512. Specifically, the memory control unit 1514 receives a memory access request from the processing unit 1512, and controls access to the memory based on the memory access request. As an example and not a limitation, the memory control unit is a device such as a memory management unit (MMU).
[0214] In one implementation example, each memory control unit 1514 addresses the memory 1520 through the system bus. And an arbiter ( Figure 8 ), which is responsible for handling and coordinating competing accesses of multiple processing units 1512.
[0215] In an implementation example, the processing unit 1512 and the memory control unit 1514 are connected to each other through connection lines inside the chip, such as address lines, so as to achieve communication between the processing unit 1512 and the memory control unit 1514.
[0216] Optionally, each processor 1510 also includes a cache 1516, wherein the cache is a buffer for data exchange (called cache). When the processing unit 1512 wants to read data, it will first search for the required data from the cache. If it is found, it will be executed directly. If it is not found, it will be searched from the memory. Since the running speed of the cache is much faster than the memory, the role of the cache is to help the processing unit 1512 run faster.
[0217] The memory 1520 can provide a running space for the processes in the computing device 1500. For example, the computer program (specifically, the program code) used to generate the process is stored in the memory 1520. After the computer program is executed by the processor to generate the process, the processor allocates a corresponding storage space for the process in the memory 1520. Furthermore, the above storage space further includes a text segment, an initialized data segment, a bit initialized data segment, a stack segment, a heap segment, etc. The memory 1520 stores the data generated during the running of the process in the storage space corresponding to the above process, such as intermediate data, process data, etc.
[0218] Optionally, the storage is also called memory, and its function is to temporarily store the operation data in the processor 1510 and the data exchanged with the external storage such as the hard disk. As long as the computer is running, the processor 1510 will transfer the data to be calculated to the memory for calculation, and when the calculation is completed, the processing unit 1512 will transmit the result.
[0219] As an example and not limitation, memory 1520 is a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory is a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory is a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DRRAM). It should be noted that the memory 1520 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0220] The structure of the computing device 1500 listed above is only an example, and the present application is not limited thereto. The computing device 1500 of the embodiment of the present application includes various hardware in the computer system in the prior art. For example, the computing device 1500 also includes other memories besides the memory 1520, such as disk storage, etc. Those skilled in the art should understand that the computing device 1500 may also include other devices necessary for normal operation. At the same time, according to specific needs, those skilled in the art should understand that the above-mentioned computing device 1500 may also include hardware devices for implementing other additional functions. In addition, those skilled in the art should understand that the above-mentioned computing device 1500 may also include only the devices necessary to implement the embodiment of the present application, and does not necessarily include Figure 8 All devices shown in .
[0221] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device may be a server. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0222] In this embodiment, a computer program product including instructions is also provided, and the computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on a computing device, the computing device executes the method provided above and performed by the first network card.
[0223] In this embodiment, a computer program product including instructions is also provided, and the computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on a computing device, the computing device executes the method provided above and performed by the second network card.
[0224] In this embodiment, a computer-readable storage medium is also provided, and the computer-readable storage medium may be any available medium that can be stored by a computing device or a data storage device such as a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc. The computer-readable storage medium includes instructions, and when the instructions in the computer-readable storage medium are executed on the computing device, the computing device executes the method provided above and performed by the first network card.
[0225] In this embodiment, a computer-readable storage medium is also provided, and the computer-readable storage medium can be any available medium that can be stored by the computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state hard disk), etc. The computer-readable storage medium includes instructions, and when the instructions in the computer-readable storage medium are executed on the computing device, the computing device executes the method provided above and performed by the second network card.
[0226] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0227] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0228] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0229] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0230] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0231] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0232] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.
[0233] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for acquiring a lock on a data object, characterized in that: The method comprises: Receiving, through a network card in a server, a lock request message sent by a first client, wherein the lock request message is used to request locking of a first data object, wherein the first data object is data stored in a distributed shared memory DSM of a processor in the server, and the processor communicates with the network card; According to the lock status information corresponding to at least part of the data objects in the DSM cached by the network card, in response to the lock request message, first lock status information corresponding to the first data object is fed back to the first client, wherein the first lock status information is used to indicate the locking status of the first data object by multiple clients, and the multiple clients include the first client.
2. The method according to claim 1, characterized in that In the case that the network card caches the first lock state information, responding to the lock request message and feeding back the first lock state information corresponding to the first data object to the first client includes: Acquire the first lock state information from the cache of the network card; Feedback the first lock status information to the first client.
3. The method according to claim 1, characterized in that In the case that the network card does not cache the first lock state information, responding to the lock request message and feeding back the first lock state information corresponding to the first data object to the first client includes: acquiring the first lock state information from the DSM of the processor through the network card, wherein the DSM stores the first lock state information; Feedback the first lock status information to the first client.
4. The method according to claim 2 or 3, characterized in that: The lock request message includes a virtual address of the first data object, The acquiring the first lock state information from the cache of the network card includes: According to the virtual address of the first data object, the lock state information corresponding to at least part of the data objects in the DSM of the processor and cached by the network card is queried to obtain the lock state information of the first data object.
5. The method according to any one of claims 1 to 4, characterized in that The lock request message includes a lock type requested by the first client to lock the first data object, and the lock type includes an exclusive lock and a shared lock. The method further includes: The lock state information of the first data object cached by the network card is updated according to the lock type requested by the first client to lock the first data object.
6. The method according to claim 5, characterized in that The lock status information of the first data object includes a first field, a second field and a third field, wherein the first field indicates the number of clients that currently obtain the exclusive lock of the first data object, the second field indicates the number of clients that apply for the exclusive lock of the first data object, and the third field indicates the number of clients that apply for the shared lock of the first data object.
7. The method according to claim 6, characterized in that The lock type requested by the first client to lock the first data object is an exclusive lock, The updating of the lock state information of the first data object cached by the first network card according to the lock type requested by the first client to lock the first data object includes: According to the lock type requested by the first client to lock the first data object being the exclusive lock, the value of the second field in the lock state information of the first data object is updated.
8. The method according to claim 7, characterized in that The method further comprises: If the value of the second field in the lock state information of the first data object before being updated is the same as the value of the first field, sending a success message to the first client, where the success message is used to indicate that the first client has successfully acquired an exclusive lock for the first data object; or If the value of the second field before update in the lock status information of the first data object is different from the value of the first field, a failure message is sent to the first client, where the failure message is used to indicate that the first client failed to obtain the exclusive lock of the first data object.
9. The method according to claim 6, characterized in that The lock type requested by the first client to lock the first data object is a shared lock, The updating of the lock state information of the first data object cached by the first network card according to the lock type requested by the first client to lock the first data object includes: According to the lock type requested by the first client to lock the first data object being the shared lock, the value of the third field in the lock state information of the first data object is updated.
10. The method according to any one of claims 1 to 9, characterized in that If the lock state information of the first data object cached by the first network card is updated, the method further includes: A notification message is sent to the first client, where the notification message is used to instruct the first client to update the received lock status information of the first data object.
11. A method for acquiring a lock on a data object, characterized in that: include: The first client sends a lock request message to the network card in the server, wherein the lock request message is used to request to lock a first data object, wherein the first data object is data stored in a distributed shared memory DSM of a processor in the server, and the processor communicates with the network card; The server responds to the lock request message according to the lock status information corresponding to at least part of the data objects in the DSM cached by the network card, and feeds back first lock status information corresponding to the first data object to the first client, wherein the first lock status information is used to indicate the locking status of the first data object by multiple clients, and the multiple clients include the first client; The first client determines whether the first data object is locked successfully according to the first lock status information.
12. The method according to claim 11, characterized in that In the case that the network card cache has the first lock state information, the server responds to the lock request message according to the lock state information corresponding to at least part of the data objects in the DSM cached by the network card, including: The server obtains the first lock status information from the cache of the network card; The server feeds back the first lock status information to the first client.
13. The method according to claim 11, characterized in that In the case that the network card does not cache the first lock state information, the server responds to the lock request message according to the lock state information corresponding to at least part of the data objects in the DSM cached by the network card, including: The server obtains the first lock state information from the DSM of the processor through the network card, and the DSM stores the first lock state information; The server feeds back the first lock status information to the first client.
14. The method according to claim 12 or 13, characterized in that The lock request message includes a virtual address of the first data object, The server obtains the first lock status information from the cache of the network card, including: The server queries the lock status information corresponding to at least some data objects in the DSM of the processor in the network card cache of the server according to the virtual address of the first data object, and obtains the lock status information of the first data object.
15. The method according to any one of claims 11 to 14, characterized in that The lock request message includes a lock type requested by the first client to lock the first data object, and the lock type includes an exclusive lock and a shared lock. The method further includes: The server updates the lock state information of the first data object cached by the network card through the network card according to the lock type requested by the first client to lock the first data object.
16. The method according to claim 15, characterized in that The lock status information of the first data object includes a first field, a second field and a third field, wherein the first field indicates the number of clients that currently obtain the exclusive lock of the first data object, the second field indicates the number of clients that apply for the exclusive lock of the first data object, and the third field indicates the number of clients that apply for the shared lock of the first data object.
17. The method according to claim 16, characterized in that The lock type requested by the first client to lock the first data object is an exclusive lock, The first client determines whether the first data object is successfully locked according to the first lock state information, including: The first client determines that the exclusive lock of the first data object is successfully acquired based on the fact that the value of the second field in the lock state information of the first data object is the same as the value of the first field; or The first client determines that acquisition of the exclusive lock of the first data object fails based on the fact that a value of the second field and a value of the first field in the lock state information of the first data object are different.
18. The method according to claim 16, characterized in that The lock type requested by the first client to lock the first data object is an exclusive lock, The server updates the lock state information of the first data object cached by the first network card through the network card according to the lock type requested by the first client to lock the first data object, including: The server, according to the lock type requested by the first client to lock the first data object is the exclusive lock, updates the value of the second field in the lock state information of the first data object through the network card.
19. The method according to claim 16, characterized in that The lock type requested by the first client to lock the first data object is a shared lock, The server updates the lock state information of the first data object cached by the first network card through the network card according to the lock type requested by the first client to lock the first data object, including: The server, according to the lock type requested by the first client to lock the first data object is the shared lock, updates the value of the third field in the lock state information of the first data object through the network card.
20. The method according to any one of claims 11 to 19, characterized in that The method further comprises: The server sends a success message to the first client through the network card according to the fact that the value of the second field before update in the lock state information of the first data object is the same as the value of the first field, wherein the success message is used to indicate that the first client has successfully acquired the exclusive lock of the first data object; or The server sends a failure message to the first client through the network card based on the fact that the value of the second field before update in the lock status information of the first data object is different from the value of the first field, wherein the failure message is used to indicate that the first client has failed to obtain an exclusive lock for the first data object.
21. The method according to any one of claims 11 to 20, characterized in that If the lock state information of the first data object cached by the network card of the server is updated, the method further includes: The server sends a notification message to the first client through the network card, where the notification message is used to instruct the first client to update the received lock status information of the first data object.
22. A network card, characterized in that: The network card comprises: A receiving circuit, used for receiving a lock request message sent by a first client through a network card in a server, wherein the lock request message is used for requesting to lock a first data object, wherein the first data object is data stored in a distributed shared memory DSM of a processor in the server, and the processor communicates with the network card; A control circuit is used to respond to the lock request message based on the lock status information corresponding to at least part of the data objects in the DSM cached by the network card, and feedback the first lock status information corresponding to the first data object to the first client, wherein the first lock status information is used to indicate the locking status of the first data object by multiple clients, and the multiple clients include the first client.
23. The network card according to claim 22, characterized in that: In the case where the network card caches the first lock state information, the control circuit is specifically used to: Acquire the first lock state information from the cache of the network card; Feedback the first lock status information to the first client.
24. The network card according to claim 22, characterized in that: In the case that the network card does not cache the first lock state information, the control circuit is specifically used to: Acquire the first lock state information from the DSM of the processor through the network card, wherein the DSM of the processor stores the first lock state information; Feedback the first lock status information to the first client.
25. The network card according to claim 23 or 24, characterized in that: The lock request message includes the virtual address of the first data object, The control circuit is specifically used to query the lock status information corresponding to at least part of the data objects in the DSM of the processor in the network card cache according to the virtual address of the first data object, and obtain the lock status information of the first data object.
26. The network card according to any one of claims 22 to 25, characterized in that: The lock request message includes the lock type that the first client requests to lock the first data object, and the lock type includes an exclusive lock and a shared lock. The control circuit is further configured to update the lock state information of the first data object cached by the network card according to the lock type requested by the first client to lock the first data object.
27. The network card according to claim 26, characterized in that: The lock status information of the first data object includes a first field, a second field and a third field, wherein the first field indicates the number of clients that currently obtain the exclusive lock of the first data object, the second field indicates the number of clients that apply for the exclusive lock of the first data object, and the third field indicates the number of clients that apply for the shared lock of the first data object.
28. The network card according to claim 27, characterized in that: The first client requests an exclusive lock of a lock type to lock the first data object, The control circuit is specifically configured to update the value of the second field in the lock state information of the first data object according to the type of the lock requested by the first client to lock the first data object being the exclusive lock.
29. The network card according to claim 28, characterized in that: The network card also includes: a transmitting circuit, configured to send a success message to the first client if the updated value of the second field in the lock state information of the first data object is the same as the value of the first field, wherein the success message is used to indicate that the first client has successfully acquired the exclusive lock of the first data object; or The transmitting circuit is also used to send a failure message to the first client if the updated value of the second field in the lock status information of the first data object is different from the value of the first field, and the failure message is used to indicate that the first client failed to obtain the exclusive lock of the first data object.
30. The network card according to claim 27, characterized in that: The lock type requested by the first client to lock the first data object is a shared lock, The control circuit is specifically configured to update the value of the third field in the lock state information of the first data object according to the type of the lock requested by the first client to lock the first data object being the shared lock.
31. The network card according to any one of claims 22 to 30, characterized in that: If the lock status information of the first data object cached by the first network card is updated, The transmitting circuit is further used to send a notification message to the first client, where the notification message is used to instruct the first client to update the received lock status information of the first data object.
32. A system for acquiring a lock on a data object, characterized in that: It comprises a first client and a server, wherein the server comprises a processor and the network card as described in any one of claims 22 to 31, and the network card and the processor communicate with each other. The first client is used to send a lock request message to the network card in the server, wherein the lock request message is used to request to lock a first data object, and the first data object is data stored in the distributed shared memory DSM of the processor in the server; The server is configured to respond to the lock request message according to the lock status information corresponding to at least part of the data objects in the DSM cached by the network card, and to feed back first lock status information corresponding to the first data object to the first client, wherein the first lock status information is used to indicate the locking status of the first data object by multiple clients, and the multiple clients include the first client; The first client is further used to determine whether the first data object is locked successfully according to the first lock state information.
33. A computing device, characterized in that The computer comprises a processor and a memory, wherein the processor is configured to execute instructions stored in the memory so that the computing device executes the method according to any one of claims 1 to 10.
34. A computing device, characterized in that The device comprises a processor and a memory, wherein the processor is configured to execute instructions stored in the memory so that the computing device performs the method according to any one of claims 11 to 21.
35. A device, characterized in that Comprising the network card as claimed in any one of claims 22 to 31.
