Method for acquiring lock of data object, network interface card, and computing device

By caching the lock status information of data objects on the network card and offloading the 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 the system performance and concurrency capabilities are improved.

WO2024183678A1PCT designated stage expired Publication Date: 2024-09-12HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/079825
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-07
Filing Date
2024-03-04
Publication Date
2024-09-12

AI Technical Summary

Technical Problem

In a distributed shared memory (DSM) system, the communication overhead between the server's processor and the network card is large, leading to system performance bottlenecks.

Method used

By caching the lock status information of the data object on the network card, it avoids obtaining the lock status information from the processor memory, thereby reducing the communication overhead between the network card and the processor, and offloading the concurrency control logic to the network card to achieve zero participation of the processor. concurrency control mechanism.

Benefits of technology

It significantly reduces the communication overhead between the server's processor and network card, increases the system's concurrent node scale, and reduces end-to-end delay jitter.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024079825_12092024_PF_FP_ABST
    Figure CN2024079825_12092024_PF_FP_ABST
Patent Text Reader

Abstract

A method for acquiring a lock of a data object, a network interface card, and a computing device. The method comprises: receiving, by means of a network interface card in a server, a lock request message sent by a first client; and according to lock state information cached by the network interface card and corresponding to at least some of data objects in a DSM and in response to the lock request message, feeding first lock state information corresponding to a first data object back to the first client, wherein the lock request message is used for requesting to lock the first data object, the first data object is data stored in the DSM of a processor of the server, the lock state information of the first data object is used for indicating the locking of the first data object by multiple clients, and the multiple clients comprise the first client. The method can reduce the communication overhead between a network interface card and a processor of a server.
Need to check novelty before this filing date? Find Prior Art

Description

Method for acquiring lock of data object, network card and computing device

[0001] This application claims priority to Chinese patent application number 202310245128.3 filed on March 7, 2023, entitled “Method, network card and computing device for obtaining a lock for a data object”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of storage, and more particularly, to a method for acquiring a lock on a data object, a network card, and a computing device. Background Art

[0003] 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. In other words, it provides a logically unified address space that any processor can directly read and write to.

[0004] To address concurrent access to shared memory, DSM uses a pessimistic locking strategy to lock the data in shared memory. In related technical solutions, the client acquires the lock by sending a request via RDMA. The server's programmable network interface card then uses peripheral component interface express (PCIe) DMA to access the memory in the server's processor. Consequently, the communication overhead between the server's processor and the network card is high.

[0005] Therefore, how to reduce the communication overhead between the server-side processor and the network card has become a technical problem that needs to be solved urgently.

[0006] Summary of the Invention

[0007] The present application provides a method for acquiring a lock on a data object, a network card, and a computing device. The method can reduce the communication overhead between the network card and the processor of a server.

[0008] In a first aspect, a method for acquiring a lock for 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 the first data object by multiple clients, the multiple clients including the first client.

[0009] 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 obtaining the lock status information of the object from the processor memory, thereby reducing the communication overhead between the network card and the processor.

[0010] In combination with the first aspect, in some implementations of the first aspect, when the network card cache has the first lock status information, the first lock status information is obtained from the cache of the network card; and the first lock status information is fed back to the first client.

[0011] 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.

[0012] 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. Based on the virtual address of the first data object, the lock status information corresponding to at least part of the 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.

[0013] In conjunction with the first aspect, in certain implementations of the first aspect, the lock request message includes a lock type requested by the first client to lock the first data object, where the lock type includes an exclusive lock and a shared lock. The method further includes:

[0014] 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.

[0015] 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 exponentially increases the scale of concurrent nodes in the overall system and reduces end-to-end delay jitter.

[0016] 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.

