WO2022194021A1 - Concurrency control method, network card, computer device, and storage medium - Google Patents

Concurrency control method, network card, computer device, and storage medium Download PDF

Info

Publication number
WO2022194021A1
WO2022194021A1 PCT/CN2022/080150 CN2022080150W WO2022194021A1 WO 2022194021 A1 WO2022194021 A1 WO 2022194021A1 CN 2022080150 W CN2022080150 W CN 2022080150W WO 2022194021 A1 WO2022194021 A1 WO 2022194021A1
Authority
WO
WIPO (PCT)
Prior art keywords
network card
data
requester
destination
verification
Prior art date
Application number
PCT/CN2022/080150
Other languages
French (fr)
Chinese (zh)
Inventor
张旭
周敬滨
项子豪
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022194021A1 publication Critical patent/WO2022194021A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

Definitions

  • the present application relates to the technical field of concurrency control, and in particular, to a concurrency control method, a network card, a computer device, and a storage medium.
  • Concurrency control regards the transaction as the basic unit of scheduling.
  • the purpose of concurrency control is to reasonably arrange the concurrent scheduling of transactions to avoid conflicts and improve the correctness and utilization of the system.
  • the verification operation is usually performed by a central processing unit (CPU) at the requesting side, resulting in a large CPU overhead.
  • CPU central processing unit
  • the present application provides a concurrency control method, a network card, a computer device, and a storage medium.
  • the present application effectively reduces CPU overhead.
  • the technical solutions provided by this application are as follows:
  • the present application provides a concurrency control method.
  • the method includes: a network card obtains an object, and the object carries data requested by a requester to be read from a destination and verification information of the data; Perform consistency check; when the consistency check passes, the network card provides data to the memory of the requester.
  • the CPU in the server does not need to be used for consistency check, and on the basis of realizing the concurrency control of the reading process, the CPU overhead caused by check and memory transfer can be effectively reduced. End-to-end delay is reduced.
  • the network card when the consistency check is passed, provides data to the memory of the requester, including: when the consistency check is passed, the network card performs a verification information stripping operation on the object to obtain data; The memory on the side provides the data.
  • the method when the network card is deployed in the destination, after the network card performs consistency check on the data according to the verification information, the method further includes: when the consistency check fails, the network card notifies the requester to verify the data. Failed to pass the test. By timely notifying the requester that the consistency check fails, the overhead caused by processing invalid data can be effectively reduced.
  • the method when the network card is deployed in the destination, after the network card performs consistency check on the data according to the verification information, the method further includes: when the consistency check fails, the network card stops checking the data in the data. The unverified part is checked for consistency, and the part that has passed the verification of the data is stopped to be sent to the requester. In this way, it is possible to reduce the resource overhead and time overhead used in the consistency check and transmission of invalid data, improve the utilization rate of resources and ensure the concurrency of the destination end.
  • the method when the network card is deployed in the requester, after the network card performs consistency check on the data according to the verification information, the method further includes: when the consistency check fails, the network card stops storing the data in the data. The part that has passed the verification is written to the memory of the requester. In this way, the resource overhead and time overhead of transmitting invalid data can be reduced, the utilization rate of resources can be improved, and the concurrency of the destination end can be guaranteed.
  • the method when the network card is deployed in the requester, after the network card performs consistency check on the data according to the verification information, the method further includes: when the consistency check fails, the network card stops checking the data in the data. The unverified part is checked for consistency. In this way, it is possible to reduce the resource overhead and time overhead used for the consistency check of invalid data, improve the utilization rate of resources and ensure the concurrency of the destination end.
  • the object can be read from memory when the network card is deployed in the destination.
  • obtaining the object by the network card includes: the network card receives a read request sent by the requester, and the read request is used to request to read data; and the network card obtains the object from the memory of the destination terminal according to the read request.
  • the network card provides data to the memory of the requester, including: the network card sends data to the network card of the requester, so that the network card of the requester sends data to the memory of the requester.
  • the object when the network card is deployed in the requester, the object is provided by the destination.
  • the method further includes: the network card sends a read request to the destination, and the read request is used to request to read data; correspondingly, the network card obtains the object, including: the network card receives the network card sent by the destination end. The object is obtained by the network card of the destination based on the read request.
  • the network card when the network card is deployed in the requester, the network card provides data to the memory of the requester, including: the network card directly sends data to the memory of the requester.
  • the organization forms of the verification information of the data involved in different read and write scales in the object may be the same or different.
  • the verification information can be described by description information.
  • the method further includes: the network card obtains description information of the object, and the description information is used to indicate the organization form of the object; and the network card obtains from the object based on the description information. Check information.
  • an identifier can also be assigned to the description information used to describe different organizational forms.
  • the network card obtains the description information of the object, including: the network card obtains the identifier of the description information; the network card is based on the The identification and mapping relationship of the description information is obtained, and the description information is obtained, and the mapping relationship reflects the corresponding relationship between the description information and the identification.
  • the network card when the network card is deployed in the destination terminal, the network card obtains the identifier of the description information, including: the network card receives a read request sent by the requester, and the read request carries the identifier of the description information; the network card obtains from the read request An identifier that describes the information.
  • the network card when the network card is deployed in the requester, the network card obtains the identifier of the description information, including: the network card receives a read response sent by the destination terminal based on the read request, and the read response carries the identifier of the description information, and the description information The identifier of the id is sent to the destination through the read request; the network card obtains the identifier of the description information from the read response.
  • the present application provides a network card
  • the network card includes: an acquisition unit for acquiring an object, the object carrying data requested by a requester to be read from a destination and verification information of the data; a verification unit for The verification information is used to check the consistency of the data; the interaction unit is used to provide data to the memory of the requester when the consistency check is passed.
  • the network card further includes: a stripping unit, configured to perform a verification information stripping operation on the object to obtain data when the consistency check is passed; an interaction unit, specifically configured to provide data to the memory of the requester.
  • a stripping unit configured to perform a verification information stripping operation on the object to obtain data when the consistency check is passed
  • an interaction unit specifically configured to provide data to the memory of the requester.
  • the network card is deployed in the destination, and the interaction unit is further configured to notify the requester that the verification fails when the consistency check fails.
  • the network card is deployed in the destination, and the check unit is also used to stop the consistency check on the unchecked part of the data when the consistency check fails; the interaction unit is also used to check the consistency When the verification fails, stop sending the part of the data that has passed the verification to the requester.
  • the network card is deployed in the requester, and the interaction unit is further configured to stop writing the part of the data that has passed the check into the memory of the requester when the consistency check fails.
  • the network card is deployed in the requester, and the verification unit is further configured to stop the consistency verification of the unverified part of the data when the consistency verification fails.
  • the interaction unit is further configured to receive a read request sent by the requesting end, and the read request is used to request to read data; the obtaining unit is specifically configured to obtain the object from the memory of the destination end according to the read request.
  • the network card is deployed in the destination, and the interaction unit is specifically configured to send data to the network card of the requester, so that the network card of the requester sends data to the memory of the requester.
  • the network card is deployed in the requesting end, and the interaction unit is also used to send a read request to the destination end, and the read request is used to request to read data; the acquiring unit is specifically used to receive the object sent by the network card of the destination end, and the object is sent by the destination end.
  • the network card of the end is obtained in the destination end based on the read request.
  • the network card is deployed in the requester, and the interaction unit is specifically configured to directly send data to the memory of the requester.
  • the acquiring unit is further configured to acquire description information of the object, where the description information is used to indicate the organization form of the object; the verification unit is further configured to acquire verification information from the object based on the description information.
  • the obtaining unit is specifically configured to: obtain the identifier of the description information; and obtain the description information based on the identifier of the description information and a mapping relationship, and the mapping relationship reflects the corresponding relationship between the description information and the identifier.
  • the network card is deployed in the destination terminal, and the interaction unit is further configured to receive a read request sent by the requester, and the read request carries the identifier of the description information; the acquisition unit is specifically configured to obtain the identifier of the description information from the read request.
  • the network card is deployed in the requester, and the interaction unit is further configured to receive a read response sent by the destination based on the read request, the read response carries an identifier of the description information, and the identifier of the description information is sent to the destination through the read request;
  • the unit is specifically used to obtain the identifier of the description information from the read response.
  • the present application provides a computer device, the computer device includes: a network card and a memory, and a computer program is stored in the memory; when the network card executes the computer program, the first aspect of the present application and any possible implementation manner thereof are realized. provided method.
  • the present application provides a non-transitory computer-readable storage medium.
  • the network card executes the first aspect of the present application and any possible implementations thereof. method provided in.
  • the present application provides a computer program product including instructions, which, when the computer program product runs on a network card, enables the network card to execute the method provided in the first aspect of the present application and any possible implementations thereof.
  • FIG. 1 is a schematic diagram of an application scenario involved in a concurrency control method provided by an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a network card provided by an embodiment of the present application.
  • FIG. 3 is a flowchart of a concurrency control method provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a storage method of an object provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of another object storage method provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a method for performing concurrency control on a network card of a destination end provided by an embodiment of the present application
  • FIG. 8 is a schematic diagram of a method for performing concurrency control on a network card of a requester provided by an embodiment of the present application
  • FIG. 9 is a schematic structural diagram of another network card provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of another network card provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • a transaction is a logical unit of operation, and a transaction is a sequence of operations consisting of all operations performed between the start of a transaction and the end of a transaction. All operations in a transaction are executed as a whole. All operations in the entire transaction are either successfully executed or all fail. When a transaction fails, an abort or rollback strategy can be used to ensure that the operation objects in the transaction will not be affected.
  • Concurrency control is used to serialize multiple concurrent transactions that operate on the same object, and is a mechanism to ensure timely detection and correction of errors caused by concurrent operations.
  • the concurrent transactions of an object include read operation transactions and write operation transactions
  • the read operation transaction and the write operation transaction can be serialized through concurrency control to prevent the simultaneous execution of the write operation during the read operation and the simultaneous execution of the read operation during the read operation.
  • Optimistic concurrency control is a lock-free concurrency control mechanism, which is based on an optimistic conflict detection strategy for concurrency control, which can maximize parallel efficiency on the basis of concurrency control.
  • OCC optimistic concurrency control
  • the execution process of a transaction includes an execute phase, a verification phase, and a commit phase.
  • objects are manipulated according to the logic of the transaction.
  • the verification phase it is judged whether the operation of the transaction on the object conflicts with the operations of other transactions on the object.
  • the transaction is allowed to enter the commit phase, otherwise , you need to use a conflict resolution mechanism for conflicting transactions.
  • the commit phase the updates generated by the transaction's operations on the object are committed, making the updates persistent.
  • a distributed transaction is a transaction involving multiple servers, and the realization of the distributed transaction requires the cooperation of the multiple servers.
  • each server applies local concurrency control to the objects it manages to ensure that the transaction is serialized locally, and concurrent control of the entire distributed transaction is required to ensure global serialization .
  • optimistic concurrency control can control the concurrency of the lock-free read process in distributed transactions.
  • process of using optimistic concurrency control to achieve lock-free reading will result in a large central processing unit (CPU) overhead in the server.
  • CPU central processing unit
  • the embodiments of the present application provide a concurrency control method.
  • the network card obtains the object, performs consistency verification on the data in the object according to the verification information carried by the object, and provides data to the memory of the requester when the consistency verification passes.
  • the object carries the data requested by the requester to be read from the destination and the verification information of the data.
  • the concurrency control method by using a network card to perform consistency check, the CPU in the server does not need to be used for consistency check, and the CPU overhead can be effectively reduced on the basis of realizing the concurrency control of the reading process.
  • the data carried by the object is a general term for the content requested by the requester to be read from the destination.
  • FIG. 1 is an implementation scenario involved in a concurrency control method provided by an embodiment of the present application.
  • the implementation scenario includes: at least two service nodes.
  • a network card is deployed in each of the at least two service nodes, and data transmission between the at least two service nodes is implemented through the network card.
  • one of the at least two service nodes is used as a destination, and the destination stores data.
  • one or more service nodes other than the service node serving as the destination serve as a requester, and the requester is used for requesting to read data from the destination.
  • 1 is a schematic diagram of the application scenario including a first service node 10 and a second service node 20, one of the first service node 10 and the second service node 20 is used as a requester, and the other is used as a destination.
  • the service node in this implementation scenario may be implemented by a physical machine, a physical machine cluster including multiple physical machines, a bare metal server, or a cloud server, or the like.
  • the process of the requester reading data from the destination includes: the requester sends a read request to the destination, the destination obtains the data read by the read request from the destination according to the read request, and provides the data to the requester.
  • the process of reading data further includes: performing consistency check on the data read by the read request.
  • the consistency check process may be performed by a network card at the destination end or by a network card at the requesting end.
  • the destination usually stores data in the memory in the unit of an object (object), wherein the object includes data and verification information for verifying the data.
  • the data in the object is usually stored in the form of data blocks, that is, the object usually includes one or more data blocks.
  • each data block has verification information, and the verification information of any data block can be located at the head or tail of any data block, or the verification information in multiple data blocks in the object can also be performed in other ways. place.
  • the network card is also used to strip (stripping) the verification information of the data in the object, such as stripping the verification information at the head of the data block from the object. information, obtain the data requested by the requester to read, and provide the data to the memory of the requester. Performing the stripping operation through the network card can reduce the CPU and memory overhead caused by the CPU performing the stripping operation.
  • the network card provided by the embodiment of the present application can support read and write operations of various read and write scales, and the data and verification information of the read and write operations of the various read and write scales are organized in different forms in objects.
  • the organization form is used to indicate how the data and verification information are stored in the object.
  • Organizational form can be reflected using descriptive information.
  • the network card needs to first obtain the description information of the object that contains the data, and then obtain the data check information from the object according to the description information, and then perform the data check according to the check information. Consistency check.
  • operations such as checksum stripping performed by the network card in the embodiment of the present application may be implemented by program code.
  • the network card for performing the consistency check may be a programmable network card.
  • the programmable network card is also called a programmable controller (programmable network interface controller, Programmable NIC).
  • Programmable NIC programmable network interface controller
  • the behavior of the network card can be changed by modifying program codes such as firmware or microcode in the programmable network card, so that the network card has the above functions.
  • the network card is configured with a remote direct memory access (RDMA) function.
  • RDMA is a fast cross-machine memory access technology ubiquitous in the distributed field. RDMA allows a machine to perform memory read and write operations in another target machine's pre-registered memory area, and can bypass the target machine's operating system and CPU, so it has the advantages of high speed, low latency, and low CPU overhead.
  • the above-mentioned functions of the network card may be implemented by multiple functional modules, and the multiple functional modules cooperate to implement the above-mentioned functions of the service node.
  • Figure 2 takes Figure 2 as an example to illustrate it:
  • the service node when the service node includes a network card for performing operations such as checksum stripping, the service node includes: a host system (host system) X01 and a programmable network card X02.
  • the host system X01 runs an application program that performs read and write operations on data.
  • the host system X01 includes an initialization module (initializing module) X011 that serves the application program.
  • the initialization module X011 is used to perform the initialization configuration required to run the application.
  • the service node is configured with a memory X012 for the host system X01. Memory X012 is used to store objects that distributed transactions need to access.
  • the programmable network card X02 includes: a network card module X021, a first buffer module X022, a match module (match module) X023, a verification module (validation module) X024, a stripping module (stripping module) X025 and The second cache module X026.
  • the verification information includes version information (version), and performing consistency verification on the data is also referred to as performing version verification on the data, and the verification module X024 is also referred to as a version verification module.
  • the network card module X021 is the hardware that allows the service nodes to communicate on the computer network, and is used to receive data sent by the network cards of other service nodes through the network, and send data to the network cards of other service nodes through the network.
  • the first cache module X022 is used to cache the object to be verified.
  • the matching module X023 is used to obtain the description information of the object.
  • the verification module X024 is configured to acquire the description information of the object from the matching module, acquire the verification information of the data from the object cached by the first cache module according to the description information, and perform consistency verification on the data according to the verification information.
  • the stripping module X025 is used to strip the verification information in the object when the data passes the verification, and obtain the data requested by the requester to be read.
  • the second cache module X026 is used to cache the verification information that has been verified.
  • the network card module X021, the first buffer module X022 and the second buffer module X026 can be implemented by hardware, such as the first buffer module X022 can be a stream buffer (stream buffer), and the second buffer module X026 can be a context buffer. device (contex).
  • the matching module X023, the verification module X024 and the stripping module X025 can be implemented by software. It should be noted that the implementations of the network card module X021, the first cache module X022, the matching module X023, the verification module X024, the stripping module X025 and the second cache module X026 are schematic examples, which are different from the implementations that define the corresponding modules. , the implementation of each module can be adjusted according to application requirements.
  • the concurrency control method provided by the embodiment of the present application may be executed by the destination end or by the requesting end.
  • the implementation process of the concurrency control method is described below with respect to the concurrency control method being executed by the destination end and the request end being executed respectively.
  • FIG. 3 is a method flowchart of a concurrency control method provided by an embodiment of the present application executed by a destination end. As shown in Figure 3, the concurrency control method includes the following steps:
  • Step 301 the application program of the destination end registers the description information of the object, and sends the identifier of the description information to the requesting end through the network card of the destination end.
  • the object of the application is stored in the memory, and the destination can provide the requesting end with an access function of the object.
  • the object includes the relevant data of the application and the verification information of the data.
  • check information is placed at the head, tail, or otherwise of the data.
  • the data related to the application includes: data read from the disk into the memory, data generated during the running of the application, and data written by other service nodes through the application.
  • the organization forms of the verification information of the data involved in different read and write scales in the object may be the same or different.
  • the verification information of data accessed by threads of different applications may be organized in the same or different forms in objects.
  • the application program needs to register the description information of the object.
  • the description information is used to indicate the organization form of the object, such as the organization form of the indicated data and verification information in the object.
  • the application program registers the description information means that the application program determines the organization form of the data it accesses and its verification information in the object according to its execution logic, and obtains the object description information according to the organization form of the object.
  • an identifier can also be assigned to the description information used to describe different organizational forms, and a mapping relationship between the description information and the identifier can be established, so that in the process of subsequent data reading, the network card
  • the description information indicated by the identification can be determined according to the identification.
  • the operation of assigning an identifier to the description information can be performed by the application program or the network card of the destination end, as long as it can be ensured that one identifier can uniquely identify one description information.
  • the network card stores a mapping relationship table, and the mapping relationship table is used to describe the mapping relationship between the description information and the identifier.
  • the destination end Since there is usually a lot of data stored in the memory of the destination end, and the destination end cannot predict the data that the requesting end needs to read, correspondingly, the destination end cannot predict the verification information of the data that the requesting end needs to read. Therefore, in order for the destination end to be able to determine the verification information of the data to be read by the requesting end, the read request sent by the requesting end to the destination end needs to carry the identifier or description information of the description information of the object. Correspondingly, after determining the description information of the object, the destination also needs to notify the requester of the description information used to describe different organizational forms, so that when the requester needs to read data from the destination, the requester can carry the corresponding data in the read request. description information.
  • the destination after the destination assigns identifiers to the description information used to describe different organizational forms, the destination also needs to notify the requester of the identifiers used to describe the description information of different organizational forms, so that when the requester needs to read data from the destination , the requester can carry the identifier of the corresponding description information in the read request.
  • the application at the destination end may notify the application at the requesting end of description information or its identifier for describing different organizational forms to the application at the requesting end in an in-band or out-of-band manner.
  • the data in one object may be divided into multiple data blocks, and in order to facilitate verification of each data block, the object also carries verification information of each data block.
  • each cache line can store one data block, or multiple cache lines can jointly store one data block.
  • each cache line of the 3 cache lines stores a data block in the object, and each cache line also stores the cache line Checksum information of data blocks stored in .
  • the lengths of the verification information in the multiple cache lines may be the same or different, and/or the contents included in the verification information in the multiple cache lines may be the same or different.
  • the length of each cache line is 256 bytes.
  • the check information is located at the head of the data block, and the length of the check information in each cache line is 8 bytes. Both are 248 bytes in length.
  • the data in the object is divided into two data blocks, each data block is stored in two cache lines, and the header of each data block also stores the check information of the data block.
  • the corresponding data block can be verified according to the verification information in the header of each data block.
  • the storage of one data block in the object by several cache lines can be determined according to application requirements, for example, it can be determined according to the atomic read and write granularity of the network card.
  • the atomic read/write granularity of the network card is one cache line, each cache line is used to store one data block.
  • the atomic read/write granularity of the network card is multiple cache lines, multiple cache lines store one data block together.
  • the description information of the object may be represented by a pattern descriptor (pattern descriptor) of the object, and the identifier of the corresponding description information may be represented by a pattern identifier (pattern identify, pattern ID for short).
  • pattern descriptor pattern descriptor
  • pattern identify pattern ID for short
  • the aforementioned matching module X023 is also referred to as a pattern matching module (pattern match module), and the mapping relationship table used to describe the pattern and the pattern identifier may be referred to as a pattern table (pattern table).
  • the mode descriptor includes: a length field (length) and an offset field (offset).
  • the length field is used to indicate the valid length of the check information.
  • the offset field is used to indicate the offset of the verification information in the object.
  • the mode descriptor is used to define the effective length and offset of the verification information, the storage location of the verification information in the object can be determined according to the effective length and the offset. And since the object includes two parts, the data and the verification information, after the storage location of the verification information in the object is determined, the storage location of the data in the object can be determined.
  • the mode descriptor further includes: a write lock identification field and an object release field.
  • the write lock identification field is used to indicate whether the data is added with the identification of the write operation.
  • the object deallocation field is used to indicate whether the object has been deallocated by another thread.
  • the network card can support one or more applications using objects of different organizational forms, and the adaptability of the network card is improved, and It helps to flexibly adjust the format of the verification information according to the business attributes of the service node, so that the network card can support different business models.
  • this step 301 is an optional step, and it may be determined whether or not this step 301 needs to be executed according to application requirements. For example, when the multiple verification information to be verified by the network card is organized in different forms in the object, step 301 needs to be executed. When the multiple types of verification information to be verified by the network card are in the same organization form in the object, step 301 does not need to be performed.
  • Step 302 The network card of the destination end receives the read request sent by the requesting end.
  • the read request is used to indicate the data that the requester needs to read from the destination.
  • the read request carries the logical address of the data requested to be read, so that the data requested to be read is indicated by the logical address.
  • the logical address is used to indicate the object including the data requested to be read (the object including the data requested to be read is also called a read object).
  • the read request also carries the description information of the object or the identifier of the description information, so that the destination terminal can obtain the verification information in the object according to the description information or the identifier.
  • the requesting end can determine the description information or the identifier of the description information according to its requirement of reading data, and carry the description information or the identifier of the description information in the read request.
  • the requester and the destination can pre-agree on the organization form of the verification information of the data accessed by different threads in the object.
  • the requester can Determine the organizational form of the object that the thread needs to read according to the result of the protocol, and carry the identifier of the description information describing the organizational form in the read request, so that the destination can determine the verification information of the data according to the identifier.
  • the read request may determine whether to carry the identifier of the description information of the object according to the application requirements.
  • the read request may also carry a check indication identifier, which is used to instruct the network card in the destination to perform consistency check on the data read by the read request request .
  • the implementation manner of the identification of the description information and the verification indication identification carried in the read request includes: adding an operation code (operation code) in the message area corresponding to the InfiniBand (IB) transport layer in the read request , OPCode), instruct the network card in the destination end to perform consistency check on the data read by the read request through the opcode, and add an identifier of the description information before the payload of the field corresponding to the IB transport layer.
  • IB is a computer network communication standard for high-performance computing. It has extremely high throughput and extremely low latency. It is used for data interconnection between computers and can carry RDMA technology. IB also uses It can be used as direct or switched interconnection between servers and storage systems, as well as interconnection between storage systems.
  • the implementation manner in which the read request carries the identifier of the description information and the verification indication identifier includes: using an existing reserved field in the read request, the identifier of the description information and the verification indication identifier are both Embedded in a reserved field in the header of a read request.
  • Step 303 The network card of the destination acquires the object from the memory of the destination according to the read request.
  • the network card of the destination end can obtain the object from the memory of the destination end according to the logical address carried by the read request.
  • the object carries the data requested by the requester to be read from the destination and the verification information of the data.
  • Step 304 the network card of the destination terminal obtains the description information of the object.
  • the network card of the destination end obtains the description information of the object, including: the network card of the destination end obtains the identifier of the description information from the read request, and based on the description information
  • the identity query step 301 establishes the mapping relationship between the description information and the identity in the network card, so as to obtain the description information of the object.
  • the destination network card can extract the descriptive information in the read request according to the manner in which the read request carries the descriptive information, so as to obtain the descriptive information of the object.
  • Step 305 the network card of the destination terminal obtains the verification information from the object based on the description information.
  • the network card of the destination end can determine the storage location of the verification information in the object according to the organization form indicated by the description information. Moreover, since the network card of the destination end has acquired the object from the memory, the network card of the destination end can know the storage location of the object, and correspondingly, the network card of the destination end can obtain the verification information from the object in the storage location of the object.
  • the organization forms of the objects involved in the read and write operations are the same.
  • the read request may not carry the identifier of the description information of the object.
  • the organization form of the object can be negotiated between the requesting end and the destination end in advance, and the network card of the destination end can obtain the verification information from the object according to the pre-negotiated organization form after receiving the read request.
  • the above step 304 does not need to be performed.
  • Step 306 The network card of the destination end performs consistency check on the data according to the check information.
  • the implementation of the consistency check on the data may include: judging whether the check information of multiple data blocks in the object is all the same, and when the check information of the multiple data blocks is all the same, determining that the data passes the consistency check , then step 307 is performed, and when the verification information of the multiple data blocks is not all the same, it is determined that the data does not pass the consistency check, and step 308 is performed.
  • the verification information of the data block includes the version number of the data block, and performing consistency verification on the data according to the verification information can be realized by judging whether the version numbers of the multiple data blocks of the data are all the same. Among them, each time an operation is performed on the data, a version number is generated. Different version numbers are used to identify different operations performed on the data. When the version numbers of any two data blocks in the object are different, it indicates that the operations performed on the two data blocks are different, and it can be determined that the data cannot pass the consistency check. In addition, when judging whether all the multiple verification information are the same, any one of the multiple verification information can be used as a reference, and the other verification information in the multiple verification information can be compared with the referenced one. The verification information is compared, which is not specifically limited in this embodiment of the present application.
  • Step 307 When the consistency check is passed, the network card of the destination end provides data to the memory of the requesting end.
  • the network card at the destination end can obtain the data from the object according to the description information, and provide the data to the requester.
  • the implementation manner of the destination end providing the data to the requesting end includes: the network card of the destination end performs a verification information stripping operation on the object, obtains the data in the object, and provides the data to the memory of the requesting end.
  • the verification information of any data block can be located at the head or tail of any data block, or the verification information in multiple data blocks in the object can also be placed in other ways, so
  • the check information indicated by the information and the placement position of the data block in the object can be described, and an operation is performed on the data block to obtain the data block.
  • the data block can be left-biased according to the description information. The operation of shifting makes all bytes from the first byte of the object after the offset belong to the payload of the object, and the data after stripping the check information from the object is obtained.
  • the check information of the data block is located at the head of the data block, and the description information of the object indicates that the valid length of the check information of each data block is 10 bytes, then the The 4 data blocks are all shifted to the left by 10 bytes to obtain the data after stripping the header from the object.
  • the parity information stripping operation can be performed according to similar operation logic to obtain the data block.
  • providing data by the network card of the destination end to the memory of the requesting end includes: the network card of the destination end sending the data to the network card of the requesting end, and sending the data to the memory of the requesting end through the network card of the requesting end.
  • the network card of the requesting end may use a direct memory access (direct memory access, DMA) method to write the data into the memory of the requesting end.
  • DMA direct memory access
  • the network card of the destination end sends the data to the network card of the requesting end, it is also necessary to encapsulate the relevant header of the data, so as to send the data to the network card of the requesting end by using a message.
  • the above steps 304 to 307 can be executed in a streaming manner, that is, after some data blocks in the object are read from the memory of the destination end to the network card of the destination end, the above steps 304 to 307 can be executed.
  • a streaming manner By performing the above steps 304 to 307 in a streaming manner, there is no need to wait until all data blocks in the object are read into the network card of the destination end, and then perform the data consistency check operation.
  • the stripping operation can be performed on the data block, and then the data block obtained by the stripping operation can be sent to the requester, and it is not necessary to wait until all data blocks in the object have been verified for consistency.
  • the implementation method of performing consistency check on the data in a streaming manner is: judging whether the check information of the at least two data blocks read are all the same, and when the check information of the at least two data blocks are all the same, It is determined that the at least two data blocks pass the consistency check, and when the check information of the at least two data blocks is not all the same, it is determined that the at least two data blocks do not pass the consistency check.
  • Step 308 When the consistency check fails, the network card of the destination informs the requester that the check fails, so that the requester stops writing the received part of the data into the memory of the requester, and the network card of the destination stops checking the data. The unverified part is checked for consistency, and the part that has passed the verification of the data is stopped to be sent to the requester.
  • the network card of the destination can notify the requester that the verification fails, so that the requester stops writing the received part of the data into the memory of the requester.
  • the network card of the requesting end determines that the consistency check fails, it can also notify the application requesting to read the data to perform conflict resolution processing, such as informing the application to roll back and retry or terminate the transaction.
  • the implementation manner of the network card of the requesting end notifying the application program includes: the network card constructs a message for indicating the failure of the consistency check, and puts the message into a queue that communicates with the application program, and the application program obtains the message from the queue, according to This message informs that the consistency check failed.
  • the implementation manner of the destination end notifying the requesting end includes: replying to the requesting end a read response indicating a failure of the consistency check.
  • a flag bit can be added to the read response, and the consistency check failure can be identified by the value of the flag bit.
  • an opcode can be added to the read response, and the opcode can be used to identify a consistency check failure.
  • the read response can be an RDMA read response ABORT message.
  • the network card of the destination end may also stop performing consistency check on the unchecked part of the data, and stop sending the data to the requesting end.
  • the part of the sent data that has passed the verification it is possible to reduce the resource overhead and time overhead used in the consistency check and transmission of invalid data, improve the utilization rate of resources and ensure the concurrency of the destination end.
  • steps 301 to 308 may be implemented by functional modules.
  • step 301 can be implemented by the initialization module X011 in Figure 2
  • step 302 can be implemented by the network card module X021
  • the first cache module X022 is implemented, and the data read from the memory can be stored in the first cache module X022
  • step 304 is implemented by the matching module X023
  • steps 305 and 306 are implemented by the verification module X024.
  • the verification module X024 sends notification information to the stripping module X025, so that the stripping module X025 performs the verification information stripping operation in step 307 on the objects that have been verified cached in the first cache module X022, and after the stripping operation is completed, the network card Module X021 reads data from the first cache module X022, and performs the operation of sending data to the network card of the requester in step 307. In step 308, the requester is notified that the verification is not realized by the network card module X021. Consistency verification of the unverified part is implemented by the verification module X024, and in step 308, the part that has passed the verification in the data that has passed the verification is stopped by the network card module X021.
  • the unverified object in order to distinguish the verified object from the unverified object, the unverified object can be stored in the first cache module X022, the verification information of the verified object can be stored in the second cache module X026, and the After the requester sends the data in the object, the object is deleted from the first cache module X022.
  • the concurrency control method provided by the embodiment of the present application, by using the network card to perform consistency check and perform the peel operation, it is unnecessary to use the CPU in the server to perform the consistency check and perform the peel operation, and the concurrency of the reading process can be realized. On the basis of control, the CPU overhead due to checksum memory transfer is effectively reduced, and the end-to-end delay is reduced. Moreover, in the process of concurrency control, the consistency check and the stripping operation are implemented by software, which reduces the dependence of the concurrency control on the hardware, and correspondingly reduces the implementation cost of the concurrency control.
  • FIG. 7 is a flowchart of a method executed by a requester in a concurrency control method provided by an embodiment of the present application. As shown in Figure 7, the concurrency control method includes the following steps:
  • Step 701 The application program of the requesting end registers the description information of the object.
  • step 701 please refer to the implementation process of registering the description information of the object by the application program of the destination end in step 301, which will not be repeated here.
  • step 701 and step 301 The difference between step 701 and step 301 is that after the registration of the description information is completed, the application program of the requesting end does not need to send the identifier of the description information to the destination end.
  • Step 702 A read request sent by the network card of the requesting end to the destination end.
  • step 702 please refer to the implementation process of the requesting end sending the read request in step 302, which will not be repeated here.
  • whether to carry the identifier of the description information of the object may also be determined in the read request according to application requirements.
  • Step 703 The network card of the destination acquires the object from the memory of the destination according to the read request, and sends a read response to the requester.
  • the read response carries the identifier of the object and the description information of the object.
  • the object includes the data requested by the requester to be read from the destination and the verification information of the data.
  • the identifier of the description information can be transmitted from the requesting end to the destination end through the read request and read response in the form of an accompanying signal, and then transmitted from the destination end to the requesting end, so that the destination end does not need to perceive the identifier of the description information.
  • Step 704 The network card of the requesting end obtains the description information of the object according to the read response.
  • the network card of the requesting end since the read response carries the identifier of the description information, the network card of the requesting end obtains the description information of the object, including: the network card of the requesting end obtains the identifier of the description information from the read response, and based on the identifier of the description information
  • the mapping relationship between the description information and the identifier established in the network card in step 701 is queried to obtain the description information of the object.
  • Step 705 Based on the description information, the network card of the requester obtains the verification information from the object.
  • the network card of the requesting end can obtain the data of the data read by the read request request in the object according to the storage location indicated by the description information. Check information.
  • the organization forms of the objects involved in the read and write operations are the same.
  • the read request may not carry the identifier of the description information of the object.
  • the organization form of the object can be negotiated between the requesting end and the destination end in advance, and the network card of the requesting end can obtain the verification information from the object according to the pre-negotiated organization form after receiving the read response.
  • the above step 704 does not need to be performed.
  • Step 706 The network card of the requesting end performs consistency check on the data according to the check information.
  • step 706, please refer to the implementation process of step 306, which will not be repeated here.
  • Step 707 When the consistency check is passed, the network card of the requester sends data to the memory of the requester.
  • the network card of the requesting end sends data to the memory of the requesting end, which may be that the network card of the requesting end directly sends the obtained data to the memory of the requesting end.
  • the network card of the requesting end sends data to the memory of the requesting end, which may be that the network card of the requesting end directly sends the obtained data to the memory of the requesting end.
  • this step 707 please refer to the corresponding description in the step 307, which will not be repeated here.
  • Step 708 When the consistency check fails, the network card of the requester stops writing the part of the data that has passed the check into the memory of the requester, and the network card of the requester stops performing consistency check on the unverified part of the data. .
  • step 708 For the implementation process of step 708, please refer to the relevant description in step 308 accordingly, and details are not repeated here.
  • steps 701 to 708 may be implemented by functional modules.
  • the function of the network card in the requester is realized by the function module shown in Fig. 2, as shown in Fig. 8, step 701 can be realized by the initialization module X011 in Fig. 2, step 702 can be realized by the network card module X021, step 704 can be realized by matching
  • the module X023 is implemented, and the steps 705 and 706 are implemented by the verification module X024.
  • the verification module X024 sends notification information to the stripping module X025, so that the stripping module X025 can verify the cached in the first cache module X022.
  • the object performs the verification information stripping operation in step 707, and after the stripping operation is completed, the first cache module X022 performs the operation of sending data to the memory of the requester in step 707, and in step 708, stops the part of the data that has passed the verification Writing to the memory of the requesting end is implemented by the first cache module X022, and in step 708, stopping the consistency verification of the unverified part of the data is implemented by the verification module X024.
  • the unverified object can also be stored in the first cache module X022, and the verification information of the verified object can be stored in the second cache module X026, and stored in the second cache module X026.
  • the object After the data in the object is sent to the memory of the requester, the object is deleted from the first cache module X022.
  • the network card module X021 can obtain the object from the read response, and store the object in the first cache module X022.
  • the network card by using the network card to perform consistency check and perform the peel operation, it is unnecessary to use the CPU in the server to perform the consistency check and perform the peel operation, which can achieve Based on the concurrency control of the reading process, the CPU overhead due to checksum memory transfer is effectively reduced, and the end-to-end delay is reduced.
  • the functions implemented by the network card can be implemented by software, thus reducing the concurrency control dependence on hardware and correspondingly reducing the implementation cost of the concurrency control.
  • the network card 90 includes:
  • the obtaining unit 901 is configured to obtain an object, where the object carries the data requested by the requesting end to be read from the destination end and the verification information of the data.
  • the verification unit 902 is configured to perform consistency verification on the data according to the verification information.
  • the interaction unit 903 is configured to provide data to the memory of the requester when the consistency check is passed.
  • the network card 90 further includes: a stripping unit 904, configured to perform a stripping operation of verification information on the object to obtain data when the consistency check is passed.
  • a stripping unit 904 configured to perform a stripping operation of verification information on the object to obtain data when the consistency check is passed.
  • the interaction unit 903 is specifically configured to provide data to the memory of the requester.
  • the network card is deployed in the destination, and the interaction unit 903 is further configured to notify the requester that the verification fails when the consistency check fails.
  • the network card is deployed in the destination end, and the verification unit 902 is further configured to stop the consistency verification of the unverified part of the data when the consistency verification fails.
  • the interaction unit 903 is further configured to stop sending the part of the data that has passed the check to the requesting end when the consistency check fails.
  • the network card is deployed in the requester, and the interaction unit 903 is further configured to stop writing the part of the data that has passed the check into the memory of the requester when the consistency check fails.
  • the network card is deployed in the requester, and the verification unit 902 is further configured to stop the consistency verification of the unverified part of the data when the consistency verification fails.
  • the interaction unit 903 is further configured to receive a read request sent by the requester, where the read request is used to request to read data.
  • the obtaining unit 901 is specifically configured to obtain the object from the memory of the destination end according to the read request.
  • the network card is deployed in the destination, and the interaction unit 903 is specifically configured to send data to the network card of the requester, so that the network card of the requester sends data to the memory of the requester.
  • the network card is deployed in the requesting end, and the interaction unit 903 is further configured to send a read request to the destination end, where the read request is used to request to read data.
  • the obtaining unit 901 is specifically configured to receive the object sent by the network card of the destination end, and the object is obtained by the network card of the destination end in the destination end based on the read request.
  • the network card is deployed in the requester, and the interaction unit 903 is specifically configured to directly send data to the memory of the requester.
  • the obtaining unit 901 is further configured to obtain description information of the object, where the description information is used to indicate the organization form of the object.
  • the verification unit 902 is further configured to obtain verification information from the object based on the description information.
  • the obtaining unit 901 is specifically configured to: obtain the identifier of the description information; and obtain the description information based on the identifier of the description information and the mapping relationship, and the mapping relationship reflects the corresponding relationship between the description information and the identifier.
  • the network card is deployed in the destination end, and the interaction unit 903 is further configured to receive a read request sent by the requesting end, where the read request carries the identifier of the description information.
  • the obtaining unit 901 is specifically configured to obtain the identifier of the description information from the read request.
  • the network card is deployed in the requester, and the interaction unit 903 is further configured to receive a read response sent by the destination based on the read request.
  • the read response carries the identifier of the description information, and the identifier of the description information is sent to the destination through the read request.
  • the obtaining unit 901 is specifically configured to obtain the identifier of the description information from the read response.
  • the network card provided in the embodiment of the present application, by using the verification unit in the network card to perform consistency check, and the peeling unit to perform the peeling operation, it is unnecessary to use the CPU in the server to perform consistency check and perform peeling. operation, on the basis of realizing the concurrency control of the reading process, the CPU overhead due to checksum memory transfer can be effectively reduced, and the end-to-end delay can be reduced.
  • the functions of some or all of the units in the network card can be implemented by software, so that the dependence of the concurrency control on the hardware is reduced, and the implementation cost of the concurrency control is correspondingly reduced.
  • the above division of units in the network card is only an example, and is not used to limit the implementation of the network card provided by the embodiments of the present application.
  • the method of dividing the functional modules in the network card in the embodiments of the present application may be performed according to application requirements. Adjustment.
  • the network card can be further subdivided. Please refer to the division method of the programmable network card in FIG. 2 for the division method. As shown in FIG.
  • the functions implemented by the network card module X021 refer to the functions implemented by the interaction unit in the foregoing
  • the functions implemented by the verification module X024 refer to the functions implemented by the verification unit in the previous embodiment
  • the functions implemented by the stripping module X025 refer to the functions implemented by the stripping units in the previous embodiments
  • the functions implemented by the matching module X023 refer to the acquisition units in the previous embodiments to obtain descriptions
  • FIG. 11 exemplarily provides a possible architectural diagram of a computer device.
  • the computer device 110 may include a network card 1101 , a memory 1102 , a communication interface 1103 and a bus 1104 .
  • the number of network cards 1101 may be one or more, and FIG. 11 only illustrates one of the network cards 1101 .
  • the computer device 110 may further include a processor 1105, and the processor 1105 may be a central processing unit (Central Processing Unit, CPU). If the computer device has multiple processors, the multiple processors may be of different types or may be the same.
  • multiple processors of the computer device may also be integrated into a multi-core processor.
  • the network card 1101 is used for data interaction with other computer devices.
  • the process of the consistency check may be performed by the network card 1101 .
  • the network card 1101 is further configured to strip the verification information of the data blocks in the object, obtain the data requested by the requester to read, and provide the data to the memory of the requester.
  • the network card 1001 can support various read and write operations of different read and write scales, and the data and verification information of the read and write operations of the various read and write scales are organized in different forms in the object.
  • the network card 1001 performs operations such as checksum stripping and the like, which may be implemented by program codes.
  • the network card 1001 for performing the consistency check may be a programmable network card.
  • the behavior of the network card 1001 can be changed by modifying program codes such as firmware or microcode in the programmable network card, so that the network card 1001 has the above functions.
  • the network card 1001 is configured with a remote direct memory access function.
  • the memory 1102 stores computer instructions and data, and the memory 1102 may store computer instructions and data required to implement the concurrency control method provided by the present application.
  • the memory 1102 can be any one or any combination of the following storage media: non-volatile memory (such as read-only memory (Read-Only Memory, ROM), solid state disk (Solid State Disk, SSD), hard disk (Hard Disk) Drive, HDD), optical disc, etc., volatile memory.
  • non-volatile memory such as read-only memory (Read-Only Memory, ROM), solid state disk (Solid State Disk, SSD), hard disk (Hard Disk) Drive, HDD), optical disc, etc., volatile memory.
  • the communication interface 1103 may be any one or any combination of the following devices: a network interface (eg, an Ethernet interface) having a network access function.
  • a network interface eg, an Ethernet interface having a network access function.
  • the communication interface 1103 is used for data communication between the computer device and other nodes or other computer devices.
  • FIG. 11 also exemplarily depicts bus 1104 .
  • the bus 1104 can connect the network card 1101 with the memory 1102 and the communication interface 1103 .
  • the network card 1101 can access the memory 1102, and can also use the communication interface 1103 to perform data interaction with other nodes or other computer devices.
  • the computer program is stored in the memory of the computer device, and the network card executes the computer program in the memory 1102 to implement the concurrency control method provided by the present application.
  • Embodiments of the present application further provide a storage medium, which is a non-transitory computer-readable storage medium.
  • a storage medium which is a non-transitory computer-readable storage medium.
  • the network card executes the concurrency control method provided by the embodiments of the present application.
  • the embodiments of the present application also provide a computer program product including instructions, when the computer program product runs on the network card, the network card is made to execute the concurrency control method provided by the embodiments of the present application.
  • the terms “first”, “second” and “third” are only used for description purposes, and cannot be understood as indicating or implying relative importance.
  • the term “at least one” refers to one or more, and the term “plurality” refers to two or more, unless expressly limited otherwise.

