Data access method, medium and electronic equipment
By analyzing the read and write characteristics of node devices to memory blocks and determining the read and write strategies, the problem of high communication delay between nodes in the global memory system is solved, and more efficient memory access and business operation efficiency is achieved.
Patent Information
- Application Number
- CN202311087063.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-25
- Publication Date
- 2025-02-25
AI Technical Summary
In a global memory system, the data communication between nodes is delayed at a high level, resulting in low efficiency of frequent access to data in global memory, and the MSI protocol increases the overhead of communication between nodes.
By analyzing the read and write characteristics of the node device to the memory block, determining the read and write strategy for each memory block, distinguishing between the main nodes and the secondary nodes, and reducing communication between nodes.
Most read and write operations can be performed in local memory, reducing communication between nodes, reducing communication delays for read and write data in the global memory system, improving the access speed of node devices to memory, and improving the operation efficiency of high-performance computing services.
Smart Images

Figure CN119512773A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data access method, a medium and an electronic device. Background Art
[0002] At present, memory resource pooling is increasingly used in business systems such as big data computing and high-performance computing (HPC). Memory resource pooling refers to building part of the memory resources of multiple nodes (such as servers) into a global memory resource pool (hereinafter referred to as global memory), and the other part of the memory resources are used as the local memory resources of the node itself (hereinafter referred to as local memory). Figure 1 As shown, taking the global memory system including nodes A to C as an example, nodes A to C can share memory resources in the global memory and can access memory resources in their own local memories.
[0003] Since the data communication delay between nodes is higher than the delay of nodes accessing their own memory, in order to avoid frequent access to the memory of other nodes in the global memory, the nodes will store the data on the global memory that needs to be accessed recently in the local memory in advance. In addition, in order to avoid conflicts when each node accesses data in the global memory, the cache consistency protocol (modified-shared-invalid, MSI) is usually used to mark the memory blocks read from the global memory to the local memory by the node. Specifically, the memory blocks can be marked as modified (modified, M) state, shared (shared, S) state and invalid (invalid, I) state. Among them, the memory block is the smallest unit of memory reading and writing data, which can also be called a "page", which can be 4 kilobytes (KB) or 8KB, etc.
[0004] For example, when both node A and node B read the data of memory block X in global memory into local memory, the data of memory block X in local memory of node A and node B is consistent with the data in global memory, so both are recorded as S state. When node A modifies the data of memory block X in its local memory, the state of node A becomes M for memory block X. In addition, node A will send an invalidation request to node B, so that the state of node B becomes I for memory block X. When node B wants to obtain the data of memory block X again, it needs to send a request to node A so that node A sends the modified data of memory block X to node B.
[0005] The MSI protocol can avoid the problem of inconsistency between the data in the local memory of other nodes and the data in the local memory of the memory block after the data is modified in the local memory. The MSI protocol can ensure that all nodes can obtain the latest global memory data.
[0006] However, after using the MSI protocol, nodes still need to send each other memory block status requests and the latest data, and there is a high communication delay between nodes, which leads to low efficiency in node access to data in global memory, making the efficiency of services such as big data computing also low. Summary of the invention
[0007] The present application provides a data access method, medium and electronic device, which can determine the read and write strategy for each node device according to the read and write characteristics of the memory block, which can better adapt to the actual situation of each memory block, so that most read and write operations can be performed in the local memory of the node, reducing communication between nodes.
[0008] In a first aspect, a data access method is provided, which is applied to a global memory system, wherein the global memory system includes a first device and multiple node devices, the node devices include local memory and global memory, the multiple node devices share the global memory, and the global memory includes a first memory block, wherein the method includes: the first device obtains operation information of read and write operations performed by multiple node devices on the first memory block, the operation information is used to represent the access rate of the read and write operations on the first memory block; the first device determines the read and write operation characteristics of the multiple node devices corresponding to the first memory block based on the operation information; the first device determines the read and write strategy of the multiple node devices corresponding to the first memory block based on the read and write operation characteristics, and the read and write strategy includes distinguishing the multiple node devices into primary nodes and secondary nodes for performing read and write operations.
[0009] In the above method, the first device determines the read and write strategy for each node device according to the read and write characteristics of the memory block, which can better adapt to the actual situation of each memory block, rather than just dividing the memory block into M state, S state, and I state according to whether it is modified. Furthermore, most of the read and write operations performed by the node device can be performed in the local memory, which can reduce communication between nodes, reduce the communication delay of reading and writing data in the global memory system, and improve the access speed of the node device to the memory. In addition, it can also improve the operating efficiency of the services performed by the node device, such as high-performance computing services.
[0010] In combination with the first aspect, in some implementations, the access rate is determined based on the number and / or time of read and write operations performed by multiple node devices on the first memory block.
[0011] In the above method, the access rate can be the number or time of read and write operations on the memory block as a proportion of all access operations, whether the read and write operations on the memory block come from multiple node devices or mostly come from the same node device. Furthermore, the first device can determine the read and write strategy for each node device according to the read and write characteristics of the memory block, which can better adapt to the actual situation of each memory block.
[0012] In combination with the first aspect, in some implementations, the type of primary node includes a metadata node that stores the first memory block.
[0013] In combination with the first aspect, in some implementations, the type of the main node includes a read master node whose operation information of the read operation meets a first condition, and the first condition includes that the value of the access rate of the node device's read operation on the first memory block meets a first preset condition.
[0014] In combination with the first aspect, in some implementations, the type of the main node includes a write master node whose operation information of the write operation meets a second condition, and the second condition includes that the value of the access rate of the node device's write operation on the first memory block meets a second preset condition.
[0015] In combination with the first aspect, in some implementations, the types of main nodes include read-write main nodes whose operation information of read operations and write operations meets a third condition, and the third condition includes that the value of the access rate of the node device's read operation on the first memory block meets the first preset condition, and the value of the access rate of the write operation on the first memory block meets the second preset condition.
[0016] In the above method, the first device determines a relatively special node in the node device according to the read-write characteristics, such as a metadata node, a read master node, a write master node, and a read-write master node. Determining the type of node device for each node device according to the read-write characteristics of the memory block can better adapt to the actual situation of each memory block.
[0017] In combination with the first aspect, in some implementations, the read-write operation characteristics include a read-write ratio, and the method further includes: the first device determines that the read-write operation ratio of the first memory block is mostly read based on the fact that the numerical value of the access rate of read operations of multiple node devices to the first memory block is greater than the numerical value of the access rate of write operations to the first memory block; or the first device determines that the read-write operation ratio of the first memory block is mostly write based on the fact that the numerical value of the access rate of read operations to the first memory block is less than or equal to the numerical value of the access rate of write operations to the first memory block.
[0018] In the above method, the read-write ratio in the read-write characteristics may include more read operations than write operations (more reads / less writes), and more write operations than read operations (less reads / more writes). In this way, determining the type of node device for each node device based on the read-write characteristics of the memory block can better adapt to the actual situation of each memory block.
[0019] In combination with the first aspect, in some implementations, the read and write operation characteristics include read and write distribution, and the method also includes: the first device determines that the read and write distribution of the first memory block is read exclusive based on the existence of a read master node in multiple node devices; or, the first device determines that the read and write distribution of the first memory block is read shared based on the absence of a read master node in multiple node devices.
[0020] In combination with the first aspect, in some implementations, the read and write operation characteristics include read and write distribution, and the method also includes: the first device determines that the read and write distribution of the first memory block is write-exclusive based on the existence of a write master node in multiple node devices; or, the first device determines that the read and write distribution of the first memory block is write-shared based on the absence of a write master node in multiple node devices.
[0021] In combination with the first aspect, in some implementations, the read and write operation characteristics include read and write distribution, and the method also includes: the first device determines that the read and write distribution of the first memory block is exclusive access based on the existence of a read and write master node in multiple node devices; or, the first device determines that the read and write distribution of the first memory block is shared access based on the absence of a read and write master node in multiple node devices.
[0022] In the above method, the read-write distribution may include being written by multiple node devices (write sharing), most of the write operations come from the same node device (write exclusive), most of the read operations come from the same node device (read exclusive), being read by multiple node devices (read sharing), most of the read and write operations come from the same node device (access exclusive), and read and write operations come from different node devices (access sharing). In this way, determining the type of node device for each node device based on the read and write characteristics of the memory block can better adapt to the actual situation of each memory block.
[0023] In combination with the first aspect, in some implementations, the method also includes: the first device determines that the read and write operation characteristics of the first memory are read-mostly based on the read-write ratio of the first memory block being read-mostly and the read-write distribution being any one of read sharing, write sharing, write exclusive or access sharing; the first device determines that the read and write operation characteristics of the first memory are access exclusive based on the read-write ratio of the first memory block being read-mostly and the read-write distribution being read exclusive or access exclusive, or the read-write ratio of the first memory block being write-mostly and the read-write distribution being write exclusive or access exclusive; the first device determines that the read and write operation characteristics of the first memory are write sharing based on the read-write ratio of the first memory block being write-mostly and the read-write distribution being write sharing or access sharing.
[0024] In the above method, the corresponding read-write strategy can also be determined in combination with the read-write ratio and the read-write distribution. In this way, the type of node device is determined for each node device according to the read-write characteristics of the memory block, which can better adapt to the actual situation of each memory block.
[0025] In combination with the first aspect, in some implementations, the method also includes: the first device determines that the read and write operation characteristics of the first memory are write-exclusive based on the fact that the value of the access rate of the write operation of the first memory block is greater than the first threshold and less than or equal to the second threshold, and the read-write distribution is write-exclusive; the first device determines that the read and write operation characteristics of the first memory are read-exclusive based on the fact that the value of the access rate of the read operation of the first memory block is greater than the third threshold and less than or equal to the fourth threshold, and the read-write distribution is read-exclusive.
[0026] In the above method, the corresponding read-write strategy can also be determined in combination with the read-write ratio and the read-write distribution. In this way, the type of node device is determined for each node device according to the read-write characteristics of the memory block, which can better adapt to the actual situation of each memory block.
[0027] In combination with the first aspect, in some implementations, the method also includes: the first device determines a metadata node among multiple node devices based on the read and write operation characteristics being write sharing, and determines other node devices except the metadata node as write sharing nodes among secondary nodes; based on the first write sharing node among the write sharing nodes receiving a write request corresponding to the first memory block, the first write sharing node updates the write node of the first memory block in the metadata node to be the first write sharing node; and based on the second write sharing node among the write sharing nodes receiving a read request, the second write sharing node obtains the write node of the first memory block from the metadata node; based on the second write sharing node obtaining the write node as the first write sharing node, the second write sharing node obtains data corresponding to the first memory block from the first write sharing node.
[0028] In the above method, the requesting node does not need to send invalidation requests to each other node device when writing data, which reduces communication overhead. After updating the data, the requesting node only needs to update the latest write node to the metadata node, so that the next node device that needs to read and write data can know the node where the latest data is located through the metadata node.
[0029] In combination with the first aspect, in some implementations, the method also includes: the first device determines a read-write master node among multiple node devices based on the read-write operation characteristic being access exclusive, and determines node devices other than the read-write master node as access secondary nodes among secondary nodes; based on the access shared node receiving a read request, the access secondary node requests the data of the first memory block from the read-write master node; and based on the access shared node receiving a write request corresponding to the first memory block, the access secondary node sends the data corresponding to the write request to the read-write master node; and based on the read-write master node receiving a read request corresponding to the first memory block, the read-write master node reads the data of the first memory block in the local memory; and, based on the read-write master node receiving a write request corresponding to the first memory block, the read-write master node reads and updates the data of the first memory block in the local memory.
[0030] In the above method, since in the case of exclusive access, the node device that mainly performs read and write operations on the memory block is the read-write master node, when ensuring that the read-write master node has the latest data, the read-write master node can directly read or write the data of the memory block, which can reduce communication between nodes.
[0031] In combination with the first aspect, in some implementations, the method further includes: the first device determines a write master node among multiple node devices based on the read-write operation characteristic being write exclusive, and determines node devices other than the write master node as write secondary nodes among secondary nodes; based on the write master node receiving a read request corresponding to the first memory block, the write master node reads data of the first memory block in the local memory; and, based on the write master node receiving a write request corresponding to the first memory block, the write master node sends an invalidation request to the write secondary node; and, based on the non-invalidated write secondary node receiving a read request corresponding to the first memory block, The non-invalidated write secondary node reads the data of the first memory block in the local memory, wherein the non-invalidated write secondary node refers to a write secondary node that has not received an invalidation request sent by the write primary node; and, based on the invalidated write secondary node receiving a read request corresponding to the first memory block, the invalidated write secondary node requests the data of the first memory block from the write primary node, wherein the invalidated write secondary node refers to a write secondary node that has received an invalidation request sent by the write primary node; and, based on the write secondary node receiving a write request corresponding to the first memory block, the write secondary node sends data corresponding to the write request to the write primary node.
[0032] In the above method, after updating the data, the secondary write node will send the updated data to the primary write node, so that the primary write node can save the latest data. For the case of exclusive writing, most operations are performed by the primary write node. When the primary write node can save the latest data, the primary write node can directly perform the write operation, reducing the communication between nodes.
[0033] In combination with the first aspect, in some implementations, the method also includes: the first device determines a read master node among multiple node devices based on the read-write operation characteristic being read exclusive, and determines the node devices other than the read master node as read secondary nodes among the secondary nodes; based on the read master node receiving a read request corresponding to the first memory block, the read master node reads the data of the first memory block in the local memory; and, based on the read master node receiving a write request corresponding to the first memory block, the read master node sends an invalidation request to the read secondary node; and, based on the read secondary node receiving a read request corresponding to the first memory block, the read secondary node requests the data of the first memory block from the read master node; and, based on the read secondary node receiving a write request corresponding to the first memory block, the read secondary node sends the data corresponding to the write request to the read master node.
[0034] In the above method, after the secondary node updates the data, it can synchronize the updated data to the read master node, so that the local memory of the read master node can save the latest data. For the read exclusive situation, most operations are performed by the read master node. When the read master node can save the latest data, the read master node can directly perform the read operation, reducing the communication between nodes.
[0035] In combination with the first aspect, in some implementations, the method also includes: based on the read-write operation characteristic being read-most, multiple node devices receive a read request corresponding to a first memory block, and multiple node devices read the data of the first memory block in the corresponding local memory; and, a fourth node device among the multiple node devices receives a write request corresponding to the first memory block, and the fourth node device sends the data corresponding to the write request to other node devices.
[0036] In the above method, any node device that performs a write operation can synchronize the latest data to other node devices, so that each node device can directly read the data in the local memory when performing a read operation, thereby reducing communication between nodes.
[0037] In combination with the first aspect, in some implementations, the method also includes: the first device obtains location information of data of the first memory block read by multiple node devices; the first device divides the first memory block into multiple sub-blocks according to the location information corresponding to the multiple node devices; the first device determines the read and write operation characteristics of the multiple sub-blocks in the first memory block based on the operation information; the first device determines the read and write strategies of the multiple node devices corresponding to the multiple sub-blocks based on the read and write operation characteristics of the multiple sub-blocks.
[0038] In the above method, by dividing the sub-blocks, the amount of data required to store the node information is reduced, and the problem of frequent modification of the node information of the memory block when multiple node devices 200 access different locations of the same memory block is avoided.
[0039] In combination with the first aspect, in some implementations, the method also includes: within a preset time when the node device performs a read and write operation on the data of the first memory block in the local memory, the node device determines a read and write policy corresponding to the first memory block; based on the node device determining that the data of the first memory block in the local memory is a new value according to the read and write policy, the node device continues to perform the read and write operation; based on the node device determining that the data of the first memory block in the local memory is an old value according to the read and write policy, the node device re-executes the read and write operation according to the read and write policy.
[0040] In the above method, if the speculation is successful, it means that the node device can directly access the data, which consumes less time and saves data access time.
[0041] In combination with the first aspect, in some implementations, the method further includes: the first device determines read and write operation characteristics of multiple memory blocks based on operation information of read operations of multiple memory blocks; the first device determines read and write strategies of multiple memory blocks based on the read and write operation characteristics of multiple memory blocks; the fifth node device determines the number of memory blocks in the local memory of the fifth node device that are out-of-bounds values based on the read and write operation characteristics of the multiple memory blocks, wherein an out-of-bounds value means that after the fifth node device reads the memory block data, the number of times the memory block data is updated by other node devices exceeds a preset number, or the fifth node device does not update the memory block data for a preset period of time; based on the fact that the number of memory blocks in the fifth node device that are out-of-bounds values does not exceed a preset number, the fifth node device performs a read operation or a write operation on the data of the multiple memory blocks in the local memory of the fifth node device; or, based on the fact that the number of memory blocks in the fifth node device that are out-of-bounds values exceeds a preset number, the fifth node device performs a read operation or a write operation on the data of the multiple memory blocks in the local memory of the fifth node device according to the read and write strategy of the multiple memory blocks.
[0042] In the above method, by determining the number of bounded values, the situation where node devices execute read and write strategies to obtain the latest data can be effectively reduced. In some cases, node devices can directly use data in local memory, reducing communication between nodes.
[0043] In a second aspect, the present application provides an electronic device, characterized in that it includes a processor and a memory, the memory is used to store instructions, and the processor is used to execute instructions. When the processor executes the instructions, the method described in the first aspect is performed.
[0044] In a third aspect, the present application provides a computer-readable storage medium, characterized in that instructions are stored in the computer-readable storage medium, and when the instructions are run on a computing device, the method described in the first aspect is executed.
[0045] In a fourth aspect, the present application provides a computer program product, characterized in that the computer program product includes computer instructions, and when the computer program product is executed by a computing device, the computing device executes the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for describing the embodiments are briefly introduced below.
[0047] Figure 1 It is a schematic diagram of the system structure of a global direct-connect memory provided in an embodiment of the present application;
[0048] Figure 2 This is a schematic diagram of a server sharing global memory provided by an embodiment of the present application;
[0049] Figure 3 It is an interactive schematic diagram of a read and write operation corresponding to an MSI protocol provided in an embodiment of the present application;
[0050] Figure 4 It is an interactive schematic diagram of read and write operations corresponding to another MSI protocol provided in an embodiment of the present application;
[0051] Figure 5A is a schematic diagram of the system structure of another global direct-connect memory provided in an embodiment of the present application;
[0052] Figure 5B It is a structural diagram of a data access system provided in an embodiment of the present application;
[0053] Figure 6 It is a structural diagram of another server sharing global memory provided in an embodiment of the present application;
[0054] Figure 7 It is a schematic diagram of determining a read-write strategy by read-write characteristics provided by an embodiment of the present application;
[0055] Figure 8 This is a schematic diagram of the interaction of read and write operations corresponding to a write sharing strategy provided in an embodiment of the present application;
[0056] Fig. 9 It is an interactive schematic diagram of a read and write operation corresponding to an access exclusive strategy provided in an embodiment of the present application;
[0057] Fig.10 This is an interactive schematic diagram of a read and write operation corresponding to a write exclusive strategy provided in an embodiment of the present application;
[0058] Fig.11 This is an interactive schematic diagram of a read and write operation corresponding to a read exclusive strategy provided in an embodiment of the present application;
[0059] Fig.12 It is an interactive schematic diagram of read and write operations corresponding to a read-multiple strategy provided in an embodiment of the present application;
[0060] Fig.13 It is a schematic diagram of evenly dividing memory blocks provided in an embodiment of the present application;
[0061] Fig.14 is a schematic diagram of another method of evenly dividing memory blocks provided in an embodiment of the present application;
[0062] Fig.15 It is a schematic diagram of dividing memory blocks according to node read positions provided in an embodiment of the present application;
[0063] Fig.16 It is another schematic diagram of dividing memory blocks according to node read positions provided in an embodiment of the present application;
[0064] Fig.17 It is a schematic diagram of a speculative delay provided by an embodiment of the present application;
[0065] Fig.18 is a schematic diagram of an adaptive speculation system provided by an embodiment of the present application;
[0066] Fig.19 is a schematic diagram of a bounded inconsistency method provided in an embodiment of the present application;
[0067] Fig. 20 It is a flowchart of a data access method provided by an embodiment of the present application;
[0068] Fig.21 It is a structural diagram of a data access device provided in an embodiment of the present application;
[0069] Fig. 22 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] Illustrative embodiments of the present application include, but are not limited to, data access methods, media, and electronic devices.
[0071] First, combine Figure 2 The global memory system involved in the embodiment of the present application is introduced, wherein: Figure 2 The global memory system includes servers 1 to 3, and server 1 is used as an example to perform high performance computing.
[0072] The server 1 includes a high-performance computing platform 210, which specifically includes an application programming interface (API) 211, a global memory directory entry 212, a runtime engine 213, a memory management unit 214, and a communication management unit 215. The server 1 also includes hardware resources: a processor 216, a local memory 217, a global memory 218, and a network card 219. The processor 216, the local memory 217, the global memory 218, and the network card 219 can be interconnected through an internal bus, or can communicate through other means such as wireless transmission. Figure 2 Not shown.
[0073] The structures of server 2 and server 3 can refer to server 1, and can also have more or fewer modules than server 1, which is not specifically limited in this application. In addition, servers 1 to 3 are interconnected through a network switch 201, and servers 1 to 3 can share global memory with each other. For example, server 1 uses a part of its memory as global memory 218, and servers 1 to 3 can all use the storage space of global memory 218.
[0074] Among them, the high-performance computing platform 210 is run by a processor 216, and can be specifically used to provide model training or reasoning services such as image processing and autonomous driving, and this application does not impose specific restrictions on this. The programming interface 211 in the high-performance computing platform 210 can be used to transmit information between different programs, such as a program function in high-performance computing obtains the calculation results generated by another program function, or writes the calculation results to the local memory 217 through the programming interface 211. The global memory directory entry 212 is used to represent the attribute information of the memory block contained in the global memory in the global memory system, such as the metadata node to which the memory block belongs, the MSI status, etc. The runtime engine 213 may include functional functions that need to be called by the programming language, etc.
[0075] The memory management module 214 may include a memory sequential consistency model and a local memory consistency protocol.
[0076] The memory sequential consistency model is used to manage the operation order of a series of read and write operations performed by the processor 216 on the local memory 217 or the global memory 218. For example, if the processor 216 executes multiple threads, the memory sequential consistency model is used to determine the execution order of the multiple threads to avoid reordering of memory operations. The memory sequential consistency model can specifically adopt a sequential consistency memory model (SC), a relaxed memory model (RMM), and a total store order (TSO).
[0077] The local memory consistency protocol is used to make the data read from the global memory by different servers consistent. It is usually implemented by using the MSI protocol for multi-core processor cache consistency. The cache in the MSI protocol corresponds to the local memory, and the memory in the MSI protocol corresponds to the global memory. The introduction of the MSI protocol will be combined with Figure 3 Provide detailed explanation.
[0078] The communication management unit 215 is used to manage the communication of the server 1, so that the server 1 can realize the communication of the hardware devices inside the server 1 through the communication interface, and realize the communication between the server 1 and other devices. For example, the server 1 can communicate with other servers through the network card 219 and the network switch 201, and then can access the global memory of other servers.
[0079] The processor 216 may be composed of at least one general-purpose processor, such as a central processing unit (CPU), or a combination of a CPU and a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The processor 216 executes various types of digital storage instructions, such as software or firmware programs stored in the local memory 217, which enables the server 1 to provide high-performance computing services.
[0080] The local memory 217 and the global memory 218 may include volatile memory, such as dynamic random access memory (DRAM); or non-volatile memory, such as flash memory, phase change memory (PCM), resistive random-access memory (RRAM); the local memory 217 and the global memory 218 may also include a combination of the above types. The local memory 217 and the global memory 218 may be used to store data required by the high-performance computing platform 210, and the local memory 217 may also be used to store program code, and the execution is controlled by the processor 216.
[0081] It is worth noting that Figure 2 This is only a schematic diagram of a global memory system and server architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 2 In the example, servers 1 to 3 are taken as examples. In other cases, other servers may also be included. This application does not make specific limitations on this.
[0082] The MSI protocol involved in this application is introduced in detail below. As can be seen from the above, the MSI protocol will mark the memory blocks read from the global memory to the local memory of the node, specifically marking them as modified (M), shared (S) and invalid (I).
[0083] Combine the following Figure 3 (A) to (E) in FIG. 1 describe the process of each node performing read and write operations on a memory block Y in the global memory when the memory block Y is in the M, S, and I states in the local memory of each node. And, for the convenience of description, Figure 3 In (A) to (E), when the data of memory block Y is in M, S, and I states in the local memory of each node, the corresponding nodes are recorded as M nodes, S nodes, and I nodes, respectively.
[0084] (1) Perform a read operation on the S node.
[0085] An S node refers to a node whose local memory contains the same data as the data of memory block Y in the global memory. That is, after reading the data of memory block Y from the global memory, no other node has modified the data of memory block Y. It should be understood that there can be multiple S nodes for memory block Y. Therefore, the local memory of the S node contains the latest data of memory block Y, such as Figure 3 As shown in (A), the S node receives a request to read data (hereinafter referred to as a read request), and the S node can directly read its own local memory to obtain the data of memory block Y.
[0086] (2) Perform write operation on the S node.
[0087] When the S node receives a request to write data to the local data of the memory block Y (hereinafter referred to as a write request), it will invalidate other S nodes, so that other S nodes can know that the data of the memory block Y has been modified, and the state of the S node performing the write operation will also be updated to the M state. Figure 3 As shown in (B) in FIG. 1 , including:
[0088] 3B-1: Node S receives the write request.
[0089] 3B-2: The S node will send invalidation requests to other S nodes. Figure 3 (B) in the figure takes two S nodes as an example. It should be understood that if there are three or more S nodes, the S node will also send invalidation requests to other S nodes.
[0090] 3B-3: Other S nodes will change their status to I nodes. I nodes indicate that the data of memory block Y has been modified by other nodes, and the data of memory block Y in the local memory of I nodes is no longer the latest data.
[0091] 3B-4: Other S nodes send a reply to the S node, indicating that the other S nodes have been invalidated as I nodes.
[0092] 3B-5: The S node changes its state to an M node. The S node will also perform data write operations according to the write request and change its own state to an M node. The M node indicates that the data of the memory block Y in the local memory of the node is the latest data. It should be understood that when there is an M node in the memory block Y, the other nodes are all I nodes.
[0093] (3) Perform read and write operations on the M node.
[0094] Since the M node indicates that the data of the memory block Y in the local memory of the node is the latest data, if Figure 3 As shown in (C), the M node can directly read and write data in the local memory.
[0095] (4) Perform a read operation on the I node.
[0096] The I node indicates that the data of memory block Y has been invalidated in this node, and other nodes have modified the data of memory block Y. Therefore, Figure 3 As shown in (D), when the I node needs to read the data of the memory block Y, the following steps are included:
[0097] 3D-1: The I node receives a read request.
[0098] 3D-2: Node I requests the latest data from node M. Node M is the node that has recently modified the data of memory block Y, so node I can obtain the latest data of memory block Y from node M.
[0099] 3D-3: The M node sends the latest data to the I node.
[0100] (5) Perform write operation on the I node.
[0101] The I node does not have the latest data of memory block Y, so it needs to obtain the latest data from the M node before it can perform a write operation. After the I node performs a write operation, the I node will be updated to the M node, and the previous M node will be invalidated as an I node. Figure 3 As shown in (E) in FIG. 1 , the process may include:
[0102] 3E-1: The I node receives a write request.
[0103] 3E-2: The I node requests the latest data from the M node.
[0104] 3E-3: Node M sends the latest data to node I.
[0105] 3E-4: M node changes state to I node. After M node sends the latest data of memory block Y to I node, I node will perform a write operation, so that the data in the current M node is not the latest data, and then M node needs to be changed to I node. It should be understood that this step can also be performed after I node completes the write operation, and this application does not make specific limitations on this.
[0106] 3E-5: The I node changes to an M node. After the I node obtains the latest data, it writes the corresponding data according to the write request, so that the current node has the latest data, and then the I node also changes its status to an M node.
[0107] In some embodiments, the global memory directory entry of a node only stores the status data of each memory block for its own node and the metadata node of the memory block, where the metadata node refers to the node where the memory block is actually stored. The metadata node stores the status of the memory block actually stored in its own global memory for each node.
[0108] For example, the I node only knows that the state of the memory block for this node is I, and the metadata node where the memory block is actually stored, but does not know which M node stores the latest data of the memory block. Therefore, when performing read and write operations on the I node, the I node also needs to send a request to the metadata node to obtain the M node of the memory block.
[0109] For example, Figure 4 As shown, a global memory system including nodes A to D is taken as an example. In which, memory block Y is stored in node D, that is, node D is a metadata node. And, for memory block Y, when the state of node A is M, and both node B and node C are I, if a write operation is performed on node B (I state), the process includes:
[0110] 4-1: Node B receives the write request.
[0111] 4-2: Node B requests the metadata node to send the latest data to node M. Since node B only knows the metadata node where memory block Y is actually stored, and does not know the M node that stores the latest data of memory block Y, it needs to send a request to the metadata node.
[0112] 4-3: The metadata node forwards the request to node A. When the metadata node determines that the state of node A is M by querying the global memory directory entry, it will forward the request for node B to obtain the latest data to node A.
[0113] 4-4: Node A sends the latest data to node B. Node A will read the latest data corresponding to memory block Y from the local memory and send it to node B. Then node B can perform a write operation based on the latest data of the current memory block Y. After node B completes the write operation, the state of node B changes to M and the state of node A changes to I.
[0114] If at this time the state of node B is M, and both node A and node C are I, if a write operation is performed on node C (I state), the process includes:
[0115] 4-5: Node C receives the write request.
[0116] 4-6: Node C requests the metadata node to send the latest data to node M.
[0117] 4-7: The metadata node forwards the request to node B.
[0118] 4-8: Node B sends the latest data to node C. Node C can then perform a write operation based on the current latest data, and after node C completes the write operation, the state of node C changes to M, and the state of node B changes to I.
[0119] In summary, the MSI protocol can ensure that the data obtained by any node in the local memory is the latest data, avoiding the situation where the data of a memory block is modified in the local memory of a node, and the data obtained by other nodes from their own local memory is still the old data that has not been modified. The MSI protocol ensures that the data of the same memory block read by each node through the local memory is consistent. Furthermore, each node can store the data in the global memory in the local memory in advance, avoiding the need to communicate with other nodes every time the global memory is read.
[0120] However, the MSI protocol still has a lot of inter-node communication, especially when the memory block state is I, or when a write operation is required on a memory block in S state. For details, please refer to the above Figure 3 (B) Figure 3 (D) Figure 3 (E) and Figure 4 Since the MSI protocol involves a large number of nodes sending state change requests and sending the latest data, there is still a large communication delay in the global memory system, which makes the node's access speed to the memory still low.
[0121] In order to solve the problem that nodes in a global memory system have slow access to global memory, the present application provides a data access method that can be applied to Figure 1The global memory system and electronic device 100 shown. The global memory system includes multiple node devices 200, and the electronic device 100 can be any node device in the global memory system, or a management device of the global memory system, that is, a device connected to the global memory system but not sharing memory with the node devices 200 in the global memory system.
[0122] The electronic device 100 can collect statistics on the access rates of the read and write operations of each memory block by each node device 200 in the global memory system to obtain the read and write characteristics of each memory block. For example, the read and write characteristics may include the proportion of the number or time of the read and write operations of the memory block to all access operations (hereinafter referred to as the read and write ratio), and may also include whether the read and write operations of the memory block come from multiple node devices 200 or whether they mostly come from the same node device 200 (hereinafter referred to as the read and write distribution). Then the electronic device 100 determines the strategy for performing read and write operations on each node device 200 (hereinafter referred to as the read and write strategy) based on the read and write characteristics of each node device 200 for each memory block.
[0123] Optionally, the electronic device 100 may determine the read / write strategy of the node device 200 for the memory block according to the read / write ratio or the read / write distribution. The electronic device 100 may also determine the read / write strategy of the node device 200 for the memory block in combination with the read / write ratio and the read / write distribution. The present application does not specifically limit the specific type of the read / write feature.
[0124] For example, for a memory block with more read operations, after the node device 200 performs a write operation on the local memory data corresponding to the memory block, the latest data will be synchronized to other node devices 200 that have read the memory block. In this way, when each node device 200 wants to read the data of the memory block, it can directly read the latest data of the memory block from the local memory, reducing the communication between nodes.
[0125] For another example, if the read and write operations of a memory block mostly come from the same node device 200, the node device 200 that performs a large number of read / write operations on the memory block will be used as the master node of the memory block, and other node devices 200 that perform a small number of read and write operations will be used as secondary nodes. When the secondary node wants to write the local memory data corresponding to the memory block, it will send the latest written data to the master node, so that the local memory of the master node records the latest data of the memory block. In this way, the master node can read and write the latest data directly from its own local memory, and most operations for this type of memory block also come from the master node, thereby reducing communication between nodes.
[0126] In this way, the read and write strategy for each node device 200 is determined according to the read and write characteristics of the memory block, which can better adapt to the actual situation of each memory block, rather than just dividing the memory block into M state, S state, and I state according to whether it is modified. Furthermore, most of the read and write operations performed by the node device 200 can be performed in the local memory, which can reduce inter-node communication, reduce the communication delay of reading and writing data in the global memory system, and improve the access speed of the node device 200 to the memory. In addition, it can also improve the operating efficiency of the business performed by the node device 200, such as high-performance computing business.
[0127] In some embodiments, the data access method involved in the present application can be applied to a distributed computing system, which refers to a distributed computing system through multiple, such as Figure 5A As shown, the electronic device 100 manages and connects multiple node devices 200 (including node A, node B, node C, etc.), and the multiple node devices 200 share a global memory.
[0128] Figure 5B FIG. 1 shows a schematic diagram of a data access system provided by the present application when applied to distributed computing. Figure 5B As shown, the data access system includes a user layer, a distributed scheduling layer, and a global direct memory layer. The user layer is used to provide computing data and computing tasks, and the distributed scheduling layer is used for the electronic device 100 to distribute computing tasks and computing data to multiple node devices 200 for processing according to the computing data and computing tasks. The global direct memory layer is used to ensure that data remains consistent within multiple node devices 200, specifically including solutions such as strong data consistency and weak data consistency. Strong data consistency includes a memory sequential consistency model, a local memory consistency protocol, and a local memory consistency protocol is implemented through a local memory synchronization module. The local memory synchronization module specifically includes a read-write feature module 510, a read-write strategy module 520, a sub-block partitioning module 530, and an adaptive speculation module 540. Weak data consistency includes a bounded inconsistency module 550.
[0129] The read / write feature module 510 is used to determine the read / write features according to the access rates of the read and write operations of the memory block. The read / write strategy module 520 is used to determine the corresponding read / write strategy according to the read / write features of the memory block. Figures 7 to 12 and its related description.
[0130] When a memory block is accessed by multiple node devices 200, the sub-block division module 530 will dynamically divide the memory block into multiple sub-blocks according to the locations accessed by the multiple node devices 200, and determine the read and write characteristics of each sub-block. Different read and write strategies can be adopted for different sub-blocks. For details, please refer to Figures 13 to 16 and its related description.
[0131] The adaptive speculation module 540 is used for the node device 200 to perform speculative reading and writing when accessing data. After the speculation delay, the data is judged to determine whether to re-read or re-write according to the read-write strategy. If the data during the speculative reading and writing is judged to be the latest data, the speculation is successful, thereby reducing the time wasted in determining the read-write strategy process. For details, please refer to Fig.17 and Fig.18 and its related description.
[0132] When a certain node device 200 needs to obtain multiple memory block data, the bounded inconsistency module 550 will determine the proportion of bounded values in the multiple memory block data required in the current node device 200, wherein the bounded value refers to the memory block data that has been modified by other node devices or the reading time is within a preset range. For example, after a certain node device 200 reads the memory block data, other node devices 200 have modified the memory block more than 5 times or the node device 200 has obtained the memory block for more than 1 hour, then the memory block data in the node device 200 is not a bounded value (i.e., an out-of-bounds value). If the proportion of bounded values is greater than the threshold, then there are many bounded values in the multiple memory block data required, and the latest data may not be obtained according to the read-write strategy. If the proportion of bounded values is less than or equal to the threshold, that is, the number of out-of-bounds values is large, then the node device 200 needs to update the memory block data through the corresponding read-write strategy mentioned above. For details, please refer to Fig.19 and its related description.
[0133] Above Figure 5B The data access system shown can also be applied to Figure 2 In the architecture shown in Figure 6 As shown, taking server 1 as an example, server 1 includes a high-performance computing platform 610, specifically including a programming interface 611, a global memory directory entry 612, a runtime engine 613, a memory management unit 614, and a communication management unit 615. Server 1 also includes hardware resources: a processor 616, a local memory 617, a global memory 618, a network card 619, and a hardware transactional memory (HTM) 620. The structure of the memory management unit 614 can refer to the aforementioned Figure 5B And its related description, the rest of the structure can refer to the aforementioned Figure 2 The related descriptions will not be repeated here.
[0134] Below Figure 5B The read-write feature module 510 and the read-write strategy module 520 involved in the description are described in detail.
[0135] The read-write feature module 510 is used to determine the read-write features of the memory block, and the read-write features include a read-write ratio and a read-write distribution. The read-write ratio in the read-write feature may include more read operations than write operations (more reads / less writes), and more write operations than read operations (less reads / more writes). The read-write distribution may include being written by multiple node devices 200 (write sharing), most of the write operations come from the same node device 200 (write exclusive), most of the read operations come from the same node device 200 (read exclusive), data is read by multiple node devices 200 (read sharing), most of the read operations and write operations come from the same node device 200 (access exclusive), read operations and write operations come from different node devices 200 (access sharing), etc.
[0136] The following takes memory block L as an example to describe the situations of mostly read and mostly write.
[0137] The electronic device 100 can determine whether the memory block L is read-mostly or write-mostly by comparing the number of read operations and write operations performed on the memory block L. When the number of read operations performed on the memory block L is greater than the number of write operations performed on the memory block L, the memory block L is read-mostly. Conversely, when the number of read operations performed on the memory block L is less than the number of write operations performed on the memory block L, the memory block L is write-mostly.
[0138] Specifically, the electronic device 100 can compare the number of read operations and write operations performed on the memory block L with a preset threshold. For example, the case where the read-write characteristic is read-mostly may include: the number of read operations of the memory block L is greater than the threshold δ1, wherein δ1 may be the number of read operations, or the ratio of the number of read operations to all access times. The number of accesses refers to the sum of the number of read operations and write operations. For example, δ1 may be taken as 90%. The case where the read-write characteristic is write-mostly may include the number of write operations on the memory block L being greater than δ2, wherein the second threshold may be the number of write operations, or the ratio of the number of write operations to all access times, and δ2 may be taken as 90%.
[0139] In the above description, for the convenience of explanation, the number of read operations and write operations is used as an example of access rate, but the present application is not limited to this. The electronic device 100 can make a judgment based on the number of read and write operations, or based on the time of the read and write operations, or based on the number and time of the read and write operations. When making a judgment based on the number and time of read and write operations, the number and time of each read and write operation can also be converted. For example, an access by a node device exceeding a predetermined time period can be regarded as multiple read and write operations on the memory block L, or a node device's continuous multiple reads and writes to the memory block L within a certain period of time can be regarded as one read and write operation, etc.
[0140] In some embodiments, the electronic device 100 may also count the number of read operations and the number of write operations within a preset time. That is, read more means that the number of read operations within the preset time is greater than δ1. Write more means that the number of write operations within the preset time is greater than δ2.
[0141] In other embodiments, the electronic device 100 may also determine the access rate based on the time taken by the node device 200 to perform read operations and write operations, respectively. For example, more reads may mean that the time taken by the node device 200 to perform read operations is longer than the time taken to perform write operations. Alternatively, more reads may mean that the time taken by the node device 200 to perform read operations is greater than a threshold value T1, and more writes may mean that the time taken by the node device 200 to perform write operations is greater than a threshold value T2.
[0142] Taking memory block L as an example, write sharing, write exclusive, read exclusive, read sharing, access exclusive and access sharing are described below.
[0143] The electronic device 100 determines the read and write distribution of the memory block L by counting the devices that perform read and write operations on the memory block L. Specifically, the electronic device 100 counts the access rate of each node device 200 for reading the memory block L, and sorts the node devices 200 according to the access rate of the read operation. As mentioned above, the access rate can be the number of read operations or the occupied time, or the number of read operations within a preset time, etc. And calculate the number of nodes N that occupy the read operation access rate of the preset proportion δ3, and 1 / N is the read exclusive index. The larger the read exclusive index, the more concentrated the distribution of the read operation. Among them, δ3 can also be taken as 90%. The electronic device 100 will also determine whether the memory block L is read exclusive by judging whether the read exclusive index is greater than the threshold δ4. If it is greater than the threshold δ4, it means that the memory block L is read exclusive, that is, the memory block L is read by a small number of node devices 200. If it is less than the threshold δ4, it means that the memory block L is read shared, that is, the memory block L is read by a large number of node devices 200. Similarly, the above method can be used for write operations and all access operations to determine whether the memory block L is write-exclusive and access-exclusive, which will not be repeated here.
[0144] In some embodiments, if there is a node device 200 whose access rate of the read operation on the memory block L is greater than the threshold δ6, it can also be determined that the memory block L is read-exclusive.
[0145] Similarly, the above method can be used for write operations and all access operations to determine whether the memory block L is write-exclusive and access-exclusive. The present application does not specifically limit the determination method of read-exclusive, write-exclusive and access-exclusive.
[0146] The read / write strategy module 520 is used to determine the read / write strategy according to the read / write characteristics. The read / write strategies corresponding to different read / write characteristics are described below.
[0147] The electronic device 100 can determine the read-write strategy by the read-write ratio and / or the read-write distribution, wherein the read-write strategy can include a read mostly strategy, a write shared strategy, an access exclusive strategy, a write exclusive strategy, a read exclusive strategy, and an MSI strategy. The specific method of the MSI strategy can be referred to in the aforementioned Figure 3 (A) to (E) in the above table, the other read and write strategies will be combined below. Figures 8 to 12 Provide a detailed introduction.
[0148] In some embodiments, the electronic device 100 may determine the read-write strategy only according to the read-write ratio. For example, as shown in Table 1 below, if the memory block L is read-mostly, the read-mostly strategy is determined to be adopted, and if the memory block is write-mostly, the MSI strategy may be adopted.
[0149] Table 1
[0150] Read-Write Ratio Read more Write more Read and write strategies Read more strategies MSI Strategy
[0151] In other embodiments, the electronic device 100 may determine the read-write strategy only based on the read-write distribution. For example, as shown in Table 2 below, if the memory block L is read-shared, the MSI strategy is determined to be adopted; if the memory block L is read-exclusive, the read-exclusive strategy is determined to be adopted; if the memory block L is write-shared, the write-shared strategy is determined to be adopted; if the memory block L is write-exclusive, the write-exclusive strategy is determined to be adopted; if the memory block L is access-shared, the MSI strategy is determined to be adopted; if the memory block L is access-exclusive, the access-exclusive strategy is determined to be adopted.
[0152] Table 2
[0153] Read and write distribution Read Share Read Exclusive Write Share write exclusive Access Share Exclusive access Read and write strategies MSI Strategy Read Exclusive Policy Write Sharing Policy Write Exclusive Strategy MSI Strategy Access Exclusive Policy
[0154] In other embodiments, the electronic device 100 can also comprehensively consider the read-write ratio and the read-write distribution to determine the read-write strategy. For example, as shown in Table 3 below, when the read-write ratio is read-most, if the read-write distribution is read-shared, write-shared, write-exclusive or access-shared, the read-most strategy can be adopted. When the read-write ratio is read-most and the read-write distribution is read-exclusive or access-exclusive, or the read-write ratio is write-most and the read-write distribution is write-exclusive or access-exclusive, the access-exclusive strategy can be adopted. When the read-write ratio is write-most and the read-write distribution is write-shared or access-shared, the write-shared strategy can be adopted. When the read-write ratio is write-most and the read-write distribution is read-shared or access-shared, the MSI strategy can be adopted.
[0155] Table 3
[0156] Read Share Read Exclusive Write Share write exclusive Access Share Exclusive access Read more Read more strategies Access Exclusive Policy Read more strategies Read more strategies Read more strategies Access Exclusive Policy Write more MSI Strategy MSI Strategy Write Sharing Policy Access Exclusive Policy Write Sharing Policy Access Exclusive Policy
[0157] In other embodiments, the electronic device 100 determines the ratio of the number of read operations / time to all access operations (read ratio) and the ratio of the number of write operations / time to all access operations (write ratio) of the memory block L. Then, the read ratio, write ratio, read exclusive index, write exclusive index and access exclusive index are compared with the upper threshold and the lower threshold, respectively, to determine the corresponding read and write strategy.
[0158] For example, Figure 7 As shown in (A), when the read ratio is less than the low threshold RM1, the MSI strategy is adopted. When the read ratio is greater than the low threshold RM1 and less than the high threshold RM2, when the read exclusive index is less than the high threshold RE2, the MSI strategy is adopted, and when the read exclusive index is greater than the high threshold RE2, the read exclusive strategy is adopted.
[0159] like Figure 7 As shown in (B), if the write exclusive index is less than the low threshold WE1, the write sharing strategy can be adopted. If the write exclusive index is greater than the low threshold WE1, if the write ratio is less than the low threshold WM1, the read-multiple strategy can be adopted; if the write ratio is greater than the low threshold WM1, the MSI strategy can be adopted. If the write ratio is greater than the low threshold WM1, the read-multiple strategy can be adopted. If the write ratio is greater than the high threshold WE2, if the write ratio is less than WM1, the read-multiple strategy can be adopted; if the write ratio is greater than WM1 and less than WM2, the write exclusive strategy can be adopted; if the write ratio is greater than WM2, the access exclusive strategy can be adopted.
[0160] like Figure 7 As shown in (C), when the read-based ratio is less than the high threshold RM2 and the access exclusive index is less than AE2, the MSI protocol can be used. When the read-based ratio is greater than RM2 and the access exclusive index is less than AE2, the read sharing strategy can be used. When the access exclusive index is greater than AE2, the access exclusive strategy can be used.
[0161] In summary, as shown in Table 4 below, if the memory block L is written by multiple node devices 200, a write sharing strategy can be adopted. If the access operations of the memory block L are mostly from the same node device 200, an access exclusive strategy can be adopted. If the write operations of the memory block L are mostly from the same node device 200, a write exclusive strategy can be adopted. If the read operations of the memory block L are more, a read-multiple strategy can be adopted. If the read operations of the memory block L are mostly from the same node device 200, a read-exclusive strategy can be adopted. For other situations, the MSI strategy can be adopted.
[0162] Table 4
[0163]
[0164] The following describes in detail the processes of the above-mentioned write sharing strategy, access exclusive strategy, write exclusive strategy, read exclusive strategy, and read multiple strategy when performing read and write operations, wherein the memory block L is also used as an example for illustration.
[0165] The write sharing strategy divides the node device 200 into a metadata node and a request node. The metadata node is the node device 200 that actually stores the memory block L, and the request node is the node device 200 that receives a write request or a read request. Figure 8 The process of reading and writing data using the write sharing strategy is shown.
[0166] like Figure 8 As shown in (A), the requesting node receives a write request, including:
[0167] 8A-1: The requesting node receives a write request.
[0168] 8A-2: The request node updates the latest write node of the memory block to the metadata node. The latest write node refers to the data that has been modified the most recently on the data of the memory block L.
[0169] 8A-3: The metadata node feeds back the requesting node that the write is successful.
[0170] like Figure 8 As shown in (B), the requesting node receives a write request, including:
[0171] 8B-1: The requesting node receives a read request.
[0172] 8B-2: The requesting node queries the metadata node for the latest write node of the memory block.
[0173] 8B-3: The metadata node feeds back node information to the requesting node.
[0174] 8B-4: The requesting node sends a data request to the latest writing node.
[0175] 8B-5: The latest writing node sends the latest data to the requesting node.
[0176] In this way, the requesting node does not need to send invalidation requests to each other node device 200 when writing data, which reduces communication overhead. After updating the data, the requesting node only needs to update the latest write node to the metadata node, so that the next node device 200 that needs to read and write data can know the node where the latest data is located through the metadata node.
[0177] The access exclusive strategy divides the node device 200 into a read-write primary node and a secondary node. The read-write primary node is a node whose access rate (e.g., number of times or time) for reading and writing operations on the memory block L is greater than a preset value, such as a node of δ3, that is, a node device 200 that mainly performs read and write operations on the memory block L. Alternatively, it can be a node device 200 that performs the most read and write operations on the memory block L or has the longest access time. In other words, there can be only one read-write primary node or multiple read-write primary nodes.
[0178] like Fig. 9 As shown in (A), the read-write master node receives a write request, including:
[0179] 9A-1: The read / write master node receives a read / write request. The read / write master node stores the latest data of the memory block L, so the read / write master node can directly read or write the data of the memory block L.
[0180] like Fig. 9 (B) in FIG. 1 shows the situation where the secondary node receives a write request, including:
[0181] 9B-1: The secondary node receives a read / write request.
[0182] 9B-2: The secondary node forwards the request to the read-write primary node.
[0183] 9B-3: The read-write master node sends the latest data to the secondary node / feedbacks successful writing. Since the read-write master node stores the latest data of memory block L, other secondary nodes need to send requests to the read-write master node when they need to read or update data.
[0184] In this way, since in the case of exclusive access, the node device 200 that mainly performs read and write operations on the memory block L is the read-write master node, when the read-write master node is guaranteed to have the latest data, the read-write master node can directly read or write the data of the memory block L, thereby reducing communication between nodes.
[0185] The write exclusive strategy divides the node device 200 into a write master node and a secondary node, and records the MSI status of the secondary node. The write master node is a node device 200 whose access rate (e.g., number of times or time) for write operations is greater than a preset value, such as δ3, that is, a node device 200 that mainly performs write operations on memory block L. Alternatively, it can be a node device 200 that performs the most write operations on memory block L or takes the longest time for write operations. In other words, there can be only one or more write master nodes.
[0186] like Fig.10 (A) in FIG. 1 shows the situation where the write master node receives a read request, including:
[0187] 10A-1: The write master node receives a read request. The write master node stores the latest data of memory block L, so the write master node can directly read the data of memory block L.
[0188] like Fig.10 (B) in FIG. 1 shows the situation where the write master node receives a write request, including:
[0189] 10B-1: The write master node receives the write request.
[0190] 10B-2: The write master node sends an invalidation request to the secondary node. After the write master node updates the data, it will invalidate the secondary node, causing the secondary node to change to the I state, and then the secondary node (I state) can know that the data in the current local memory is not the latest data.
[0191] 10B-3: The secondary node reports success to the write primary node.
[0192] like Fig.10 As shown in (C), the secondary node (S state) receives a read request, including:
[0193] 10C-1: The secondary node (S state) receives a read request. The secondary node (S state) has not been written to the primary node, so the data in the memory block L can be read directly.
[0194] like Fig.10 As shown in (D), the secondary node (I state) receives a read request, including:
[0195] 10D-1: The secondary node (I state) receives a read request.
[0196] 10D-2: The secondary node (I state) forwards the request to the write master node. Since the secondary node (I state) has been invalidated, the node data in the local memory is no longer the latest data, and thus, a data request needs to be sent to the write master node that stores the latest data.
[0197] 10D-3: The write master node sends the latest data to the secondary node (I state).
[0198] like Fig.10 As shown in (E), the secondary node (I state / S state) receives a write request, including:
[0199] 10E-1: The secondary node receives the write request.
[0200] 10E-2: The secondary node forwards the request to the write primary node.
[0201] 10E-3: The write primary node sends feedback to the secondary node indicating that the write was successful.
[0202] In this way, after updating the data, the secondary node will send the updated data to the write master node, so that the write master node can save the latest data. For the case of exclusive write, most operations are performed by the write master node. When the write master node can save the latest data, the write master node can directly perform the write operation, reducing the communication between nodes.
[0203] The read exclusive strategy divides the node device 200 into a read master node and a secondary node. The read master node is a node device 200 whose access rate (e.g., number of times or time) for performing read operations is greater than a preset value, such as δ3, that is, a node device 200 that mainly performs read operations on memory block L. Alternatively, it can be a node device 200 that performs the most read operations on memory block L or takes the longest time for read operations. In other words, there can be only one read master node or multiple read master nodes.
[0204] like Fig.11 (A) in FIG. 1 shows the situation where the read master node receives a read request, including:
[0205] 11A-1: The read master node receives the read request. The read master node stores the latest data of the memory block L, so the read master node can directly read the data of the memory block L in the local memory.
[0206] like Fig.11 (B) in FIG. 1 shows the situation where the read master node receives a write request, including:
[0207] 11B-1: The read master node receives the write request.
[0208] 11B-2: The read master node sends an invalidation request to the secondary node. After the read master node updates the data, it will invalidate the secondary node so that the secondary node can know that the data in the current local memory is not the latest data.
[0209] 11B-3: The secondary node reports success to the read primary node.
[0210] like Fig.11 (C) in FIG. 1 shows the situation where the secondary node receives a read request, including:
[0211] 11C-1: The secondary node receives a read request.
[0212] 11C-2: The secondary node forwards the request to the read primary node.
[0213] 11C-3: The read master node sends the latest data to the secondary node.
[0214] like Fig.11 (D) in FIG. 1 shows the situation where the secondary node receives a write request, including:
[0215] 11D-1: The secondary node receives the write request.
[0216] 11D-2: The secondary node updates and reads the data of the primary node.
[0217] 11D-3: The read primary node feeds back to the secondary node that the update was successful.
[0218] In this way, after the secondary node updates the data, it can synchronize the updated data to the read master node, so that the local memory of the read master node can save the latest data. For the read exclusive situation, most operations are performed by the read master node. When the read master node can save the latest data, the read master node can directly perform the read operation, reducing the communication between nodes.
[0219] The read-multiple strategy corresponds to the situation where there are many read requests and a large number of node devices 200 perform read operations on the memory block L. Therefore, it is necessary to ensure that each node device 200 has the latest data, so that each node device 200 can directly read data from the local memory.
[0220] like Fig.12 (A) shows the situation where the requesting node receives a read request, including:
[0221] 12A-1: The requesting node receives the read request. Each node device has the latest data, so the requesting node can directly perform the read operation.
[0222] like Fig.12 (B) shows the situation where the requesting node receives a read request, including:
[0223] 12B-1: The requesting node receives the write request.
[0224] 12B-2: The request node updates the data of other data nodes.
[0225] 12B-3: Other data nodes feedback success to the requesting node.
[0226] In this way, any node device 200 that performs a write operation can synchronize the latest data to other node devices 200, so that each node device 200 can directly read the data in the local memory when performing a read operation, thereby reducing communication between nodes.
[0227] The details of the sub-block division module 530 are introduced below. Since the electronic device 100 is based on memory blocks, the read and write characteristics of the memory blocks and the corresponding read and write strategies are marked. However, in some cases, a node device 200 may only access part of the data in a certain memory block, such as part of the data in memory block L. If multiple node devices 200 access data at different locations in memory block L respectively, after each node device 200 accesses memory block L, the electronic device 100 needs to re-determine the read and write characteristics of memory block L and determine the read and write strategy of memory block L for each node device 200. In this way, the electronic device 100 will need to frequently modify the read and write status of memory block L in the global memory directory 612.
[0228] Especially for the write sharing state, if the read-write strategy adopts the MSI strategy, the electronic device 100 also needs to determine the M, S, and I states of each node device 200 corresponding to the memory block L. When a certain node A modifies the data corresponding to the memory block in the local memory, the states of other node devices 200 except node A are modified to the I state, so that other node devices 200 cannot directly read the data.
[0229] In some embodiments, the electronic device 100 divides the memory block L into multiple sub-blocks, and can mark the read and write status of the multiple sub-blocks respectively. Fig.13 As shown, when nodes 1 to 5 access data at different positions of the memory block L respectively, since the number of nodes is 5, log5=3 bits of data are required for one sub-block.
[0230] like Fig.13 As shown, if the memory block L is divided into 2 blocks, a total of 2*3=6 bits of data are required, but at this time nodes 1 to 4 are still in the same block, and the above problem still exists. If the memory block L is divided into 4 blocks, a total of 4*3=12 bits of data are required, but at this time nodes 1 to 3 are still in the same block. If the memory block L is divided into 8 blocks, a total of 8*3=24 bits of data are required, but at this time nodes 1 and 2 are still in the same block. Therefore, if the memory block L is divided into 16 blocks, a total of 16*3=48 bits of data are required, and all nodes correspond to different blocks. However, the amount of data required to save the node information corresponding to the memory block L is relatively large.
[0231] Also refer to Fig.14 ,like Fig.14As shown in the figure, if the memory block is divided into 16 sub-blocks, when only two nodes access the memory block, each sub-block needs to record the corresponding node information, including the node to which the latest data belongs. For example, sub-blocks 0 to 7 are updated with the latest data by node A, and sub-blocks 8 to 15 are updated with data by node B. When node C modifies the data of sub-blocks 8 to 15, sub-blocks 8 to 15 will modify the node information to node C. At this time, it is necessary to record the node information corresponding to each sub-block, and the amount of data that needs to be recorded is relatively large.
[0232] In other embodiments, in order to solve the problem that the memory block information needs to be frequently modified when the multiple node devices 200 access the data at different locations of the same memory block, the electronic device 100 divides the sub-blocks according to the location where each node device 200 accesses the memory block. Fig.15 As shown, the electronic device 100 divides the memory block L into five sub-blocks according to the starting positions of the data accessed by nodes 1 to 5 in the memory block L. Thus, the amount of data required to store the node information is reduced, and the problem of frequent modification of the node information of the memory block when multiple node devices 200 access different positions of the same memory block is avoided.
[0233] For example, if Fig.16 As shown, for the above Fig.14 In the case shown, the present application can divide the memory block into two sub-blocks according to the locations accessed by nodes A and B. The latest writer of the first sub-block is node A, and the latest writer of the second sub-block is node B. When node C modifies the data corresponding to the second sub-block, the latest writer of the second sub-block will be modified to node C. Fig.14 Need to store 16 node information, Fig.16 Only two pieces of node information need to be stored, which reduces the amount of data required to store the node information.
[0234] The following is a detailed description of the adaptive speculation module 540. When the node device 200 accesses data, it also needs to obtain the read / write characteristics and read / write strategy determined by the electronic device 100 for the memory block corresponding to the data, and then the node device 200 accesses the data according to the read / write strategy, including requesting the latest data from other node devices 200. Fig.17 In (A), the time for the node device 200 to obtain the read-write strategy can be recorded as T D1 .
[0235] The adaptive speculation module 540 is used to directly access the data in the local memory when the node device 200 needs to access data. D2After that, the read / write policy corresponding to the memory block is determined to determine whether the data in the current local memory is the latest data. If the read / write policy indicates that the data corresponding to the memory block in the current local memory is the latest data, the node device 200 maintains the previously executed access operation. If the read / write policy indicates that the data corresponding to the memory block in the current local memory is not the latest data, the node device 200 re-acquires the latest data according to the read / write policy.
[0236] In this way, Fig.17 In (B), if the speculation is successful, it means that the node device 200 can directly access the data, and the time consumed is T D2 Less than T D1 , saving data access time. If speculation fails, it means that the node device 200 needs to access the data again according to the read-write strategy, and the time required is T D3 , T D3 Greater than T D1 .
[0237] Combine the following Fig.18 The details of the adaptive speculation module 540 are introduced. Fig.18 is a structural diagram of an adaptive speculation system, which includes an adaptive speculation module 540 , and the adaptive speculation module 540 includes a transaction acquisition module 1810 , a speculation probability adjustment module 1820 and a conflict detection module 1830 .
[0238] The transaction acquisition module 1810 is used to obtain the access operations that the node device 200 needs to perform, and then encapsulate the access operations into transactions. Among them, transactions include function transactions and ordinary transactions. Function transactions refer to some transactions that need to be executed cyclically. This type of function is encapsulated by putting it into the transaction executor and using the Exec(Func) function. Ordinary transactions encapsulate the code into transactions through the begin_trans and end_trans functions, or the system automatically divides the program into multiple transactions.
[0239] The speculation probability adjustment module 1820 is used to obtain the difference value P1 obtained from the data in the local memory and the latest data in the last conflict detection, as well as the memory block P2 in the write sharing state in the memory block to be accessed this time. Then the probability P of speculation is adjusted according to P1 and P2. Among them, when P1 and P2 are higher, it means that the data update may be faster and more, and then if speculation is performed, the probability of speculation failure is higher, and then the probability P will be reduced. When P1 and P2 are lower, it means that the data update may be slower, and the probability of speculation success is higher, and then the probability P can be larger.
[0240] The conflict detection module 1830 can determine whether the data in the local memory of the node device 200 is the latest data by obtaining the node information of the memory block. It can also obtain the latest data of the memory block from the global memory, and compare the latest data of the memory block with the data of the local memory to determine whether the data in the local memory is the latest data. If the data in the local memory is not the latest data, the node device 200 needs to cancel the access operation that has been executed and access it again according to the read-write strategy. If the data in the local memory is the latest data, the node device 200 can maintain the original access operation.
[0241] In this way, the node device 200 has a greater probability of succeeding in speculation. When the speculation succeeds, the data access time is shortened, thereby improving the data calculation efficiency.
[0242] The following is a detailed description of the bounded inconsistency module 550. The bounded inconsistency module 550 is used to determine whether each memory block data is a bounded value when the node device 200 uses multiple memory block data. The bounded value can refer to the memory block data being the latest data in the local memory, or the value being within a preset time T. D4 The bounded inconsistency module 550 can determine whether the memory block data has been modified multiple times by other node devices 200 through the node information recorded in the global memory directory entry 612, or determine whether it is a bounded value by recording the reading time of the memory block by the node device 200 itself.
[0243] Then the node device 200 will also determine whether to execute the read-write strategy based on the proportion of bounded value memory blocks to the total number of memory blocks that need to be used. If the node device 200 determines that the bounded value ratio exceeds the threshold α, it means that most of the data are newer bounded value data, and then, for a small amount of out-of-bounds value data in the data of multiple memory blocks, it is not necessary to execute the read-write strategy to update the data. If the node device 200 determines that the bounded value ratio does not exceed the threshold α, it means that more data is out-of-bounds value, and the node device 200 needs to execute the read-write strategy to update the data.
[0244] For example, if Fig.19As shown, for computing tasks that require multiple iterations, if there are individual out-of-bounds values in some of the iterative calculations, it will not have a significant impact on the final result. Exemplarily, take the case where the number of out-of-bounds values is at most 1. Among them, in the first round of iterations, when there is one out-of-bounds value, the node device 200 can directly calculate based on the data in the local memory. Before the second round of iterations, other node devices 200 have modified the data, so that the node device 200 has two out-of-bounds values. Furthermore, the node device 200 needs to update the data according to the read-write strategy, so that there is at most one out-of-bounds value in the multiple data. When in the third round of iterations, when there is only one out-of-bounds value again, the node device 200 can directly calculate based on the data in the local memory.
[0245] In this way, the situation where the node device 200 executes the read-write strategy to obtain the latest data can be effectively reduced, and the node device 200 can directly use the data in the local memory, reducing the communication between nodes.
[0246] The following introduces a data access method provided in an embodiment of the present application, which can be applied to the above-mentioned global memory system including the electronic device 100 and multiple node devices 200.
[0247] S2001: The electronic device 100 obtains the operation information of the node device 200 performing read operations and write operations on each memory block.
[0248] When the node device 200 performs a read operation or a write operation on the data in the global memory or the data after reading the data in the global memory to the local memory, the electronic device 100 records the operation information. The operation information is used to indicate the access rate of the node device 200 to the memory block, which can be the number of write operations and read operations, for example, the number of write operations and read operations performed within a preset time, or the time occupied by each read operation and write operation. The electronic device 100 can also make a judgment based on the number and time of read and write operations, and can also convert the number and time of each read and write operation. For example, the access of the node device 200 for more than a predetermined time can be regarded as multiple read and write operations on the memory block. Alternatively, multiple consecutive read and write operations of the node device 200 within a certain period of time can be identified as a read and write operation on the memory block, etc. For details, please refer to the above description of the read and write feature module 510.
[0249] Optionally, the electronic device 100 may also be Figure 6 The network switch 601 or other bus in the network is used to obtain the time and number of access operations performed by each node device 200 on each memory block.
[0250] S2002: The electronic device 100 determines the read and write characteristics of each memory block based on the operation information.
[0251] The electronic device 100 determines the read and write characteristics of each memory block according to the operation information of each memory block, and the read and write characteristics may include a read-write ratio and a read-write distribution. The read-write ratio specifically includes read-most and write-most, and the read-write distribution may include write sharing, write exclusive, read exclusive, read sharing, access exclusive, and access sharing. Among them, the specific method for determining the read and write characteristics can refer to the relevant description of the aforementioned read and write feature module 510, which will not be repeated here.
[0252] S2003: The electronic device 100 determines the read / write strategy for each node device 200 to perform read / write operations on each memory block according to the read / write characteristics of each memory block and the operation information of each node device 200 on the memory block.
[0253] After determining the read / write characteristics of each memory block, the electronic device 100 may also determine the corresponding read / write strategy according to the preset regulations, wherein the correspondence between the read / write characteristics and the read / write strategy may refer to the aforementioned Tables 1 to 4 and Figure 7 In addition, the electronic device 100 will also determine the type of each node for each memory block according to the read / write strategy, and mark the type of the node in the global memory directory entry 612 .
[0254] Among them, the types of nodes include primary nodes and secondary nodes. The primary nodes can specifically include metadata nodes, read-write master nodes, read master nodes, write master nodes, etc. Secondary nodes are node devices other than primary nodes. The types of nodes corresponding to each read-write strategy and the method for confirming the node type can also refer to the aforementioned Figure 3 , Figures 8 to 12 and its related description.
[0255] Optionally, when a memory block is accessed by multiple node devices 200 and the locations of the accessed memory blocks are different, the electronic device 100 may further divide the memory block into multiple sub-blocks according to the location accessed by each node device 200, and respectively count the read and write characteristics of each sub-block and respectively mark the node information of each node device 100. For details, please refer to the above description of the sub-block division module 530, which will not be repeated here.
[0256] S2004: The node device 200 accesses the corresponding memory block according to the read-write strategy.
[0257] When the node device 200 needs to access the data of the global memory pre-read in the local memory, it will first determine the read-write strategy for performing the access operation based on the read-write characteristics of the memory block corresponding to the data to be obtained in the global memory directory entry 612 and the node information.
[0258] Optionally, when the node device 200 needs to access data, it can also directly access the data in the local memory first. After the preset time TD2 after the node device 200 starts to access the data, it determines the read-write policy corresponding to the memory block to determine whether the data in the current local memory is the latest data. If the read-write policy indicates that the data corresponding to the memory block in the current local memory is the latest data, the node device 200 maintains the access operation previously performed. If the read-write policy indicates that the data corresponding to the memory block in the current local memory is not the latest data, the node device 200 re-acquires the latest data according to the read-write policy. For details, please refer to the relevant description of the adaptive speculation module 540.
[0259] Optionally, if the node device 200 wants to use multiple memory block data, it will determine whether each memory block data is a bounded value. Then the node device 200 will also determine whether to execute the read-write strategy based on the proportion of memory blocks with bounded values to the memory blocks that need to be used. If the node device 200 determines that the bounded value ratio exceeds the threshold value α, it means that most of the data is newer data, and thus, there is no need to execute the read-write strategy to update the data. If the node device 200 determines that the bounded value ratio does not exceed the threshold value α, it means that more data is out-of-bounds value, and the node device 200 needs to execute the read-write strategy to update the data. For details, please refer to the relevant description of the bounded inconsistency module 550.
[0260] In summary, through the data access method provided by the present application, the read and write strategy can be determined for each node device 200 according to the read and write characteristics of the memory block, which can better adapt to the actual situation of each memory block, rather than just dividing the memory block into M state, S state, and I state according to whether it is modified. Furthermore, most of the read and write operations performed by the node device 200 can be performed in the local memory, which can reduce inter-node communication, reduce the communication delay of reading and writing data in the global memory system, and improve the access speed of the node device 200 to the memory. In addition, it can also improve the operating efficiency of the business performed by the node device 200, such as high-performance computing business.
[0261] In order to solve the above-mentioned problem of slow access speed of nodes to global memory in a global memory system, the present application also provides a data access device 2100, including an acquisition unit 2110, a determination unit 2120, an update unit 2130, a sending unit 2140, and a reading unit 2150.
[0262] The acquisition unit 2110 is used to obtain operation information of read and write operations performed by multiple node devices on the first memory block, and the operation information is used to represent the access rate of the read and write operations on the first memory block; the determination unit 2120 is used to determine the read and write operation characteristics of the multiple node devices corresponding to the first memory block; the determination unit 2120 is also used to determine the read and write strategies of the multiple node devices corresponding to the first memory block based on the read and write operation characteristics, and the read and write strategies include distinguishing the multiple node devices into primary nodes and secondary nodes for performing read and write operations.
[0263] In some embodiments, the access rate is determined based on the number and / or time of read and write operations performed by multiple node devices on the first memory block.
[0264] In other embodiments, the type of primary node includes a metadata node that stores the first memory block.
[0265] In other embodiments, the type of main node includes a read master node whose operation information of the read operation meets a first condition, and the first condition includes that the value of the access rate of the node device's read operation on the first memory block meets a first preset condition.
[0266] In other embodiments, the type of main node includes a write master node whose operation information of the write operation meets a second condition, and the second condition includes that the value of the access rate of the node device's write operation on the first memory block meets a second preset condition.
[0267] In other embodiments, the types of main nodes include read-write master nodes whose operation information of read operations and write operations meets a third condition, and the third condition includes that the value of the access rate of the node device's read operation on the first memory block meets the first preset condition, and the value of the access rate of the write operation on the first memory block meets the second preset condition.
[0268] In other embodiments, the read-write operation characteristics include a read-write ratio, and the determination unit 2120 is further used to determine that the read-write operation ratio of the first memory block is mostly read based on the fact that a numerical value of an access rate of read operations of multiple node devices to the first memory block is greater than a numerical value of an access rate of write operations to the first memory block; or the determination unit 2120 is further used to determine that the read-write operation ratio of the first memory block is mostly write based on the fact that a numerical value of the access rate of read operations to the first memory block is less than or equal to a numerical value of the access rate of write operations to the first memory block.
[0269] In other embodiments, the determination unit 2120 is also used to determine that the read and write distribution of the first memory block is read exclusive based on the existence of a read master node in multiple node devices; or to determine that the read and write distribution of the first memory block is read shared based on the absence of a read master node in multiple node devices.
[0270] In other embodiments, the determination unit 2120 is also used to determine that the read and write distribution of the first memory block is write-exclusive based on the existence of a write master node in multiple node devices; or to determine that the read and write distribution of the first memory block is write-shared based on the absence of a write master node in multiple node devices.
[0271] In other embodiments, the determination unit 2120 is also used to determine that the read-write distribution of the first memory block is exclusive access based on the existence of a read-write master node in multiple node devices; or to determine that the read-write distribution of the first memory block is shared access based on the absence of a read-write master node in multiple node devices.
[0272] In other embodiments, the determination unit 2120 is further used to determine that the read-write operation characteristics of the first memory are read-mostly based on the read-write ratio of the first memory block being read-mostly and the read-write distribution being any one of read sharing, write sharing, write exclusive, or access sharing; and to determine that the read-write operation characteristics of the first memory are access exclusive based on the read-write ratio of the first memory block being read-mostly and the read-write distribution being read exclusive or access exclusive, or the read-write ratio of the first memory block being write-mostly and the read-write distribution being write exclusive or access exclusive; and to determine that the read-write operation characteristics of the first memory are write sharing based on the read-write ratio of the first memory block being write-mostly and the read-write distribution being write sharing or access sharing.
[0273] In other embodiments, the method also includes: the determination unit 2120 is also used to determine that the read and write operation characteristics of the first memory are write-exclusive based on the fact that the value of the access rate of the write operation of the first memory block is greater than the first threshold and less than or equal to the second threshold, and the read-write distribution is write-exclusive; the determination unit 2120 is also used to determine that the read and write operation characteristics of the first memory are read-exclusive based on the fact that the value of the access rate of the read operation of the first memory block is greater than the third threshold and less than or equal to the fourth threshold, and the read-write distribution is read-exclusive.
[0274] In other embodiments, the determination unit 2120 is also used to determine the metadata node among multiple node devices based on the read and write operation characteristics being write sharing, and determine other node devices except the metadata node as write sharing nodes among the secondary nodes; the update unit 2130 is used to update the write node of the first memory block in the metadata node to the first write sharing node based on the first write sharing node among the write sharing nodes receiving a write request corresponding to the first memory block; and the acquisition unit 2110 is used to acquire the write node of the first memory block from the metadata node based on the second write sharing node among the write sharing nodes receiving a read request; the acquisition unit 2110 is used to acquire data corresponding to the first memory block from the first write sharing node based on the second write sharing node acquiring the write node as the first write sharing node.
[0275] In other embodiments, the determination unit 2120 is also used to determine a read-write master node among multiple node devices based on the read-write operation characteristic being access exclusive, and determine node devices other than the read-write master node as access secondary nodes among secondary nodes; the acquisition unit 2110 is also used to request data of the first memory block from the read-write master node based on the access shared node receiving a read request; the sending unit 2140 is used to determine to send data corresponding to the write request to the read-write master node based on the access shared node receiving a write request corresponding to the first memory block; and the reading unit 2150 is used to read the data of the first memory block in the local memory based on the read-write master node receiving the read request corresponding to the first memory block; and the update unit 2130 is also used to read and update the data of the first memory block in the local memory based on the read-write master node receiving the write request corresponding to the first memory block.
[0276] In some other embodiments, the method further includes: the determination unit 2120 is also used to determine a write master node among multiple node devices based on the read and write operation characteristics being write exclusive, and determine the node devices other than the write master node as write secondary nodes among the secondary nodes; the reading unit 2150 is also used to read the data of the first memory block in the local memory based on the write master node receiving a read request corresponding to the first memory block; and the sending unit 2140 is also used to send an invalidation request to the write secondary node based on the write master node receiving a write request corresponding to the first memory block; and the reading unit 2150 is also used to send an invalidation request to the write secondary node based on the non-invalidated write secondary node A read request corresponding to a first memory block is received, and data of the first memory block in the local memory is read, wherein a non-invalidated write secondary node refers to a write secondary node that has not received an invalidation request sent by the write primary node; and, the acquisition unit 2110 is also used to request data of the first memory block from the write primary node based on the invalidated write secondary node receiving the read request corresponding to the first memory block, wherein the invalidated write secondary node refers to a write secondary node that receives an invalidation request sent by the write primary node; and, based on the write secondary node receiving the write request corresponding to the first memory block, the write secondary node sends data corresponding to the write request to the write primary node.
[0277] In other embodiments, the determination unit 2120 is also used to determine a read master node among multiple node devices based on the read-write operation characteristic being read exclusive, and determine the node devices other than the read master node as read secondary nodes among the secondary nodes; the reading unit 2150 is also used to read the data of the first memory block in the local memory based on the read master node receiving a read request corresponding to the first memory block; and the sending unit 2140 is also used to send an invalidation request to the read secondary node based on the read master node receiving a write request corresponding to the first memory block; and the acquisition unit 2110 is also used to request the data of the first memory block from the read master node based on the read secondary node receiving a read request corresponding to the first memory block; and the sending unit 2140 is also used to send the data corresponding to the write request to the read master node based on the read secondary node receiving a write request corresponding to the first memory block.
[0278] In other embodiments, the acquisition unit 2110 is also used to receive a read request corresponding to the first memory block and read the data of the first memory block in the corresponding local memory based on the read-write operation characteristic being read-mostly; and the acquisition unit 2110 is also used to receive a write request corresponding to the first memory block, and the sending unit 2140 is also used to send the data corresponding to the write request to other node devices.
[0279] In some other embodiments, the acquisition unit 2110 is further used to acquire location information of data read by multiple node devices in the first memory block. The determination unit 2120 is further used to divide the first memory block into multiple sub-blocks according to the location information corresponding to the multiple node devices; the determination unit 2120 is further used to determine the read and write operation characteristics of the multiple sub-blocks in the first memory block based on the operation information; the determination unit 2120 is further used to determine the read and write strategies of the multiple node devices corresponding to the multiple sub-blocks respectively based on the read and write operation characteristics of the multiple sub-blocks.
[0280] In other embodiments, within a preset time of performing read and write operations on the data of the first memory block in the local memory, the determination unit 2120 is also used to determine the read and write policy corresponding to the first memory block; the determination unit 2120 is also used to determine that the data of the first memory block in the local memory is a new value based on the node device according to the read and write policy, and determine to keep performing the read and write operations; the determination unit 2120 is also used to determine that the data of the first memory block in the local memory is an old value based on the node device according to the read and write policy, and re-execute the read and write operations according to the read and write policy.
[0281] In other embodiments, the determination unit 2120 is also used to determine the read and write operation characteristics of multiple memory blocks based on the operation information of the read operation of multiple memory blocks; and determine the read and write strategies of multiple memory blocks based on the read and write operation characteristics of multiple memory blocks; the determination unit 2120 is also used to determine the number of memory blocks in the local memory of the fifth node device that are out-of-bounds values based on the read and write operation characteristics of multiple memory blocks, wherein the out-of-bounds value means that after the fifth node device reads the memory block data, the number of times the memory block data is updated by other node devices exceeds a preset number, or the fifth node device does not update the memory block data for more than a preset time; the determination unit 2120 is also used to determine to perform a read operation or a write operation on the data of multiple memory blocks in the local memory of the fifth node device based on the number of memory blocks in the fifth node device that are out-of-bounds values does not exceed a preset number; or the determination unit 2120 is also used to determine to perform a read operation or a write operation on the data of multiple memory blocks in the local memory of the fifth node device according to the read and write strategies of multiple memory blocks based on the number of memory blocks in the fifth node device that are out-of-bounds values exceeds a preset number.
[0282] In summary, through the data access device 2100 provided by the present application, the read and write strategy can be determined for each node device according to the read and write characteristics of the memory block, which can better adapt to the actual situation of each memory block, rather than just dividing the memory block into M state, S state, and I state according to whether it is modified. Furthermore, most of the read and write operations performed by the node device can be performed in the local memory, which can reduce communication between nodes, reduce the communication delay of reading and writing data in the global memory system, and improve the access speed of the node device to the memory. In addition, it can also improve the operating efficiency of the services performed by the node device, such as high-performance computing services.
[0283] The method of the embodiment of the present application is described in detail above. In order to facilitate better implementation of the above scheme of the embodiment of the present application, correspondingly, related equipment for cooperating in implementing the above scheme is also provided below.
[0284] Fig. 22 2 is a schematic diagram of the structure of an electronic device 2200 provided by the present application. The electronic device 2200 may be the data access device 2100 in the aforementioned content. Fig. 22As shown, the electronic device 2200 includes: a processor 2210, a communication interface 2220 and a memory 2230. Among them, the processor 2210, the communication interface 2220 and the memory 2230 can be connected to each other through the internal bus 2240, and can also communicate through other means such as wireless transmission. In the embodiment of the present application, the connection through the bus 2240 is taken as an example. The bus 2240 can be a peripheral component interconnect Express (PCIe) bus, or an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a computer express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 2240 can be divided into an address bus, a data bus, a control bus, etc. In addition to the data bus, the bus 2240 can also include a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are marked as bus 2240 in the figure.
[0285] The memory 2230 is used to store program codes, and is controlled by the processor 2210 to execute the processing steps of the data access method in the above embodiment. The program code may include one or more software modules, which may be Fig.21 The software modules provided in the embodiments.
[0286] It should be noted that this embodiment can be implemented by a general physical server, for example, an ARM server or an X86 server, or it can be implemented by a virtual machine based on a general physical server combined with NFV technology. A virtual machine refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment. This application does not make any specific limitations.
[0287] The memory 2230 may include a volatile memory, such as a random access memory (RAM); the memory 2230 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 2230 may also include a combination of the above types. The memory 2230 may store program codes, specifically executing Fig. 20 Steps S2001 to S2004 and their optional steps in the embodiment will not be described in detail here.
[0288] The communication interface 2220 can be a wired interface (such as an Ethernet interface), an internal interface (such as a high-speed serial computer expansion bus interface), a wired interface (such as an Ethernet interface) or a wireless interface (such as a cellular network interface or a wireless local area network interface) for communicating with other devices or modules.
[0289] Need to explain, Fig. 22 This is only a possible implementation of the embodiment of the present application. In practical applications, the electronic device 2200 may also include more or fewer components, which is not limited here. Fig. 20 The relevant explanations in the embodiments will not be repeated here.
[0290] It should be understood that Fig. 22 The electronic device shown may also be a computer cluster consisting of at least one server, which is not specifically limited in this application.
[0291] The present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a processor, Fig. 20 The method flow shown is realized.
[0292] The present application also provides a computer program product. When the computer program product is run on a processor, Fig. 20 The method flow shown is realized.
[0293] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media sets. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a high-density digital video disc (DVD), or a semiconductor medium. The semiconductor medium may be an SSD.
[0294] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A data access method, characterized in that: Applied to a global memory system, the global memory system includes a first device and multiple node devices, the node devices include local memory and global memory, the multiple node devices share the global memory, the global memory includes a first memory block, the method includes: The first device obtains operation information of read and write operations performed by the multiple node devices on the first memory block, where the operation information is used to indicate an access rate of the read and write operations on the first memory block; The first device determines, based on the operation information, read and write operation characteristics of the plurality of node devices corresponding to the first memory block; The first device determines the read and write strategies of the multiple node devices corresponding to the first memory block based on the read and write operation characteristics, and the read and write strategies include dividing the multiple node devices into primary nodes and secondary nodes for performing read and write operations.
2. The method according to claim 1, characterized in that The access rate is determined based on the number and / or time of read and write operations performed by the multiple node devices on the first memory block.
3. The method according to claim 1, characterized in that The type of the primary node includes a metadata node storing the first memory block.
4. The method according to claim 1, characterized in that: The type of the primary node includes a read primary node whose operation information of the read operation meets the first condition, and The first condition includes that a value of an access rate of a read operation of a node device on the first memory block satisfies a first preset condition.
5. The method according to claim 1, characterized in that The type of the primary node includes a write primary node whose operation information of the write operation meets the second condition, The second condition includes that the value of the access rate of the node device's write operation on the first memory block meets the second preset condition.
6. The method according to claim 1, characterized in that The types of the main nodes include read-write main nodes whose operation information of read operations and write operations meets the third condition, The third condition includes that the value of the access rate of the node device's read operation on the first memory block meets the first preset condition, and the value of the access rate of the node device's write operation on the first memory block meets the second preset condition.
7. The method according to any one of claims 3 to 6, characterized in that: The read / write operation characteristics include a read / write ratio, and the first device determines the read / write operation characteristics of the plurality of node devices corresponding to the first memory block based on the operation information, including: The first device determines that the ratio of read operations to the first memory block is more than read operations based on the fact that a value of an access rate of read operations to the first memory block by the multiple node devices is greater than a value of an access rate of write operations to the first memory block; or The first device determines that the ratio of read and write operations of the first memory block is more write based on the value of the access rate of the read operation of the first memory block being less than or equal to the value of the access rate of the write operation to the first memory block.
8. The method according to claim 4, characterized in that The read / write operation characteristics include read / write distribution, and the first device determines the read / write operation characteristics of the plurality of node devices corresponding to the first memory block based on the operation information, including: The first device determines that the read and write distribution of the first memory block is read exclusive based on the presence of the read master node in the multiple node devices; or The first device determines that the read and write distribution of the first memory block is read sharing based on the fact that the read master node does not exist in the multiple node devices.
9. The method according to claim 5, characterized in that The read / write operation characteristics include read / write distribution, and the first device determines the read / write operation characteristics of the plurality of node devices corresponding to the first memory block based on the operation information, including: The first device determines that the read and write distribution of the first memory block is write-exclusive based on the existence of the write master node in the multiple node devices; or, The first device determines that the read-write distribution of the first memory block is write-sharing based on the absence of the write master node among the multiple node devices.
10. The method according to claim 6, characterized in that The read / write operation characteristics include read / write distribution, and the first device determines the read / write operation characteristics of the plurality of node devices corresponding to the first memory block based on the operation information, including: The first device determines that the read and write distribution of the first memory block is exclusive access based on the existence of a read and write master node in the multiple node devices; or, The first device determines that the read and write distribution of the first memory block is access sharing based on the absence of a read and write master node among the multiple node devices.
11. The method according to any one of claims 7 to 10, characterized in that: The first device determines, based on the operation information, read and write operation characteristics of the plurality of node devices corresponding to the first memory block, including: The first device determines that the read and write operation characteristics of the first memory are read-mostly based on that the read-write ratio of the first memory block is read-mostly and the read-write distribution is any one of read-shared, write-shared, write-exclusive, or access-shared; The first device determines that the read and write operation characteristics of the first memory are access exclusive based on the read-write ratio of the first memory block being read-mostly and the read-write distribution being read-exclusive or access-exclusive, or the read-write ratio of the first memory block being write-mostly and the read-write distribution being write-exclusive or access-exclusive; The first device determines that the read and write operation characteristics of the first memory are write sharing based on the read-write ratio of the first memory block being write-dominated and the read-write distribution being write sharing or access sharing.
12. The method according to claim 11, characterized in that The first device determines, based on the operation information, read and write operation characteristics of the plurality of node devices corresponding to the first memory block, further comprising: The first device determines that the read and write operation characteristics of the first memory are write-exclusive based on the value of the access rate of the write operation of the first memory block being greater than the first threshold and less than or equal to the second threshold, and the read and write distribution being write-exclusive; The first device determines that the read and write operation characteristics of the first memory are read exclusive based on the fact that the value of the access rate of the read operation of the first memory block is greater than a third threshold and less than or equal to a fourth threshold, and the read and write distribution is read exclusive.
13. The method according to claim 9, characterized in that The first device determines, based on the read / write operation characteristics, the read / write strategies of the plurality of node devices corresponding to the first memory block, including: The first device determines a metadata node among the plurality of node devices based on the read / write operation characteristic being the write sharing, and determines other node devices except the metadata node as write sharing nodes among the secondary nodes; Based on a first write sharing node among the write sharing nodes receiving a write request corresponding to the first memory block, the first write sharing node updates the write node of the first memory block in the metadata node to the first write sharing node; and Based on a second write sharing node among the write sharing nodes receiving a read request, the second write sharing node obtaining a write node of the first memory block from the metadata node; Based on the second write sharing node obtaining that the write node is the first write sharing node, the second write sharing node obtains data corresponding to the first memory block from the first write sharing node.
14. The method according to claim 10, characterized in that The first device determines, based on the read / write operation characteristics, the read / write strategies of the plurality of node devices corresponding to the first memory block, including: The first device determines the read-write master node among the plurality of node devices based on the read-write operation characteristic being the access exclusive, and determines the node devices other than the read-write master node as access secondary nodes among the secondary nodes; Based on the access sharing node receiving the read request, the access secondary node requests the read-write primary node for data of the first memory block; and Based on the access shared node receiving the write request corresponding to the first memory block, the access secondary node sends data corresponding to the write request to the read-write primary node; and Based on the read / write master node receiving a read request corresponding to the first memory block, the read / write master node reads data of the first memory block in the local memory; and Based on the read-write master node receiving a write request corresponding to the first memory block, the read-write master node reads and updates the data of the first memory block in the local memory.
15. The method according to claim 9, characterized in that The first device determines, based on the read / write operation characteristics, the read / write strategies of the plurality of node devices corresponding to the first memory block, including: The first device determines the write master node among the multiple node devices based on the read / write operation characteristic being write exclusive, and determines the node devices other than the write master node as write secondary nodes among the secondary nodes; Based on the write master node receiving a read request corresponding to the first memory block, the write master node reads data of the first memory block in the local memory; and, Based on the write master node receiving the write request corresponding to the first memory block, the write master node will send an invalidation request to the write secondary node; and, Based on the non-invalidated write secondary node receiving a read request corresponding to the first memory block, the non-invalidated write secondary node reads the data of the first memory block in the local memory, wherein the non-invalidated write secondary node refers to a write secondary node that has not received the invalidation request sent by the write primary node; and, Based on the invalidated write secondary node receiving a read request corresponding to the first memory block, the invalidated write secondary node requests the data of the first memory block from the write primary node, wherein the invalidated write secondary node refers to the write secondary node that receives the invalidation request sent by the write primary node; and, Based on the write secondary node receiving the write request corresponding to the first memory block, the write secondary node sends data corresponding to the write request to the write primary node.
16. The method according to claim 8, characterized in that The first device determines, based on the read / write operation characteristics, the read / write strategies of the plurality of node devices corresponding to the first memory block, including: The first device determines the read master node among the multiple node devices based on the read-write operation characteristic being read exclusive, and determines the node devices other than the read master node as read secondary nodes among the secondary nodes; Based on the read master node receiving the read request corresponding to the first memory block, the read master node reads the data of the first memory block in the local memory; and Based on the read master node receiving a write request corresponding to the first memory block, the read master node will send an invalidation request to the read secondary node; and, Based on the read secondary node receiving the read request corresponding to the first memory block, the read secondary node requests the data of the first memory block from the read primary node; and, Based on the read secondary node receiving the write request corresponding to the first memory block, the read secondary node sends the data corresponding to the write request to the read primary node.
17. The method according to any one of claims 11 to 12, characterized in that: The first device determines, based on the read / write operation characteristics, the read / write strategies of the plurality of node devices corresponding to the first memory block, including: Based on the read-write operation characteristic being read-most, the multiple node devices receive a read request corresponding to the first memory block, and the multiple node devices read data of the first memory block in the corresponding local memory; and A fourth node device among the multiple node devices receives a write request corresponding to the first memory block, and the fourth node device sends data corresponding to the write request to other node devices.
18. The method according to claim 1, characterized in that The method further comprises: The first device obtains location information of the data of the first memory block read by the multiple node devices; The first device divides the first memory block into a plurality of sub-blocks according to the position information corresponding to the plurality of node devices; The first device determines, based on the operation information, read and write operation characteristics of the plurality of node devices corresponding to the first memory block, including: The first device determines, based on the operation information, read and write operation characteristics of a plurality of sub-blocks in the first memory block; The first device determines, based on the read / write operation characteristics, the read / write strategies of the plurality of node devices corresponding to the first memory block, including: The first device determines the read and write strategies of the multiple node devices corresponding to the multiple sub-blocks respectively based on the read and write operation characteristics of the multiple sub-blocks.
19. The method according to claim 1, characterized in that The method further comprises: Within a preset time when the node device performs a read and write operation on data of a first memory block in a local memory, the node device determines a read and write strategy corresponding to the first memory block; Based on the node device determining that the data of the first memory block in the local memory is a new value according to the read-write strategy, the node device keeps executing the read-write operation; Based on the node device determining, according to the read-write policy, that the data of the first memory block in the local memory is an old value, the node device re-executes the read-write operation according to the read-write policy.
20. The method according to claim 1, characterized in that The multiple node devices include a fifth node device, the local memory of the fifth node device includes data of multiple memory blocks, and the method further includes: The first device determines read and write operation characteristics of the plurality of memory blocks according to operation information of read operations of the plurality of memory blocks; The first device determines the read and write strategies of the multiple memory blocks according to the read and write operation characteristics of the multiple memory blocks; The fifth node device determines, according to the read and write operation characteristics of the multiple memory blocks, the number of memory blocks in the local memory of the fifth node device that are out-of-bounds values, wherein the out-of-bounds value means that after the fifth node device reads the memory block data, the number of times the memory block data is updated by other node devices exceeds a preset number of times, or the fifth node device fails to update the memory block data for more than a preset time period; Based on the fact that the number of memory blocks in the fifth node device that are out-of-bounds values does not exceed a preset number, the fifth node device performs a read operation or a write operation on the data of the multiple memory blocks in the local memory of the fifth node device; or, Based on the fact that the number of memory blocks in the fifth node device that are out-of-bounds values exceeds a preset number, the fifth node device performs a read operation or a write operation on the data of the multiple memory blocks according to the read and write policies of the multiple memory blocks.
21. A readable medium, characterized in that The readable medium contains instructions, which, when executed by a processor of an electronic device, enable the electronic device to implement the method of any one of claims 1 to 20.
22. An electronic device, characterized in that: include: a memory for storing instructions to be executed by one or more processors of the electronic device; and a processor, which is one of the processors of the electronic device, configured to execute the instructions so that the electronic device implements the method according to any one of claims 1 to 20.
Citation Information
Cited By
Cross-host memory sharing method, system, equipment and medium
CN120371537A