[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 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.

[0018] 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 the update 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 the update 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.

[0019] 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 fact that the lock type requested by the first client to lock the first data object is the shared lock, the value of the third field in the lock status information of the first data object is updated.

[0020] 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 further 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.

[0021] In a second aspect, a method for obtaining a lock for 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 the distributed shared memory DSM of the server's processor, the lock status information of the first data object being used to indicate the locking status of the first data object by multiple clients; and storing the lock status information of the first data object in the cache of the network card.

[0022] 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.

[0023] 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 for locking the first data object.

[0024] 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 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.

[0025] In combination with the second aspect, in certain implementations of the second aspect, the method further includes: receiving a notification message sent by the server, the notification message being used to indicate an update of 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.

[0026] According to a third aspect, a method for obtaining 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 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 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 determining whether the first data object is successfully locked based on the first lock status information.

[0027] In combination with the third aspect, in certain implementations of the third aspect, when the network card cache has the first lock status information, the server obtains the first lock status information from the cache of the network card; and the server feeds back the first lock status information to the first client.

[0028] 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 server's processor through the network card, and the first lock status information is stored in the DSM of the server's processor; the server feeds back the first lock status information to the first client.

[0029] 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.

[0030] 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.

[0031] 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.

[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 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.

[0033] 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 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 lock the first data object as the exclusive lock.

[0034] 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.

[0035] In combination with the third aspect, in certain implementations of the third aspect, the method further 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 the update is the same as the value of the first field, and the success message is used to indicate that the first client successfully obtained 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 the update 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.

[0036] 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.

[0037] 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 the distributed shared memory DSM of the processor in the server, and the network card communicates with the processor; the 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 to feedback first lock status information corresponding to the first data object to the first client, 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.

[0038] 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.

[0039] 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.

[0040] 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.

[0041] 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.

[0042] 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.

[0043] In combination with the fourth aspect, in certain implementations of the fourth aspect, the first client requests an exclusive lock as the lock type for locking 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 exclusive lock as the lock type requested by the first client to lock the first data object.

[0044] In combination with the fourth aspect, in certain implementations of the fourth aspect, the network card further 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 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 further configured 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 has failed to acquire the exclusive lock of the first data object.

[0045] 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.

[0046] 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.

[0047] In a fifth aspect, a network card is provided, which includes: a receiving circuit for receiving lock status information of a first data object sent by a server, where the first data object is any storage object in the distributed shared memory DSM of the processor of the server, and the lock status information of the first data object is used to indicate the 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 the cache of the network card.

[0048] In combination with the fifth aspect, in some implementations of the fifth aspect, the network card further includes: a transmitting circuit for 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.

[0049] In combination with the fifth aspect, in certain 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.

[0050] 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 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.

[0051] In combination with the fifth aspect, in certain implementations of the fifth aspect, the receiving circuit is further used to receive a notification message sent by the server, wherein the notification message is used to indicate an update of the lock status information of the received first data object; the control circuit is further used to update the lock status information of the first data object stored in the network card according to the notification message.

[0052] In a sixth aspect, a computing device is provided, comprising a processor and a memory, and optionally, an input / output interface. The processor is configured to control the input / output interface to send and receive information, the memory is configured to store a computer program, and the processor is configured to retrieve and execute the computer program from the memory, so as to perform the method of the first aspect or any possible implementation of the first aspect.

[0053] Optionally, the processor may be a general-purpose processor, which may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated into the processor or located independently of the processor.

[0054] In a seventh aspect, a computing device is provided, comprising a processor and a memory, and optionally, an input / output interface. The processor is configured to control the input / output interface to send and receive information, the memory is configured to store a computer program, and the processor is configured to call and execute the computer program from the memory, so as to perform the method of the second aspect or any possible implementation of the second aspect.

[0055] Optionally, the processor may be a general-purpose processor, which may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated into the processor or located independently of the processor.

[0056] In an eighth aspect, a computing device is provided, comprising a processor and a memory, and optionally, an input / output interface. The processor is configured to control the input / output interface to send and receive information, the memory is configured to store a computer program, and the processor is configured to call and execute the computer program from the memory, so as to perform the method of the third aspect or any possible implementation of the third aspect.

[0057] Optionally, the processor may be a general-purpose processor, which may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated into the processor or located independently of the processor.

[0058] 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 implementation manner of the first aspect.

[0059] Optionally, as an implementation, 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 of the first aspect.

[0060] 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 on 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.

[0061] 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 implementation manner of the second aspect.

[0062] Optionally, as an implementation, 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 one of the implementations of the second aspect.

[0063] 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 on 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.

[0064] In an eleventh aspect, a chip is provided, which obtains instructions and executes the instructions to implement the method in the above-mentioned third aspect and any implementation manner of the third aspect.

[0065] Optionally, as an implementation, 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 of the third aspect.

[0066] 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 on 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.

[0067] In a twelfth aspect, a device is provided, comprising a network card as in the fourth aspect and any one of the implementations of the fourth aspect.

[0068] 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.

[0069] In a fourteenth aspect, a system for acquiring a lock for 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 some 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, 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.

[0070] In a fifteenth aspect, a computer program product comprising instructions is provided, which, when executed by a computing device, enables the computing device to execute the method in the first aspect and any one of the implementations of the first aspect.

[0071] In the sixteenth aspect, a computer program product comprising instructions is provided, which, when executed by a computing device, enables the computing device to execute the method in the above-mentioned second aspect and any one of the implementations of the second aspect.

[0072] In the seventeenth aspect, a computer program product comprising instructions is provided, which, when executed by a computing device, enables the computing device to execute the method in the third aspect and any one of the implementations of the third aspect.

[0073] In the 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 as described in the first aspect and any one of the implementations of the first aspect.

[0074] 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 a hard drive.

[0075] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium.

[0076] 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 as described in the second aspect and any one of the implementations of the second aspect.

[0077] 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 a hard drive.

[0078] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium.

[0079] 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 as described in the third aspect and any one of the implementations of the third aspect.

[0080] 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 a hard drive.

[0081] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium. BRIEF DESCRIPTION OF THE DRAWINGS

[0082] FIG1 is a schematic block diagram of a DSM system applied to an embodiment of the present application.

[0083] FIG2 is a schematic flowchart of a method for acquiring a lock of a data object provided in an embodiment of the present application.

[0084] FIG3 is a schematic flowchart of another method for acquiring a lock on a data object provided in an embodiment of the present application.

[0085] FIG4 is a schematic diagram of lock status information provided by an embodiment of the present application.

[0086] FIG5 is a schematic flowchart of a method for predicting a concurrency control strategy on a client provided in an embodiment of the present application.

[0087] FIG6 is a schematic block diagram of a network card 600 provided in an embodiment of the present application.

[0088] FIG7 is a schematic block diagram of another network card 700 provided in an embodiment of the present application.

[0089] FIG8 is a schematic diagram of the architecture of a computing device 1500 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0090] The technical solution in this application will be described below with reference to the accompanying drawings.

[0091] This application will present various aspects, embodiments, or features around systems 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 of the devices, components, modules, etc. discussed in conjunction with the figures. Furthermore, combinations of these aspects may also be used.

[0092] Additionally, in the embodiments of this application, words such as "exemplary" and "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner.

[0093] In the embodiments of the present application, “corresponding” and “relevant” may sometimes be used interchangeably. It should be noted that when the distinction between them is not emphasized, the meanings they intend to express are consistent.

[0094] 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 skilled in the art will 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 equally applicable to similar technical problems.

[0095] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0096] In this application, "at least one" means one or more, and "more" 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 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.