Abstract

The present application belongs to the technical field of concurrency control. Disclosed are a concurrency control method, a network card, a computer device, and a storage medium. The method comprises: a network card acquiring an object, wherein the object carries data that a requesting end requests to read from a destination end, and check information of the data; the network card performing consistency check on the data according to the check information; and when the consistency check is passed, the network card providing the data for a memory of the requesting end. By means of the present application, CPU overheads are effectively saved on.

Description

并发控制方法、网卡、计算机设备、存储介质Concurrency control method, network card, computer equipment, storage medium
本申请要求于2021年03月16日提交的申请号为202110281600.X、发明名称为“并发控制方法、网卡、计算机设备、存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on March 16, 2021 with the application number 202110281600.X and the invention titled "Concurrency control method, network card, computer equipment, storage medium", the entire contents of which are incorporated by reference in in this application.
技术领域technical field
本申请涉及并发控制技术领域,特别涉及一种并发控制方法、网卡、计算机设备、存储介质。The present application relates to the technical field of concurrency control, and in particular, to a concurrency control method, a network card, a computer device, and a storage medium.
背景技术Background technique
并发控制把事务作为调度的基本单位。并发控制的目的是合理安排事务的并发调度以避免冲突,提高系统的正确性和利用率。Concurrency control regards the transaction as the basic unit of scheduling. The purpose of concurrency control is to reasonably arrange the concurrent scheduling of transactions to avoid conflicts and improve the correctness and utilization of the system.
相关技术中,当请求端需要从目的端中读取数据时,为了进行并发控制,需要对请求端请求读取的数据进行一致性校验,以保证在读取数据的过程中没有对请求读取的数据执行更新操作,即该读取数据的操作不存在并发冲突。In the related art, when the requester needs to read data from the destination, in order to perform concurrency control, it is necessary to perform a consistency check on the data requested by the requester to ensure that the request is not read during the process of reading the data. The fetched data performs an update operation, that is, there is no concurrency conflict in the operation of reading the data.
但是,该校验操作通常由请求端的中央处理器(central processing unit,CPU)执行,导致cpu的开销较大。However, the verification operation is usually performed by a central processing unit (CPU) at the requesting side, resulting in a large CPU overhead.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种并发控制方法、网卡、计算机设备、存储介质。本申请有效地降低了CPU开销。本申请提供的技术方案如下:The present application provides a concurrency control method, a network card, a computer device, and a storage medium. The present application effectively reduces CPU overhead. The technical solutions provided by this application are as follows:
第一方面,本申请提供了一种并发控制方法,该方法包括:网卡获取对象,对象携带有请求端请求从目的端读取的数据和数据的校验信息;网卡根据校验信息,对数据进行一致性校验;当一致性校验通过时,网卡向请求端的内存提供数据。In a first aspect, the present application provides a concurrency control method. The method includes: a network card obtains an object, and the object carries data requested by a requester to be read from a destination and verification information of the data; Perform consistency check; when the consistency check passes, the network card provides data to the memory of the requester.
通过采用网卡进行一致性校验,使得无需使用服务器中的CPU进行一致性校验,能够在实现读取过程的并发控制的基础上,有效地减小因校验和内存搬移耗费的CPU开销,降低了端到端的时延。By using the network card for consistency check, the CPU in the server does not need to be used for consistency check, and on the basis of realizing the concurrency control of the reading process, the CPU overhead caused by check and memory transfer can be effectively reduced. End-to-end delay is reduced.
在一种可实现方式中,当一致性校验通过时,网卡向请求端的内存提供数据,包括:当一致性校验通过时,网卡对对象执行校验信息剥离操作,得到数据;网卡向请求端的内存提供数据。In an implementation manner, when the consistency check is passed, the network card provides data to the memory of the requester, including: when the consistency check is passed, the network card performs a verification information stripping operation on the object to obtain data; The memory on the side provides the data.
通过采用网卡执行剥离操作,使得无需使用服务器中的CPU执行剥离操作,能够在实现读取过程的并发控制的基础上,有效地减小因校验和内存搬移耗费的CPU开销,降低了端到端的时延。By using the network card to perform the stripping operation, it is unnecessary to use the CPU in the server to perform the stripping operation. On the basis of realizing the concurrency control of the reading process, the CPU overhead due to checksum memory transfer can be effectively reduced, and the end-to-end end delay.
在一种可实现方式中,当网卡部署在目的端中时,网卡根据校验信息,对数据进行一致性校验之后,方法还包括:当一致性校验不通过时,网卡通知请求端校验不通过。通过及时通知请求端一致性校验不通过,能够有效降低因处理无效数据产生的开销。In an implementation manner, when the network card is deployed in the destination, after the network card performs consistency check on the data according to the verification information, the method further includes: when the consistency check fails, the network card notifies the requester to verify the data. Failed to pass the test. By timely notifying the requester that the consistency check fails, the overhead caused by processing invalid data can be effectively reduced.
在一种可实现方式中,当网卡部署在目的端中时,网卡根据校验信息,对数据进行一致性校验之后,方法还包括:当一致性校验不通过时,网卡停止对数据中未校验的部分进行一致性校验,并停止向请求端发送数据中已通过校验的部分。这样一来,能够减小对无效数据进行一致性校验和传输使用的资源开销和时间开销,提高资源的利用率和保证目的端的并发度。In an implementation manner, when the network card is deployed in the destination, after the network card performs consistency check on the data according to the verification information, the method further includes: when the consistency check fails, the network card stops checking the data in the data. The unverified part is checked for consistency, and the part that has passed the verification of the data is stopped to be sent to the requester. In this way, it is possible to reduce the resource overhead and time overhead used in the consistency check and transmission of invalid data, improve the utilization rate of resources and ensure the concurrency of the destination end.
在一种可实现方式中,当网卡部署在请求端中时,网卡根据校验信息,对数据进行一致性校验之后,方法还包括:当一致性校验不通过时,网卡停止将数据中已通过校验的部分写入请求端的内存中。这样一来,能够减小对无效数据进行传输使用的资源开销和时间开销,提高资源的利用率和保证目的端的并发度。In an implementation manner, when the network card is deployed in the requester, after the network card performs consistency check on the data according to the verification information, the method further includes: when the consistency check fails, the network card stops storing the data in the data. The part that has passed the verification is written to the memory of the requester. In this way, the resource overhead and time overhead of transmitting invalid data can be reduced, the utilization rate of resources can be improved, and the concurrency of the destination end can be guaranteed.
在一种可实现方式中,当网卡部署在请求端中时,网卡根据校验信息,对数据进行一致性校验之后,方法还包括:当一致性校验不通过时,网卡停止对数据中未校验的部分进行一致性校验。这样一来,能够减小对无效数据进行一致性校验使用的资源开销和时间开销,提高资源的利用率和保证目的端的并发度。In an implementation manner, when the network card is deployed in the requester, after the network card performs consistency check on the data according to the verification information, the method further includes: when the consistency check fails, the network card stops checking the data in the data. The unverified part is checked for consistency. In this way, it is possible to reduce the resource overhead and time overhead used for the consistency check of invalid data, improve the utilization rate of resources and ensure the concurrency of the destination end.
可选地,当网卡部署在目的端中时,对象可以从内存中读取。作为一种可实现方式,网卡获取对象,包括:网卡接收请求端发送的读请求,读请求用于请求读取数据;网卡根据读请求,从目的端的内存中获取对象。Optionally, the object can be read from memory when the network card is deployed in the destination. As an achievable manner, obtaining the object by the network card includes: the network card receives a read request sent by the requester, and the read request is used to request to read data; and the network card obtains the object from the memory of the destination terminal according to the read request.
并且,网卡向请求端的内存提供数据,包括:网卡向请求端的网卡发送数据,使得请求端的网卡向请求端的内存发送数据。In addition, the network card provides data to the memory of the requester, including: the network card sends data to the network card of the requester, so that the network card of the requester sends data to the memory of the requester.
可选地,当网卡部署在请求端中时,对象由目的端提供。作为一种可实现方式,在网卡获取对象之前,该方法还包括:网卡向目的端发送读请求,读请求用于请求读取数据;相应的,网卡获取对象,包括:网卡接收目的端的网卡发送的对象,对象由目的端的网卡基于读请求在目的端中获得。Optionally, when the network card is deployed in the requester, the object is provided by the destination. As an achievable manner, before the network card obtains the object, the method further includes: the network card sends a read request to the destination, and the read request is used to request to read data; correspondingly, the network card obtains the object, including: the network card receives the network card sent by the destination end. The object is obtained by the network card of the destination based on the read request.
在一种可实现方式中,当网卡部署在请求端中时,网卡向请求端的内存提供数据,包括:网卡直接向请求端的内存发送数据。In an implementation manner, when the network card is deployed in the requester, the network card provides data to the memory of the requester, including: the network card directly sends data to the memory of the requester.
可选地,当本申请提供的网卡能够支持多种不同读写规模的读写操作时,不同读写规模涉及的数据的校验信息在对象中的组织形式可能相同或不同,不同组织形式地校验信息可以通过描述信息进行描述。相应的,在网卡根据校验信息,对数据进行一致性校验之前,该方法还包括:网卡获取对象的描述信息,描述信息用于指示对象的组织形式;网卡基于描述信息,从对象中获取校验信息。Optionally, when the network card provided by this application can support a variety of read and write operations of different read and write scales, the organization forms of the verification information of the data involved in different read and write scales in the object may be the same or different. The verification information can be described by description information. Correspondingly, before the network card performs consistency check on the data according to the verification information, the method further includes: the network card obtains description information of the object, and the description information is used to indicate the organization form of the object; and the network card obtains from the object based on the description information. Check information.
其中,为了区分用于描述不同组织形式的描述信息,还可以为用于描述不同组织形式的描述信息分配标识,相应的,网卡获取对象的描述信息,包括:网卡获取描述信息的标识;网卡基于描述信息的标识和映射关系,获取描述信息,映射关系反映描述信息和标识的对应关系。Among them, in order to distinguish the description information used to describe different organizational forms, an identifier can also be assigned to the description information used to describe different organizational forms. Correspondingly, the network card obtains the description information of the object, including: the network card obtains the identifier of the description information; the network card is based on the The identification and mapping relationship of the description information is obtained, and the description information is obtained, and the mapping relationship reflects the corresponding relationship between the description information and the identification.
在一种可实现方式中,当网卡部署在目的端中时,网卡获取描述信息的标识,包括:网卡接收请求端发送的读请求,读请求携带有描述信息的标识;网卡从读请求中获取描述信息的标识。In an implementation manner, when the network card is deployed in the destination terminal, the network card obtains the identifier of the description information, including: the network card receives a read request sent by the requester, and the read request carries the identifier of the description information; the network card obtains from the read request An identifier that describes the information.
在另一种可实现方式中,当网卡部署在请求端中时,网卡获取描述信息的标识,包括:网卡接收目的端基于读请求发送的读响应,读响应携带有描述信息的标识,描述信息的标识通过读请求发送至目的端;网卡从读响应中获取描述信息的标识。In another implementation manner, when the network card is deployed in the requester, the network card obtains the identifier of the description information, including: the network card receives a read response sent by the destination terminal based on the read request, and the read response carries the identifier of the description information, and the description information The identifier of the id is sent to the destination through the read request; the network card obtains the identifier of the description information from the read response.
第二方面,本申请提供了一种网卡,网卡包括:获取单元,用于获取对象,对象携带有请求端请求从目的端读取的数据和数据的校验信息;校验单元,用于根据校验信息,对数据进行一致性校验;交互单元,用于当一致性校验通过时,向请求端的内存提供数据。In a second aspect, the present application provides a network card, the network card includes: an acquisition unit for acquiring an object, the object carrying data requested by a requester to be read from a destination and verification information of the data; a verification unit for The verification information is used to check the consistency of the data; the interaction unit is used to provide data to the memory of the requester when the consistency check is passed.
可选地,网卡,还包括:剥离单元,用于当一致性校验通过时,对对象执行校验信息剥离操作,得到数据;交互单元,具体用于向请求端的内存提供数据。Optionally, the network card further includes: a stripping unit, configured to perform a verification information stripping operation on the object to obtain data when the consistency check is passed; an interaction unit, specifically configured to provide data to the memory of the requester.
可选地,网卡部署在目的端中,交互单元,还用于当一致性校验不通过时,通知请求端校验不通过。Optionally, the network card is deployed in the destination, and the interaction unit is further configured to notify the requester that the verification fails when the consistency check fails.
可选地,网卡部署在目的端中,校验单元,还用于当一致性校验不通过时,停止对数据中未校验的部分进行一致性校验;交互单元,还用于当一致性校验不通过时,停止向请求端发送数据中已通过校验的部分。Optionally, the network card is deployed in the destination, and the check unit is also used to stop the consistency check on the unchecked part of the data when the consistency check fails; the interaction unit is also used to check the consistency When the verification fails, stop sending the part of the data that has passed the verification to the requester.
可选地,网卡部署在请求端中,交互单元还用于当一致性校验不通过时,停止将数据中已通过校验的部分写入请求端的内存中。Optionally, the network card is deployed in the requester, and the interaction unit is further configured to stop writing the part of the data that has passed the check into the memory of the requester when the consistency check fails.
可选地,网卡部署在请求端中,校验单元还用于当一致性校验不通过时,停止对数据中未校验的部分进行一致性校验。Optionally, the network card is deployed in the requester, and the verification unit is further configured to stop the consistency verification of the unverified part of the data when the consistency verification fails.
可选地,交互单元,还用于接收请求端发送的读请求,读请求用于请求读取数据;获取单元,具体用于根据读请求,从目的端的内存中获取对象。Optionally, the interaction unit is further configured to receive a read request sent by the requesting end, and the read request is used to request to read data; the obtaining unit is specifically configured to obtain the object from the memory of the destination end according to the read request.
可选地,网卡部署在目的端中,交互单元,具体用于向请求端的网卡发送数据,使得请求端的网卡向请求端的内存发送数据。Optionally, the network card is deployed in the destination, and the interaction unit is specifically configured to send data to the network card of the requester, so that the network card of the requester sends data to the memory of the requester.
可选地,网卡部署在请求端中,交互单元,还用于向目的端发送读请求,读请求用于请求读取数据;获取单元,具体用于接收目的端的网卡发送的对象,对象由目的端的网卡基于读请求在目的端中获得。Optionally, the network card is deployed in the requesting end, and the interaction unit is also used to send a read request to the destination end, and the read request is used to request to read data; the acquiring unit is specifically used to receive the object sent by the network card of the destination end, and the object is sent by the destination end. The network card of the end is obtained in the destination end based on the read request.
可选地,网卡部署在请求端中,交互单元,具体用于直接向请求端的内存发送数据。Optionally, the network card is deployed in the requester, and the interaction unit is specifically configured to directly send data to the memory of the requester.
可选地,获取单元,还用于获取对象的描述信息,描述信息用于指示对象的组织形式;校验单元,还用于基于描述信息,从对象中获取校验信息。Optionally, the acquiring unit is further configured to acquire description information of the object, where the description information is used to indicate the organization form of the object; the verification unit is further configured to acquire verification information from the object based on the description information.
可选地,获取单元,具体用于:获取描述信息的标识;基于描述信息的标识和映射关系,获取描述信息,映射关系反映描述信息和标识的对应关系。Optionally, the obtaining unit is specifically configured to: obtain the identifier of the description information; and obtain the description information based on the identifier of the description information and a mapping relationship, and the mapping relationship reflects the corresponding relationship between the description information and the identifier.
可选地,网卡部署在目的端中,交互单元,还用于接收请求端发送的读请求,读请求携带有描述信息的标识;获取单元,具体用于从读请求中获取描述信息的标识。Optionally, the network card is deployed in the destination terminal, and the interaction unit is further configured to receive a read request sent by the requester, and the read request carries the identifier of the description information; the acquisition unit is specifically configured to obtain the identifier of the description information from the read request.
可选地,网卡部署在请求端中,交互单元,还用于接收目的端基于读请求发送的读响应,读响应携带有描述信息的标识,描述信息的标识通过读请求发送至目的端;获取单元,具体用于从读响应中获取描述信息的标识。Optionally, the network card is deployed in the requester, and the interaction unit is further configured to receive a read response sent by the destination based on the read request, the read response carries an identifier of the description information, and the identifier of the description information is sent to the destination through the read request; The unit is specifically used to obtain the identifier of the description information from the read response.
第三方面,本申请提供了一种计算机设备,计算机设备包括:网卡和存储器,存储器中存储有计算机程序;网卡执行计算机程序时,实现本申请第一方面以及其任一种可能的实现方式中提供的方法。In a third aspect, the present application provides a computer device, the computer device includes: a network card and a memory, and a computer program is stored in the memory; when the network card executes the computer program, the first aspect of the present application and any possible implementation manner thereof are realized. provided method.
第四方面,本申请提供了一种非瞬态的计算机可读存储介质,当计算机可读存储介质中的指令被网卡执行时,网卡执行本申请第一方面以及其任一种可能的实现方式中提供的方法。In a fourth aspect, the present application provides a non-transitory computer-readable storage medium. When an instruction in the computer-readable storage medium is executed by a network card, the network card executes the first aspect of the present application and any possible implementations thereof. method provided in.
第五方面,本申请提供了一种包含指令的计算机程序产品,当计算机程序产品在网卡上运行时,使得网卡执行本申请第一方面以及其任一种可能的实现方式中提供的方法。In a fifth aspect, the present application provides a computer program product including instructions, which, when the computer program product runs on a network card, enables the network card to execute the method provided in the first aspect of the present application and any possible implementations thereof.
附图说明Description of drawings
图1是本申请实施例提供的一种并发控制方法涉及的应用场景的示意图;1 is a schematic diagram of an application scenario involved in a concurrency control method provided by an embodiment of the present application;
图2是本申请实施例提供的一种网卡的结构示意图;FIG. 2 is a schematic structural diagram of a network card provided by an embodiment of the present application;
图3是本申请实施例提供的一种并发控制方法的流程图;3 is a flowchart of a concurrency control method provided by an embodiment of the present application;
图4是本申请实施例提供的一种对象的存储方式的示意图;4 is a schematic diagram of a storage method of an object provided by an embodiment of the present application;
图5是本申请实施例提供的另一种对象的存储方式的示意图;FIG. 5 is a schematic diagram of another object storage method provided by an embodiment of the present application;
图6是本申请实施例提供的一种目的端的网卡执行并发控制方法的示意图;6 is a schematic diagram of a method for performing concurrency control on a network card of a destination end provided by an embodiment of the present application;
图7是本申请实施例提供的另一种并发控制方法的流程图;7 is a flowchart of another concurrency control method provided by an embodiment of the present application;
图8是本申请实施例提供的一种请求端的网卡执行并发控制方法的示意图;8 is a schematic diagram of a method for performing concurrency control on a network card of a requester provided by an embodiment of the present application;
图9是本申请实施例提供的另一种网卡的结构示意图;9 is a schematic structural diagram of another network card provided by an embodiment of the present application;
图10是本申请实施例提供的又一种网卡的结构示意图;10 is a schematic structural diagram of another network card provided by an embodiment of the present application;
图11是本申请实施例提供的一种计算机设备的结构示意图。FIG. 11 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
为便于理解,下面先对本申请实施例中涉及的相关背景知识进行介绍。For ease of understanding, the relevant background knowledge involved in the embodiments of the present application is first introduced below.
事务(transaction)是一个逻辑操作单元,事务是由事务开始与事务结束之间执行的全部操作构成的操作序列。一个事务中的所有操作是一个执行整体,整个事务中的所有操作要么成功执行,要么全都失败,且事务失败时可通过中止或回滚策略保证对事物中操作的操作对象不产生影响。A transaction is a logical unit of operation, and a transaction is a sequence of operations consisting of all operations performed between the start of a transaction and the end of a transaction. All operations in a transaction are executed as a whole. All operations in the entire transaction are either successfully executed or all fail. When a transaction fails, an abort or rollback strategy can be used to ensure that the operation objects in the transaction will not be affected.
并发控制(concurrency control,CC)用于将对同一对象进行操作的多个并发事务串行化,是确保及时发现并纠正由并发操作导致的错误的一种机制。当某一对象的并发事务包括读操作事务和写操作事务时,可以通过并发控制将读操作事务和写操作事务串行化,以防止在读操作过程中同时执行写操作、在读操作过程中同时执行读操作、在写操作的过程中同时执行读操作、或在写操作的过程中同时执行其他写操作等并发操作,从而保证数据的一致性。Concurrency control (CC) is used to serialize multiple concurrent transactions that operate on the same object, and is a mechanism to ensure timely detection and correction of errors caused by concurrent operations. When the concurrent transactions of an object include read operation transactions and write operation transactions, the read operation transaction and the write operation transaction can be serialized through concurrency control to prevent the simultaneous execution of the write operation during the read operation and the simultaneous execution of the read operation during the read operation. Read operations, concurrently perform read operations during a write operation, or perform concurrent operations such as other write operations during a write operation to ensure data consistency.
大多数实现系统采用锁方法实现并发控制。采用锁方法实现并发控制的原理为:在事务对对象进行操作时,对对象加锁,以防止在事务的执行过程中其他事务对该对象进行操作,并在完成该事物后释放加在对象上的锁。然而锁方法会增加实现系统的开销,并降低了实现系统潜在的并发度。Most implementation systems implement concurrency control using locking methods. The principle of using the lock method to achieve concurrency control is: when a transaction operates on an object, the object is locked to prevent other transactions from operating on the object during the execution of the transaction, and the object is released after the transaction is completed. lock. However, the locking method will increase the overhead of the implementation system and reduce the potential concurrency of the implementation system.
实现并发控制的另一种机制是乐观并发控制(optimistic concurrency control,OCC)。乐观并发控制是一种无锁(lock free)的并发控制机制,它基于一种乐观的冲突检测策略进行并发控制,能够在实现并发控制的基础上最大化并行效率。使用乐观并发控制时,事务的执行过程包括执行阶段、验证阶段和提交阶段。在执行阶段,根据事务的逻辑对对象进行操作。在验证阶段,判断事务在对象上的操作是否与其他事务对该对象的操作存在冲突,若事务在对象上的操作未与其他事务对该对象的操作存在冲突,则允许事务进入提交阶段,否则,需要对存在冲突的事务使用冲突解决机制。在提交阶段,提交事务对对象的操作产生的更新,使得更新持久化。Another mechanism for implementing concurrency control is optimistic concurrency control (OCC). Optimistic concurrency control is a lock-free concurrency control mechanism, which is based on an optimistic conflict detection strategy for concurrency control, which can maximize parallel efficiency on the basis of concurrency control. When optimistic concurrency control is used, the execution process of a transaction includes an execute phase, a verification phase, and a commit phase. During the execution phase, objects are manipulated according to the logic of the transaction. In the verification phase, it is judged whether the operation of the transaction on the object conflicts with the operations of other transactions on the object. If the operation of the transaction on the object does not conflict with the operations of other transactions on the object, the transaction is allowed to enter the commit phase, otherwise , you need to use a conflict resolution mechanism for conflicting transactions. During the commit phase, the updates generated by the transaction's operations on the object are committed, making the updates persistent.
分布式事务是涉及多个服务器的事务,该分布式事务的实现需要该多个服务器协同合作。 在分布式事务中,每个服务器对自己管理的对象应用本地的并发控制,以保证事务在本地是串行化的,同时还需要对整个分布式事务进行并发控制,以保证全局的串行化。A distributed transaction is a transaction involving multiple servers, and the realization of the distributed transaction requires the cooperation of the multiple servers. In a distributed transaction, each server applies local concurrency control to the objects it manages to ensure that the transaction is serialized locally, and concurrent control of the entire distributed transaction is required to ensure global serialization .
其中,利用乐观并发控制可以对分布式事务中无锁读(lock-free read)的过程进行并发控制。但是,该利用乐观并发控制实现无锁读的过程会导致服务器中中央处理器(central processing unit,CPU)开销较大。Among them, the use of optimistic concurrency control can control the concurrency of the lock-free read process in distributed transactions. However, the process of using optimistic concurrency control to achieve lock-free reading will result in a large central processing unit (CPU) overhead in the server.
本申请实施例提供了一种并发控制方法。网卡获取对象,根据对象携带的校验信息对对象中的数据进行一致性校验,并在一致性校验通过时,向请求端的内存提供数据。其中,对象携带有请求端请求从目的端读取的数据和数据的校验信息。在该并发控制方法中,通过采用网卡进行一致性校验,使得无需使用服务器中的CPU进行一致性校验,能够在实现读取过程的并发控制的基础上,有效地减小CPU开销。其中,对象携带的数据为请求端请求从目的端读取的内容的统称。The embodiments of the present application provide a concurrency control method. The network card obtains the object, performs consistency verification on the data in the object according to the verification information carried by the object, and provides data to the memory of the requester when the consistency verification passes. The object carries the data requested by the requester to be read from the destination and the verification information of the data. In the concurrency control method, by using a network card to perform consistency check, the CPU in the server does not need to be used for consistency check, and the CPU overhead can be effectively reduced on the basis of realizing the concurrency control of the reading process. The data carried by the object is a general term for the content requested by the requester to be read from the destination.
图1是本申请实施例提供的一种并发控制方法涉及的实施场景。该实施场景包括:至少两个服务节点。该至少两个服务节点中每个服务器节点中均部署有网卡,该至少两个服务节点中两两之间通过网卡实现数据传输。在读数据的场景中,该至少两个服务节点中的一个服务节点用作目的端,该目的端中存储有数据。该至少两个服务节点中除作为目的端的服务节点外的一个或多个服务节点用作请求端,该请求端用于请求从目的端中读取数据。其中,图1是该应用场景包括第一服务节点10和第二服务节点20的示意图,该第一服务节点10和第二服务节点20中的一个用作请求端,另一个用作目的端。FIG. 1 is an implementation scenario involved in a concurrency control method provided by an embodiment of the present application. The implementation scenario includes: at least two service nodes. A network card is deployed in each of the at least two service nodes, and data transmission between the at least two service nodes is implemented through the network card. In the scenario of reading data, one of the at least two service nodes is used as a destination, and the destination stores data. Among the at least two service nodes, one or more service nodes other than the service node serving as the destination serve as a requester, and the requester is used for requesting to read data from the destination. 1 is a schematic diagram of the application scenario including a first service node 10 and a second service node 20, one of the first service node 10 and the second service node 20 is used as a requester, and the other is used as a destination.
可选地,该实施场景中的服务节点可以通过物理机、包括多个物理机的物理机集群、裸金属服务器或云服务器等实现。Optionally, the service node in this implementation scenario may be implemented by a physical machine, a physical machine cluster including multiple physical machines, a bare metal server, or a cloud server, or the like.
请求端从目的端中读数据的过程包括:请求端向目的端发送读请求,目的端根据该读请求在该目的端中获取读请求请求读取的数据,并向请求端提供该数据。并且,为了对该读数据的过程进行并发控制,该读数据的过程还包括:对读请求请求读取的数据进行一致性校验。在本申请实施例中,该一致性校验的过程可以由目的端的网卡执行,也可以由请求端的网卡执行。The process of the requester reading data from the destination includes: the requester sends a read request to the destination, the destination obtains the data read by the read request from the destination according to the read request, and provides the data to the requester. In addition, in order to control the concurrency of the process of reading data, the process of reading data further includes: performing consistency check on the data read by the read request. In this embodiment of the present application, the consistency check process may be performed by a network card at the destination end or by a network card at the requesting end.
并且,目的端通常以对象(object)为单位在内存中存储数据,其中,对象包括数据和用于对数据进行校验的校验信息。对象中的数据通常以数据块的形式进行存储,即对象通常包括一个或多个数据块。并且,每个数据块均具有校验信息,任一数据块的校验信息可以位于该任一数据块的头部、尾部,或者对象中多个数据块中校验信息也可以按照其他方式进行放置。而请求端需要获取的是该对象中的数据,因此在数据通过校验时,网卡还用于剥离(stripping)对象中数据的校验信息,例如从对象中剥离位于数据块头部的校验信息,得到请求端请求读取的数据,并向请求端的内存提供该数据。通过网卡执行剥离操作,能够减小CPU执行剥离操作带来的CPU和内存等开销。In addition, the destination usually stores data in the memory in the unit of an object (object), wherein the object includes data and verification information for verifying the data. The data in the object is usually stored in the form of data blocks, that is, the object usually includes one or more data blocks. In addition, each data block has verification information, and the verification information of any data block can be located at the head or tail of any data block, or the verification information in multiple data blocks in the object can also be performed in other ways. place. What the requester needs to obtain is the data in the object, so when the data passes the verification, the network card is also used to strip (stripping) the verification information of the data in the object, such as stripping the verification information at the head of the data block from the object. information, obtain the data requested by the requester to read, and provide the data to the memory of the requester. Performing the stripping operation through the network card can reduce the CPU and memory overhead caused by the CPU performing the stripping operation.
进一步地,本申请实施例提供的网卡能够支持多种不同读写规模的读写操作,且该多种读写规模的读写操作的数据和校验信息在对象中的组织形式不同。其中,组织形式用于指示数据和校验信息在对象中的存储方式。组织形式可以使用描述信息反映。在需要对数据进行一致性校验时,网卡需要先获取包括有该数据的对象的描述信息,然后根据该描述信息从对象中获取数据的校验信息,然后根据该校验信息对该数据进行一致性校验。Further, the network card provided by the embodiment of the present application can support read and write operations of various read and write scales, and the data and verification information of the read and write operations of the various read and write scales are organized in different forms in objects. Among them, the organization form is used to indicate how the data and verification information are stored in the object. Organizational form can be reflected using descriptive information. When data consistency check is required, the network card needs to first obtain the description information of the object that contains the data, and then obtain the data check information from the object according to the description information, and then perform the data check according to the check information. Consistency check.
在一种可实现方式中,本申请实施例中网卡执行校验和剥离等操作可以通过程序代码实现。相应的,用于执行一致性校验的网卡可以是可编程网卡。该可编程网卡也称可编程控制器(programmable network interface controller,Programmable NIC)。当网卡为可编程网卡时,能够通过修改可编程网卡中的固件或微码等程序代码,改变网卡的行为,使得该网卡具有上述功能。In an achievable manner, operations such as checksum stripping performed by the network card in the embodiment of the present application may be implemented by program code. Correspondingly, the network card for performing the consistency check may be a programmable network card. The programmable network card is also called a programmable controller (programmable network interface controller, Programmable NIC). When the network card is a programmable network card, the behavior of the network card can be changed by modifying program codes such as firmware or microcode in the programmable network card, so that the network card has the above functions.
并且,为了进一步减小CPU的时延,该网卡配置有远程直接内存访问(remote direct memory access,RDMA)功能。其中,RDMA是分布式领域中普遍存在的快速跨机器内存访问技术。RDMA允许机器在另一台目标机器预注册的内存区域执行内存读写操作,并且能够绕过目标机器的操作系统和CPU,因此具有高速、低延迟和低CPU开销的优点。In addition, in order to further reduce the delay of the CPU, the network card is configured with a remote direct memory access (RDMA) function. Among them, RDMA is a fast cross-machine memory access technology ubiquitous in the distributed field. RDMA allows a machine to perform memory read and write operations in another target machine's pre-registered memory area, and can bypass the target machine's operating system and CPU, so it has the advantages of high speed, low latency, and low CPU overhead.
可选地,网卡的上述功能可以通过多个功能模块实现,该多个功能模块协同合作实现该服务节点的上述功能。下面以图2为例对其进行说明:Optionally, the above-mentioned functions of the network card may be implemented by multiple functional modules, and the multiple functional modules cooperate to implement the above-mentioned functions of the service node. The following takes Figure 2 as an example to illustrate it:
如图2所示,当服务节点包含有用于执行校验和剥离等操作的网卡时,该服务节点包括:主机系统(host system)X01和可编程网卡X02。该主机系统X01中运行有对数据执行读写操作的应用程序,相应的,该主机系统X01包括为应用程序服务的初始化模块(intializing module)X011。初始化模块X011用于执行运行应用程序所需的初始化配置。并且,该服务节点为该主机系统X01配置有内存X012。内存X012用于存储分布式事务需要访问的对象。As shown in FIG. 2 , when the service node includes a network card for performing operations such as checksum stripping, the service node includes: a host system (host system) X01 and a programmable network card X02. The host system X01 runs an application program that performs read and write operations on data. Correspondingly, the host system X01 includes an initialization module (initializing module) X011 that serves the application program. The initialization module X011 is used to perform the initialization configuration required to run the application. And, the service node is configured with a memory X012 for the host system X01. Memory X012 is used to store objects that distributed transactions need to access.
如图2所示,可编程网卡X02包括:网卡模块X021、第一缓存(buffer)模块X022、匹配模块(match module)X023、校验模块(validation module)X024、剥离模块(stripping module)X025和第二缓存模块X026。其中,校验信息包括版本信息(version),对数据进行一致性校验也称为对数据进行版本校验,则校验模块X024也称为版本校验模块(version validation module)。网卡模块X021是允许服务节点在计算机网络上进行通讯的硬件,用于接收其他服务节点的网卡通过网络发送的数据等,通过网络向其他服务节点的网卡发送数据等。第一缓存模块X022用于缓存待校验的对象。匹配模块X023用于获取对象的描述信息。校验模块X024用于从匹配模块获取对象的描述信息,根据描述信息从第一缓存模块缓存的对象中获取数据的校验信息,根据校验信息对数据进行一致性校验。剥离模块X025用于在数据通过校验时,剥离对象中的校验信息,得到请求端请求读取的数据。第二缓存模块X026用于缓存已完成校验的校验信息。As shown in Figure 2, the programmable network card X02 includes: a network card module X021, a first buffer module X022, a match module (match module) X023, a verification module (validation module) X024, a stripping module (stripping module) X025 and The second cache module X026. The verification information includes version information (version), and performing consistency verification on the data is also referred to as performing version verification on the data, and the verification module X024 is also referred to as a version verification module. The network card module X021 is the hardware that allows the service nodes to communicate on the computer network, and is used to receive data sent by the network cards of other service nodes through the network, and send data to the network cards of other service nodes through the network. The first cache module X022 is used to cache the object to be verified. The matching module X023 is used to obtain the description information of the object. The verification module X024 is configured to acquire the description information of the object from the matching module, acquire the verification information of the data from the object cached by the first cache module according to the description information, and perform consistency verification on the data according to the verification information. The stripping module X025 is used to strip the verification information in the object when the data passes the verification, and obtain the data requested by the requester to be read. The second cache module X026 is used to cache the verification information that has been verified.
可选地,网卡模块X021、第一缓存模块X022和第二缓存模块X026可以通过硬件实现,如第一缓存模块X022可以是流式缓存器(stream buffer),第二缓存模块X026可以是上下文缓存器(contex)。匹配模块X023、校验模块X024和剥离模块X025可以通过软件实现。需要说明的是,网卡模块X021、第一缓存模块X022、匹配模块X023、校验模块X024、剥离模块X025和第二缓存模块X026的实现方式为示意性的举例,不同于限定对应模块的实现方式,各个模块的实现方式能够根据应用需求进行调整。Optionally, the network card module X021, the first buffer module X022 and the second buffer module X026 can be implemented by hardware, such as the first buffer module X022 can be a stream buffer (stream buffer), and the second buffer module X026 can be a context buffer. device (contex). The matching module X023, the verification module X024 and the stripping module X025 can be implemented by software. It should be noted that the implementations of the network card module X021, the first cache module X022, the matching module X023, the verification module X024, the stripping module X025 and the second cache module X026 are schematic examples, which are different from the implementations that define the corresponding modules. , the implementation of each module can be adjusted according to application requirements.
如前所述,本申请实施例提供的并发控制方法可以由目的端执行,也可以由请求端执行。下面分别针对该并发控制方法由目的端执行和由请求端执行,对该并发控制方法的实现过程进行说明。As mentioned above, the concurrency control method provided by the embodiment of the present application may be executed by the destination end or by the requesting end. The implementation process of the concurrency control method is described below with respect to the concurrency control method being executed by the destination end and the request end being executed respectively.
图3是本申请实施例提供的一种并发控制方法由目的端执行的方法流程图。如图3所示,该并发控制方法包括以下步骤:FIG. 3 is a method flowchart of a concurrency control method provided by an embodiment of the present application executed by a destination end. As shown in Figure 3, the concurrency control method includes the following steps:
步骤301、目的端的应用程序对对象的描述信息进行注册,并通过目的端的网卡向请求端发送描述信息的标识。 Step 301 , the application program of the destination end registers the description information of the object, and sends the identifier of the description information to the requesting end through the network card of the destination end.
在目的端中运行应用程序时,内存中存储有该应用程序的对象,目的端能够向请求端提供对该对象的访问功能。其中,对象包括该应用程序的相关数据和数据的校验信息。在对象中,校验信息位于数据的头部、尾部或按照其他方式进行放置。并且,应用程序的相关数据包括:从磁盘中读取到该内存中的数据、运行该应用程序的过程中生成的数据和其他服务节点通过该应用程序写入的数据等。When an application is run in the destination, the object of the application is stored in the memory, and the destination can provide the requesting end with an access function of the object. Among them, the object includes the relevant data of the application and the verification information of the data. In an object, check information is placed at the head, tail, or otherwise of the data. In addition, the data related to the application includes: data read from the disk into the memory, data generated during the running of the application, and data written by other service nodes through the application.
当本申请实施例提供的网卡能够支持多种不同读写规模的读写操作时,不同读写规模涉及的数据的校验信息在对象中的组织形式可能相同或不同。例如,不同应用程序的线程访问的数据的校验信息在对象中的组织形式可能相同或不同。此时,为便于网卡能够获取数据的校验信息,应用程序需要对对象的描述信息进行注册。其中,描述信息用于指示对象的组织形式,如指示数据和校验信息在对象中的组织形式。应用程序对描述信息进行注册是指应用程序根据其执行逻辑,确定其访问的数据和其校验信息在对象中的组织形式,根据对象的组织形式得到对象的描述信息。When the network card provided in the embodiment of the present application can support multiple read and write operations of different read and write scales, the organization forms of the verification information of the data involved in different read and write scales in the object may be the same or different. For example, the verification information of data accessed by threads of different applications may be organized in the same or different forms in objects. At this time, in order for the network card to obtain the verification information of the data, the application program needs to register the description information of the object. The description information is used to indicate the organization form of the object, such as the organization form of the indicated data and verification information in the object. The application program registers the description information means that the application program determines the organization form of the data it accesses and its verification information in the object according to its execution logic, and obtains the object description information according to the organization form of the object.
并且,为了区分用于描述不同组织形式的描述信息,还可以为用于描述不同组织形式的描述信息分配标识,并建立描述信息与标识的映射关系,以便于后续读取数据的过程中,网卡能够根据标识确定标识指示的描述信息。可选地,为描述信息分配标识的操作可以由应用程序或目的端的网卡执行,只要能确保一个标识能够唯一标识一个描述信息即可。其中,网卡中存储有映射关系表,该映射关系表用于描述描述信息与标识的映射关系。In addition, in order to distinguish the description information used to describe different organizational forms, an identifier can also be assigned to the description information used to describe different organizational forms, and a mapping relationship between the description information and the identifier can be established, so that in the process of subsequent data reading, the network card The description information indicated by the identification can be determined according to the identification. Optionally, the operation of assigning an identifier to the description information can be performed by the application program or the network card of the destination end, as long as it can be ensured that one identifier can uniquely identify one description information. The network card stores a mapping relationship table, and the mapping relationship table is used to describe the mapping relationship between the description information and the identifier.
由于目的端的内存中通常存储有许多数据,且目的端无法预测请求端需要读取的数据,相应的,目的端无法预测请求端需要读取的数据的校验信息。因此,为便于目的端能够确定请求端需要读取的数据的校验信息,请求端向目的端发送的读请求中需要携带有对象的描述信息的标识或描述信息。相应的,在确定对象的描述信息后,目的端还需要通知请求端用于描述不同组织形式的描述信息,以便于请求端需要从目的端中读取数据时,该请求端能够在读请求携带对应的描述信息。或者,目的端为用于描述不同组织形式的描述信息分配标识后,目的端还需要通知请求端用于描述不同组织形式的描述信息的标识,以便于请求端需要从目的端中读取数据时,该请求端能够在读请求携带对应的描述信息的标识。可选地,目的端的应用程序可以通过带内或者带外方式,向请求端的应用程序通知用于描述不同组织形式的描述信息或其标识。Since there is usually a lot of data stored in the memory of the destination end, and the destination end cannot predict the data that the requesting end needs to read, correspondingly, the destination end cannot predict the verification information of the data that the requesting end needs to read. Therefore, in order for the destination end to be able to determine the verification information of the data to be read by the requesting end, the read request sent by the requesting end to the destination end needs to carry the identifier or description information of the description information of the object. Correspondingly, after determining the description information of the object, the destination also needs to notify the requester of the description information used to describe different organizational forms, so that when the requester needs to read data from the destination, the requester can carry the corresponding data in the read request. description information. Alternatively, after the destination assigns identifiers to the description information used to describe different organizational forms, the destination also needs to notify the requester of the identifiers used to describe the description information of different organizational forms, so that when the requester needs to read data from the destination , the requester can carry the identifier of the corresponding description information in the read request. Optionally, the application at the destination end may notify the application at the requesting end of description information or its identifier for describing different organizational forms to the application at the requesting end in an in-band or out-of-band manner.
其中,一个对象中的数据可以被划分为多个数据块,且为了便于对每个数据块进行校验,对象中还携带有每个数据块的校验信息。当内存以缓存行(cache line)的方式缓存数据时,每个缓存行中可以存储一个数据块,或者,多个缓存行可以共同存储一个数据块,下面以图4和图5为例对这两种实现方式进行说明。The data in one object may be divided into multiple data blocks, and in order to facilitate verification of each data block, the object also carries verification information of each data block. When the memory caches data in the form of cache lines, each cache line can store one data block, or multiple cache lines can jointly store one data block. The following uses Figure 4 and Figure 5 as examples to illustrate this. Two implementations are described.
如图4所示,对象中的数据被划分为3个数据块,3个缓存行的每个缓存行中均存储有对象中的一个数据块,且每个缓存行中还存储有该缓存行中存储的数据块的校验信息。对对象中的数据进行校验时,需要分别根据每个缓存行中存储的数据块的校验信息对对应缓存行中存储的数据块进行校验。其中,多个缓存行中的校验信息的长度可以相同或不同,和/或,多个缓存行中的校验信息包括的内容可以相同或不同。例如,每个缓存行的长度为256字节,根据描述信息的指示,可知校验信息位于数据块的头部,且每个缓存行中校验信息的长度均 为8字节,数据块的长度均为248字节。As shown in Figure 4, the data in the object is divided into 3 data blocks, each cache line of the 3 cache lines stores a data block in the object, and each cache line also stores the cache line Checksum information of data blocks stored in . When verifying the data in the object, it is necessary to verify the data blocks stored in the corresponding cache lines according to the verification information of the data blocks stored in each cache line. The lengths of the verification information in the multiple cache lines may be the same or different, and/or the contents included in the verification information in the multiple cache lines may be the same or different. For example, the length of each cache line is 256 bytes. According to the instructions of the description information, it can be seen that the check information is located at the head of the data block, and the length of the check information in each cache line is 8 bytes. Both are 248 bytes in length.
如图5所示,对象中的数据被划分为2个数据块,每个数据块存储在2个缓存行中,且每个数据块的头部还存储有该数据块的校验信息。对对象中的数据进行校验时,可以根据每个数据块头部的校验信息对对应的数据块进行校验。As shown in Figure 5, the data in the object is divided into two data blocks, each data block is stored in two cache lines, and the header of each data block also stores the check information of the data block. When verifying the data in the object, the corresponding data block can be verified according to the verification information in the header of each data block.
其中,对象中的一个数据块由几个缓存行存储可以根据应用需求确定,例如,可以根据网卡的原子读写粒度确定。当网卡的原子读写粒度为一个缓存行时,每个缓存行用于存储一个数据块,当网卡的原子读写粒度为多个缓存行时,多个缓存行共同存储一个数据块。The storage of one data block in the object by several cache lines can be determined according to application requirements, for example, it can be determined according to the atomic read and write granularity of the network card. When the atomic read/write granularity of the network card is one cache line, each cache line is used to store one data block. When the atomic read/write granularity of the network card is multiple cache lines, multiple cache lines store one data block together.
在一种可实现方式中,对象的描述信息可以采用对象的模式描述符(pattern descriptor)表示,相应的描述信息的标识可以采用模式标识(pattern identify,简称pattern ID)表示。相应的,前述匹配模块X023也称为模式匹配模块(pattern match module),用于描述模式与模式标识的映射关系表可称为模式表(pattern table)。In an implementation manner, the description information of the object may be represented by a pattern descriptor (pattern descriptor) of the object, and the identifier of the corresponding description information may be represented by a pattern identifier (pattern identify, pattern ID for short). Correspondingly, the aforementioned matching module X023 is also referred to as a pattern matching module (pattern match module), and the mapping relationship table used to describe the pattern and the pattern identifier may be referred to as a pattern table (pattern table).
可选地,模式描述符包括:长度字段(length)和偏移字段(offset)。长度字段用于指示校验信息的有效长度。偏移字段用于指示校验信息在对象中的偏移量。当使用模式描述符定义校验信息的有效长度和偏移量时,能够根据有效长度和偏移量确定校验信息在对象中的存储位置。且由于对象包括数据和校验信息两部分,确定校验信息在对象中的存储位置后,即可确定数据在对象中的存储位置。可选地,该模式描述符还包括:写锁标识字段和对象释放字段。写锁标识字段用于指示数据是否被加上写操作的标识。对象释放字段用于指示对象是否已经被其他线程释放。Optionally, the mode descriptor includes: a length field (length) and an offset field (offset). The length field is used to indicate the valid length of the check information. The offset field is used to indicate the offset of the verification information in the object. When the mode descriptor is used to define the effective length and offset of the verification information, the storage location of the verification information in the object can be determined according to the effective length and the offset. And since the object includes two parts, the data and the verification information, after the storage location of the verification information in the object is determined, the storage location of the data in the object can be determined. Optionally, the mode descriptor further includes: a write lock identification field and an object release field. The write lock identification field is used to indicate whether the data is added with the identification of the write operation. The object deallocation field is used to indicate whether the object has been deallocated by another thread.
通过使用描述信息指示对象的组织形式,并在网卡中维护描述信息与标识的映射关系,使得网卡能够支持使用不同组织形式的对象的一种或多种应用,提高了网卡的适配性,且有助于根据服务节点的业务属性灵活调整校验信息的格式,使得网卡能够支持不同的业务模型。By using the description information to indicate the organization form of the object, and maintaining the mapping relationship between the description information and the identifier in the network card, the network card can support one or more applications using objects of different organizational forms, and the adaptability of the network card is improved, and It helps to flexibly adjust the format of the verification information according to the business attributes of the service node, so that the network card can support different business models.
需要说明的是,该步骤301为可选步骤,可以根据应用需求确定是否需要执行该步骤301。例如,当网卡需要校验的多种校验信息在对象中的组织形式不同时,需要执行该步骤301。当网卡需要校验的多种校验信息在对象中的组织形式均相同时,无需执行该步骤301。It should be noted that this step 301 is an optional step, and it may be determined whether or not this step 301 needs to be executed according to application requirements. For example, when the multiple verification information to be verified by the network card is organized in different forms in the object, step 301 needs to be executed. When the multiple types of verification information to be verified by the network card are in the same organization form in the object, step 301 does not need to be performed.
步骤302、目的端的网卡接收请求端发送的读请求。Step 302: The network card of the destination end receives the read request sent by the requesting end.
当请求端需要从目的端中读取数据时,请求端需要向目的端发送读请求。该读请求用于指示该请求端需要从目的端中读取的数据。其中,读请求中携带有请求读取的数据的逻辑地址,以通过该逻辑地址指示请求读取的数据。并且,由于目的端在内存中以对象为单位存储数据,因此该逻辑地址用于指示包括请求读取的数据的对象(该包括请求读取的数据的对象也称读对象)。When the requester needs to read data from the destination, the requester needs to send a read request to the destination. The read request is used to indicate the data that the requester needs to read from the destination. The read request carries the logical address of the data requested to be read, so that the data requested to be read is indicated by the logical address. Furthermore, since the destination stores data in the memory in units of objects, the logical address is used to indicate the object including the data requested to be read (the object including the data requested to be read is also called a read object).
另外,该读请求中还携带有对象的描述信息或描述信息的标识,以便于目的端根据该描述信息或标识获取对象中的校验信息。其中,请求端可以根据其需要读取数据的需求,确定对象的描述信息或描述信息的标识,并在读请求中携带该描述信息或描述信息的标识。在一种可实现方式中,请求端和目的端可以预先协议不同线程访问的数据的校验信息在对象中的组织形式,当请求端的某线程需要从目的端中读取数据时,请求端可根据协议的结果确定该线程需要读取的对象的组织形式,并将用于描述该组织形式的描述信息的标识携带在读请求中,以便于目的端根据该标识确定数据的校验信息。其中,读请求中可以根据应用需求确定是否携带对象的描述信息的标识。In addition, the read request also carries the description information of the object or the identifier of the description information, so that the destination terminal can obtain the verification information in the object according to the description information or the identifier. The requesting end can determine the description information or the identifier of the description information according to its requirement of reading data, and carry the description information or the identifier of the description information in the read request. In an implementation manner, the requester and the destination can pre-agree on the organization form of the verification information of the data accessed by different threads in the object. When a thread on the requester needs to read data from the destination, the requester can Determine the organizational form of the object that the thread needs to read according to the result of the protocol, and carry the identifier of the description information describing the organizational form in the read request, so that the destination can determine the verification information of the data according to the identifier. The read request may determine whether to carry the identifier of the description information of the object according to the application requirements.
同时,为了区别于普通的读请求,该读请求中还可以携带有校验指示标识,该校验指示 标识用于指示目的端中的网卡对该读请求请求读取的数据进行一致性校验。At the same time, in order to be different from ordinary read requests, the read request may also carry a check indication identifier, which is used to instruct the network card in the destination to perform consistency check on the data read by the read request request .
在一种可实现方式中,读请求携带描述信息的标识和校验指示标识的实现方式包括:在读请求中无限带宽(InfiniBand,IB)传输层对应的报文区域中新增操作码(operation code,OPCode),通过该操作码指示目的端中的网卡对该读请求请求读取的数据进行一致性校验,并在IB传输层对应的字段的载荷前新增描述信息的标识。其中,IB是一个用于高性能计算的计算机网络通信标准,它具有极高的吞吐量和极低的延迟,用于计算机与计算机之间的数据互连,可以承载RDMA技术,且IB也用作服务器与存储系统之间的直接或交换互连,以及存储系统之间的互连。In a possible implementation manner, the implementation manner of the identification of the description information and the verification indication identification carried in the read request includes: adding an operation code (operation code) in the message area corresponding to the InfiniBand (IB) transport layer in the read request , OPCode), instruct the network card in the destination end to perform consistency check on the data read by the read request through the opcode, and add an identifier of the description information before the payload of the field corresponding to the IB transport layer. Among them, IB is a computer network communication standard for high-performance computing. It has extremely high throughput and extremely low latency. It is used for data interconnection between computers and can carry RDMA technology. IB also uses It can be used as direct or switched interconnection between servers and storage systems, as well as interconnection between storage systems.
在另一种可实现方式中,读请求携带描述信息的标识和校验指示标识的实现方式包括:利用读请求中已存在的保留(reserved)字段,将描述信息的标识和校验指示标识均嵌入读请求头部的保留字段中。In another achievable manner, the implementation manner in which the read request carries the identifier of the description information and the verification indication identifier includes: using an existing reserved field in the read request, the identifier of the description information and the verification indication identifier are both Embedded in a reserved field in the header of a read request.
类似的,读请求携带描述信息的实现方式,可相应参考读请求携带描述信息的标识的实现方式,此处不再赘述。Similarly, for the implementation manner of the read request carrying the description information, reference may be made to the implementation manner of the read request carrying the identifier of the description information, which will not be repeated here.
步骤303、目的端的网卡根据读请求,从目的端的内存中获取对象。Step 303: The network card of the destination acquires the object from the memory of the destination according to the read request.
目的端的网卡接收到读请求后,可以根据读请求携带的逻辑地址,从目的端的内存中获取对象。其中,对象携带有请求端请求从目的端读取的数据和数据的校验信息。After receiving the read request, the network card of the destination end can obtain the object from the memory of the destination end according to the logical address carried by the read request. The object carries the data requested by the requester to be read from the destination and the verification information of the data.
步骤304、目的端的网卡获取对象的描述信息。 Step 304 , the network card of the destination terminal obtains the description information of the object.
在一种可实现方式中,当读请求中携带有描述信息的标识时,则目的端的网卡获取对象的描述信息,包括:目的端的网卡从读请求中获取描述信息的标识,并基于描述信息的标识查询步骤301在网卡中建立的描述信息与标识的映射关系,以得到对象的描述信息。当读请求中携带有描述信息时,则目的端网卡则可以根据读请求携带描述信息的方式,在该读请求中提取描述信息,以得到对象的描述信息。In an implementation manner, when the read request carries the identifier of the description information, the network card of the destination end obtains the description information of the object, including: the network card of the destination end obtains the identifier of the description information from the read request, and based on the description information The identity query step 301 establishes the mapping relationship between the description information and the identity in the network card, so as to obtain the description information of the object. When the read request carries descriptive information, the destination network card can extract the descriptive information in the read request according to the manner in which the read request carries the descriptive information, so as to obtain the descriptive information of the object.
步骤305、目的端的网卡基于描述信息,从对象中获取校验信息。 Step 305 , the network card of the destination terminal obtains the verification information from the object based on the description information.
由于描述信息用于指示对象的组织形式,在获取对象的描述信息后,目的端的网卡则可根据该描述信息指示的组织形式,确定校验信息在对象中的存储位置。并且,由于目的端的网卡已从内存中获取了对象,目的端的网卡能够知道对象的存储位置,相应的,目的端的网卡能够在对象的存储位置中从对象中获取校验信息。Since the description information is used to indicate the organization form of the object, after obtaining the description information of the object, the network card of the destination end can determine the storage location of the verification information in the object according to the organization form indicated by the description information. Moreover, since the network card of the destination end has acquired the object from the memory, the network card of the destination end can know the storage location of the object, and correspondingly, the network card of the destination end can obtain the verification information from the object in the storage location of the object.
需要说明的是,当网卡支持的读写操作涉及的数据的校验信息在对象中的组织形式均相同时,例如,在某些固定的业务场景中,读写操作涉及的对象的组织形式均相同,读请求中可以不携带有对象的描述信息的标识。此时,请求端与目的端之间可以预先协商对象的组织形式,目的端的网卡接收到读请求后可以根据预先协商的组织形式从对象中获取校验信息。相应的,则无需执行上述步骤304。It should be noted that when the verification information of the data involved in the read and write operations supported by the network card is organized in the same form in the object, for example, in some fixed business scenarios, the organization forms of the objects involved in the read and write operations are the same. Similarly, the read request may not carry the identifier of the description information of the object. At this time, the organization form of the object can be negotiated between the requesting end and the destination end in advance, and the network card of the destination end can obtain the verification information from the object according to the pre-negotiated organization form after receiving the read request. Correspondingly, the above step 304 does not need to be performed.
步骤306、目的端的网卡根据校验信息,对数据进行一致性校验。Step 306: The network card of the destination end performs consistency check on the data according to the check information.
对数据进行一致性校验的实现方式可以包括:判断对象中多个数据块的校验信息是否全部相同,当该多个数据块的校验信息全部相同时,确定该数据通过一致性校验,则执行步骤307,当该多个数据块的校验信息不是全部相同时,确定该数据不通过一致性校验,则执行步骤308。The implementation of the consistency check on the data may include: judging whether the check information of multiple data blocks in the object is all the same, and when the check information of the multiple data blocks is all the same, determining that the data passes the consistency check , then step 307 is performed, and when the verification information of the multiple data blocks is not all the same, it is determined that the data does not pass the consistency check, and step 308 is performed.
可选地,数据块的校验信息包括数据块的版本号,根据校验信息对数据进行一致性校验可以通过判断该数据的多个数据块的版本号是否全部相同实现。其中,每次对数据执行操作 后,均会生成版本号。不同的版本号用于标识对数据执行的不同操作。当对象中任意两个数据块的版本号不同时,说明对该两块数据块执行的操作不同,则可以确定数据无法通过一致性校验。并且,在判断多个校验信息是否全部相同时,可以以该多个校验信息中的任一个校验信息为参照,将该多个校验信息中的其他校验信息与该作为参照的校验信息进行比较,本申请实施例对其不做具体限定。Optionally, the verification information of the data block includes the version number of the data block, and performing consistency verification on the data according to the verification information can be realized by judging whether the version numbers of the multiple data blocks of the data are all the same. Among them, each time an operation is performed on the data, a version number is generated. Different version numbers are used to identify different operations performed on the data. When the version numbers of any two data blocks in the object are different, it indicates that the operations performed on the two data blocks are different, and it can be determined that the data cannot pass the consistency check. In addition, when judging whether all the multiple verification information are the same, any one of the multiple verification information can be used as a reference, and the other verification information in the multiple verification information can be compared with the referenced one. The verification information is compared, which is not specifically limited in this embodiment of the present application.
步骤307、当一致性校验通过时,目的端的网卡向请求端的内存提供数据。Step 307: When the consistency check is passed, the network card of the destination end provides data to the memory of the requesting end.
当一致性校验通过时,说明在读取数据的过程中不存在并发冲突,不会出现不一致的情况,则目的端可以向请求端提供对象中的数据。When the consistency check passes, it means that there is no concurrent conflict and no inconsistency in the process of reading data, and the destination can provide the data in the object to the requester.
由于数据存储在对象中,描述信息用于描述对象的组织形式,则目的端的网卡可以根据该描述信息从对象中获取数据,并向请求端提供该数据。在一种可实现方式中,目的端向请求端提供该数据的实现方式包括:目的端的网卡对对象执行校验信息剥离操作,得到对象中的数据,并向请求端的内存提供该数据。Since the data is stored in the object, and the description information is used to describe the organization form of the object, the network card at the destination end can obtain the data from the object according to the description information, and provide the data to the requester. In an implementation manner, the implementation manner of the destination end providing the data to the requesting end includes: the network card of the destination end performs a verification information stripping operation on the object, obtains the data in the object, and provides the data to the memory of the requesting end.
可选地,由于在对象中,任一数据块的校验信息可以位于该任一数据块的头部、尾部,或者对象中多个数据块中校验信息也可以按照其他方式进行放置,因此可以描述信息所指示的校验信息和数据块在对象中的放置位置,对数据块执行操作,以得到数据块。在一种可实现方式中,当任一数据块的校验信息位于该任一数据块的头部时,由于数据块位于校验信息的后面,因此可以根据描述信息对数据块执行向左偏移的操作,使得偏移后的对象从第一个字节起的所有字节均属于对象的净荷,得到从对象中剥离校验信息后的数据。例如,当对象包括4个数据块,数据块的校验信息位于数据块的头部,且对象的描述信息指示每个数据块的校验信息的有效长度均为10字节时,则可将该4个数据块均向左偏移10字节,以得到从对象中剥离头部后的数据。当校验信息和数据块在对象中采用其他方式放置时,可以按照类似的操作逻辑执行校验信息剥离操作,以得到数据块。Optionally, because in the object, the verification information of any data block can be located at the head or tail of any data block, or the verification information in multiple data blocks in the object can also be placed in other ways, so The check information indicated by the information and the placement position of the data block in the object can be described, and an operation is performed on the data block to obtain the data block. In an implementation manner, when the check information of any data block is located at the head of any data block, since the data block is located behind the check information, the data block can be left-biased according to the description information. The operation of shifting makes all bytes from the first byte of the object after the offset belong to the payload of the object, and the data after stripping the check information from the object is obtained. For example, when the object includes 4 data blocks, the check information of the data block is located at the head of the data block, and the description information of the object indicates that the valid length of the check information of each data block is 10 bytes, then the The 4 data blocks are all shifted to the left by 10 bytes to obtain the data after stripping the header from the object. When the parity information and the data block are placed in the object in other ways, the parity information stripping operation can be performed according to similar operation logic to obtain the data block.
其中,目的端的网卡向请求端的内存提供数据包括:目的端的网卡向请求端的网卡发送该数据,并通过请求端的网卡向请求端的内存发送该数据。其中,请求端的网卡可以采用直接存储器访问(direct memory access,DMA)方式将该数据写入请求端的内存中。并且,目的端的网卡向请求端的网卡发送该数据之前,还需要对数据封装相关的报文头,以使用报文的方式将数据发送至请求端的网卡。Wherein, providing data by the network card of the destination end to the memory of the requesting end includes: the network card of the destination end sending the data to the network card of the requesting end, and sending the data to the memory of the requesting end through the network card of the requesting end. Wherein, the network card of the requesting end may use a direct memory access (direct memory access, DMA) method to write the data into the memory of the requesting end. In addition, before the network card of the destination end sends the data to the network card of the requesting end, it is also necessary to encapsulate the relevant header of the data, so as to send the data to the network card of the requesting end by using a message.
需要说明的是,上述步骤304至步骤307可以采用流式方式执行,即在将对象中的部分数据块从目的端的内存读取到目的端的网卡中之后,即可执行上述步骤304至步骤307。通过流式方式执行上述步骤304至步骤307,不需要等到将对象中的所有数据块全部都读取到目的端的网卡中,再执行对数据的一致性校验操作。并且,可以在任一数据块通过校验时就对数据块执行剥离操作,然后将通过剥离操作得到的数据块发送至请求端,也不需要等到对对象中的所有数据块都执行完一致性校验操作,才将对象中的所有数据块一起发送至请求端。同时,采用流式方式指向上述步骤304至步骤307时,可以看出目的端在向请求端发送一部分数据的同时,可能在对另一部分数据执行一致性校验操作。由此可以看出,通过流式执行上述步骤304至步骤307,提高了请求端内存的并发度,并能够有效利用网卡的存储空间。It should be noted that the above steps 304 to 307 can be executed in a streaming manner, that is, after some data blocks in the object are read from the memory of the destination end to the network card of the destination end, the above steps 304 to 307 can be executed. By performing the above steps 304 to 307 in a streaming manner, there is no need to wait until all data blocks in the object are read into the network card of the destination end, and then perform the data consistency check operation. In addition, when any data block passes the verification, the stripping operation can be performed on the data block, and then the data block obtained by the stripping operation can be sent to the requester, and it is not necessary to wait until all data blocks in the object have been verified for consistency. After the verification operation, all the data blocks in the object are sent to the requester together. At the same time, when the streaming method is used to point to the above steps 304 to 307, it can be seen that the destination end may perform a consistency check operation on another part of the data while sending a part of the data to the requesting end. It can be seen from this that, by stream execution of the above steps 304 to 307, the concurrency of the memory of the requester is improved, and the storage space of the network card can be effectively utilized.
其中,当采用流式方式对数据进行一致性校验时,需要等到将至少两个数据块读取到目的端的网卡后,开始执行一致性校验的操作。且采用流式方式对数据进行一致性校验的实现方式为:判断读取到的至少两个数据块的校验信息是否全部相同,当该至少两个数据块的校 验信息全部相同时,确定该至少两个数据块通过一致性校验,当该至少两个数据块的校验信息不是全部相同时,确定该至少两个数据块不通过一致性校验。Among them, when the data consistency check is performed in a streaming manner, it is necessary to wait until at least two data blocks are read to the network card of the destination end, and then start the operation of the consistency check. And the implementation method of performing consistency check on the data in a streaming manner is: judging whether the check information of the at least two data blocks read are all the same, and when the check information of the at least two data blocks are all the same, It is determined that the at least two data blocks pass the consistency check, and when the check information of the at least two data blocks is not all the same, it is determined that the at least two data blocks do not pass the consistency check.
步骤308、当一致性校验不通过时,目的端的网卡通知请求端校验不通过,使得请求端停止将数据中已接收到的部分写入请求端的内存中,且目的端的网卡停止对数据中未校验的部分进行一致性校验,并停止向请求端发送数据中已通过校验的部分。Step 308: When the consistency check fails, the network card of the destination informs the requester that the check fails, so that the requester stops writing the received part of the data into the memory of the requester, and the network card of the destination stops checking the data. The unverified part is checked for consistency, and the part that has passed the verification of the data is stopped to be sent to the requester.
当一致性校验不通过时,说明在读取数据的过程中存在并发冲突,会导致出现不一致的情况,则不能向请求端提供该对象中的数据。此时,目的端的网卡可以通知请求端校验不通过,使得请求端停止将该数据中已接收到的部分写入请求端的内存中。并且,请求端的网卡在确定一致性校验不通过时,还可以通知请求读取数据的应用程序做冲突解决处理,例如通知应用程序进行回滚重试或终止事务。通过及时通知请求端一致性校验不通过,能够有效降低因处理无效数据产生的开销。When the consistency check fails, it means that there is a concurrency conflict in the process of reading data, which will lead to inconsistency, and the data in the object cannot be provided to the requester. At this time, the network card of the destination can notify the requester that the verification fails, so that the requester stops writing the received part of the data into the memory of the requester. In addition, when the network card of the requesting end determines that the consistency check fails, it can also notify the application requesting to read the data to perform conflict resolution processing, such as informing the application to roll back and retry or terminate the transaction. By timely notifying the requester that the consistency check fails, the overhead caused by processing invalid data can be effectively reduced.
其中,请求端的网卡通知应用程序的实现方式包括:网卡构造用于指示一致性校验失败的消息,并将该消息放入与应用程序通信的队列中,应用程序从该队列中获取消息,根据该消息获知一致性校验失败。Among them, the implementation manner of the network card of the requesting end notifying the application program includes: the network card constructs a message for indicating the failure of the consistency check, and puts the message into a queue that communicates with the application program, and the application program obtains the message from the queue, according to This message informs that the consistency check failed.
在一种可实现方式中,目的端通知请求端的实现方式包括:向请求端回复用于指示一致性校验失败的读响应。可选的,可以通过在读响应中添加标志位,并通过该标志位的取值标识一致性校验失败。或者,可以在读响应中增加操作码,使用该操作码标识一致性校验失败,例如,读响应可以为RDMA读响应中止(read response ABORT)报文。In an implementation manner, the implementation manner of the destination end notifying the requesting end includes: replying to the requesting end a read response indicating a failure of the consistency check. Optionally, a flag bit can be added to the read response, and the consistency check failure can be identified by the value of the flag bit. Alternatively, an opcode can be added to the read response, and the opcode can be used to identify a consistency check failure. For example, the read response can be an RDMA read response ABORT message.
并且,当采用流式方式执行上述步骤303至步骤306时,在确定一致性校验失败时,目的端的网卡还可以停止对数据中未校验的部分进行一致性校验,并停止向请求端发送数据中已通过校验的部分。这样一来,能够减小对无效数据进行一致性校验和传输使用的资源开销和时间开销,提高资源的利用率和保证目的端的并发度。In addition, when the above steps 303 to 306 are performed in a streaming manner, when it is determined that the consistency check fails, the network card of the destination end may also stop performing consistency check on the unchecked part of the data, and stop sending the data to the requesting end. The part of the sent data that has passed the verification. In this way, it is possible to reduce the resource overhead and time overhead used in the consistency check and transmission of invalid data, improve the utilization rate of resources and ensure the concurrency of the destination end.
需要说明的是,上述步骤301至步骤308可以通过功能模块实现。例如,假设目的端中网卡的功能通过图2所示的功能模块实现,则如图6所示,步骤301可以通过图2中的初始化模块X011实现,步骤302通过网卡模块X021实现,步骤303通过第一缓存模块X022实现,且从内存中读出的数据可存储在该第一缓存模块X022中,步骤304通过匹配模块X023实现,步骤305和步骤306通过校验模块X024实现,校验通过时校验模块X024向剥离模块X025发送通知信息,使得剥离模块X025对第一缓存模块X022中缓存的已经过校验的对象执行步骤307中的校验信息剥离操作,且在完成剥离操作后,网卡模块X021从第一缓存模块X022中读取数据,并执行步骤307中向请求端的网卡发送数据的操作,步骤308中通知请求端校验不通过通过网卡模块X021实现,步骤308中停止对数据中未校验的部分进行一致性校验通过校验模块X024实现,步骤308中停止向请求端发送数据中已通过校验的部分通过网卡模块X021实现。另外,为区分已验证的对象和未验证的对象,可以将未验证的对象存储在第一缓存模块X022中,将已验证的对象的校验信息存储在第二缓存模块X026中,并在向请求端发送对象中的数据后,从第一缓存模块X022中删除该对象。It should be noted that, the above steps 301 to 308 may be implemented by functional modules. For example, assuming that the function of the network card in the destination is implemented by the function module shown in Figure 2, then as shown in Figure 6, step 301 can be implemented by the initialization module X011 in Figure 2, step 302 can be implemented by the network card module X021, The first cache module X022 is implemented, and the data read from the memory can be stored in the first cache module X022, step 304 is implemented by the matching module X023, and steps 305 and 306 are implemented by the verification module X024. The verification module X024 sends notification information to the stripping module X025, so that the stripping module X025 performs the verification information stripping operation in step 307 on the objects that have been verified cached in the first cache module X022, and after the stripping operation is completed, the network card Module X021 reads data from the first cache module X022, and performs the operation of sending data to the network card of the requester in step 307. In step 308, the requester is notified that the verification is not realized by the network card module X021. Consistency verification of the unverified part is implemented by the verification module X024, and in step 308, the part that has passed the verification in the data that has passed the verification is stopped by the network card module X021. In addition, in order to distinguish the verified object from the unverified object, the unverified object can be stored in the first cache module X022, the verification information of the verified object can be stored in the second cache module X026, and the After the requester sends the data in the object, the object is deleted from the first cache module X022.
在本申请实施例提供的并发控制方法中,通过采用网卡进行一致性校验和执行剥离操作,使得无需使用服务器中的CPU进行一致性校验和执行剥离操作,能够在实现读取过程的并发控制的基础上,有效地减小了因校验和内存搬移耗费的CPU开销,降低了端到端的时延。并且,在该并发控制过程中,通过软件实现一致性校验和执行剥离操作,减小了并发控制对硬 件的依赖,相应地降低了并发控制的实现成本。In the concurrency control method provided by the embodiment of the present application, by using the network card to perform consistency check and perform the peel operation, it is unnecessary to use the CPU in the server to perform the consistency check and perform the peel operation, and the concurrency of the reading process can be realized. On the basis of control, the CPU overhead due to checksum memory transfer is effectively reduced, and the end-to-end delay is reduced. Moreover, in the process of concurrency control, the consistency check and the stripping operation are implemented by software, which reduces the dependence of the concurrency control on the hardware, and correspondingly reduces the implementation cost of the concurrency control.
图7是本申请实施例提供的一种并发控制方法由请求端执行的方法流程图。如图7所示,该并发控制方法包括以下步骤:FIG. 7 is a flowchart of a method executed by a requester in a concurrency control method provided by an embodiment of the present application. As shown in Figure 7, the concurrency control method includes the following steps:
步骤701、请求端的应用程序对对象的描述信息进行注册。Step 701: The application program of the requesting end registers the description information of the object.
该步骤701的实现过程,请相应参考步骤301中目的端的应用程序对对象的描述信息进行注册的实现过程,此处不再赘述。该步骤701与步骤301不同的是,在完成描述信息的注册后,请求端的应用程序无需向目的端发送描述信息的标识。For the implementation process of this step 701, please refer to the implementation process of registering the description information of the object by the application program of the destination end in step 301, which will not be repeated here. The difference between step 701 and step 301 is that after the registration of the description information is completed, the application program of the requesting end does not need to send the identifier of the description information to the destination end.
步骤702、请求端的网卡向目的端发送的读请求。Step 702: A read request sent by the network card of the requesting end to the destination end.
该步骤702的实现过程,请相应参考步骤302中请求端发送读请求的实现过程,此处不再赘述。其中,该读请求中也可以根据应用需求确定是否携带对象的描述信息的标识。For the implementation process of step 702, please refer to the implementation process of the requesting end sending the read request in step 302, which will not be repeated here. Wherein, whether to carry the identifier of the description information of the object may also be determined in the read request according to application requirements.
步骤703、目的端的网卡根据读请求,从目的端的内存中获取对象,并向请求端发送读响应。Step 703: The network card of the destination acquires the object from the memory of the destination according to the read request, and sends a read response to the requester.
读响应中携带有对象和对象的描述信息的标识。对象包括请求端请求从目的端读取的数据和数据的校验信息。并且,该描述信息的标识可以以随路信号的方式,通过读请求和读响应,由请求端传输至目的端,再由目的端传输至请求端,从而使得目的端无需感知描述信息的标识。其中,目的端获取对象的实现过程,请相应参考步骤303中的相关描述,此处不再赘述。The read response carries the identifier of the object and the description information of the object. The object includes the data requested by the requester to be read from the destination and the verification information of the data. In addition, the identifier of the description information can be transmitted from the requesting end to the destination end through the read request and read response in the form of an accompanying signal, and then transmitted from the destination end to the requesting end, so that the destination end does not need to perceive the identifier of the description information. Wherein, for the implementation process of acquiring the object by the destination end, please refer to the relevant description in step 303 accordingly, which will not be repeated here.
步骤704、请求端的网卡根据读响应获取对象的描述信息。Step 704: The network card of the requesting end obtains the description information of the object according to the read response.
在一种可实现方式中,由于读响应中携带有描述信息的标识,则请求端的网卡获取对象的描述信息,包括:请求端的网卡从读响应中获取描述信息的标识,并基于描述信息的标识查询步骤701在网卡中建立的描述信息与标识的映射关系,以得到对象的描述信息。In an implementation manner, since the read response carries the identifier of the description information, the network card of the requesting end obtains the description information of the object, including: the network card of the requesting end obtains the identifier of the description information from the read response, and based on the identifier of the description information The mapping relationship between the description information and the identifier established in the network card in step 701 is queried to obtain the description information of the object.
步骤705、请求端的网卡基于描述信息,从对象中获取校验信息。Step 705: Based on the description information, the network card of the requester obtains the verification information from the object.
由于描述信息用于指示校验信息在对象中的存储位置,在获取对象的描述信息后,请求端的网卡则可根据该描述信息指示的存储位置,在对象中获取读请求请求读取的数据的校验信息。Since the description information is used to indicate the storage location of the verification information in the object, after obtaining the description information of the object, the network card of the requesting end can obtain the data of the data read by the read request request in the object according to the storage location indicated by the description information. Check information.
需要说明的是,当网卡支持的读写操作涉及的数据的校验信息在对象中的组织形式均相同时,例如,在某些固定的业务场景中,读写操作涉及的对象的组织形式均相同,读请求中可以不携带有对象的描述信息的标识。此时,请求端与目的端之间可以预先协商对象的组织形式,请求端的网卡接收到读响应后可以根据预先协商的组织形式从对象中获取校验信息。相应的,则无需执行上述步骤704。It should be noted that when the verification information of the data involved in the read and write operations supported by the network card is organized in the same form in the object, for example, in some fixed business scenarios, the organization forms of the objects involved in the read and write operations are the same. Similarly, the read request may not carry the identifier of the description information of the object. At this time, the organization form of the object can be negotiated between the requesting end and the destination end in advance, and the network card of the requesting end can obtain the verification information from the object according to the pre-negotiated organization form after receiving the read response. Correspondingly, the above step 704 does not need to be performed.
步骤706、请求端的网卡根据校验信息,对数据进行一致性校验。Step 706: The network card of the requesting end performs consistency check on the data according to the check information.
该步骤706的实现过程,请相应参考步骤306的实现过程,此处不再赘述。For the implementation process of this step 706, please refer to the implementation process of step 306, which will not be repeated here.
步骤707、当一致性校验通过时,请求端的网卡向请求端的内存发送数据。Step 707: When the consistency check is passed, the network card of the requester sends data to the memory of the requester.
其中,请求端的网卡向请求端的内存发送数据,可以是请求端的网卡直接将得到的数据发送至请求端的内存。该步骤707的实现过程,请相应参考步骤307中的相应描述,此处不再赘述。Wherein, the network card of the requesting end sends data to the memory of the requesting end, which may be that the network card of the requesting end directly sends the obtained data to the memory of the requesting end. For the implementation process of this step 707, please refer to the corresponding description in the step 307, which will not be repeated here.
步骤708、当一致性校验不通过时,请求端的网卡停止将数据中已通过校验的部分写入请求端的内存中,且请求端的网卡停止对数据中未校验的部分进行一致性校验。Step 708: When the consistency check fails, the network card of the requester stops writing the part of the data that has passed the check into the memory of the requester, and the network card of the requester stops performing consistency check on the unverified part of the data. .
该步骤708的实现过程,请相应参考步骤308中的相关描述,此处不再赘述。For the implementation process of step 708, please refer to the relevant description in step 308 accordingly, and details are not repeated here.
类似的,上述步骤701至步骤708中的至少部分步骤可以通过功能模块实现。例如,假设请求端中网卡的功能通过图2所示的功能模块实现,如图8所示,步骤701可以通过图2中的初始化模块X011实现,步骤702通过网卡模块X021实现,步骤704通过匹配模块X023实现,步骤705和步骤706通过校验模块X024实现,校验通过时校验模块X024向剥离模块X025发送通知信息,使得剥离模块X025对第一缓存模块X022中缓存的已经过校验的对象执行步骤707中的校验信息剥离操作,且在完成剥离操作后,第一缓存模块X022执行步骤707中向请求端的内存发送数据的操作,步骤708中停止将数据中已通过校验的部分写入请求端的内存中通过第一缓存模块X022实现,步骤708中停止对数据中未校验的部分进行一致性校验通过校验模块X024实现。另外,为区分已验证的对象和未验证的对象,也可以将未验证的对象存储在第一缓存模块X022中,将已验证的对象的校验信息存储在第二缓存模块X026中,并在向请求端的内存发送对象中的数据后,从第一缓存模块X022中删除该对象。其中,网卡模块X021接收到目的端发送的读响应后,可从该读响应中获取对象,并将该对象存储在第一缓存模块X022中。Similarly, at least some of the above steps 701 to 708 may be implemented by functional modules. For example, it is assumed that the function of the network card in the requester is realized by the function module shown in Fig. 2, as shown in Fig. 8, step 701 can be realized by the initialization module X011 in Fig. 2, step 702 can be realized by the network card module X021, step 704 can be realized by matching The module X023 is implemented, and the steps 705 and 706 are implemented by the verification module X024. When the verification is passed, the verification module X024 sends notification information to the stripping module X025, so that the stripping module X025 can verify the cached in the first cache module X022. The object performs the verification information stripping operation in step 707, and after the stripping operation is completed, the first cache module X022 performs the operation of sending data to the memory of the requester in step 707, and in step 708, stops the part of the data that has passed the verification Writing to the memory of the requesting end is implemented by the first cache module X022, and in step 708, stopping the consistency verification of the unverified part of the data is implemented by the verification module X024. In addition, in order to distinguish the verified object from the unverified object, the unverified object can also be stored in the first cache module X022, and the verification information of the verified object can be stored in the second cache module X026, and stored in the second cache module X026. After the data in the object is sent to the memory of the requester, the object is deleted from the first cache module X022. Wherein, after receiving the read response sent by the destination terminal, the network card module X021 can obtain the object from the read response, and store the object in the first cache module X022.
综上所述,在本申请实施例提供的并发控制方法中,通过采用网卡进行一致性校验和执行剥离操作,使得无需使用服务器中的CPU进行一致性校验和执行剥离操作,能够在实现读取过程的并发控制的基础上,有效地减小因校验和内存搬移耗费的CPU开销,降低了端到端的时延。并且,在该并发控制过程中,在该并发控制过程中,网卡实现的功能可以通过软件实现,这样一来,减小了并发控制对硬件的依赖,相应地降低了并发控制的实现成本。To sum up, in the concurrency control method provided by the embodiments of the present application, by using the network card to perform consistency check and perform the peel operation, it is unnecessary to use the CPU in the server to perform the consistency check and perform the peel operation, which can achieve Based on the concurrency control of the reading process, the CPU overhead due to checksum memory transfer is effectively reduced, and the end-to-end delay is reduced. Moreover, in the concurrency control process, the functions implemented by the network card can be implemented by software, thus reducing the concurrency control dependence on hardware and correspondingly reducing the implementation cost of the concurrency control.
需要说明的是,本申请实施例提供的并发控制方法的步骤先后顺序可以进行适当调整,步骤也可以根据情况进行相应增减。任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化的方法,都应涵盖在本申请的保护范围之内,因此不再赘述。It should be noted that, the sequence of steps of the concurrency control method provided by the embodiments of the present application may be appropriately adjusted, and the steps may be correspondingly increased or decreased according to the situation. Any person skilled in the art who is familiar with the technical scope disclosed in the present application can easily think of any variation of the method, which should be covered by the protection scope of the present application, and thus will not be repeated here.
本申请实施例还提供了一种远程访问装置。如图9所示,该网卡90包括:The embodiment of the present application also provides a remote access device. As shown in Figure 9, the network card 90 includes:
获取单元901,用于获取对象,对象携带有请求端请求从目的端读取的数据和数据的校验信息。The obtaining unit 901 is configured to obtain an object, where the object carries the data requested by the requesting end to be read from the destination end and the verification information of the data.
校验单元902,用于根据校验信息,对数据进行一致性校验。The verification unit 902 is configured to perform consistency verification on the data according to the verification information.
交互单元903,用于当一致性校验通过时,向请求端的内存提供数据。The interaction unit 903 is configured to provide data to the memory of the requester when the consistency check is passed.
可选地,如图10所示,网卡90还包括:剥离单元904,用于当一致性校验通过时,对对象执行校验信息剥离操作,得到数据。Optionally, as shown in FIG. 10, the network card 90 further includes: a stripping unit 904, configured to perform a stripping operation of verification information on the object to obtain data when the consistency check is passed.
相应的,交互单元903,具体用于向请求端的内存提供数据。Correspondingly, the interaction unit 903 is specifically configured to provide data to the memory of the requester.
可选地,网卡部署在目的端中,交互单元903,还用于当一致性校验不通过时,通知请求端校验不通过。Optionally, the network card is deployed in the destination, and the interaction unit 903 is further configured to notify the requester that the verification fails when the consistency check fails.
可选地,网卡部署在目的端中,校验单元902,还用于当一致性校验不通过时,停止对数据中未校验的部分进行一致性校验。交互单元903,还用于当一致性校验不通过时,停止向请求端发送数据中已通过校验的部分。Optionally, the network card is deployed in the destination end, and the verification unit 902 is further configured to stop the consistency verification of the unverified part of the data when the consistency verification fails. The interaction unit 903 is further configured to stop sending the part of the data that has passed the check to the requesting end when the consistency check fails.
可选地,网卡部署在请求端中,交互单元903还用于当一致性校验不通过时,停止将数据中已通过校验的部分写入请求端的内存中。Optionally, the network card is deployed in the requester, and the interaction unit 903 is further configured to stop writing the part of the data that has passed the check into the memory of the requester when the consistency check fails.
可选地,网卡部署在请求端中,校验单元902还用于当一致性校验不通过时,停止对数 据中未校验的部分进行一致性校验。Optionally, the network card is deployed in the requester, and the verification unit 902 is further configured to stop the consistency verification of the unverified part of the data when the consistency verification fails.
可选地,交互单元903,还用于接收请求端发送的读请求,读请求用于请求读取数据。相应的,获取单元901,具体用于根据读请求,从目的端的内存中获取对象。Optionally, the interaction unit 903 is further configured to receive a read request sent by the requester, where the read request is used to request to read data. Correspondingly, the obtaining unit 901 is specifically configured to obtain the object from the memory of the destination end according to the read request.
可选地,网卡部署在目的端中,交互单元903,具体用于向请求端的网卡发送数据,使得请求端的网卡向请求端的内存发送数据。Optionally, the network card is deployed in the destination, and the interaction unit 903 is specifically configured to send data to the network card of the requester, so that the network card of the requester sends data to the memory of the requester.
可选地,网卡部署在请求端中,交互单元903,还用于向目的端发送读请求,读请求用于请求读取数据。相应的,获取单元901,具体用于接收目的端的网卡发送的对象,对象由目的端的网卡基于读请求在目的端中获得。Optionally, the network card is deployed in the requesting end, and the interaction unit 903 is further configured to send a read request to the destination end, where the read request is used to request to read data. Correspondingly, the obtaining unit 901 is specifically configured to receive the object sent by the network card of the destination end, and the object is obtained by the network card of the destination end in the destination end based on the read request.
可选地,网卡部署在请求端中,交互单元903,具体用于直接向请求端的内存发送数据。Optionally, the network card is deployed in the requester, and the interaction unit 903 is specifically configured to directly send data to the memory of the requester.
可选地,获取单元901,还用于获取对象的描述信息,描述信息用于指示对象的组织形式。相应的,校验单元902,还用于基于描述信息,从对象中获取校验信息。Optionally, the obtaining unit 901 is further configured to obtain description information of the object, where the description information is used to indicate the organization form of the object. Correspondingly, the verification unit 902 is further configured to obtain verification information from the object based on the description information.
可选地,获取单元901,具体用于:获取描述信息的标识;基于描述信息的标识和映射关系,获取描述信息,映射关系反映描述信息和标识的对应关系。Optionally, the obtaining unit 901 is specifically configured to: obtain the identifier of the description information; and obtain the description information based on the identifier of the description information and the mapping relationship, and the mapping relationship reflects the corresponding relationship between the description information and the identifier.
可选地,网卡部署在目的端中,交互单元903,还用于接收请求端发送的读请求,读请求携带有描述信息的标识。相应的,获取单元901,具体用于从读请求中获取描述信息的标识。Optionally, the network card is deployed in the destination end, and the interaction unit 903 is further configured to receive a read request sent by the requesting end, where the read request carries the identifier of the description information. Correspondingly, the obtaining unit 901 is specifically configured to obtain the identifier of the description information from the read request.
可选地,网卡部署在请求端中,交互单元903,还用于接收目的端基于读请求发送的读响应,读响应携带有描述信息的标识,描述信息的标识通过读请求发送至目的端。相应的,获取单元901,具体用于从读响应中获取描述信息的标识。Optionally, the network card is deployed in the requester, and the interaction unit 903 is further configured to receive a read response sent by the destination based on the read request. The read response carries the identifier of the description information, and the identifier of the description information is sent to the destination through the read request. Correspondingly, the obtaining unit 901 is specifically configured to obtain the identifier of the description information from the read response.
综上所述,在本申请实施例提供的网卡中,通过采用网卡中地校验单元进行一致性校验,剥离单元执行剥离操作,使得无需使用服务器中的CPU进行一致性校验和执行剥离操作,能够在实现读取过程的并发控制的基础上,有效地减小因校验和内存搬移耗费的CPU开销,降低了端到端的时延。并且,网卡中部分或全部单元的功能可以通过软件实现,这样一来,减小了并发控制对硬件的依赖,相应地降低了并发控制的实现成本。To sum up, in the network card provided in the embodiment of the present application, by using the verification unit in the network card to perform consistency check, and the peeling unit to perform the peeling operation, it is unnecessary to use the CPU in the server to perform consistency check and perform peeling. operation, on the basis of realizing the concurrency control of the reading process, the CPU overhead due to checksum memory transfer can be effectively reduced, and the end-to-end delay can be reduced. In addition, the functions of some or all of the units in the network card can be implemented by software, so that the dependence of the concurrency control on the hardware is reduced, and the implementation cost of the concurrency control is correspondingly reduced.
需要说明的是,上述对网卡中单元的划分仅为一种示例,不用于限制本申请实施例提供的网卡的实现方式,本申请实施例中对网卡中功能模块的划分方式可以根据应用需求进行调整。例如,还可以网卡进行进一步细分,其划分方式请参考图2中可编程网卡的划分方式,如图2所示,网卡模块X021实现的功能参考前述实施例中的交互单元实现的功能,校验模块X024实现的功能参考前述实施例中校验单元实现的功能,剥离模块X025实现的功能参考前述实施例中剥离单元实现的功能,匹配模块X023实现的功能参考前述实施例中获取单元获取描述信息的功能,第一缓存模块X022实现的功能参考前述实施例中获取单元获取对象的功能。It should be noted that the above division of units in the network card is only an example, and is not used to limit the implementation of the network card provided by the embodiments of the present application. The method of dividing the functional modules in the network card in the embodiments of the present application may be performed according to application requirements. Adjustment. For example, the network card can be further subdivided. Please refer to the division method of the programmable network card in FIG. 2 for the division method. As shown in FIG. 2, the functions implemented by the network card module X021 refer to the functions implemented by the interaction unit in the foregoing The functions implemented by the verification module X024 refer to the functions implemented by the verification unit in the previous embodiment, the functions implemented by the stripping module X025 refer to the functions implemented by the stripping units in the previous embodiments, and the functions implemented by the matching module X023 refer to the acquisition units in the previous embodiments to obtain descriptions For the function of the information, for the function implemented by the first cache module X022, refer to the function of the acquisition unit acquiring the object in the foregoing embodiment.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置、单元和模块的具体工作过程,可以参考前述方法实施例中的对应内容,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, for the specific working process of the devices, units and modules described above, reference may be made to the corresponding content in the foregoing method embodiments, which will not be repeated here.
本申请实施例提供了一种计算机设备。图11示例性的提供了计算机设备的一种可能的架构图。如图11所示,该计算机设备110可以包括网卡1101、存储器1102、通信接口1103和总线1104。在计算机设备中,网卡1101的数量可以是一个或多个,图11仅示意了其中一个网卡1101。可选的,如图11所示,计算机设备110还可以包括处理器1105,处理器1105可 以是中央处理器(Central Processing Unit,CPU)。若计算机设备具有多个处理器,多个处理器的类型可以不同,或者可以相同。可选的,计算机设备的多个处理器还可以集成为多核处理器。The embodiments of the present application provide a computer device. FIG. 11 exemplarily provides a possible architectural diagram of a computer device. As shown in FIG. 11 , the computer device 110 may include a network card 1101 , a memory 1102 , a communication interface 1103 and a bus 1104 . In a computer device, the number of network cards 1101 may be one or more, and FIG. 11 only illustrates one of the network cards 1101 . Optionally, as shown in FIG. 11 , the computer device 110 may further include a processor 1105, and the processor 1105 may be a central processing unit (Central Processing Unit, CPU). If the computer device has multiple processors, the multiple processors may be of different types or may be the same. Optionally, multiple processors of the computer device may also be integrated into a multi-core processor.
网卡1101用于与其他计算机设备进行数据交互。在本申请实施例中,该一致性校验的过程可以由网卡1101执行。可选地,网卡1101还用于剥离对象中数据块的校验信息,得到请求端请求读取的数据,并向请求端的内存提供该数据。并且,该网卡1001能够支持多种不同读写规模的读写操作,且该多种读写规模的读写操作的数据和校验信息在对象中的组织形式不同。The network card 1101 is used for data interaction with other computer devices. In this embodiment of the present application, the process of the consistency check may be performed by the network card 1101 . Optionally, the network card 1101 is further configured to strip the verification information of the data blocks in the object, obtain the data requested by the requester to read, and provide the data to the memory of the requester. In addition, the network card 1001 can support various read and write operations of different read and write scales, and the data and verification information of the read and write operations of the various read and write scales are organized in different forms in the object.
在一种可实现方式中,该网卡1001执行校验和剥离等操作可以通过程序代码实现。相应的,用于执行一致性校验的网卡1001可以是可编程网卡。当网卡1001为可编程网卡时,能够通过修改可编程网卡中的固件或微码等程序代码,改变网卡1001的行为,使得该网卡1001具有上述功能。并且,为了进一步减小CPU的时延,该网卡1001配置有远程直接内存访问功能。In an implementation manner, the network card 1001 performs operations such as checksum stripping and the like, which may be implemented by program codes. Correspondingly, the network card 1001 for performing the consistency check may be a programmable network card. When the network card 1001 is a programmable network card, the behavior of the network card 1001 can be changed by modifying program codes such as firmware or microcode in the programmable network card, so that the network card 1001 has the above functions. Moreover, in order to further reduce the time delay of the CPU, the network card 1001 is configured with a remote direct memory access function.
存储器1102存储计算机指令和数据,存储器1102可以存储实现本申请提供的并发控制方法所需的计算机指令和数据。存储器1102可以是以下存储介质的任一种或任一种组合:非易失性存储器(如只读存储器(Read-Only Memory,ROM)、固态硬盘(Solid State Disk,SSD)、硬盘(Hard Disk Drive,HDD)、光盘等、易失性存储器。The memory 1102 stores computer instructions and data, and the memory 1102 may store computer instructions and data required to implement the concurrency control method provided by the present application. The memory 1102 can be any one or any combination of the following storage media: non-volatile memory (such as read-only memory (Read-Only Memory, ROM), solid state disk (Solid State Disk, SSD), hard disk (Hard Disk) Drive, HDD), optical disc, etc., volatile memory.
通信接口1103可以是以下器件的任一种或任一种组合:网络接口(如以太网接口)具有网络接入功能的器件。The communication interface 1103 may be any one or any combination of the following devices: a network interface (eg, an Ethernet interface) having a network access function.
通信接口1103用于计算机设备与其他节点或者其他计算机设备进行数据通信。The communication interface 1103 is used for data communication between the computer device and other nodes or other computer devices.
图11还示例性地绘制出总线1104。总线1104可以将网卡1101与存储器1102、通信接口1103连接。这样,通过总线1104,网卡1101可以访问存储器1102,还可以利用通信接口1103与其他节点或者其他计算机设备进行数据交互。FIG. 11 also exemplarily depicts bus 1104 . The bus 1104 can connect the network card 1101 with the memory 1102 and the communication interface 1103 . In this way, through the bus 1104, the network card 1101 can access the memory 1102, and can also use the communication interface 1103 to perform data interaction with other nodes or other computer devices.
在本申请中,计算机设备地存储器中存储由计算机程序,网卡执行存储器1102中的计算机程序,可以实现本申请提供的并发控制方法。In the present application, the computer program is stored in the memory of the computer device, and the network card executes the computer program in the memory 1102 to implement the concurrency control method provided by the present application.
本申请实施例还提供了一种存储介质,该存储介质为非瞬态的计算机可读存储介质,当存储介质中的指令被网卡执行时,网卡执行如本申请实施例提供的并发控制方法。Embodiments of the present application further provide a storage medium, which is a non-transitory computer-readable storage medium. When an instruction in the storage medium is executed by a network card, the network card executes the concurrency control method provided by the embodiments of the present application.
本申请实施例还提供了一种包含指令的计算机程序产品,当计算机程序产品在网卡上运行时,使得网卡执行本申请实施例提供的并发控制方法。The embodiments of the present application also provide a computer program product including instructions, when the computer program product runs on the network card, the network card is made to execute the concurrency control method provided by the embodiments of the present application.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, etc.
在本申请实施例中,术语“第一”、“第二”和“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。术语“至少一个”是指一个或多个,术语“多个”指两个或两个以上,除非另有明确的限定。In the embodiments of the present application, the terms "first", "second" and "third" are only used for description purposes, and cannot be understood as indicating or implying relative importance. The term "at least one" refers to one or more, and the term "plurality" refers to two or more, unless expressly limited otherwise.
本申请中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系, 例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。The term "and/or" in this application is only an association relationship to describe associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, it can mean that A exists alone, A and B exist at the same time, independently There are three cases of B. In addition, the character "/" in this document generally indicates that the related objects are an "or" relationship.
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的构思和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above are only optional embodiments of the present application, and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the concept and principles of the present application shall be included in the protection of the present application. within the range.

Claims (24)

  1. 一种并发控制方法,其特征在于,所述方法包括:A concurrency control method, characterized in that the method comprises:
    网卡获取对象,所述对象携带有请求端请求从目的端读取的数据和所述数据的校验信息;The network card obtains an object, and the object carries the data requested by the requester to be read from the destination and the verification information of the data;
    所述网卡根据所述校验信息,对所述数据进行一致性校验;The network card performs consistency check on the data according to the check information;
    当所述一致性校验通过时,所述网卡向所述请求端的内存提供所述数据。When the consistency check is passed, the network card provides the data to the memory of the requester.
  2. 根据权利要求1所述的方法,其特征在于,所述当所述一致性校验通过时,所述网卡向所述请求端的内存提供所述数据,包括:The method according to claim 1, wherein when the consistency check is passed, the network card provides the data to the memory of the requester, comprising:
    当所述一致性校验通过时,所述网卡对所述对象执行校验信息剥离操作,得到所述数据;When the consistency check is passed, the network card performs a verification information stripping operation on the object to obtain the data;
    所述网卡向所述请求端的内存提供所述数据。The network card provides the data to the memory of the requester.
  3. 根据权利要求1或2所述的方法,其特征在于,所述网卡部署在所述目的端中,所述网卡根据所述校验信息,对所述数据进行一致性校验之后,所述方法还包括:The method according to claim 1 or 2, wherein the network card is deployed in the destination terminal, and after the network card performs consistency check on the data according to the verification information, the method Also includes:
    当所述一致性校验不通过时,所述网卡通知所述请求端校验不通过。When the consistency check fails, the network card informs the requester that the check fails.
  4. 根据权利要求1至3任一所述的方法,其特征在于,所述网卡部署在所述目的端中,所述网卡根据所述校验信息,对所述数据进行一致性校验之后,所述方法还包括:The method according to any one of claims 1 to 3, wherein the network card is deployed in the destination terminal, and after the network card performs consistency check on the data according to the verification information, the The method also includes:
    当所述一致性校验不通过时,所述网卡停止对所述数据中未校验的部分进行一致性校验,并停止向所述请求端发送所述数据中已通过校验的部分。When the consistency check fails, the network card stops performing consistency check on the unchecked part of the data, and stops sending the data that has passed the check to the requesting end.
  5. 根据权利要求1或2所述的方法,其特征在于,所述网卡部署在所述请求端中,所述网卡根据所述校验信息,对所述数据进行一致性校验之后,所述方法还包括:The method according to claim 1 or 2, wherein the network card is deployed in the requester, and after the network card performs consistency check on the data according to the verification information, the method Also includes:
    当所述一致性校验不通过时,所述网卡停止将所述数据中已通过校验的部分写入所述请求端的内存中。When the consistency check fails, the network card stops writing the part of the data that has passed the check into the memory of the requester.
  6. 根据权利要求1、2或5所述的方法,其特征在于,所述网卡部署在所述请求端中,所述网卡根据所述校验信息,对所述数据进行一致性校验之后,所述方法还包括:The method according to claim 1, 2 or 5, wherein the network card is deployed in the requester, and after the network card performs consistency check on the data according to the verification information, the The method also includes:
    当所述一致性校验不通过时,所述网卡停止对所述数据中未校验的部分进行一致性校验。When the consistency check fails, the network card stops performing consistency check on the unchecked part of the data.
  7. 根据权利要求1至4任一所述的方法,其特征在于,所述网卡部署在所述目的端中,所述网卡获取对象,包括:The method according to any one of claims 1 to 4, wherein the network card is deployed in the destination terminal, and the network card obtains an object, comprising:
    所述网卡接收所述请求端发送的读请求,所述读请求用于请求读取所述数据;The network card receives a read request sent by the requester, and the read request is used to request to read the data;
    所述网卡根据所述读请求,从所述目的端的内存中获取所述对象。The network card acquires the object from the memory of the destination according to the read request.
  8. 根据权利要求1至4任一或7所述的方法,其特征在于,所述网卡部署在所述目的端中,所述网卡向所述请求端的内存提供所述数据,包括:The method according to any one of claims 1 to 4 or 7, wherein the network card is deployed in the destination, and the network card provides the data to the memory of the requester, comprising:
    所述网卡向所述请求端的网卡发送所述数据,使得所述请求端的网卡向所述请求端的内 存发送所述数据。The network card sends the data to the network card of the requester, so that the network card of the requester sends the data to the memory of the requester.
  9. 根据权利要求1、2、5或6所述的方法,其特征在于,所述网卡部署在所述请求端中,在所述网卡获取对象之前,所述方法还包括:The method according to claim 1, 2, 5 or 6, wherein the network card is deployed in the requester, and before the network card acquires the object, the method further comprises:
    所述网卡向所述目的端发送读请求,所述读请求用于请求读取所述数据;The network card sends a read request to the destination, and the read request is used to request to read the data;
    所述网卡获取对象,包括:The network card acquisition object includes:
    所述网卡接收所述目的端的网卡发送的所述对象,所述对象由所述目的端的网卡基于所述读请求在所述目的端中获得。The network card receives the object sent by the network card of the destination end, and the object is obtained by the network card of the destination end in the destination end based on the read request.
  10. 根据权利要求1、2、5、6或9所述的方法,其特征在于,所述网卡部署在所述请求端中,所述网卡向所述请求端的内存提供所述数据,包括:The method according to claim 1, 2, 5, 6 or 9, wherein the network card is deployed in the requester, and the network card provides the data to the memory of the requester, comprising:
    所述网卡直接向所述请求端的内存发送所述数据。The network card directly sends the data to the memory of the requester.
  11. 根据权利要求1至10任一所述的方法,其特征在于,在所述网卡根据所述校验信息,对所述数据进行一致性校验之前,所述方法还包括:The method according to any one of claims 1 to 10, wherein before the network card performs consistency check on the data according to the check information, the method further comprises:
    所述网卡获取所述对象的描述信息,所述描述信息用于指示所述对象的组织形式;obtaining, by the network card, description information of the object, where the description information is used to indicate the organization form of the object;
    所述网卡基于所述描述信息,从所述对象中获取所述校验信息。The network card acquires the verification information from the object based on the description information.
  12. 一种网卡,其特征在于,所述网卡包括:A network card, characterized in that the network card comprises:
    获取单元,用于获取对象,所述对象携带有请求端请求从目的端读取的数据和所述数据的校验信息;an acquisition unit, configured to acquire an object, the object carrying the data requested by the requester to be read from the destination and the verification information of the data;
    校验单元,用于根据所述校验信息,对所述数据进行一致性校验;a verification unit, configured to perform consistency verification on the data according to the verification information;
    交互单元,用于当所述一致性校验通过时,向所述请求端的内存提供所述数据。The interaction unit is configured to provide the data to the memory of the requester when the consistency check is passed.
  13. 根据权利要求12所述的网卡,其特征在于,所述网卡,还包括:The network card according to claim 12, wherein the network card further comprises:
    剥离单元,用于当所述一致性校验通过时,对所述对象执行校验信息剥离操作,得到所述数据;a stripping unit, configured to perform a verification information stripping operation on the object to obtain the data when the consistency check is passed;
    所述交互单元,具体用于向所述请求端的内存提供所述数据。The interaction unit is specifically configured to provide the data to the memory of the requester.
  14. 根据权利要求12或13所述的网卡,其特征在于,所述网卡部署在所述目的端中,所述交互单元,还用于当所述一致性校验不通过时,通知所述请求端校验不通过。The network card according to claim 12 or 13, wherein the network card is deployed in the destination terminal, and the interaction unit is further configured to notify the requesting terminal when the consistency check fails The verification fails.
  15. 根据权利要求12至14任一所述的网卡,其特征在于,所述网卡部署在所述目的端中,The network card according to any one of claims 12 to 14, wherein the network card is deployed in the destination terminal,
    所述校验单元,还用于当所述一致性校验不通过时,停止对所述数据中未校验的部分进行一致性校验;The verification unit is further configured to stop performing consistency verification on the unverified part of the data when the consistency verification fails;
    所述交互单元,还用于当所述一致性校验不通过时,停止向所述请求端发送所述数据中已通过校验的部分。The interaction unit is further configured to stop sending the part of the data that has passed the check to the requesting end when the consistency check fails.
  16. 根据权利要求12或13所述的网卡,其特征在于,所述网卡部署在所述请求端中,所 述交互单元还用于当所述一致性校验不通过时,停止将所述数据中已通过校验的部分写入所述请求端的内存中。The network card according to claim 12 or 13, wherein the network card is deployed in the requester, and the interaction unit is further configured to stop storing the data in the data when the consistency check fails. The part that has passed the verification is written into the memory of the requester.
  17. 根据权利要求12、13或16所述的网卡,其特征在于,所述网卡部署在所述请求端中,所述校验单元还用于当所述一致性校验不通过时,停止对所述数据中未校验的部分进行一致性校验。The network card according to claim 12, 13 or 16, wherein the network card is deployed in the requester, and the verification unit is further configured to stop checking the The unverified part of the data is checked for consistency.
  18. 根据权利要求12至15任一所述的网卡,其特征在于,The network card according to any one of claims 12 to 15, wherein,
    所述交互单元,还用于接收所述请求端发送的读请求,所述读请求用于请求读取所述数据;The interaction unit is further configured to receive a read request sent by the requester, where the read request is used to request to read the data;
    所述获取单元,具体用于根据所述读请求,从所述目的端的内存中获取所述对象。The obtaining unit is specifically configured to obtain the object from the memory of the destination terminal according to the read request.
  19. 根据权利要求12至15任一或18所述的网卡,其特征在于,所述网卡部署在所述目的端中,所述交互单元,具体用于向所述请求端的网卡发送所述数据,使得所述请求端的网卡向所述请求端的内存发送所述数据。The network card according to any one of claims 12 to 15 or 18, wherein the network card is deployed in the destination end, and the interaction unit is specifically configured to send the data to the network card of the requesting end, so that The network card of the requester sends the data to the memory of the requester.
  20. 根据权利要求12、13、16或17所述的网卡,其特征在于,所述网卡部署在所述请求端中,所述交互单元,还用于向所述目的端发送读请求,所述读请求用于请求读取所述数据;The network card according to claim 12, 13, 16 or 17, wherein the network card is deployed in the requester, and the interaction unit is further configured to send a read request to the destination, and the read request for requesting to read said data;
    所述获取单元,具体用于接收所述目的端的网卡发送的所述对象,所述对象由所述目的端的网卡基于所述读请求在所述目的端中获得。The obtaining unit is specifically configured to receive the object sent by the network card of the destination end, where the object is obtained by the network card of the destination end in the destination end based on the read request.
  21. 根据权利要求12、13、16、17或20所述的网卡,其特征在于,所述网卡部署在所述请求端中,所述交互单元,具体用于直接向所述请求端的内存发送所述数据。The network card according to claim 12, 13, 16, 17 or 20, wherein the network card is deployed in the requester, and the interaction unit is specifically configured to directly send the requester to the memory of the requester. data.
  22. 根据权利要求12至21任一所述的网卡,其特征在于,The network card according to any one of claims 12 to 21, wherein,
    所述获取单元,还用于获取所述对象的描述信息,所述描述信息用于指示所述对象的组织形式;The obtaining unit is further configured to obtain description information of the object, where the description information is used to indicate the organization form of the object;
    所述校验单元,还用于基于所述描述信息,从所述对象中获取所述校验信息。The verification unit is further configured to acquire the verification information from the object based on the description information.
  23. 一种计算机设备,其特征在于,所述计算机设备包括:网卡和存储器,所述存储器中存储有计算机程序;所述网卡执行计算机程序时,实现权利要求1至11任一所述的方法。A computer device, characterized in that the computer device comprises: a network card and a memory, wherein a computer program is stored in the memory; when the network card executes the computer program, the method according to any one of claims 1 to 11 is implemented.
  24. 一种非瞬态的计算机可读存储介质,其特征在于,当所述计算机可读存储介质中的指令被网卡执行时,所述网卡执行权利要求1至11任一所述的方法。A non-transitory computer-readable storage medium, characterized in that, when an instruction in the computer-readable storage medium is executed by a network card, the network card executes the method of any one of claims 1 to 11.
PCT/CN2022/080150 2021-03-16 2022-03-10 Concurrency control method, network card, computer device, and storage medium WO2022194021A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110281600.X 2021-03-16
CN202110281600.XA CN115150472A (en) 2021-03-16 2021-03-16 Concurrency control method, network card, computer device, and storage medium

Publications (1)

Publication Number Publication Date
WO2022194021A1 true WO2022194021A1 (en) 2022-09-22

Family

ID=83321573

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/080150 WO2022194021A1 (en) 2021-03-16 2022-03-10 Concurrency control method, network card, computer device, and storage medium

Country Status (2)

Country Link
CN (1) CN115150472A (en)
WO (1) WO2022194021A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117318892B (en) * 2023-11-27 2024-04-02 阿里云计算有限公司 Computing system, data processing method, network card, host computer and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102595446A (en) * 2012-02-17 2012-07-18 南京邮电大学 Wireless sensor network transaction coordination method
US20140172916A1 (en) * 2012-12-14 2014-06-19 Oracle International Corporation Concurrent access for hierarchical data storage
CN108459866A (en) * 2018-02-11 2018-08-28 广东美的厨房电器制造有限公司 Upgrade method, device, computer equipment, program product and storage medium
CN110086571A (en) * 2019-04-10 2019-08-02 广州华多网络科技有限公司 A kind of data transmission and received method, apparatus and data processing system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102595446A (en) * 2012-02-17 2012-07-18 南京邮电大学 Wireless sensor network transaction coordination method
US20140172916A1 (en) * 2012-12-14 2014-06-19 Oracle International Corporation Concurrent access for hierarchical data storage
CN108459866A (en) * 2018-02-11 2018-08-28 广东美的厨房电器制造有限公司 Upgrade method, device, computer equipment, program product and storage medium
CN110086571A (en) * 2019-04-10 2019-08-02 广州华多网络科技有限公司 A kind of data transmission and received method, apparatus and data processing system

Also Published As

Publication number Publication date
CN115150472A (en) 2022-10-04

Similar Documents

Publication Publication Date Title
EP3796179A1 (en) System, apparatus and method for processing remote direct memory access operations with a device-attached memory
US9684611B2 (en) Synchronous input/output using a low latency storage controller connection
US9858190B2 (en) Maintaining order with parallel access data streams
JP2014531687A (en) System and method for providing and managing message queues for multi-node applications in a middleware machine environment
JP4660064B2 (en) Performing locks in a distributed processing system
CN110119304B (en) Interrupt processing method and device and server
US9811404B2 (en) Information processing system and method
US11048422B2 (en) Method, device, and computer readable storage medium for allocating access rights to data among storage processors
US10341804B2 (en) System, method and computer program product for accessing data from a source by a variety of methods to improve performance and ensure data integrity
US10700869B2 (en) Access control and security for synchronous input/output links
US10229084B2 (en) Synchronous input / output hardware acknowledgement of write completions
US10068001B2 (en) Synchronous input/output replication of data in a persistent storage control unit
CN115080277B (en) Inter-core communication system of multi-core system
US9910808B2 (en) Reflective memory bridge for external computing nodes
WO2022194021A1 (en) Concurrency control method, network card, computer device, and storage medium
CN113821309B (en) Communication method, device, equipment and storage medium between microkernel virtual machines
JP2014532234A (en) System and method for supporting composite message headers in a transaction middleware machine environment
US10133691B2 (en) Synchronous input/output (I/O) cache line padding
CN116166198A (en) Data transmission method, device, system and storage medium
CN114356839B (en) Method, device, processor and device readable storage medium for processing write operation
US10009424B2 (en) Synchronous input/output initialization exchange sequences
US11789634B2 (en) Systems and methods for processing copy commands
US10762011B2 (en) Reflective memory bridge for external computing nodes
WO2023077846A1 (en) Data processing method, device, system, and apparatus
JP2023532138A (en) Image distribution method, electronic device and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22770376

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22770376

Country of ref document: EP

Kind code of ref document: A1