[0097] To facilitate understanding, the following first introduces relevant terms and concepts that may be involved in the embodiments of this application.

[0098] 1. Distributed shared memory (DSM)

[0099] DSM is a key technology emerging in the development of parallel processing, designed to provide users with abstract, unified global memory access through distributed technology. Specifically, DSM is a virtual address space shared by all nodes (processors) in a distributed system. This means it provides a logically unified address space that any processor can directly read and write to. Programs access data in the DSM in much the same way they access data in the virtual memory of a traditional computer. On a system with a DSM, data moves between the local memories of different computers in the same way that it moves between a single computer's RAM and external memory.

[0100] Therefore, DSM has the advantages of scalability of distributed memory structure and the advantages of good versatility, portability and easy programming of shared memory structure.

[0101] 2. Remote direct memory access (RDMA)

[0102] RDMA is a remote direct data access technology developed to address server-side data processing delays during network transmission. RDMA allows applications to bypass the kernel network protocol stack and transfer data directly to a computer's storage area over the network. This allows direct access to remote memory without the direct involvement of either processor, allowing data to be quickly moved from one system to a remote system's memory without impacting the operating system. RDMA enables zero-copy data transfer and eliminates the overhead of external memory copying and context switching, freeing up memory bandwidth and processor cycles.

[0103] RDMA provides two types of communication primitives: unilateral and bilateral. Unilateral primitives enable memory reads and writes without the knowledge of the remote processor; bilateral primitives require the participation of both processors. Currently, network protocol stacks supporting RDMA technology include Infiniband, RoCE, and iWARP. The first two are supported by Mellanox hardware. The latter two, in particular, utilize the data link layer of standard Ethernet and are therefore fully compatible with Ethernet.

[0104] 3. Exclusive lock

[0105] An exclusive lock, also called an exclusive lock, can be held by only one thread at a time. This means that once a thread has an exclusive lock on a piece of data, no other thread can apply any other lock to that data. The thread that holds the exclusive lock can both read and modify the data.

[0106] 4. Shared locks

[0107] Shared locks can be held by multiple threads. This means that when a thread applies a shared lock to a piece of data, other threads can also apply shared locks to that data, but they cannot apply exclusive locks to that data. The thread that obtains the shared lock can read the data but cannot modify it.

[0108] 5. Optimistic Locking

[0109] As the name suggests, optimistic locking is highly optimistic. Whenever data is retrieved, it assumes that no one else has modified it, so it doesn't lock it. However, when updating data, it checks whether anyone else has updated the data in the meantime, perhaps using mechanisms like version numbers. Optimistic locking is suitable for applications with multiple reads. In Java, optimistic locking is implemented using lock-free programming, most commonly using the compare and swap (CAS) algorithm. The increment operation in Java atomic classes is implemented using a CAS spin algorithm.

[0110] It should be understood that CAS stands for a lock-free algorithm. It synchronizes variables 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 or written, the value A to be compared, and the new value B to be written. Only if 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 concept, trusting that no other thread has modified the value before it changes it.

[0111] 6. Pessimistic Locking

[0112] As the name suggests, 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, there is no guarantee that the external system will not modify the data. Traditional MySQL relational databases use many such locking mechanisms, such as row locks, table locks, read locks, write locks, etc., which are all locked before performing operations.

[0113] The DSM system aims to provide users with abstracted, unified global memory access through distributed technology. This concept was first proposed in the 1990s, but limited by the low-speed networks and resulting high latency, as well as the relatively complex distributed consistency design, it experienced only a brief period of research. In recent years, with the emergence of low-latency, high-speed network communication technologies like RDMA, the concept of distributed shared memory—the abstraction and pooling of independent memory resources—has been rediscovered and has become a hot topic in academic research.

[0114] In order to solve the problem of concurrent access to shared memory in DSM, a pessimistic locking 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. Because the PCIe DMA 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, the bandwidth can easily become a system bottleneck for large amounts of data transmission.

[0115] In view of this, an embodiment of the present application provides a method for acquiring a lock on a data object, which can reduce the PCIeDMA communication overhead between the programmable network card and the processor in the server.

[0116] For ease of description, a distributed shared memory DSM system applied to an embodiment of the present application is illustrated below with reference to FIG1 .

[0117] Figure 1 is a schematic block diagram of a DSM system used in an embodiment of the present application. As shown in Figure 1 , the system may include a client 110 and a server 120. Client 110 is the initiator of remote data read and write requests, while server 120 is used to store and manage shared data and receive and process remote data read and write requests from client 110. Client 110 and server 120 are interconnected via Remote Data Access (RDMA).

[0118] The internal structures of the client 110 and the server 120 are described in detail below.

[0119] Client 110 includes a processor 111 and a programmable network interface card (NIC) 112. The hardware layer of processor 111 may include chips such as a CPU and memory, while the software layer may include applications (APPs). Processor 111 sends remote data read / write requests to NIC 112 via PCIe DMA, and NIC 112 sends these remote data read / write requests to server 120 via RDMA.

[0120] It should be understood that the programmable network interface card 112 can also be referred to as a smart network interface card (smart NIC) or intelligent network adapter. In addition to performing the network transmission functions of a standard network interface card, the programmable network interface card 112 can also provide a built-in programmable and configurable hardware acceleration engine, which offloads some tasks performed by the central processing unit (CPU) to the programmable network interface card 112, thereby improving application performance and significantly reducing CPU consumption during communication, providing more CPU resources for applications.

[0121] 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 memory. The programmable network card 122 receives remote data read and write requests from 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 PCIe DMA.

[0122] 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 a DSM.

[0123] 2 , a method for acquiring a lock on a data object provided by an embodiment of the present application is described in detail.

[0124] Figure 2 is a schematic flow chart of a method for acquiring a lock on a data object provided by an embodiment of the present application. As shown in Figure 2, the method may include steps 210-230, which are described in detail below.

[0125] Step 210: The first network card receives a lock request message sent by the second device.

[0126] 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 via a bus. As an example, taking the scenario shown in Figure 1 as an example, the first device can be the server 120, the first network card can be the programmable network card 122, and the first processor can be the processor 121. The first network card and the first processor communicate via PCIeDMA.

[0127] 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. As an example, taking the scenario shown in Figure 1 as an example, the second device may be client 110, the second network card may be programmable network card 112, and the second processor may be processor 111. The second network card and the second processor communicate via PCIeDMA.

[0128] The first network interface card may receive a lock request message sent by the second device. For example, the first network interface card may receive a lock request message sent by the second network interface card in the second device. The lock request message is used to request the first network interface card to obtain a lock on a first data object, where the first data object is any storage object in the distributed shared memory (DSM) of the first processor.

[0129] 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.

[0130] 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.

[0131] In an embodiment of the present application, the lock status information of the first data object may be cached in the first network interface card. After receiving the lock request message sent by the second network interface card, the first network interface card may obtain the cached lock status information of the first data object from the memory of the first network interface card. As an example, in one possible implementation, the first network interface card may obtain the cached lock status information of the first data object from the memory of the first network interface card based on the virtual address of the first data object.

[0132] Optionally, in some embodiments, if the lock status information of the first data object is not stored in the memory of the first network card, the first network card may obtain the lock status information of the first data object from the first processor and store it in the memory of the first network card. Specifically, in one possible implementation, the first network card may obtain the lock status information of the first data object stored in the memory of the first processor via PCIeDMA and store it in the memory of the first network card.

[0133] Step 230: The first network card sends lock status information of the first data object to the second device.

[0134] 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 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 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.

[0135] Below, taking the scenario shown in FIG1 as an example, in conjunction with FIG3, a specific implementation of the method for obtaining a lock on a data object provided by an embodiment of the present application is described in detail. It should be understood that the example of FIG3 below is merely to help those skilled in the art understand the embodiment of the present application, and is not intended to limit the application embodiment to the specific numerical values ​​or specific scenarios illustrated in FIG3 below. Those skilled in the art can obviously make various equivalent modifications or changes based on the example given in FIG3 below, and such modifications and changes also fall within the scope of the embodiment of the present application.

[0136] FIG3 is a schematic flowchart of another method for acquiring a lock on 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.

[0137] Step 310: The client 110 sends a request message for obtaining a lock to the server 120.

[0138] In this embodiment of the present application, the client 110 may send a request message to the server 120 via the programmable network card 112, wherein the request message is used to request a lock. For example, the request message is used to request 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.

[0139] As an example, the request message may include, but is not limited to, the virtual address of data object A 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.

[0140] For example, in one possible implementation, the client 110 may call the atomic operation fetch_and_add to implement the above-mentioned process of requesting to obtain the lock of the data object A.

[0141] 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.

[0142] 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.

[0143] Optionally, in some embodiments, if the memory of the programmable network card 122 does not contain the lock status information of the data object A, the programmable network card 122 may obtain the lock status information of the object A from the processor 121 and store it in the memory of the programmable network card 122. Specifically, in one possible implementation, the programmable network card 122 may obtain the lock status 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.

[0144] In one possible implementation, a 64-bit value can be used to represent the lock status information of data object A. For example, as shown in FIG4 , the first 4 bytes of the lock status information (the first 32 bits of the lock status information, including the exclusive ture 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.

[0145] The following explains each field of the lock status information.

[0146] The exclusive_true field stores the count of clients currently holding the exclusive lock, also known as the current count. When a client holding an exclusive lock releases the lock, the programmable network interface card 122 in the server 120 can increment the true field by 1. For example, the initial value of the exclusive_true field can be 0.

[0147] The exclusive ticket field stores the total number of clients currently holding the exclusive lock, which can also be understood as a global count. If client 110 attempts to acquire the exclusive lock using the atomic fetch_and_add operation, programmable network interface card 122 in server 120 can increment the ticket field by 1 and return the old value (the value of the ticket field before the increment) as the client 110's turn count. For example, the initial value of the exclusive ticket field can be 0.

[0148] The shared count field is used to preempt a shared lock. If client 110 attempts to acquire a shared lock using the atomic fetch_and_add operation, programmable network interface card 122 in server 120 can increment the shared count field by 1. If client 110 attempts to release the shared lock using the atomic fetch_and_add operation, programmable network interface card 122 in server 120 can decrement the shared count field by 1. For example, the initial value of the shared count field can be 0.

[0149] In the above technical solution, the lock status information can be cached in the memory of the server's programmable network card. When the client accesses a shared data object, the server's programmable network card first searches the programmable network card's memory for the lock status information of the object based on its virtual address, thereby avoiding the programmable network card from obtaining the lock status information of the object from the server's processor's memory, thereby reducing the PCIe DMA communication overhead between the server's programmable network card and the server's processor.

[0150] 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 .

[0151] 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 .

[0152] In one possible implementation, if the lock type for data object A requested by client 110 from server 120 is an exclusive lock, programmable network card 122 in server 120 can operate on the lock status information of data object A shown in FIG3 , for example, by incrementing the exclusive ticket field by 1, and returning the old value (the value of the exclusive ticket field before the increment) to client 110. In other words, programmable network card 122 returns to client 110 the values ​​of each field in the lock status information of data object A before the operation was performed.

[0153] It should be noted that, in the implementation in which client 110 applies for an exclusive lock, if the values ​​of the exclusive ticket field and the exclusive ture field in the lock status information of data object A shown in FIG3 are equal, and the value of the field identifying a shared lock (the shared count field) is 0, then the exclusive lock of data object A has not been preempted by other clients, and no other clients have applied for a shared lock of data object A. In this case, client 110 can successfully acquire the exclusive lock. If the values ​​of the exclusive ticket field and the exclusive ture field in the lock status information of data object A shown in FIG3 are not equal, then the exclusive lock of data object A has been preempted by other clients. Client 110 needs to wait until the other clients release the exclusive lock of data object A, that is, until the values ​​of the exclusive ticket field and the exclusive ture field in the lock status information are equal, before it can successfully acquire the exclusive lock.

[0154] Optionally, if the client 110 fails to acquire the exclusive lock, the programmable network card 122 may further send an acquisition failure message to the client 110 .

[0155] In another possible implementation, if the lock type for data object A requested by client 110 from server 120 is a shared lock, programmable network interface card 122 in server 120 may operate on the lock status information of data object A shown in FIG3 , for example, by adding 1 to the shared count field. The values ​​of the various fields of the lock status information of data object A after the operation are returned to client 110.

[0156] It should be noted that, in the implementation where client 110 applies for a shared lock, if the values ​​of the exclusive ticket field and the exclusive ture field in the lock status information of data object A shown in FIG3 are equal, then the exclusive lock of data object A has not been preempted by other clients, and client 110 can successfully acquire the shared lock. If the values ​​of the exclusive ticket field and the exclusive ture field in the lock status information of data object A shown in FIG3 are not equal, then the exclusive lock of data object A has been preempted by other clients, and client 110 must wait until the exclusive lock of data object A is released by the other clients, that is, until the values ​​of the exclusive ticket field and the exclusive ture field in the lock status information are equal, before client 110 can successfully acquire the shared lock.

[0157] Optionally, if the client 110 fails to acquire the shared lock, the programmable network card 122 may further send an acquisition failure message to the client 110 .

[0158] In the above technical solution, part of the concurrency control logic for data objects can be offloaded 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 scale of concurrent nodes of the overall system and reducing end-to-end delay jitter.

[0159] Step 340: The client 110 determines whether it can acquire the lock based on the lock status information of the data object A.

[0160] As an example, in an embodiment of the present application, after receiving the lock status information of data object A sent by programmable network card 122, client 110 can directly cache the information in the memory of programmable network card 112 of client 110. In this way, if client 110 wants to determine whether data object A is locked, it does not need to query the server 120 over the network. Instead, it can directly query the lock status information of data object A from the local programmable network card 112 of client 110 to determine whether 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 client 110 and server 120.

[0161] The client 110 may obtain the lock status information of the data object A from the programmable network card 112 and determine whether to obtain the corresponding lock based on the lock status information of the data object A. Several possible implementations are described in detail below.

[0162] 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 client 110 can use the value of the exclusive ticket field in the lock status information of data object A as the client's own count turn.

[0163] For example, if the client's own count "turn" is the same as the value of the "exclusive ture" 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 (the "shared count" field) is 0, indicating that the exclusive lock of data object A has not been preempted by other clients, and no other clients have applied for a shared lock on data object A. In this case, client 110 can successfully acquire the exclusive lock of data object A. In other words, if the value of the "exclusive ticket" field and the value of the "exclusive ture" field in the lock status information of data object A are the same, and the value of the "shared count" field is 0, client 110 can successfully acquire the exclusive lock of data object A.

[0164] For another example, if the client's own turn count differs from the value of the exclusive true field in the lock status information of data object A, it can be understood that the exclusive lock of data object A has been preempted by another client, and client 110 cannot successfully acquire the exclusive lock of data object A. In other words, if the value of the exclusive ticket field and the value of the exclusive true field in the lock status information of data object A are different, client 110 cannot successfully acquire the exclusive lock of data object A. Client 110 needs to wait until the other client releases the exclusive lock of data object A. After the programmable network interface card 122 returns the lock status information of data object A to client 110, the value of the exclusive ticket field and the value of the exclusive true field are the same, and the value of the shared count field is 0. At this point, client 110 can successfully acquire the exclusive lock of data object A.

[0165] 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.

[0166] 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 ture field in the lock status information of data object A are the same.

[0167] For example, if the values ​​of the exclusive ticket field and the exclusive ture 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.

[0168] For another example, if the values ​​of the exclusive ticket field and the exclusive true field in the lock status information of data object A are not equal, it means that the exclusive lock of data object A has been preempted by another client. Client 110 must wait until the other client releases the exclusive lock of data object A, that is, until the values ​​of the exclusive ticket field and the exclusive true field in the lock status information are equal, before it can successfully acquire the shared lock.

[0169] Optionally, in some embodiments, if the lock status information of 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 data object A stored therein. In this way, if the client 110 fails to obtain the lock of data object A and wants to obtain the lock status information of data object A again, it does not need to query the server 120 over the network for updated lock status information to determine whether it can obtain the lock of data object A. This can further reduce the network communication overhead between the client 110 and the server 120.

[0170] There are multiple 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 via 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 based on the broadcast notification.

[0171] 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.

[0172] 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.

[0173] In another possible implementation, if the client 110 obtains 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.

[0174] It should be understood that the method shown in FIG2 above describes a pessimistic locking strategy (also known as a blocking strategy) employed by client 110. That is, during the entire data processing process, a lock is applied to the data, and the data is locked by relying on the locking mechanism provided by the database to ensure maximum exclusivity of the operation, thereby ensuring exclusive data access.

[0175] Alternatively, in some embodiments, in contrast to the pessimistic locking strategy, an optimistic locking strategy (also known as the CAS strategy) can be employed for low-concurrency scenarios (those with less server-side data contention) to reduce the significant performance overhead associated with the database's locking mechanism. Specifically, during the entire data processing process, data is locked, not relying on the database's locking mechanism, but rather on a data versioning mechanism. The implementation of the CAS strategy is described in detail below.

[0176] Taking the CAS strategy as an example, the client calls the atomic operation compare_and_swap to send a remote data read / write request to the server. The request can include an expected value and a value to be modified. The server's programmable network card compares the expected value with the target value stored in the server's processor to see if they are consistent. If the expected value and the target value stored in the server's processor are consistent, the server's programmable network card 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, overwriting the target value with the value to be modified, and the data modification is successful. If the expected value and the target value stored in the server's processor are inconsistent, the data modification fails.

[0177] In an embodiment of the present application, the client can predict the data competition situation on the server side (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. The following takes the scenario shown in Figure 1 as an example and combines Figure 5 to describe this implementation method in detail.

[0178] FIG5 is a schematic flowchart of a method for predicting a concurrency control strategy on a client provided in an embodiment of the present application. The method may include steps 510 - 520 , and steps 510 - 520 are described in detail below.

[0179] Step 510 : The client 110 trains a model based on the lock status information of the data object stored in the programmable network card 112 .

[0180] In an embodiment of the present application, the client 110 can obtain the stored lock state information (also referred to as history) of multiple data objects from the programmable network card 112 and use the lock state information of the multiple data objects as input information for the model. The output information of the model includes the selected concurrency control strategy (e.g., pessimistic locking strategy or optimistic locking strategy). In other words, the client 110 can predict the corresponding concurrency control strategy based on the lock state information of the data objects.

[0181] For example, taking the exclusive ticket field and exclusive ture field in the lock status information as an example, the exclusive ture field indicates the current client's level of hunger, and the exclusive ticket field indicates the number of clients accessing the data object. Therefore, the lock status information of a data object can represent the data contention situation on the server side. In one example, if the data contention on the server side is relatively fierce, the failure probability of using an optimistic locking strategy is relatively high, so a pessimistic locking strategy can be selected. In another example, if the data contention on the server side is relatively fierce, the failure probability of using an optimistic locking strategy is relatively low, so an optimistic locking strategy can be selected, thereby saving the significant performance overhead brought about by the database's locking mechanism.

[0182] 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.

[0183] Step 520: The client 110 performs inference and prediction based on the model to determine the corresponding concurrency control strategy.

[0184] After training the model, the client 110 can obtain the lock status information of the stored data object A from the programmable network card 112. The lock status 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 locking strategy or optimistic locking strategy, etc.).

[0185] It should be noted that the embodiments of the present application specifically define the above model. In one possible implementation, the model is a light gradient boosting machine (light GBM).

[0186] The above description, in conjunction with Figures 1 to 5 , details the method for acquiring a lock on a data object provided by an embodiment of the present application. The following description, in conjunction with Figures 6 to 8 , details the embodiment of the apparatus of the present application. It should be understood that the description of the method embodiment corresponds to the description of the apparatus embodiment. Therefore, for portions not described in detail, reference can be made to the preceding method embodiment.

[0187] Figure 6 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 method flow shown in Figure 1 of the embodiment of the present application. 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 a network card in a server, and 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 and the processor communicate; the control circuit 620 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, 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.

[0188] Optionally, when the network card cache has the first lock status information, the control circuit 620 is specifically configured to: obtain the first lock status information from the cache of the network card; and feed back the first lock status information to the first client.

[0189] 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, where the DSM of the processor stores the first lock state information; and feed back the first lock state information to the first client.

[0190] 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.

[0191] 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.

[0192] 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.

[0193] Optionally, the first client requests an exclusive lock as the lock type for locking 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 for locking the first data object.

[0194] 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 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.

[0195] 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.

[0196] Optionally, if the lock status information of the first data object cached by the first network card is updated, the transmitting circuit 630 is further configured to send a notification message to the first client, instructing the first client to update the received lock status information of the first data object.

[0197] Figure 7 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 method flow shown in Figure 2 of the embodiment of the present application, and the network card 700 includes: a receiving circuit 710, for receiving the lock status information of the first data object sent by the server, the first data object being any storage object in the distributed shared memory DSM of the processor of the server, and the lock status information of the first data object being used to indicate the locking status of the first data object by multiple clients; a control circuit 720, for storing the lock status information of the first data object in the cache of the network card.

[0198] Optionally, the network card 700 further includes: a transmitting circuit 730, configured to send 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.

[0199] Optionally, the lock request message carries the virtual address of the first data object and / or the lock type for locking the first data object.

[0200] 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.

[0201] Optionally, the receiving circuit 710 is further used to receive a notification message sent by the server, which 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.

[0202] The modules of each example described in the embodiments of this 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. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0203] 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 and will not be repeated here.

[0204] 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 the function and structure of the hardware are subsequently 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. Furthermore, optionally, the computer system is a handheld device such as a smart phone, or a terminal device such as a personal computer, and this application is not particularly limited, as long as the method provided in 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.

[0205] A computing device provided in an embodiment of the present application is described in detail below in conjunction with FIG8 .

[0206] FIG8 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, a computer, or other device with computing capabilities. The computing device 1500 shown in FIG8 includes: at least one processor 1510 and a memory 1520.

[0207] It should be understood that this application does not limit the number of processors and memories in the computing device 1500.

[0208] The processor 1510 executes the instructions in the memory 1520 so that the computing device 1500 implements the method provided in this application. Alternatively, the processor 1510 executes the instructions in the memory 1520 so that the computing device 1500 implements the functional modules provided in this application, thereby implementing the method provided in this application.

[0209] 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.

[0210] 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, only one thick line is used in Figure 8, but this does not mean that there is only one bus or one type of bus.

[0211] In one possible implementation, the processor 1510 is primarily responsible for interpreting computer program instructions (or codes) and processing data in the computer software. The computer program instructions and the data in the computer software may be stored in the memory 1520 or the cache 1516.

[0212] Optionally, the processor 1510 may be an integrated circuit chip having signal processing capabilities. By way of example and not 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, or a discrete hardware component. The general-purpose processor is a microprocessor, etc. For example, the processor 1510 is a central processing unit (CPU).

[0213] Optionally, each processor 1510 includes at least one processing unit 1512 and a memory control unit 1514 .

[0214] Processing unit 1512, also known as a core, is the most important component of a processor. Processing unit 1512 is manufactured from single-crystal silicon using a specific production process. All processor calculations, command reception, command storage, and data processing are performed by the core. Each processing unit independently executes program instructions, leveraging parallel computing capabilities to accelerate program execution. Each processing unit has a fixed logical structure. For example, a processing unit includes logical units such as a level 1 cache, a level 2 cache, an execution unit, an instruction-level unit, and a bus interface.

[0215] In one implementation example, the memory control unit 1514 is configured to control data exchange between the memory 1520 and the processing unit 1512. Specifically, the memory control unit 1514 receives memory access requests from the processing unit 1512 and controls access to the memory based on the memory access requests. By way of example and not limitation, the memory control unit is a device such as a memory management unit (MMU).

[0216] In one implementation example, each memory control unit 1514 addresses the memory 1520 via the system bus. An arbiter (not shown in FIG8 ) is configured in the system bus to handle and coordinate competing accesses by multiple processing units 1512 .

[0217] In an implementation example, the processing unit 1512 and the memory control unit 1514 are connected to each other via 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.

[0218] Optionally, each processor 1510 also includes a cache 1516, which is a buffer for data exchange (called a cache). When a processing unit 1512 needs to read data, it first searches the cache for the required data. If the data is found, it executes the request directly; if not, it searches the memory. Because the cache runs much faster than the memory, the cache helps the processing unit 1512 run faster.

[0219] Memory 1520 can provide runtime space for processes in computing device 1500. For example, memory 1520 stores computer programs (specifically, program code) used to generate processes. After the computer program is executed by the processor to generate a process, the processor allocates corresponding storage space for the process in memory 1520. Furthermore, the aforementioned storage space further includes a text segment, an initialized data segment, a bit-initialized data segment, a stack segment, a heap segment, and the like. Memory 1520 stores data generated during the execution of the process, such as intermediate data or process data, in the storage space corresponding to the aforementioned process.

[0220] Optionally, the memory is also called the internal memory. Its function is to temporarily store the data processed by the processor 1510 and the data exchanged with external storage such as a hard disk. As long as the computer is running, the processor 1510 will load the data to be calculated into the internal memory for calculation. When the calculation is completed, the processing unit 1512 will transmit the result.

[0221] By way of example and not limitation, memory 1520 is a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Non-volatile memory is read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory is 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), synchronous link DRAM (SLDRAM), and direct RAM bus RAM (DR RAM). 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.

[0222] The structure of the computing device 1500 listed above is only for illustrative purposes, 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 in addition to 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 to achieve 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 that implement 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 all the devices shown in Figure 8.

[0223] 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 smartphone.

[0224] This embodiment also provides a computer program product containing instructions. The computer program product may be software or a program product containing 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, it causes the computing device to execute the method provided above and performed by the first network interface card.

[0225] This embodiment also provides a computer program product including instructions. 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, it causes the computing device to execute the method provided above and performed by the second network interface card.

[0226] This embodiment also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of storing data on a computing device, or a data storage device such as a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, or a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that, when executed on a computing device, cause the computing device to execute the method provided above, performed by the first network interface card.

[0227] This embodiment also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of storing data on a computing device, or a data storage device such as a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, or a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that, when executed on a computing device, cause the computing device to execute the method provided above, performed by the second network interface card.

[0228] 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.

[0229] Those skilled 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 beyond the scope of this application.

[0230] Those skilled in the art will 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.

[0231] In the several embodiments provided in this 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 merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, 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.

[0232] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0233] 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.

[0234] 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, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0235] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for acquiring a lock on a data object, It is 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 some 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is characterized in that The lock type requested by the first client to lock the first data object is a shared lock, the first data object is locked according to the lock type requested by the first client, the first network card cached The lock status information of a data object is updated, including: 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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 in the lock state information of the first data object is different from a value of the first field.

18. The method according to claim 16, It is 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 locks the first data object according to the lock type requested by the first client as the exclusive lock, and 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, It is 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 updates the value of the third field in the lock state information of the first data object through the network card according to the lock type of the first client requesting the first data object to be the shared lock.

20. The method according to any one of claims 11 to 19, It is characterized in that The method further comprises: The server sends a success message to the first client through the network card according to the value of the second field before update and the value of the first field in the lock state information of the first data object being the same, 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is characterized in that Comprising the network card as claimed in any one of claims 22 to 31.

Citation Information

Patent Citations

  • High concurrent data transmission method based on RDMA (Remote Direct Memory Access)

    CN106657365A

  • Method and device for implementing lock resource processing

    CN110471779A

  • Index access method and computer cluster

    CN115599532A

  • Lock management method, device and system

    CN116257366A

  • Transactional lock elision with delayed lock checking

    US20160371128A1