Data access method of distributed memory architecture and related device

By creating multiple virtual memory spaces in a distributed memory architecture and dynamically setting data path flags, the problem of poor remote data access performance in the existing technology is solved, and flexible data access granularity and efficient data access performance are achieved.

CN120234261APending Publication Date: 2025-07-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311866232.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

The prior art is difficult to effectively realize high performance of remote data access in memory architectures, especially when access to different granular data is required.

Method used

By creating multiple virtual memory spaces in a distributed memory architecture and dynamically setting data path flags for each virtual memory space, the data access granularity is determined based on the memory access characteristics of the virtual memory space, thereby optimizing data access performance.

Benefits of technology

It improves the performance of data access in a distributed memory architecture, can flexibly respond to the access needs of different granular data, reduces data access latency and improves the overall performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120234261A_ABST
    Figure CN120234261A_ABST
Patent Text Reader

Abstract

The invention discloses a data access method for a distributed memory architecture and a related device, and the method comprises the steps: a plurality of memory servers of the distributed memory architecture comprise a target memory server, and data corresponding to each virtual memory space in the target memory server is located in a physical memory space distributed in the plurality of memory servers; the target memory server obtains a target virtual address of data needing to be accessed by the data access request; determining a target virtual memory space based on the target virtual address; the target virtual memory space has a data path mark for indicating the data access granularity; and if the data needing to be accessed is located in a first physical memory space not belonging to the target memory server, reading the data needing to be accessed from the first physical memory space by adopting the data access granularity indicated by the data path sign based on the target virtual address. By the adoption of the data access method and device, the mode of data access in the distributed memory architecture can be enriched, and the performance of data access in the distributed memory architecture is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a data access method and related device for a distributed memory architecture. Background Art

[0002] When remotely accessing data, a specific data path can be used for remote data access. For example, a specific data path can be configured in a memory framework. Different data paths configured in the memory framework result in different granularities for remote data access.

[0003] In actual data access scenarios, various situations may occur where remote data needs to be accessed. For example, at one moment, a small-granularity data needs to be remotely accessed, or at another moment, a large-granularity data needs to be remotely accessed. However, this is difficult to achieve based on the specific data path configured in the memory architecture, resulting in poor performance for remote data access in the memory architecture. Summary of the Invention

[0004] This application provides a data access method and related device for a distributed memory architecture, which can improve the performance of data access in the distributed memory architecture.

[0005] On the one hand, this application provides a data access method for a distributed memory architecture. The distributed memory architecture includes multiple memory servers. This method is applied to a target memory server, which is a memory server that provides data processing resources among the multiple memory servers. There are N virtual memory spaces in the target memory server, where N is a positive integer. Each virtual memory space is used to indicate the data that can be accessed corresponding to it. The data corresponding to each virtual memory space is stored in the physical memory space associated with each virtual memory space. The physical memory spaces associated with the N virtual memory spaces are distributed among multiple memory servers. The method includes:

[0006] In response to a data access request, obtain the target virtual address of the data required to be accessed by the data access request;

[0007] Based on the target virtual address, determine the target virtual memory space corresponding to the data required to be accessed by the data access request from the N virtual memory spaces; the target virtual memory space has a data path flag, and the data path flag is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag is used to indicate the data access granularity required when accessing the data in the physical memory space associated with the target virtual memory space;

[0008] If the data required to be accessed by a data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers except the target memory server among multiple memory servers, then based on the target virtual address, the data access granularity indicated by the data path flag is adopted to read the data required to be accessed by the data access request from the first physical memory space.

[0009] On the one hand, the present application provides a data access device for a distributed memory architecture. The distributed memory architecture includes multiple memory servers. The device is applied to a target memory server, which is the memory server that provides data processing resources among multiple memory servers. There are N virtual memory spaces in the target memory server, where N is a positive integer. Each virtual memory space is used to indicate the accessible data corresponding to it. The data corresponding to each virtual memory space is respectively stored in the physical memory space associated with each virtual memory space. The physical memory spaces associated with the N virtual memory spaces are distributed among multiple memory servers. The device includes:

[0010] An acquisition module, configured to acquire the target virtual address of the data required to be accessed by a data access request in response to the data access request;

[0011] A determination module, configured to determine, based on the target virtual address, the target virtual memory space corresponding to the data required to be accessed by the data access request from the N virtual memory spaces; the target virtual memory space has a data path flag, and the data path flag is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space, and the data path flag is used to indicate the data access granularity required when accessing the data in the physical memory space associated with the target virtual memory space;

[0012] An access module, configured to if the data required to be accessed by a data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers except the target memory server among multiple memory servers, then based on the target virtual address, the data access granularity indicated by the data path flag is adopted to read the data required to be accessed by the data access request from the first physical memory space.

[0013] Optionally, the data corresponding to the target virtual memory space exists in the data page corresponding to the target virtual memory space based on a paging mechanism; the above data access device is further configured to:

[0014] Acquire the page prefetch efficiency for the data page corresponding to the target virtual memory space;

[0015] Acquire the data memory access latency for the data corresponding to the target virtual memory space;

[0016] Set a data path flag for the target virtual memory space based on page prefetch efficiency and data access latency;

[0017] Among them, both page prefetch efficiency and data access latency belong to the memory access characteristics of the target virtual memory space.

[0018] Optionally, the method for the data access device to obtain the page prefetch efficiency of the data page corresponding to the target virtual memory space includes:

[0019] Count the first quantity of data pages obtained based on page prefetch operations in the data pages corresponding to the target virtual memory space;

[0020] Count the second quantity of data pages that have been accessed among the data pages obtained based on page prefetch operations corresponding to the target virtual memory space;

[0021] Determine the quantity ratio between the second quantity and the first quantity as the page prefetch efficiency.

[0022] Optionally, the method for the data access device to obtain the data access latency of the data corresponding to the target virtual memory space includes:

[0023] Obtain the access latencies respectively corresponding to M data accesses to the data corresponding to the target virtual memory space within the target time period; M is a positive integer, and the target time period is the adjacent time period before the current time;

[0024] Calculate the data access latency of the data corresponding to the target virtual memory space based on the access latencies respectively corresponding to the M data accesses;

[0025] Among them, the data access latency is any one of the following: the average access latency of the M access latencies corresponding to the M data accesses, the median access latency among the M access latencies corresponding to the M data accesses.

[0026] Optionally, the method for the data access device to set a data path flag for the target virtual memory space based on page prefetch efficiency and data access latency includes:

[0027] Obtain a first reference threshold set for the page prefetch efficiency and a second reference threshold set for the data access latency;

[0028] If the page prefetch efficiency is less than or equal to the first reference threshold and the data access latency is greater than or equal to the second reference threshold, then set a data path flag for the target virtual memory space based on the first data access granularity;

[0029] If the page prefetch efficiency is greater than the first reference threshold or the data access latency is less than the second reference threshold, then set a data path flag for the target virtual memory space based on the second data access granularity;

[0030] Among them, the first data access granularity is smaller than the second data access granularity.

[0031] Optionally, the data access granularity indicated by the data path flag is any one of the following: the first data access granularity, the second data access granularity; the first data access granularity is smaller than the second data access granularity;

[0032] Among them, the first data access granularity is the granularity of data access in units of data objects, and the second data access granularity is the granularity of data access in units of data pages. One data page can contain one or more data objects, and the data corresponding to each virtual memory space includes the data pages corresponding to each virtual memory space.

[0033] Optionally, the access module reads the data required for the data access request from the first physical memory space by using the data access granularity indicated by the data path flag based on the target virtual address. The methods include:

[0034] If the data path flag is used to indicate the first data access granularity, allocate a second physical memory space for the data object required for the data access request; the second physical memory space is the physical memory space in the target memory server;

[0035] Based on the target virtual address, read the data object required for the data access request from the first physical memory space;

[0036] Store the read data object in the allocated second physical memory space, and modify the virtual address of the read data object from the target virtual address to the virtual address pointing to the physical address of the second physical memory space.

[0037] Optionally, the access module reads the data object required for the data access request from the first physical memory space based on the target virtual address. The methods include:

[0038] Extract the target page virtual address of the data page where the data object required for the data access request is located and the in-page offset of the data object required for the data access request in the data page from the target virtual address; the in-page offset is used to indicate the position of the data object required for the data access request in the data page;

[0039] Obtain the page table entry; the page table entry contains the mapping relationship between the page virtual address of the data page corresponding to each virtual memory space and the physical address of the page where it is located;

[0040] Obtain the target page physical address having a mapping relationship with the target page virtual address from the page table entry;

[0041] Add the target page physical address and the offset within the page to obtain the object physical address of the data object to be accessed by the data access request; the object physical address belongs to the physical addresses in the first physical memory space;

[0042] Read the data object to be accessed by the data access request from the first physical memory space based on the object physical address.

[0043] Optionally, the way for the access module to read the data to be accessed by the data access request from the first physical memory space based on the target virtual address and the data access granularity indicated by the data path flag includes:

[0044] If the data path flag is used to indicate the second data access granularity, allocate a third physical memory space for the data page where the data object to be accessed by the data access request is located; the third physical memory space is the physical memory space in the target memory server;

[0045] Based on the target virtual address, obtain the target page physical address of the data page where the data object to be accessed by the data access request is located; the target page physical address belongs to the physical addresses in the first physical memory space;

[0046] Read the data page where the data object to be accessed by the data access request is located from the first physical memory space based on the target page physical address and the second data access granularity;

[0047] Store the read data page in the allocated third physical memory space, and modify the page physical address of the read data page from the target page physical address to the physical address of the third physical memory space;

[0048] Obtain the data object to be accessed by the data access request from the read data page stored in the third physical memory space.

[0049] Optionally, after the data page where the data object to be accessed by the data access request is located is read and stored in the third physical memory space, the target page physical address is written into the metadata of the read data page; the above data access device is further used for:

[0050] If the read data page is triggered for page recycling, obtain the target page physical address of the read data page in the first physical memory space from the metadata;

[0051] Based on the obtained target page physical address, rewrite the read data page from the third physical memory space back to the first physical memory space, and rewrite the physical address of the read data page from the physical address of the third physical memory space back to the target page physical address.

[0052] Optionally, the above data access device is further used for:

[0053] Obtain the data volume of the surviving data corresponding to the target virtual memory space and the maximum data volume of the data corresponding to the target virtual memory space; the surviving data refers to the data in the data corresponding to the target virtual memory space that is not occupied.

[0054] Calculate the data volume ratio between the data volume of the surviving data and the maximum data volume.

[0055] If the data volume ratio is less than or equal to the ratio threshold, perform a merging process on the surviving data corresponding to the target virtual memory space.

[0056] Optionally, the target virtual memory space has a corresponding first access counter. The count value of the first access counter increases by a unit value when the data corresponding to the target virtual memory space is accessed and decreases by a unit value when the data access ends.

[0057] Among them, when the count value of the first access counter is the target count value, the data path flag of the target virtual memory space supports being switched; and when the count value of the first access counter is not the target count value, the data path flag of the target virtual memory space does not support being switched.

[0058] Optionally, the target virtual memory space corresponds to multiple data pages. The multiple data pages are used to store the data corresponding to the target virtual memory space, and each of the multiple data pages has its own corresponding second access counter; the count value of the second access counter corresponding to any one of the multiple data pages increases by a unit value when the data in any one of the data pages is accessed and enters the secure access space, and decreases by a unit value when the data access ends and exits the secure access space.

[0059] Among them, when the count value of the second access counter corresponding to any one of the data pages is the target count value, any one of the data pages supports being swapped out; and when the count value of the second access counter corresponding to any one of the data pages is not the target count value, any one of the data pages does not support being swapped out.

[0060] Optionally, the above data access device is further configured to:

[0061] Perform a summation process on the count values of the second access counters respectively corresponding to each of the data pages corresponding to the target virtual memory space to obtain a summation count value.

[0062] Among them, when the summation count value is the target count value, the data corresponding to the target virtual memory space supports being merged; and when the summation count value is not the target count value, the data corresponding to the target virtual memory space does not support being merged.

[0063] Optionally, the above data access device is further configured to:

[0064] Initiate a target transaction to be executed based on the target virtual address; the target transaction is used to access the data to which the target virtual address belongs;

[0065] If the target transaction is successfully executed, determine that the data to which the target virtual address belongs is located in the physical memory space of the target memory server;

[0066] If the target transaction fails to be executed, determine that the data to which the target virtual address belongs is located in the physical memory space of other memory servers except the target memory server among multiple memory servers.

[0067] Optionally, the N virtual memory spaces are obtained by partitioning the memory space of the target application, and the data access request is sent by the application client of the target application. The data access request is used to access the application page of the target application in the application client;

[0068] The above data access device is further used for:

[0069] Return the data required by the data access request read from the first physical memory space to the application client;

[0070] Wherein, the application client is used to render and display the application page of the target application based on the data returned by the target memory server.

[0071] On the one hand, the present application provides a computer device, including a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor executes the method in one aspect of the present application.

[0072] On the one hand, the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by the processor, the processor executes the method in the above one aspect.

[0073] According to one aspect of the present application, there is provided a computer program product. The computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the methods provided in the above one aspect and various optional manners.

[0074] In this application, the distributed memory architecture may include multiple memory servers. Among the multiple memory servers, there may be a target memory server that provides data processing resources. The target memory server may have N virtual memory spaces. Each virtual memory space is used to indicate the accessible data corresponding to it. The data corresponding to each virtual memory space is stored in the physical memory space associated with each virtual memory space. The physical memory spaces associated with the N virtual memory spaces are distributed among multiple memory servers. The target memory server may respond to a data access request, obtain the target virtual address of the data required to be accessed by the data access request, and based on the target virtual address, determine the target virtual memory space corresponding to the data required to be accessed by the data access request from the N virtual memory spaces. The target virtual memory space has a data path flag, which is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag is used to indicate the data access granularity to be adopted when accessing the data in the physical memory space associated with the target virtual memory space. If the data required to be accessed by the data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers except the target memory server among the multiple memory servers, the target memory server may also read the data required to be accessed by the data access request from the first physical memory space based on the data access granularity indicated by the data path flag using the target virtual address. It can be seen that the method proposed in this application can create N virtual memory spaces in the distributed memory architecture. The physical memory spaces associated with each virtual memory space can be distributed among multiple memory servers. Moreover, this application can also set corresponding data path flags for each virtual memory space. The data path flag is set through the memory access characteristics of the corresponding virtual memory space. Therefore, if the data to be accessed is located in the remote physical memory (such as the first physical memory space that does not belong to the target memory server), the data reading granularity indicated by the data path flag of the target virtual memory space can be adopted to read the data to be accessed from the remote first physical memory space, so that the data reading granularity adopted can better conform to the memory access characteristics of the target virtual memory space, thereby improving the performance of data access. In addition, by adopting the data access granularity indicated by the dynamically set data path flag of the target virtual memory space for data access, the access methods for the data in the physical memory space associated with the target virtual memory space can also be enriched. Description of the Drawings

[0075] To more clearly illustrate the technical solutions in the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.

[0076] Figure 1 It is a schematic diagram of the architecture of a memory access network provided by an embodiment of the present application;

[0077] Figure 2 It is a schematic diagram of a scenario for data access provided by an embodiment of the present application;

[0078] Figure 3 It is a schematic flowchart of a method for data access in a distributed memory architecture provided by an embodiment of the present application;

[0079] Figure 4 It is another schematic diagram of a scenario for data access provided by an embodiment of the present application;

[0080] Figure 5 It is a schematic flowchart of a method for setting data path flags in a virtual memory space provided by an embodiment of the present application;

[0081] Figure 6 It is a schematic diagram of the state transition of data path flags provided by an embodiment of the present application;

[0082] Figure 7 It is a schematic flowchart of a method for data access with data objects as the granularity provided by an embodiment of the present application;

[0083] Figure 8 It is a schematic diagram of a scenario for data access with data objects as the granularity provided by an embodiment of the present application;

[0084] Figure 9 It is a schematic flowchart of a method for data access with data pages as the granularity provided by an embodiment of the present application;

[0085] Figure 10 It is a schematic diagram of a scenario for data access with data pages as the granularity provided by an embodiment of the present application;

[0086] Figure 11 It is a schematic diagram of the structure of a data access device in a distributed memory architecture provided by an embodiment of the present application;

[0087] Figure 12 It is a schematic diagram of the structure of a computer device provided by an embodiment of the present application. Detailed implementation manners

[0088] The technical solutions in the present application will be clearly and completely described below with reference to the accompanying drawings in the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without making creative efforts shall fall within the protection scope of the present application.

[0089] The present application relates to artificial intelligence related technologies. Among them, Artificial Intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines, enabling the machines to have the functions of perception, reasoning and decision-making.

[0090] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields, including both hardware-level technologies and software-level technologies. The basic technologies of artificial intelligence generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. The software technologies of artificial intelligence mainly include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0091] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in multiple fields. For example, common ones include smart home, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless, autonomous driving, drones, digital twins, virtual humans, robots, Artificial Intelligence Generated Content (AIGC), conversational interaction, smart healthcare, smart customer service, game AI, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0092] The embodiments of the present application mainly relate to technologies such as distributed storage of artificial intelligence. The present application can adopt a flexible data path in a distributed memory architecture (for distributed storage of data) to achieve flexible access to remote data, which will be specifically described through the following embodiments.

[0093] The present application relates to cloud technology. Among them, Cloud Technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.

[0094] Cloud technology is the general term for network technology, information technology, integration technology, management platform technology, application technology, etc. applied based on the cloud computing business model. It can form a resource pool, be used on demand, and is flexible and convenient. Cloud computing technology will become an important support. The back-end services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark and needs to be transmitted to the back-end system for logical processing. Data at different levels will be processed separately, and various industry data requires the support of a powerful system background, which can only be achieved through cloud computing.

[0095] Among the memory servers in the distributed memory architecture of this application, distributed storage, processing, and sharing of memory data can be achieved based on cloud technology.

[0096] First of all, it should be noted that all the data collected in this application (such as related data like the virtual address of the data, the data path flag of the virtual memory space, and the physical address of the physical memory space) are collected with the consent and authorization of the object to which the data belongs (such as users, institutions, or enterprises), and the collection, use, and processing of the relevant data need to comply with the relevant laws, regulations, and standards of the relevant region.

[0097] Here, relevant technical concepts involved in this application are explained:

[0098] Memory decoupling architecture: It means that memory resources are distributed on multiple machines, and these machines can be interconnected through IB (InfiniBand, a high-speed network card). The latency of the IB network card is usually only a few microseconds, and the bandwidth can reach 400 Gbps (gigabit). An application (such as an application program) actually runs on one server, which is called the local server. The memory resources in the local server are called local memory, and the memory resources on other servers except the local server are called remote memory.

[0099] RDMA: Remote Direct Memory Access, remote direct memory access. It is a new network data transmission technology that can reduce the latency of data transmission on the network, increase the bandwidth, and the data transmission does not occupy the CPU (Central Processing Unit) resources of the server. It requires a dedicated RDMA network card (such as an IB network card) to support.

[0100] Swap-in: It means retrieving data from remote memory back to local memory. Since the application runs on the local server, when actually reading and writing data, the data must be pulled back from remote memory to local memory.

[0101] Swap-out: When local memory is insufficient, the operating system or runtime will move some infrequently accessed "cold data" out of local memory and into remote memory.

[0102] Data path: Refers to the way of managing remote memory, including details such as how to determine whether data is in remote memory, how to read data from remote memory, at what granularity to read data, and how to swap out data from local memory to remote memory.

[0103] Runtime: Libraries, code, frameworks, etc. used to support the running of applications.

[0104] Smart Pointer: Used to manage the raw pointer of an object. For example, the raw pointer of an object can be obtained through the deref method of the smart pointer.

[0105] Online Profiling: Refers to dynamically performing profiling (information collection) during the execution of an application, collecting characteristic information during the execution of the application. That is, the execution of the application and profiling are carried out simultaneously, and the information of the application does not need to be known in advance.

[0106] Prefetching: Refers to calculating, through certain algorithms, the data that the application may access next and is located in remote memory, and preloading this data into local memory in advance to reduce the subsequent data access latency of the application. For example, data pages can be prefetched through page prefetching operations.

[0107] Please refer to Figure 1 , Figure 1 which is a schematic diagram of the architecture of a memory access network provided by an embodiment of the present application. As Figure 1 shown, the memory access network may include a user's terminal device and a distributed memory architecture. The distributed memory architecture may include multiple memory servers. Here, it may include memory servers c1 to c6. Among them, the specific number of memory servers in the distributed memory architecture can be determined according to the actual application scenario and is not limited thereto. The distributed memory architecture may be the above-mentioned memory decoupling architecture.

[0108] Among them, the terminal device may include an application client of the application (belonging to the front end). Each memory server in the distributed memory architecture can be used to store application data related to the application. The distributed memory architecture can be understood as the background of the application. The terminal device can request data access from the distributed memory architecture through the application client.

[0109] As Figure 1The memory server shown can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal device can be: intelligent terminals such as smartphones, tablets, laptops, desktop computers, smart TVs, and in-vehicle terminals.

[0110] In the above distributed memory architecture, there can be a memory server for providing data processing resources (such as CPU resources). A series of operations performed by this application can be executed by the memory server that provides data processing resources. The memory server that provides data processing resources can be called the target memory server. The application client can interact with the target memory server to access relevant application data of the application.

[0111] Among them, the target memory server can have N virtual memory spaces, each virtual memory space has its corresponding data. The data corresponding to each virtual memory space can be understood as the data divided into each virtual memory space. The data corresponding to each virtual memory space can be stored in the physical memory space associated with each virtual memory space respectively. The physical memory spaces associated with each virtual memory space can be distributed in each memory server.

[0112] Please refer to Figure 2 , Figure 2 which is a schematic diagram of a scenario for data access provided by an embodiment of this application. As Figure 2 shown, the application client in the terminal device 100 can send a data access request to the target memory server, and the target memory server can receive the data access request sent by the application client in the terminal device 100. This data access request can be used to access the application data of the application.

[0113] Specifically, the target memory server can obtain the virtual address of the data to be accessed through the data access request (which can be called the target virtual address), and can determine the virtual memory space corresponding to the data to be accessed from the above N virtual memory spaces through the target virtual address (which can be called the target virtual memory space). The target virtual memory space can have a data path flag, and the data path flag can be dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag can be used to indicate the data access granularity required when accessing the data in the physical memory space associated with the target virtual memory space. Therefore, if the target memory server determines through the above target virtual address that the data to be accessed is located in the remote first physical memory space (that is, the first physical memory space belongs to the remote memory and does not belong to the local memory), the target memory server can read the data required by the data access request from the remote first physical memory space through the target virtual address and using the data access granularity indicated by the data path flag of the target virtual memory space. The specific process can also refer to the corresponding descriptions in the following embodiments.

[0114] By using the method provided in the embodiments of the present application, data in the remote physical memory space can be read with a data access granularity that more conforms to the memory access characteristics of the virtual memory space, thereby improving the performance of data access in the distributed memory architecture.

[0115] Please refer to Figure 3 , Figure 3 which is a schematic flowchart of a data access method for a distributed memory architecture provided by the embodiments of the present application. As Figure 3 shown, the method may include:

[0116] Step S101, in response to a data access request, obtain the target virtual address of the data to be accessed by the data access request.

[0117] Specifically, the distributed memory architecture of the present application (which can be denoted as Atlas) may include multiple memory servers, and these multiple memory servers together implement the distributed storage of memory data (which can be simply referred to as data). The specific number of these multiple memory servers can be determined according to the actual application scenario and is not limited thereto.

[0118] Among these multiple memory servers, there may be a target memory server, and the target memory server may be the memory server that provides data processing resources among these multiple memory servers. The data processing resources may refer to CPU resources. The execution entity in the embodiments of the present application may be the target memory server. In other words, the device for data processing in the present application is the memory server that provides CPU resources.

[0119] Among them, the data stored in the distributed memory architecture (i.e., the data distributedly stored by the above-mentioned multiple memory servers) can be any data that needs to be distributedly stored. For example, the data stored in the distributed memory architecture can be the application data of a distributed storage application. This application can be any software or program. The data required for the operation of the front end of the application (such as the application client) can be provided by the distributed memory architecture. In this scenario, the distributed memory architecture can be understood as the back end of the application.

[0120] Therefore, it can be understood that the distributed memory architecture in this application can be the memory decoupling architecture described above. The target memory server can be the above-mentioned local server, and the memory resources in the target memory server can be referred to as the above-mentioned local memory. The memory resources in the memory servers other than the target memory server among the multiple memory servers can be referred to as the above-mentioned remote memory.

[0121] Among them, the target memory server can have N virtual memory spaces, where N is a positive integer, and the specific value of N can be determined according to the actual application scenario. For example, these N virtual memory spaces can be N virtual memory regions obtained by dividing the memory space of the application. The size of each virtual memory space can be fixed, and this virtual memory space can be understood as a constructed memory structure.

[0122] Each virtual memory space is used to indicate the accessible data corresponding to it. The data corresponding to each virtual memory space is respectively stored in the physical memory space associated with each virtual memory space. The physical memory spaces associated with the N virtual memory spaces can be distributed among the above-mentioned multiple memory servers. This physical memory space is the actual space for storing data.

[0123] Furthermore, the data stored in the distributed memory architecture can be stored in each data page based on a paging mechanism. The data stored in the distributed memory architecture can exist in units of data objects. One data page can be used to store one or more data objects (in some special cases, the data page may be empty, that is, no data object is stored).

[0124] Therefore, it can be understood that the accessible data corresponding to a virtual memory space can include multiple data pages. Each data page can be respectively stored in the physical memory space of any memory server (which can be called a physical machine). Different data pages can be stored in different physical memory spaces. The physical memory spaces where the data pages corresponding to a virtual memory space are stored can be the physical memory spaces associated with this virtual memory space.

[0125] Among them, the data pages corresponding to the virtual memory space can be understood as the data belonging to the virtual memory space. The data belonging to the virtual memory space is actually stored in the physical memory space associated with the virtual memory space. The virtual memory space (Virtual Range, VR) can be understood as the upper-layer memory structure (i.e., memory area) divided from the physical memory spaces of the above-mentioned multiple memory servers.

[0126] The target memory server can obtain a data access request, which can be generated and sent by an application client. For example, the application client can be the client of a target application (which can be any application), and the data access request can be a request to access the application data of the target application. For example, the application data can be data for displaying the application page of the target application or data for processing relevant services of the target application, etc.

[0127] Furthermore, the data access request may include the virtual address of the data to be accessed, and the virtual address of the data to be accessed in the data access request can be called the target virtual address. For example, the data access request may include a smart pointer to the data to be accessed. By dereferencing the smart pointer, the raw pointer to the data to be accessed can be obtained through the smart pointer, and this raw pointer is the virtual address of the data to be accessed. It can be understood that the smart pointer of the data contains the raw pointer of the data. Exemplarily, the deref function (a function for dereferencing) of the data object to be accessed can be called through the smart pointer of the data to be accessed, so as to realize the dereferencing of the smart pointer.

[0128] Exemplarily, in the Atlas of the embodiment of the present application, a smart pointer interface similar to that in the Runtime-Object data path (a data path with data objects as the processing granularity) can be provided for data objects. This smart pointer interface can be denoted as AtlasUniquePointer, and the metadata of this smart pointer interface can be as shown in the following code:

[0129]

[0130] The above code can be the metadata of the smart pointer interface for a data object, and this metadata can include information such as the virtual address of the object to which the smart pointer belongs (such as unsigned long addr in the above code), size (such as unsigned long size in the above code), and status. Among them, the get_raw function and the above deref function can be understood as the same function, which can be used to obtain the raw pointer of the data object. The unsigned long is_moving in the above code is used for synchronization between multiple threads. For example, if multiple threads all need to access a certain data object at the remote end, then at the same moment, only one thread will issue an RDMA read request (a request for reading data at the remote end) to read the data object to be accessed from the remote memory, while other threads will wait during this period.

[0131] Among them, the get_raw function can be called inside the deref scope (a safe access space where the data object being accessed will not be modified), so as to obtain the raw pointer of the data object to be accessed and read the corresponding data object through this raw pointer.

[0132] Step S102: Based on the target virtual address, determine the target virtual memory space corresponding to the data required by the data access request from N virtual memory spaces; the target virtual memory space has a data path flag, and the data path flag is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag is used to indicate the data access granularity required when accessing the data in the physical memory space associated with the target virtual memory space.

[0133] Specifically, the target memory server can determine, through the above target virtual address, the target virtual memory space corresponding to (i.e., belonging to) the data required by the data access request from the above N virtual memory spaces, and the target virtual memory space can be any one of the N virtual memory spaces.

[0134] Among them, the target virtual address of the data to be accessed can include the index information of the virtual memory space corresponding to this data. Therefore, the target memory server can directly extract this index information from the target virtual address, and then determine the target virtual memory space through this index information. The target virtual memory space is the virtual memory space indexed by this index information in the target virtual memory address.

[0135] In this application, the target virtual memory space has a data path flag. In fact, each virtual memory space can have its own data path flag. Here, the data path flag of the target virtual memory space is taken as an example for corresponding description.

[0136] The data path flag of the target virtual memory space is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag is used to indicate the data access granularity that needs to be adopted (i.e., used) when accessing the data in the physical memory space associated with the target virtual memory space. In other words, the data access granularity indicated by the data path flag of the target virtual memory space is the data access granularity that best conforms to the memory access characteristics of the current target virtual memory space. It can be understood that adopting the data access granularity indicated by the data path flag of the target virtual memory space can optimize the access performance of the current data in the physical memory space associated with the target virtual memory space.

[0137] Optionally, the data access granularity indicated by the data path flag of the target virtual memory space can be any one of the following: the first data access granularity, the second data access granularity. Among them, the first data access granularity is less than the second data access granularity. The first data access granularity belongs to the small-granularity data access granularity, and the second data access granularity belongs to the large-granularity data access granularity. Therefore, the present application can be applied to any system and architecture that requires data access using multiple mixed data access granularities.

[0138] From the above, it can be understood that the distributed memory architecture of the present application can also be a hybrid data path architecture, which can support two data paths simultaneously. Exemplarily, among the two data paths, one data path can be the Runtime-Object data path corresponding to the first data access granularity (a data path that processes data in units of data objects), and one data path can be the OS-Paging data path corresponding to the second data access granularity (a data path that processes data in units of data pages).

[0139] Among them, the first data access granularity is the granularity of accessing data in units of data objects, that is, when accessing data using the first data access granularity, data reading and access are performed in units of data objects. The second data access granularity is the granularity of accessing data in units of data pages, that is, when accessing data using the second data access granularity, data reading and access are performed in units of data pages. As described above, a data page can contain one or more data objects, and the data corresponding to each virtual memory space can include the data pages corresponding to each virtual memory space.

[0140] Among them, the specific characteristics included in the memory access characteristics of the target virtual memory space, and the process of setting the corresponding data path flag for the target virtual memory space based on the memory access characteristics of the target virtual memory space, can be referred to the relevant descriptions in the following Figure 5 corresponding embodiments.

[0141] Step S103, if the data to be accessed by the data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers except the target memory server among multiple memory servers, then the data to be accessed by the data access request is read from the first physical memory space based on the target virtual address and the data access granularity indicated by the data path flag.

[0142] Specifically, if the data to be accessed by the above data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers except the target memory server among the multiple memory servers, that is, the first physical memory space is not the physical memory space of the target memory server, which means the first physical memory space is the physical memory space in the remote memory, then the target memory server can read the data to be accessed by the data access request from the first physical memory space through the above target virtual address and using the data access granularity indicated by the data path flag of the target virtual memory space.

[0143] Exemplarily, the method for determining whether the data to be accessed by the data access request exists in the local memory may include: the target memory server may initiate a target transaction to be executed based on the target virtual address. Optionally, the target transaction may be initiated through a TSX instruction (an instruction used to determine whether there is a memory access conflict between multiple threads and is used in this application to determine whether the data object to be accessed is located in the local memory) based on the target virtual address, and the target transaction may be used to access the data belonging to the target virtual address.

[0144] Among them, if the data object to be accessed (such as the data to be accessed by the data access request, that is, the data object belonging to the target virtual address) is located in the local memory, then the target transaction can be normally executed and completed (i.e., executed successfully), while if the data object to be accessed is located in the remote memory, a page fault will be triggered when the CPU continues to access the data object belonging to the target virtual address. At this time, the CPU will abort the target transaction and the target transaction execution fails.

[0145] Therefore, in the present application, it can be quickly determined whether the data object to which the target virtual address belongs exists in the local memory or in the remote memory based on whether the above-mentioned target transaction is successfully executed. Specifically, if the target transaction is successfully executed, it indicates that the data object to which the target virtual address belongs exists in the local memory (that is, the data object to which the target virtual address belongs is located in the physical memory space of the target memory server); on the contrary, if the target transaction fails, it indicates that the data object to which the target virtual address belongs exists in the remote memory (that is, the data object to which the target virtual address belongs is located in the physical memory space of other memory servers except the target memory server among the above-mentioned multiple memory servers).

[0146] Therefore, it can be understood that if the data object to which the target virtual address belongs is located in the local memory (that is, when the above-mentioned first physical memory space is the physical memory space in the target memory server), the target memory server can directly obtain (that is, read, which is also access) the data object to which the target virtual address belongs in the local memory, that is, the data object to be accessed can be directly read in the local memory without reading the data according to the data access granularity indicated by the data path flag of the target virtual memory space.

[0147] If the data object to which the target virtual address belongs is located in the remote memory (that is, when the above-mentioned first physical memory space is not the physical memory space in the target memory server), the target memory server needs to read the data from other memory servers (that is, the memory server to which the first physical memory space associated with the target virtual memory space belongs) according to the data access granularity indicated by the data path flag of the target virtual memory space.

[0148] In the present application, the corresponding data path flag can be dynamically set for each virtual memory space according to the memory access characteristics of each virtual memory space. Therefore, when it is necessary to read the data object to which the target virtual address belongs from other memory servers, the data access granularity indicated by the data path flag of the target virtual memory space can be adaptively adopted to read the data object to which the target virtual address belongs from the first physical memory space, such as only reading the data object to which the target virtual address belongs, or reading the entire data page where the data object to which the target virtual address belongs is located.

[0149] Among them, if the data access granularity indicated by the data path flag of the target virtual memory space is the above-mentioned first data access granularity, the target memory server directly reads (that is, accesses) the data object to which the target virtual address belongs from the first physical memory space, that is, the data read at this time can be only the data object to which the target virtual address belongs (that is, the data object required to be accessed by the current data access request).

[0150] If the data access granularity indicated by the data path flag of the target virtual memory space is the second data access granularity described above, the target memory server reads the entire data page where the data object to which the target virtual address belongs is located from the first physical memory space. That is, the data read at this time is the entire data page where the data object to which the target virtual address belongs. It can be understood that the currently read data not only includes the data object required to be accessed by the data access request, but also includes other data objects in the data page where the data object is located.

[0151] Specifically, for how to read the data object required to be accessed by the above data access request from the first physical memory space, reference can also be made to the relevant descriptions in the following Figure 7 and Figure 9 corresponding embodiments.

[0152] Please refer to Figure 4 , Figure 4 which is a schematic diagram of another scenario for data access provided by the embodiments of the present application. As Figure 4 shown, the target memory server can obtain the target virtual address of the data object required to be accessed through the data access request. The target virtual address may include the page virtual address of the data page where the data object required to be accessed by the data access request is located, the in-page offset of the data object required to be accessed by the data access request in the data page (which can be used to indicate the position of the data object required to be accessed by the data access request in the data page), and the index information of the target virtual memory space corresponding to the data object required to be accessed by the data access request.

[0153] In the embodiments of the present application, the page physical address of the data page where the data object required to be accessed by the data access request is located can be obtained by mapping the page virtual address of the data page. Furthermore, the object physical address of the data object required to be accessed by the data access request can be calculated through the page physical address and the above in-page offset (the specific process can refer to the relevant descriptions in the following Figure 7 corresponding embodiments). In addition, in the embodiments of the present application, the target virtual memory space corresponding to the data object required to be accessed by the data access request can be determined through the index information of the virtual memory space in the target virtual address, so as to obtain the data path flag of the target virtual memory space.

[0154] Furthermore, the target memory server can read and obtain the data object required to be accessed by the data access request through the object physical address of the data object required to be accessed by the data access request, or the page physical address of the data page where the data object required to be accessed by the data access request is located. The specific process can also refer to the corresponding descriptions in the following embodiments.

[0155] Furthermore, in the present application, the target memory server may also obtain the amount of data of the surviving data corresponding to the target virtual memory space and the maximum amount of data of the data corresponding to the target virtual memory space. The surviving data may refer to the data in the data corresponding to the target virtual memory space that is not occupied.

[0156] It should be noted that whether the data corresponding to the target virtual memory space is alive (i.e., whether it is surviving data) has nothing to do with whether the data is located in the local memory or the remote memory. When the data object is not released (i.e., a free occurs) or not read and migrated to a new location (such as when accessed, it is migrated to the memory newly allocated for the data object in the local memory), the data object is alive. After the data object is migrated to a new location, the old location is no longer alive, and at this time, the memory originally occupied by the data object can be released.

[0157] Among them, the data object being free may mean that a mark is added to the data object, and through this mark, the data object will not be immediately recycled. The marked data object can be recycled during the compaction stage (the merging stage of data objects).

[0158] The above-mentioned maximum amount of data of the data corresponding to the target virtual memory space may refer to the maximum amount of data that the target virtual memory space can accommodate, that is, the upper limit of the amount of data that the target virtual memory space can accommodate.

[0159] Furthermore, the target memory server may calculate the data volume ratio between the amount of data of the surviving data corresponding to the target virtual memory space (such as the number of bytes of the surviving data) and the above-mentioned maximum amount of data (such as the total number of bytes of the most data). This data volume ratio is the ratio obtained by dividing the amount of data of the surviving data by the maximum amount of data. This data volume ratio can reflect the proportion occupied by the surviving data in the target virtual memory space. If this data volume ratio is less than or equal to the ratio threshold, it can be considered that the surviving data corresponding to the target virtual memory space is relatively scarce. In this case, a compaction operation (merging operation) can be performed on the surviving data corresponding to the target virtual memory space to merge the surviving data corresponding to the target virtual memory space. For example, the surviving data corresponding to the target virtual memory space can be merged into one or more data pages. These one or more data pages can be data pages that originally existed under the target virtual memory space, or can also be newly created data pages under the target virtual memory space. Specifically, how many data pages to merge into and which data pages to merge into can be determined according to the actual application scenario, and there is no limit to this. Optionally, after the surviving data corresponding to the target virtual memory space is merged, the data pages that do not have data objects (i.e., empty data pages) corresponding to the target virtual memory space can be released to reduce the memory occupation of the empty data pages.

[0160] Among them, the process of merging the surviving data corresponding to the target virtual memory space can be executed by a compaction thread (merging thread). Through the above principle, this application can determine whether it is necessary to merge the surviving data corresponding to each virtual memory space respectively. By merging the surviving data in the virtual memory space, data fragmentation can be reduced.

[0161] In addition, to ensure the execution accuracy of the above processes in this application (such as the process of reading data from the remote memory through the corresponding data access granularity and the process of merging the surviving data), this application also proposes the following synchronization algorithm for data path switching to ensure the accuracy of data processing in the above processes. For example, when the data path of VR (virtual memory space) switches from OS-Paging to Runtime-Object, how to avoid multiple copies of data objects; another example is when the data object is inside the deref scope (the safe access space of the data object, that is, the safe access area, and the data objects in this safe access area will not be modified), and the application is reading and writing the data object through a raw pointer, how to avoid the data object being swapped out to the remote memory and other problems can all be solved through the synchronization algorithm shown below, as described in the following content.

[0162] The synchronization algorithm of this application includes 3 invariants designed as follows:

[0163] Invariant 1: This application stipulates that for a specific data object, at the same moment, there can only be one data path accessing it. That is to say, for a data object at any moment, either it is accessed through the Runtime-Object data path (that is, accessed through the above first data access granularity), or it is accessed through the OS-Paging data path (that is, accessed through the above second data access granularity), even in the case of multiple data access threads. This can ensure that the data object will not be copied multiple times through the Runtime-Object data path and the OS-Paging data path at the same time, such as being copied multiple times to the local memory.

[0164] Invariant 2: This application prohibits (i.e., cannot) the data page where the data object accessed through the Runtime-Object data path within the deref scope from being swapped out through the OS-Paging data path. That is to say, if a data page contains a data object swapped in through the Runtime-Object data path and the data object is still within the deref scope, then the data page will not be reclaimed by the page reclaim mechanism of the OS-Paging data path.

[0165] Invariant 3: This application prohibits a data object from being swapped in through the Runtime-Object data path and being moved (i.e., merged) by the compaction thread at the same time. In other words, for a data object, the operation of swapping in through the Runtime-Object data path and the operation of merging through the compaction thread cannot be performed simultaneously.

[0166] Therefore, the synchronization algorithm designed in this application guarantees the above three invariants, thereby ensuring the accuracy of program operation. The implementation strategies for each invariant are described below by way of example:

[0167] ① The implementation strategies for the above Invariant 1 include, but are not limited to:

[0168] First of all, it should be understood that for the same VR, the data path on the virtual memory space is determined by the value of the set data path flag (Path selector flag, PSF). For example, if the PSF of the virtual memory space is set to 1, the data path on the virtual memory space can be the above-mentioned Runtime-Object data path (i.e., the data path corresponding to the above first data access granularity). If the PSF of the virtual memory space is set to 0, the data path on the virtual memory space can be the above-mentioned OS-Paging data path (i.e., the data path corresponding to the above second data access granularity).

[0169] Therefore, all data accesses on the VR at the same moment will be performed through the same data path. Then, when the PSF is switched (i.e., when the set data path flag is dynamically modified, such as when switching from the OS-Paging data path to the Runtime-Object data path), there may still be unfinished OS-Paging accesses to the data corresponding to the VR. Therefore, if access synchronization is not performed, multiple copies of the data will be generated.

[0170] In view of this, in the distributed memory architecture of the present application, a corresponding first access counter (which can be denoted as in-flight request, i.e., IFR counter) can be maintained for each VR. A VR can have a corresponding first access counter, and each VR can count based on a target value, which can be 1. Specifically, whenever there is an access request for the data corresponding to a VR, the count value of the first access counter corresponding to the VR can be increased by a unit value (such as adding 1), that is, adding 1 for each incoming access request, and whenever an access request for the data corresponding to the VR is completed (i.e., when a data access ends), the count value of the first access counter corresponding to the VR can be decreased by the unit value (i.e., subtracting 1), that is, subtracting 1 for each ended access request.

[0171] Based on the above description, the present application can be designed such that when the count value of the first access counter corresponding to a VR is the target count value (which can be the value 0), the PSF (i.e., data path flag) of the VR is supported (i.e., can) to be switched (i.e., modified); and when the count value of the first access counter corresponding to the VR is not the target count value, the PSF of the VR is not supported (i.e., cannot) to be switched.

[0172] Taking the target virtual memory space as an example, whenever a new access request is added to the data corresponding to the target virtual memory space, the count value of the first access counter corresponding to the target virtual memory space can be incremented by 1 (such as incrementing by 1 for each new access request, incrementing by 2 for two new access requests, and so on), and whenever an access request for the data corresponding to the target virtual memory space ends (such as is completed), the count value of the first access counter corresponding to the target virtual memory space can be decremented by 1 (such as decrementing by 1 for each completed access request, decrementing by 2 for two completed access requests, and so on). Only when the count value of the first access counter corresponding to the target virtual memory space is 0, the data path flag of the target virtual memory space is supported to be switched, and when the count value of the first access counter corresponding to the target virtual memory space is not 0, the data path flag of the target virtual memory space is not supported to be switched.

[0173] Through the above process, it can be ensured that when the data objects corresponding to a virtual memory space are not in an access state, the data path flag of the virtual memory space is supported to be switched (i.e., modified), such as modifying the value of the PSF from 0 to 1, or modifying the value of the PSF from 1 to 0.

[0174] ②Regarding the implementation strategy for the above invariant 2, including but not limited to:

[0175] First of all, it should be noted that when a data object is within the deref scope, the data object can be accessed through the raw pointer of the data object. Therefore, if a data object is swapped in through the Runtime-Object data path and is within the deref scope, the data page where the data object is located cannot be swapped out. If the data page is swapped out, then when it is swapped in again through the Runtime-Object data path, the position of the data object changes, resulting in the invalidation of the raw pointer of the data object within the deref scope.

[0176] In view of this, in the distributed memory architecture of the present application, a corresponding second access counter (which can be denoted as the deref counter) can be maintained for each data page (i.e., page). A data page can have a corresponding second access counter. Whenever a data object (i.e., object) in a data page is accessed and enters the deref scope (i.e., the safe access space), the count value of the second access counter corresponding to the data page can be increased by a unit value (such as adding 1), and when a data object in the data page exits the deref scope, the count value of the second access counter corresponding to the data page can be decreased by the unit value (such as subtracting 1), so that when the kernel performs a swap out of the data page, it can skip the data page whose count value of the corresponding second access counter is not the target count value.

[0177] In other words, when the count value of the second access counter corresponding to a data page is the target count value (such as 0), the data page supports being swapped out. On the contrary, when the count value of the second access counter corresponding to a data page is not the target count value (when it is not 0), the data page does not support being swapped out.

[0178] Taking the target virtual memory space as an example, the target virtual memory space can correspond to multiple data pages, and these multiple data pages are used to store the data (such as data objects) corresponding to the target virtual memory space. Each of the multiple data pages has its own corresponding second access counter.

[0179] Among them, the count value of the second access counter corresponding to any one of the multiple data pages is incremented by 1 whenever the data in the any one data page is accessed and enters the safe access space (that is, whenever there is an access to the data object in the any one data page and it enters the safe access space, it is incremented by 1, incremented by 1 for one access, incremented by 2 for two accesses, and so on), and is decremented by 1 whenever the data access ends and exits the safe access space (that is, whenever the access to the data object in the any one data page ends and exits the safe access space, it is decremented by 1, decremented by 1 for one access end, decremented by 2 for two access ends, and so on).

[0180] Furthermore, when the count value of the second access counter corresponding to the data page is 0, the data page supports being swapped out. Conversely, when the count value of the second access counter corresponding to the data page is not 0, the data page does not support being swapped out.

[0181] Through the above process, it can be ensured that when all data objects in a data page are not within the deref scope, the data page supports being swapped out.

[0182] ③Implementation strategies for the above invariant 3 include, but are not limited to:

[0183] The compaction thread in the distributed memory architecture of this application will move data objects. When moving data objects, it is necessary to skip the data objects that are currently within the deref scope because the compaction thread will change the raw pointer of the merged data objects, and the data object is being accessed through the raw pointer within the deref scope.

[0184] In view of this, in this application, the count values of the second access counters of all data pages corresponding to each VR can be counted to obtain the total count values corresponding to each VR respectively. The total count value of a VR is the sum of the count values of the second access counters corresponding to all data pages on that VR (i.e., all data pages corresponding to that VR).

[0185] When the total count value of a VR is the above target count value (such as 0), the surviving data corresponding to that VR supports (i.e., can) be merged (i.e., perform the compact operation); when the count value in that VR is not the above target count value (such as not 0), the surviving data corresponding to that VR does not support (i.e., cannot) be merged.

[0186] Still taking the target virtual memory space as an example, the target memory server can sum up the count values of the second access counters respectively possessed by each data page corresponding to the target virtual memory space, and can obtain the total count value of the target virtual memory space (which can be called the sum count value of the target virtual memory space).

[0187] When the sum count value is the target count value (such as 0), the data corresponding to the target virtual memory space (such as the corresponding surviving data) supports being merged, and when the sum count value is not the target count value (such as not 0), the data corresponding to the target virtual memory space does not support being merged.

[0188] Here, it is further explained that when a data page contains data objects obtained through merging processing, the PSF value of this data page can be reset to the default value of 0 (that is, set to the initial OS-Paging data path).

[0189] Through the above process, it can be ensured that when the data objects in each data page corresponding to a virtual memory space are not within the deref scope, the live data corresponding to this virtual memory space supports being executed for merging processing.

[0190] Through the three synchronization algorithms provided above, the accuracy of the program (such as the applied program) running can be ensured.

[0191] Furthermore, the implementation of the above process in this application may involve three functions, and these three functions may include the pre_scope_barrier function, the post_scope_barrier function, and the get_psf function. Among them, the pre_scope_barrier function indicates that data access is about to start, and the post_scope_barrier function indicates that data access has ended. Therefore, between the pre_scope_barrier function and the post_scope_barrier function, the above three synchronization algorithms should be maintained, that is, the implementation of the above three synchronization algorithms will be ensured between the pre_scope_barrier function and the post_scope_barrier function, so as to ensure the accuracy of the program running.

[0192] Among them, the get_psf function is used to obtain the data path identifier (that is, the value of PSF) of the virtual memory space (such as the above target virtual memory space) corresponding to the data required by the current data access request. The relevant principle of this get_psf function (that is, the specific principle of how to obtain the data path identifier of the virtual memory space corresponding to the data required by the data access request) can be seen in the following Figure 5 corresponding description in the corresponding embodiment.

[0193] Exemplarily, in a feasible implementation manner, the above N virtual memory spaces can be obtained by partitioning the memory space (which can be understood as the memory address) of the target application, and the above data access request can be sent by the application client of the target application, and this data access request can be used to access the application page of the target application in the application client.

[0194] Therefore, when the target memory server reads the data required by the above data access request from the first physical memory space, it can return the data required by the data access request read (such as a data object) to the application client. The application client can render and display the corresponding application page of the target application through the data returned by the target memory server for relevant users to view. In this case, it can be understood that the data required by the data access request can include the data object for displaying the application page.

[0195] By adopting the above method of the embodiment of the present application, a distributed memory architecture with a hybrid data path design (which can be denoted as Atlas) is provided. It simultaneously supports two data paths, namely the Runtime-Object data path and the OS-Paging data path, and can automatically select a suitable data path for different characteristic data access behaviors of the application, so as to be able to support both irregular memory access (more suitable for the Runtime-Object data path) and regular memory access (more suitable for the OS-Paging data path) well at the same time.

[0196] Moreover, by adopting different data access granularities (the same as adopting data paths with different granularities) for virtual memory spaces with different memory access characteristics, the utilization rate of memory resources can also be improved, problems such as low current memory resource utilization rate can be solved, and the running performance of the application on the memory decoupling architecture can be improved.

[0197] Through the above description, it can be understood that the method provided by the present application can be applied to any scenario that requires dynamically adopting different data access granularities for data access. For example, the different data access granularities can include the granularity of the above data object and the granularity of the data page, or can also include other custom data access granularities, which can be specifically determined according to the actual application scenario.

[0198] In this application, the distributed memory architecture may include multiple memory servers. Among the multiple memory servers, there may be a target memory server that provides data processing resources. The target memory server may have N virtual memory spaces. Each virtual memory space is used to indicate the accessible data corresponding to it. The data corresponding to each virtual memory space is stored in the physical memory space associated with each virtual memory space. The physical memory spaces associated with the N virtual memory spaces are distributed among multiple memory servers. The target memory server may respond to a data access request, obtain the target virtual address of the data required to be accessed by the data access request, and may determine the target virtual memory space corresponding to the data required to be accessed by the data access request from the N virtual memory spaces based on the target virtual address. The target virtual memory space has a data path flag, and the data path flag is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag is used to indicate the data access granularity to be used when accessing the data in the physical memory space associated with the target virtual memory space. If the data required to be accessed by the data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers except the target memory server among the multiple memory servers, the target memory server may also read the data required to be accessed by the data access request from the first physical memory space based on the data access granularity indicated by the data path flag using the target virtual address. Thus, it can be seen that the method proposed in this application can create N virtual memory spaces in the distributed memory architecture. The physical memory spaces associated with each virtual memory space can be distributed among multiple memory servers. Moreover, this application can also set corresponding data path flags for each virtual memory space, and the data path flag is set through the memory access characteristics of the corresponding virtual memory space. Therefore, if the data to be accessed is located in the remote physical memory (such as the first physical memory space that does not belong to the target memory server), the data reading granularity indicated by the data path flag of the target virtual memory space can be used to read the data to be accessed from the remote first physical memory space, so that the data reading granularity used can better conform to the memory access characteristics of the target virtual memory space, thereby improving the performance of data access. In addition, by using the data access granularity indicated by the data path flag dynamically set for the target virtual memory space for data access, the access methods for the data in the physical memory space associated with the target virtual memory space can also be enriched.

[0199] Please refer to Figure 5 , Figure 5It is a schematic flowchart of a method for setting data path flags for a virtual memory space provided by an embodiment of the present application. In the embodiment of the present application, the process of setting data path flags for a target virtual memory space is taken as an example for illustration. It can be understood that the principles of setting data path identifiers for each virtual memory space are independent and the same. As Figure 5 shown, the method may include:

[0200] Step S201, obtain the page prefetch efficiency of the data page corresponding to the target virtual memory space.

[0201] Specifically, the memory access types of applications can generally be divided into two categories. One is regular memory access (Regular), such as sequential (sequential memory access), etc., which can be understood as regular memory access; the other is irregular memory access (Irregular), such as random (random memory access), pointer-chasing (memory access in the way of pointer chasing), etc., which can be understood as irregular memory access.

[0202] Among them, for regular memory access, the performance of using the OS-Paging data path can be better because using the OS-Paging data path can access the entire data page where the data object to be accessed is located. It is very likely that the data page contains data objects that still need to be accessed next. Therefore, the efficiency of data object access can be improved and the latency of data object access can be reduced. For irregular memory access, the performance of using the Runtime-Object data path can be better because under the Runtime-Object data path, only the data object to be accessed currently needs to be accessed, and other data objects (such as other data objects in the data page where the data object to be accessed is located) other than the data object to be accessed currently do not need to be accessed. In this way, the data occupied in the local memory by the accessed data can be reduced, the waste of RDMA bandwidth can be avoided, and thus the overhead of data access can be reduced and the performance of data access can be improved.

[0203] And the present application observes and concludes in experiments that the page prefetch efficiency (Prefetching effectiveness, PE) in the kernel (i.e., the computer operating system kernel) is highly correlated with the memory access type of the application. For regular memory access, the page prefetch efficiency is high, while for irregular memory access, the page prefetch efficiency is low. Therefore, a lightweight online analysis technology for application memory access type is proposed in the distributed memory architecture of the present application, which can judge the current memory access type of the application by observing the page prefetch efficiency in the kernel.

[0204] Therefore, the target memory server can obtain the page prefetch efficiency of the data page corresponding to the target virtual memory space (i.e., the PE of the target virtual memory space), and this process may include:

[0205] The target memory server can count the number of data pages obtained based on page prefetch operations in the data pages corresponding to the target virtual memory space, and this number can be recorded as the first number. The target memory server can also count the number of data pages that have been accessed among the data pages obtained based on page prefetch operations corresponding to the target virtual memory space (i.e., the data pages that have been accessed during the period from when they were obtained based on page prefetch operations until the current time), and this number can be referred to as the second number.

[0206] The target memory server can use the ratio of the second number to the first number as the page prefetch efficiency of the data pages corresponding to the target virtual memory space, which can be simply referred to as the page prefetch efficiency of the target virtual memory space.

[0207] In specific implementation details, exemplarily, in a distributed memory architecture, a prefetch bit can be reserved for each data page (i.e., page) in the kernel. A data page can have a prefetch bit, and this prefetch bit can be used to indicate whether the corresponding data page is retrieved through a page prefetch operation (prefetch operation). The prefetch bit of a data page retrieved through a page prefetch operation can be 1, and the prefetch bit of a data page not retrieved through a page prefetch operation (such as a data page retrieved by triggering a page fault) can be set to 0.

[0208] Furthermore, in a distributed memory architecture, an access bit can also be reserved for each data page in the kernel. A data page can have an access bit, and this access bit can be used to record whether the data page has been accessed during the period from when it is mapped to a page table entry (used to record the mapping relationship between the virtual address and the corresponding physical address of each data page) to the current time, that is, whether the retrieved data page has been accessed during the period from when it is retrieved until the current time. An access bit of 1 indicates that the corresponding retrieved data page has been accessed, and an access bit of 0 indicates that the corresponding retrieved data page has not been accessed.

[0209] Therefore, the target memory server can count the proportion of data pages with a prefetch bit of 1 (i.e., retrieved through a page prefetch operation) and an access bit of 1 (accessed) among all the data pages corresponding to the target virtual memory space (i.e., the ratio of the above-mentioned second number to the first number) as the page prefetch efficiency of the target virtual memory space.

[0210] It can be understood that the higher the PE of the target virtual memory space, the greater the possibility that the memory access type of the target virtual memory space is regular memory access. Conversely, the lower the PE of the target virtual memory space, the greater the possibility that the memory access type of the target virtual memory space is irregular memory access.

[0211] Furthermore, when the present application performs data swapping in, it supports two data channels simultaneously (such as the above-mentioned Runtime-Object data channel and the OS-Paging data channel). The data recovery (i.e., memory recovery) in the present application can be implemented by adopting a page recovery mechanism consistent with the OS-Paging data channel, that is, data swapping out is performed in units of data pages. The advantage of this approach is that it ensures the flexibility of data swapping in through the two data channels, that is, the appropriate data channel can be selected for data swapping in according to the memory access type; and it also ensures the high throughput of data swapping out through the page recovery mechanism. Because in the page recovery mechanism of the OS-Paging data channel, there is no need to maintain access information in units of data objects as in the Runtime-Object data channel, nor to update the metadata such as the address information (such as virtual address) inside the smart pointer of each swapped-out data object one by one when performing data swapping out. Therefore, the efficiency and performance of data swapping out can be greatly improved. Among them, when the space of the local memory is insufficient or the occupancy is relatively large, the target memory server can perform page recovery on the data pages in the local memory, that is, swap out the data pages in the local memory to the remote memory.

[0212] Optionally, the present application can perform PE statistics on the virtual memory space associated with the recycled data pages (such as the virtual memory space associated with the physical memory space to which the data page is recycled) during the page recovery process (i.e., during the process of...). Since the above-mentioned access bit is an original feature of the CPU hardware (the access bit is automatically set during access), it can be understood that the additional overhead introduced when the present application performs PE statistics is very small.

[0213] In other words, in the page reclamation process of the present application, the PSF (data path flag) of the virtual memory space can be updated by using the real-time statistics of the PE. However, it should be understood that in actual application scenarios, other time frequencies can also be adopted to count the PEs of each virtual memory space, and the PEs of each virtual memory space obtained by the statistics can be used to dynamically update the PSFs set for each virtual memory space. For example, a time period can also be set, or certain trigger events can be set to trigger (such as reaching the cycle node of the time period or generating the set trigger event) the real-time statistics and update of the PEs of the virtual memory space, and the PSF of the virtual memory space can be updated according to the PEs obtained by the real-time statistics. The specific update moment or update frequency of the PSF of the virtual memory space can be set according to the actual application scenario, and no limitation is imposed thereon.

[0214] Step S202: Obtain the data access latency of the data corresponding to the target virtual memory space.

[0215] Specifically, the PE of the VR can be used to determine the memory access type of the VR, so that the distributed memory architecture can select an appropriate data path according to the memory access type of the virtual memory space. For example, the distributed memory architecture can initially default to using the OS-Paging data path, and during the execution of the application, it will switch to the Runtime-Object data path for the VR with irregular memory access. However, it is not necessary to immediately switch to the Runtime-Object data path for the VR with irregular memory access at any time. For example, when there are only a small number of remote memory accesses in the data corresponding to the virtual memory space and the amplification of the data introduced by the OS-Paging (such as other data objects read except for the data object to be accessed in the data page where the data object to be accessed is located) does not affect the performance of the application, the current original OS-Paging data path can continue to be used, so as to avoid the additional overhead introduced by the data path switch, such as the overhead of allocating memory for the data object and changing the virtual address of the data object.

[0216] In view of the above description, in addition to using the PE of the virtual memory space, the present application can also count the access latency of the remote memory of the virtual memory space (Remote access latency, RAL). Thus, the PE and RAL counted for the virtual memory space can be combined to determine whether it is necessary to switch the data path of the virtual memory space, that is, to determine whether it is necessary to switch the PSF of the virtual memory space (such as changing the value of the PSF from 0 to 1).

[0217] Among them, if the RAL of the virtual memory space is high, it means that there are a large number of accesses to remote memory for the data corresponding to the virtual memory space, and congestion has occurred. In this case, the data amplification introduced by the OS-Paging data path will waste a large amount of bandwidth and local memory occupied during remote data access, seriously affecting application performance. At this time, it is necessary to set the data path of the VR with low PE to the Runtime-Object data path to reduce problems such as data amplification.

[0218] If the RAL of the virtual memory space is low, it means that the data amplification problem is not serious and will not have a relatively large impact on application performance. At this time, the current original OS-Paging data path can be maintained, and there is no need to switch to the Runtime-Object data path, thereby reducing the overhead introduced by the switching of the data path.

[0219] Exemplarily, the process of statistically calculating the data access latency (i.e., the RAL of the target virtual memory space) for the data corresponding to the target virtual memory space may include: the target memory server can obtain the access latencies corresponding to M data accesses to the data corresponding to the target virtual memory space within the target time period. The M data accesses may include all data accesses to the data corresponding to the target virtual memory space within the target time period, and one data access may correspond to one access latency.

[0220] Furthermore, the target memory server can comprehensively calculate the data access latency for the data corresponding to the target virtual memory space through the access latencies corresponding to the above M data accesses. For example, the average value of the M access latencies corresponding to the M data accesses (which can be called the average access latency) can be used as the data access latency; or, the median of the M access latencies corresponding to the M data accesses (which can be called the median access latency) can also be used as the data access latency; and so on.

[0221] Among them, the statistical frequency of the data access latency of the target virtual memory space and the statistical frequency of the page prefetch efficiency of the target virtual memory space can be the same, or they can also be different, and can specifically be determined according to the actual application scenario. For example, a time period can also be set, or certain trigger events can be set to trigger (such as reaching the cycle node of the time period or the occurrence of the set trigger event) the real-time statistics and update of the RAL of the virtual memory space.

[0222] Optionally, when any one of the page prefetch efficiency and the data access latency of the target virtual memory space is updated, it can trigger the update of the PSF value of the target virtual memory space. Of course, when both are updated simultaneously, it can also trigger the update of the PSF value of the target virtual memory space.

[0223] The page prefetch efficiency and data access latency of the above target virtual memory space can both be memory access characteristics belonging to the target virtual memory space, that is, the memory access characteristics of the data corresponding to the target virtual memory space.

[0224] Step S203: Set a data path flag for the target virtual memory space based on the page prefetch efficiency and data access latency.

[0225] Specifically, the target memory server can set a data path flag (i.e., PSF) that conforms to the current memory access characteristics of the target virtual memory space for the target virtual memory space through the page prefetch efficiency and data access latency statistically obtained for the target virtual memory space above.

[0226] Exemplarily, the target memory server can obtain a reference threshold set for the page prefetch efficiency (which can be called the first reference threshold), and can obtain a reference threshold set for the data access latency (which can be called the second reference threshold). The first reference threshold can be a critical value for evaluating whether the memory access type of the virtual memory space is regular memory access or irregular memory access, and the second reference threshold can be a critical value for evaluating whether the data amplification introduced by the OS-Paging data path will affect the application performance. Both the first reference threshold and the second reference threshold can be set in advance, and the specific values of the first reference threshold and the second reference threshold can be set according to the actual application scenario, and no limitation is imposed thereon.

[0227] Therefore, if the page prefetch efficiency of the target virtual memory space is less than or equal to the first reference threshold, and the data access latency of the target virtual memory space is greater than or equal to the second reference threshold, the target memory server can set a corresponding data path flag for the target virtual memory space based on the above first data access granularity (i.e., set the PSF value of the target virtual memory space to 1). In this case, the data access granularity indicated by the data path flag set for the target virtual memory space is the first data access granularity, that is, the data path adopted at this time can be the Runtime-Object data path corresponding to the first data access granularity.

[0228] If the page prefetch efficiency of the target virtual memory space is greater than the first reference threshold, or the data access latency of the target virtual memory space is less than the second reference threshold, the target memory server can set a corresponding data path flag for the target virtual memory space based on the above second data access granularity (i.e., set the PSF value of the target virtual memory space to 0). In this case, the data access granularity indicated by the data path flag set for the target virtual memory space is the second data access granularity, that is, the data path adopted at this time can be the OS-Paging data path corresponding to the second data access granularity.

[0229] The target memory server can set corresponding data path flags for each virtual memory space according to the same principle as setting the data path flag for the target virtual memory space above. For example, corresponding data path flags can be set for each virtual memory space based on the page prefetch efficiency and data access latency of each virtual memory space respectively.

[0230] Please refer to Figure 6 , Figure 6 which is a schematic diagram of the state transition of the data path flag provided by an embodiment of the present application. As Figure 6 shown, the initial PSF value of the virtual memory space can be defaulted to 0 (i.e., default to the OS-Paging data path). During the program execution, the target memory server can access the collector (which can be denoted as Profiling and can be used to dynamically analyze and collect the memory access characteristics of each virtual memory space online, including PE and RAL). If the virtual memory space has a high RAL and a low PE (such as PE less than or equal to the first reference threshold and RAL greater than or equal to the second reference threshold), then the PSF value of this virtual memory space can be switched from 0 to 1; while if the virtual memory space has a low RAL or a high PE (such as PE greater than the first reference threshold, or RAL less than the second reference threshold), then the PSF value of this virtual memory space can be kept as 0 unchanged.

[0231] Moreover, when the PSF value of the virtual memory space is 0, both data swap-out and data swap-in can adopt the OS-Paging data path. For example, it can adopt page-in (swapping in with data pages as the unit) and page-out (swapping out with data pages as the unit); while when the PSF value of the virtual memory space is 1, data swap-in can adopt the Runtime-Object data path, and data swap-out can adopt the OS-Paging data path (using the OS-Paging data path for data swap-out can improve the efficiency of data swap-out and reduce the overhead of data swap-out). For example, it can adopt page-out (swapping out with data pages as the unit) and object-in (swapping in with data objects as the unit). After the data object is swapped in, the data object will be stored in a new VR, and the PSF value of this new VR can be 0.

[0232] In addition, if the PSF value of the virtual memory space was originally 1, after compacting (merging process) the surviving data corresponding to this virtual memory space, the PSF of this virtual memory space can be switched from 1 to the default 0.

[0233] Through the above process, the data path flags of each virtual memory space can be dynamically and flexibly set based on the page prefetching efficiency and data access latency obtained by statistically analyzing the virtual memory space in real time, so that the data path flags of each virtual memory space conform to the current memory access characteristics of each virtual memory space. Thus, higher-performance access to the data in the physical memory space associated with each virtual memory space can be achieved through the data path flags of each virtual memory space.

[0234] As described above, the embodiment of the present application provides a lightweight method for online analysis of application memory access characteristics. Through this method, the memory access characteristics of each virtual memory space can be analyzed and statistically obtained with a relatively small overhead (corresponding to lightweight). Furthermore, through the memory access characteristics of each virtual memory space obtained by analysis and statistics, the data path flags of each virtual memory space can be quickly set. The data path flag of any virtual memory space can be a flag indicating the Runtime-Object data path (which can be referred to as the first data path and belongs to a small-grained data path), or it can also be a flag indicating the OS-Paging data path (which can be referred to as the second data path and belongs to a large-grained data path). It can be seen that the present application supports both the Runtime-Object data path and the OS-Paging data path. Therefore, the present application also designs a hybrid data path system through the above method. Under this hybrid data path system, flexible and adaptive switching and use of the data path can be achieved.

[0235] The present application not only considers the phased changes (phase-changing) of the memory access characteristics of an application (such as the memory access characteristics of a virtual memory space) in terms of time and can perform dynamic online analysis and update of the memory access characteristics of the application, but also considers the differences between the memory access characteristics of different data structures (such as different virtual memory spaces) of the application in terms of space, and sets corresponding data path flags for each virtual memory space respectively, so that when accessing the data in the physical memory space associated with each virtual memory space, it can adapt to the memory access characteristics of each virtual memory space.

[0236] Please refer to Figure 7 , Figure 7 which is a schematic flowchart of a method for data access with data objects as the granularity provided by the embodiment of the present application. As Figure 7 shown, the method may include:

[0237] Step S301, if the data path flag is used to indicate the first data access granularity, allocate a second physical memory space for the data object required to be accessed by the data access request; the second physical memory space is the physical memory space in the target memory server.

[0238] Specifically, if the data path flag of the target virtual memory space is used to indicate the above-mentioned first data access granularity (i.e., the granularity of data access in units of data objects), the target memory server can pre-allocate (allocate the same application) the corresponding physical memory for the data object required to be accessed by the data access request (i.e., allocate a block of memory), and the physical memory allocated for the data object required to be accessed can be called the second physical memory space. This second physical memory space is the physical memory space in the local memory, that is, this second physical memory space is the physical memory space of the target memory server.

[0239] Step S302: Read the data object required to be accessed by the data access request from the first physical memory space based on the target virtual address.

[0240] Specifically, the target virtual address may include the virtual address of the data page where the data object required to be accessed is located (which can be called the target page virtual address and can be reflected by the byte at a specific byte position in the target virtual address), and may include the offset within the page of the data object required to be accessed by the data access request (which can also be reflected by the byte at a specific byte position in the target virtual address). Among them, this offset within the page can be used to indicate the specific position of the data object required to be accessed by the data access request in the data page where it is located.

[0241] Therefore, the target memory server can extract from the target virtual address the target page virtual address of the data page where the data object required to be accessed by the data access request is located, and the offset within the page of the data object required to be accessed by the data access request in the data page where it is located.

[0242] The target memory server can also obtain a page table entry. This page table entry can be used to maintain the mapping relationship between the virtual addresses of each data page (which can be called page virtual addresses) and the physical addresses of each data page respectively. That is, the page virtual address of a data page can map to the physical address where the data page actually is (which can be called the page physical address). In other words, this page table entry can record the mapping relationship between the page virtual addresses of the data pages corresponding to each virtual memory space and the page physical addresses where the data pages actually are.

[0243] Therefore, the target memory server can obtain from this page table entry the page physical address that has a mapping relationship with the above-mentioned target page virtual address (i.e., the page virtual address of the data page where the data object required to be accessed by the data access request is located), and the obtained page physical address can be called the target page physical address.

[0244] Furthermore, the target memory server can perform an addition operation (i.e., addition) on the target page physical address and the above-mentioned in-page offset (i.e., the in-page offset of the data object to be accessed in the data page where it is located), and then the actual physical address of the data object to be accessed by the data access request can be calculated (which can be referred to as the object physical address). This object physical address belongs to the physical address of the above-mentioned first physical memory space. It can be understood that this object physical address points to the first physical memory space.

[0245] Therefore, the target memory server can directly read the data object to be accessed by the data access request from the first physical memory space through the calculated object physical address.

[0246] Here, it should be supplemented that during the execution of the above-mentioned target transaction, when accessing the data object to which the target virtual address belongs, based on the principle described above, the physical address of the data object to which the target virtual address belongs is restored through the target virtual address (i.e., the above-mentioned object physical address), and the corresponding data object is attempted to be accessed through the calculated object physical address. If the data object is in the local memory, it can be directly accessed. If the data object is in the remote memory, a page fault exception will be triggered, and at this time, the data object needs to be read from the remote memory.

[0247] Step S303: Store the read data object in the allocated second physical memory space, and modify the virtual address of the read data object from the target virtual address to the virtual address pointing to the physical address of the second physical memory space.

[0248] Specifically, the target memory server can store the data object read from the first physical memory space in the allocated second physical memory space, and can modify the virtual address of the read data object from the target virtual address to the virtual address pointing to the physical address of the second physical memory space, that is, modify the virtual address of the read data object to the virtual address pointing to the current physical address, which is to update the virtual address of the read data object based on the physical address where the read data object is currently located in the local memory.

[0249] Please refer to Figure 8 , Figure 8 which is a schematic diagram of a scenario for data access in terms of data objects provided by an embodiment of the present application. As Figure 8 shown, an embodiment of the present application can have 4 modules, including a kernel online analysis module, an application address space module, a smart pointer module for data objects, and a memory decoupling architecture module.

[0250] Among them, the kernel online analysis module may have an online analyzer. The target memory server may use the online analyzer to analyze the memory access characteristics (including PE and RAL) of each virtual memory space, and dynamically set corresponding data path flags (i.e., PSF) for each virtual memory space based on the analyzed memory access characteristics of each virtual memory space.

[0251] The module of the application address space may include N virtual memory spaces (including VR-0 to VR-N) obtained by partitioning the memory space of the application. In the module of the smart pointer of the data object, the object physical address of the data object can be determined through the smart pointer of the data object to be accessed. In the module of the memory decoupling architecture, it may include a local server and a remote server. The local server is the above-mentioned target memory server, and the remote server is other memory servers in the memory decoupling architecture except the target memory server. Each virtual memory space may correspond to its own data object.

[0252] Suppose there can be page1, page2,... stored in the local server here, and page11, page22, page33,... stored in the remote server. If the data object to be accessed is object3 (i.e., data object 3), the virtual memory space corresponding to object3 is VR-N, the PSF value of VR-N is 1 (Runtime-Object data path), and it is determined through the target virtual address of object3 that object3 is stored in page33, then the above-mentioned first data access granularity can be used to read object3 from page33 stored in the remote server to the local memory.

[0253] Through the above process, the process of high-performance reading of the data object to be accessed from the remote memory (such as the above-mentioned first physical memory space) using the first data access granularity applicable to the current memory access characteristics of the virtual memory space is realized.

[0254] Please refer to Figure 9 , Figure 9 which is a schematic flowchart of a method for data access in data page granularity provided by an embodiment of the present application. As Figure 9 shown, the method may include:

[0255] Step S401, if the data path flag is used to indicate the second data access granularity, allocate a third physical memory space for the data page where the data object to be accessed by the data access request is located; the third physical memory space is the physical memory space in the target memory server.

[0256] Specifically, if the data path flag of the target virtual memory space is used to indicate the above-mentioned second data access granularity (i.e., the granularity of data access in units of data pages), the target memory server can pre-allocate (allocate the same) corresponding physical memory for the data page where the data object to be accessed by the data access request is located (i.e., allocate a block of memory), and the physical memory allocated for the data page where the data object to be accessed is located can be called the third physical memory space. This third physical memory space is the physical memory space in the local memory, that is, this third physical memory space is the physical memory space of the target memory server.

[0257] Step S402: Based on the target virtual address, obtain the target page physical address of the data page where the data object to be accessed by the data access request is located; the target page physical address belongs to the physical address in the first physical memory space.

[0258] Specifically, the target memory server can obtain the above-mentioned target page physical address of the data page where the data object to be accessed by the data access request is located through the above-mentioned target virtual address. Among them, the principle of obtaining the target page physical address through the target virtual address can refer to the relevant description in the corresponding embodiment above, which will not be elaborated here. This target page physical address belongs to the physical address in the first physical memory space, and this target page physical address can be used to point to this first physical memory space. In fact, this first physical memory space can be the physical memory space for storing the data page where the data object to be accessed is located. Figure 7

[0259]

[0259] Step S403: Based on the target page physical address, adopt the second data access granularity to read the data page where the data object to be accessed by the data access request is located from the first physical memory space.

[0260] Specifically, the target memory server can adopt the second data access granularity through the obtained target page physical address to read (i.e., swap in) the entire data page where the data object to be accessed by the data access request is located from the first physical memory space.

[0261] Step S404: Store the read data page in the allocated third physical memory space, and modify the page physical address of the read data page from the target page physical address to the physical address of the third physical memory space.

[0262] Specifically, the target memory server can store the data page read from the first physical memory space in the allocated third physical memory space, and can modify the page physical address of the read data page from the above-mentioned target page physical address to the physical address of the third physical memory space where the data page is currently located.

[0263] In addition, after storing the read data page in the third physical memory space, the target memory server can also write (i.e., record) the page physical address (i.e., the target page physical address) where the read data page originally resided in the first physical memory space into the metadata of the read data page.

[0264] Step S405: Obtain the data object required to be accessed by the data access request from the read data page stored in the third physical memory space.

[0265] Specifically, after storing the above-mentioned read data page in the allocated third physical memory space, the target memory server can obtain the data object required to be accessed by the data access request from the read data page stored in the third physical memory space.

[0266] Moreover, after the access to the data object required to be accessed by the data access request in the above-mentioned read data page is completed (i.e., the access ends), when the space of the local memory is insufficient, the target memory server can also trigger page recycling for the read data page.

[0267] If page recycling is triggered for the read data page, the target memory server can also obtain the above-mentioned target page physical address where the read data page originally resided in the first physical memory space from the metadata of the read data page.

[0268] Thus, the target memory server can rewrite (i.e., swap out) the read data page from the third physical memory space back to the first physical memory space through the obtained target page physical address, and can rewrite the physical address of the read data page from the physical address in the third physical memory space back to the target page physical address, thereby realizing the recycling process of the read data page.

[0269] Please refer to Figure 10 , Figure 10 which is a schematic diagram of a scenario for data access at the data page granularity provided by an embodiment of the present application. Similarly, as Figure 10 shown, an embodiment of the present application can have the above-mentioned 4 modules, including a kernel online analysis module, a module for the application address space, a module for the smart pointer of the data object, and a module for the memory decoupling architecture.

[0270] It is also assumed here that page1, page2, … can be stored in the local server, and page11, page22, page33, … can be stored in the remote server. If the data object to be accessed is object1 (i.e., data object 1), object1 and object2 are in the same data page, the virtual memory space corresponding to object1 is VR-0, the PSF value of VR-0 is 0 (OS-Paging data path), and it is determined from the target virtual address of object1 that object1 is stored in page22, then the above-mentioned second data access granularity can be adopted to read the entire page22 where object1 is located from the remote server into the local memory. At this time, the data objects read from the remote server include not only the object1 to be accessed, but also object2 that is stored in the same data page (i.e., page22) as object1.

[0271] Through the above process, the process of reading the data page where the data object to be accessed is located from the remote memory (such as the above-mentioned first physical memory space) with the second data access granularity suitable for the current memory access characteristics of the virtual memory space is realized.

[0272] In summary, in the memory decoupling architecture of the present application, for applications with dynamically changing memory access characteristics, or applications with multiple data structures having different memory access characteristics, Atlas can automatically select appropriate data paths for data structures with different access characteristics, so as to achieve: for irregular memory access behaviors, data amplification can be reduced, and the waste of local memory space by useless data can be reduced; for regular memory access behaviors, the memory access efficiency can be improved, and the additional overhead introduced by the data path can be reduced.

[0273] Please refer to Figure 11 , Figure 11 FIG. is a schematic structural diagram of a data access device for a distributed memory architecture provided by an embodiment of the present application. The distributed memory architecture includes multiple memory servers. The data access device is applied to a target memory server, which is a memory server that provides data processing resources among the multiple memory servers. There are N virtual memory spaces in the target memory server, where N is a positive integer. Each virtual memory space is used to indicate the accessible data corresponding to it, and the data corresponding to each virtual memory space is respectively stored in the physical memory space associated with each virtual memory space. The physical memory spaces associated with the N virtual memory spaces are distributed among multiple memory servers. As Figure 11 shown, the data access device 110 for the distributed memory architecture may include: an acquisition module 1101, a determination module 1102, and an access module 1103.

[0274] An acquisition module 1101, configured to acquire a target virtual address of data required for a data access request in response to the data access request;

[0275] A determination module 1102, configured to determine a target virtual memory space corresponding to the data required for the data access request from N virtual memory spaces based on the target virtual address; the target virtual memory space has a data path flag, and the data path flag is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space, and the data path flag is used to indicate the data access granularity required when accessing the data in the physical memory space associated with the target virtual memory space;

[0276] An access module 1103, configured to, if the data required for the data access request is located in a first physical memory space associated with the target virtual memory space, and the first physical memory space is a physical memory space of other memory servers except the target memory server among multiple memory servers, read the data required for the data access request from the first physical memory space based on the data access granularity indicated by the data path flag according to the target virtual address.

[0277] Optionally, the data corresponding to the target virtual memory space exists in a data page corresponding to the target virtual memory space based on a paging mechanism; the above data access device 110 is further configured to:

[0278] Acquire the page prefetch efficiency for the data page corresponding to the target virtual memory space;

[0279] Acquire the data memory access latency for the data corresponding to the target virtual memory space;

[0280] Set a data path flag for the target virtual memory space based on the page prefetch efficiency and the data memory access latency;

[0281] Wherein, both the page prefetch efficiency and the data memory access latency belong to the memory access characteristics of the target virtual memory space.

[0282] Optionally, the manner in which the above data access device 110 acquires the page prefetch efficiency for the data page corresponding to the target virtual memory space includes:

[0283] Count a first quantity of data pages obtained based on page prefetch operations in the data page corresponding to the target virtual memory space;

[0284] Count a second quantity of data pages that have been accessed among the data pages obtained based on page prefetch operations corresponding to the target virtual memory space;

[0285] Determine the quantity ratio between the second quantity and the first quantity as the page prefetch efficiency.

[0286] Optionally, the above data access device 110 obtains the data access latency for the data corresponding to the target virtual memory space in the following manner:

[0287] Obtain the access latencies respectively corresponding to M data accesses to the data corresponding to the target virtual memory space within the target time period; M is a positive integer, and the target time period is an adjacent time period before the current time;

[0288] Based on the access latencies respectively corresponding to the M data accesses, calculate the data access latency for the data corresponding to the target virtual memory space;

[0289] Wherein, the data access latency is any one of the following: the average access latency of the M access latencies corresponding to the M data accesses, the median access latency among the M access latencies corresponding to the M data accesses.

[0290] Optionally, the above data access device 110 sets the data path flag for the target virtual memory space based on the page prefetch efficiency and the data access latency in the following manner:

[0291] Obtain the first reference threshold set for the page prefetch efficiency and the second reference threshold set for the data access latency;

[0292] If the page prefetch efficiency is less than or equal to the first reference threshold and the data access latency is greater than or equal to the second reference threshold, then set the data path flag for the target virtual memory space based on the first data access granularity;

[0293] If the page prefetch efficiency is greater than the first reference threshold or the data access latency is less than the second reference threshold, then set the data path flag for the target virtual memory space based on the second data access granularity;

[0294] Wherein, the first data access granularity is less than the second data access granularity.

[0295] Optionally, the data access granularity indicated by the data path flag is any one of the following: the first data access granularity, the second data access granularity; the first data access granularity is less than the second data access granularity;

[0296] Wherein, the first data access granularity is the granularity of data access in units of data objects, the second data access granularity is the granularity of data access in units of data pages, one data page may contain one or more data objects, and the data corresponding to each virtual memory space includes the data pages corresponding to each virtual memory space.

[0297] Optionally, the access module 1103 reads the data required for the data access request from the first physical memory space using the data access granularity indicated by the data path flag based on the target virtual address in the following manner:

[0298] If the data path flag is used to indicate the first data access granularity, allocate a second physical memory space for the data object to be accessed by the data access request; the second physical memory space is the physical memory space in the target memory server;

[0299] Read the data object to be accessed by the data access request from the first physical memory space based on the target virtual address;

[0300] Store the read data object in the allocated second physical memory space, and modify the virtual address of the read data object from the target virtual address to the virtual address pointing to the physical address of the second physical memory space.

[0301] Optionally, the way for the access module 1103 to read the data object to be accessed by the data access request from the first physical memory space based on the target virtual address includes:

[0302] Extract the target page virtual address of the data page where the data object to be accessed by the data access request is located and the page offset of the data object to be accessed by the data access request in the data page from the target virtual address; the page offset is used to indicate the position of the data object to be accessed by the data access request in the data page;

[0303] Obtain the page table entry; the page table entry contains the mapping relationship between the page virtual address of each virtual memory space and the physical address of the page where it is located;

[0304] Obtain the target page physical address that has a mapping relationship with the target page virtual address from the page table entry;

[0305] Perform an addition process on the target page physical address and the page offset to obtain the object physical address of the data object to be accessed by the data access request; the object physical address belongs to the physical address in the first physical memory space;

[0306] Read the data object to be accessed by the data access request from the first physical memory space based on the object physical address.

[0307] Optionally, the way for the access module 1103 to read the data to be accessed by the data access request from the first physical memory space using the data access granularity indicated by the data path flag based on the target virtual address includes:

[0308] If the data path flag is used to indicate the second data access granularity, allocate a third physical memory space for the data page where the data object to be accessed by the data access request is located; the third physical memory space is the physical memory space in the target memory server;

[0309] Based on the target virtual address, obtain the target page physical address of the data page where the data object required by the data access request is located; the target page physical address belongs to the physical addresses in the first physical memory space;

[0310] Based on the target page physical address, read the data page where the data object required by the data access request is located from the first physical memory space using the second data access granularity;

[0311] Store the read data page in the allocated third physical memory space, and modify the page physical address of the read data page from the target page physical address to the physical address of the third physical memory space;

[0312] Obtain the data object required by the data access request from the read data page stored in the third physical memory space.

[0313] Optionally, after the data page where the data object required by the data access request is located is read and stored in the third physical memory space, the target page physical address is written into the metadata of the read data page; the above data access device 110 is further configured to:

[0314] If the read data page is triggered for page reclamation, obtain the target page physical address of the read data page in the first physical memory space from the metadata;

[0315] Based on the obtained target page physical address, rewrite the read data page from the third physical memory space back to the first physical memory space, and rewrite the physical address of the read data page from the physical address of the third physical memory space back to the target page physical address.

[0316] Optionally, the above data access device 110 is further configured to:

[0317] Obtain the data volume of the surviving data corresponding to the target virtual memory space and the maximum data volume of the data corresponding to the target virtual memory space; the surviving data refers to the data in the data corresponding to the target virtual memory space that is not occupied;

[0318] Calculate the data volume ratio between the data volume of the surviving data and the maximum data volume;

[0319] If the data volume ratio is less than or equal to the ratio threshold, perform a merge process on the surviving data corresponding to the target virtual memory space.

[0320] Optionally, the target virtual memory space has a corresponding first access counter, and the count value of the first access counter increases by a unit value when the data corresponding to the target virtual memory space is accessed, and decreases by a unit value when the data access ends;

[0321] Among them, when the counting value of the first access counter is the target counting value, the data path flag of the target virtual memory space supports being switched; and when the counting value of the first access counter is not the target counting value, the data path flag of the target virtual memory space does not support being switched.

[0322] Optionally, the target virtual memory space corresponds to multiple data pages, and the multiple data pages are used to store the data corresponding to the target virtual memory space. Each of the multiple data pages has its own corresponding second access counter; when the data in any one of the multiple data pages is accessed and enters the secure access space, the counting value of the second access counter corresponding to any one of the multiple data pages increases by a unit value, and when the data access ends and exits the secure access space, the counting value decreases by a unit value;

[0323] Among them, when the counting value of the second access counter corresponding to any one of the data pages is the target counting value, any one of the data pages supports being swapped out; and when the counting value of the second access counter corresponding to any one of the data pages is not the target counting value, any one of the data pages does not support being swapped out.

[0324] Optionally, the above data access device 110 is further configured to:

[0325] Sum up the counting values of the second access counters respectively owned by the respective data pages corresponding to the target virtual memory space to obtain a sum counting value;

[0326] Among them, when the sum counting value is the target counting value, the data corresponding to the target virtual memory space supports being merged; and when the sum counting value is not the target counting value, the data corresponding to the target virtual memory space does not support being merged.

[0327] Optionally, the above data access device 110 is further configured to:

[0328] Initiate a target transaction to be executed based on the target virtual address; the target transaction is used to access the data to which the target virtual address belongs;

[0329] If the target transaction is successfully executed, determine that the data to which the target virtual address belongs is located in the physical memory space of the target memory server;

[0330] If the target transaction fails, determine that the data to which the target virtual address belongs is located in the physical memory space of other memory servers other than the target memory server among the multiple memory servers.

[0331] Optionally, the N virtual memory spaces are obtained by partitioning the memory space of the target application, and the data access request is sent by the application client of the target application. The data access request is used to access the application page of the target application in the application client;

[0332] The above data access device 110 is further configured to:

[0333] Return the data required by the data access request read from the first physical memory space to the application client;

[0334] Wherein, the application client is configured to render and display the application page of the target application based on the data returned by the target memory server.

[0335] According to an embodiment of the present application, Figure 3 The steps involved in the data access method of the distributed memory architecture shown can be performed by Figure 11 Each module in the data access device 110 of the distributed memory architecture shown. For example, Figure 3 The step S101 shown in can be performed by Figure 11 The obtaining module 1101 in, Figure 3 The step S102 shown in can be performed by Figure 11 The determining module 1102 in; Figure 3 The step S103 shown in can be performed by Figure 11 The access module 1103 in.

[0336] In this application, a distributed memory architecture may include multiple memory servers. Among the multiple memory servers, there may be a target memory server that provides data processing resources. The target memory server may have N virtual memory spaces, and each virtual memory space is used to indicate the accessible data corresponding thereto. The data corresponding to each virtual memory space is respectively stored in the physical memory space associated with each virtual memory space. The physical memory spaces associated with the N virtual memory spaces are distributed among multiple memory servers; the target memory server may, in response to a data access request, obtain the target virtual address of the data required to be accessed by the data access request; and may, based on the target virtual address, determine the target virtual memory space corresponding to the data required to be accessed by the data access request from the N virtual memory spaces; the target virtual memory space has a data path flag, and the data path flag is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag is used to indicate the data access granularity to be adopted when accessing the data in the physical memory space associated with the target virtual memory space; if the data required to be accessed by the data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers other than the target memory server among the multiple memory servers, the target memory server may also read the data required to be accessed by the data access request from the first physical memory space based on the data access granularity indicated by the data path flag using the target virtual address. Thus, it can be seen that the device proposed in this application can create N virtual memory spaces in a distributed memory architecture, and the physical memory spaces associated with each virtual memory space can be distributed among multiple memory servers. Moreover, this application can also set corresponding data path flags for each virtual memory space, and the data path flag is set through the memory access characteristics of the corresponding virtual memory space. Therefore, if the data to be accessed is located in a remote physical memory (such as the first physical memory space that does not belong to the target memory server), the data reading granularity indicated by the data path flag of the target virtual memory space can be adopted to read the data to be accessed from the remote first physical memory space, so that the data reading granularity adopted can more conform to the memory access characteristics of the target virtual memory space, thereby improving the performance of data access; in addition, by adopting the data access granularity indicated by the data path flag dynamically set for the target virtual memory space for data access, the access method for the data in the physical memory space associated with the target virtual memory space can also be enriched.

[0337] According to an embodiment of the present application, Figure 11Each module in the data access device 110 of the distributed memory architecture shown can be separately or entirely combined into one or several units to form, or a certain one (or some) of the units can be further split into multiple smaller sub-units in terms of function, and the same operations can be achieved without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In practical applications, the function of one module can also be realized by multiple units, or the functions of multiple modules can be realized by one unit. In other embodiments of the present application, the data access device 1 of the distributed memory architecture can also include other units. In practical applications, these functions can also be assisted by other units and can be realized through the cooperation of multiple units.

[0338] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially realized by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to realize one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.

[0339] According to an embodiment of the present application, a computer program capable of executing the respective steps involved in the corresponding methods shown in the embodiments of the present application can be run on a general-purpose computer device (which can include processing elements and storage elements such as a central processing unit (CPU), a random access storage medium (RAM), and a read-only storage medium (ROM)) to construct a data access device 110 of the distributed memory architecture as shown in Figure 11 The above computer program can be recorded on a computer-readable recording medium, and can be loaded into the above computer device through the computer-readable recording medium and run therein.

[0340] Please refer to Figure 12 , Figure 12 which is a schematic structural diagram of a computer device provided by an embodiment of the present application. As shown in Figure 12As shown in the figure, the computer device 1000 may include: a processor 1001, a network interface 1004, and a memory 1005. In addition, in some embodiments, the computer device 1000 may further include: a user interface 1003 and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display) and a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. Optionally, the memory 1005 may further be at least one storage device located far from the aforementioned processor 1001. As Figure 12 shown, the memory 1005, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.

[0341] In Figure 12 the computer device 1000 shown in the figure, the network interface 1004 can provide network communication functions; while the user interface 1003 is mainly used to provide an input interface for users; the distributed memory architecture includes multiple memory servers. The computer device 1000 is applied to a target memory server, which is a memory server that provides data processing resources among multiple memory servers. There are N virtual memory spaces in the target memory server, where N is a positive integer. Each virtual memory space is used to indicate the accessible data corresponding to it. The data corresponding to each virtual memory space is stored in the physical memory space associated with each virtual memory space respectively. The physical memory spaces associated with the N virtual memory spaces are distributed among multiple memory servers. Therefore, the processor 1001 can be used to call the device control application program stored in the memory 1005 to implement:

[0342] In response to a data access request, obtain the target virtual address of the data required by the data access request;

[0343] Based on the target virtual address, determine the target virtual memory space corresponding to the data required by the data access request from the N virtual memory spaces; the target virtual memory space has a data path flag, and the data path flag is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag is used to indicate the data access granularity required when accessing the data in the physical memory space associated with the target virtual memory space;

[0344] If the data required to be accessed by a data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers except the target memory server among multiple memory servers, then the data required to be accessed by the data access request is read from the first physical memory space based on the data access granularity indicated by the data path flag using the target virtual address.

[0345] It should be understood that the computer device 1000 described in the embodiments of the present application can execute the description of the data access method for the above distributed memory architecture in various embodiments of the present application, and can also execute the description of the data access device 110 for the above distributed memory architecture in the corresponding embodiments described above, which will not be elaborated here. In addition, the description of the beneficial effects of adopting the same method will not be elaborated either. Figure 11 The description of the beneficial effects of adopting the same method will not be elaborated either.

[0346] In addition, it should be pointed out here that: the present application also provides a computer-readable storage medium, and a computer program is stored in the computer-readable storage medium. When the processor executes the computer program, it can execute the description of the data access method for the distributed memory architecture in various embodiments of the present application. Therefore, it will not be elaborated here. In addition, the description of the beneficial effects of adopting the same method will not be elaborated either. For the technical details not disclosed in the embodiments of the computer storage medium involved in the present application, please refer to the description of the method embodiments of the present application.

[0347] As an example, the above computer program can be deployed to be executed on a computer device, or deployed to be executed on multiple computer devices located at one place. Or, it can be executed on multiple computer devices distributed at multiple places and interconnected through a communication network. The multiple computer devices distributed at multiple places and interconnected through a communication network can form a blockchain network.

[0348] The above computer-readable storage medium can be an internal storage unit of the above computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Further, the computer-readable storage medium can also include both the internal storage unit and the external storage device of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store the data that has been output or will be output.

[0349] The present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the description of the data access method for the above-mentioned distributed memory architecture in the embodiments of the present application. Therefore, it will not be elaborated here. In addition, the description of the beneficial effects of using the same method will not be elaborated either. For the technical details not disclosed in the embodiments of the computer-readable storage medium involved in the present application, please refer to the description of the method embodiments of the present application.

[0350] In the description of the embodiments of the present application, the terms "first", "second", etc. in the specification, claims and drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or equipment that includes a series of steps or units is not limited to the listed steps or modules, but may optionally further include steps or modules not listed, or may optionally further include other step units inherent to these processes, methods, devices, products or equipment.

[0351] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0352] The foregoing disclosure is only for the preferred embodiments of the present application, and of course cannot be used to limit the scope of the rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data access method for a distributed memory architecture, characterized in that The distributed memory architecture includes multiple memory servers. The method is applied to a target memory server, which is a memory server that provides data processing resources among the multiple memory servers. There are N virtual memory spaces in the target memory server, where N is a positive integer. Each virtual memory space is used to indicate the accessible data corresponding to it. The data corresponding to each virtual memory space is stored in the physical memory space associated with each virtual memory space. The physical memory spaces associated with the N virtual memory spaces are distributed among the multiple memory servers. The method includes: In response to a data access request, obtain the target virtual address of the data required to be accessed by the data access request. Based on the target virtual address, determine the target virtual memory space corresponding to the data required to be accessed by the data access request from the N virtual memory spaces. The target virtual memory space has a data path flag, which is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag is used to indicate the data access granularity required when accessing the data in the physical memory space associated with the target virtual memory space. If the data required to be accessed by the data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers except the target memory server among the multiple memory servers, then read the data required to be accessed by the data access request from the first physical memory space using the data access granularity indicated by the data path flag based on the target virtual address.

2. The method according to claim 1, wherein The data corresponding to the target virtual memory space exists in the data page corresponding to the target virtual memory space based on a paging mechanism. The method further includes: Obtain the page prefetch efficiency for the data page corresponding to the target virtual memory space. Obtain the data memory access latency for the data corresponding to the target virtual memory space. Based on the page prefetch efficiency and the data memory access latency, set the data path flag for the target virtual memory space. Wherein, both the page prefetch efficiency and the data memory access latency belong to the memory access characteristics of the target virtual memory space.

3. The method according to claim 2, wherein The obtaining of the page prefetch efficiency for the data page corresponding to the target virtual memory space includes: Count the first quantity of data pages obtained based on page prefetch operations in the data page corresponding to the target virtual memory space. Count the second quantity of data pages that have been accessed among the data pages corresponding to the target virtual memory space and obtained based on the page prefetch operations. Determine the ratio of the second quantity to the first quantity as the page prefetch efficiency.

4. The method according to claim 2, characterized in that The obtaining of the data memory access latency for the data corresponding to the target virtual memory space includes: Obtain the access latencies respectively corresponding to M data accesses to the data corresponding to the target virtual memory space within a target time period. M is a positive integer, and the target time period is an adjacent time period before the current time. Calculate the data access latency for the data corresponding to the target virtual memory space based on the access latencies respectively corresponding to the M data accesses; Wherein, the data access latency is any one of the following: the average access latency of the M access latencies corresponding to the M data accesses, the median access latency among the M access latencies corresponding to the M data accesses.

5. The method according to claim 2, wherein Setting the data path flag for the target virtual memory space based on the page prefetch efficiency and the data access latency includes: Obtain a first reference threshold set for the page prefetch efficiency and a second reference threshold set for the data access latency; If the page prefetch efficiency is less than or equal to the first reference threshold and the data access latency is greater than or equal to the second reference threshold, set the data path flag for the target virtual memory space based on a first data access granularity; If the page prefetch efficiency is greater than the first reference threshold or the data access latency is less than the second reference threshold, set the data path flag for the target virtual memory space based on a second data access granularity; Wherein, the first data access granularity is less than the second data access granularity.

6. The method according to claim 1, characterized in that The data access granularity indicated by the data path flag is any one of the following: the first data access granularity, the second data access granularity; the first data access granularity is less than the second data access granularity; Wherein, the first data access granularity is the granularity of data access in units of data objects, the second data access granularity is the granularity of data access in units of data pages, one data page may contain one or more data objects, and the data corresponding to each virtual memory space includes the data pages corresponding to each virtual memory space.

7. The method according to claim 6, wherein Reading the data required to be accessed by the data access request from the first physical memory space based on the data access granularity indicated by the data path flag using the target virtual address includes: If the data path flag is used to indicate the first data access granularity, allocate a second physical memory space for the data object required to be accessed by the data access request; the second physical memory space is the physical memory space in the target memory server; Based on the target virtual address, read the data object required to be accessed by the data access request from the first physical memory space; Store the read data object in the allocated second physical memory space, and modify the virtual address of the read data object from the target virtual address to a virtual address pointing to the physical address of the second physical memory space.

8. The method according to claim 7, wherein Reading the data object required to be accessed by the data access request from the first physical memory space based on the target virtual address includes: Extract from the target virtual address the target page virtual address of the data page where the data object required to be accessed by the data access request is located, and the in-page offset of the data object required to be accessed by the data access request in the data page where it is located; the in-page offset is used to indicate the position of the data object required to be accessed by the data access request in the data page where it is located; Obtain a page table entry; the page table entry contains the mapping relationship between the page virtual address of the data page corresponding to each virtual memory space and the physical address of the page where it is located; Obtain the target page physical address having a mapping relationship with the target page virtual address from the page table entry; Perform an addition process on the target page physical address and the in-page offset to obtain the object physical address of the data object required to be accessed by the data access request; the object physical address belongs to the physical address in the first physical memory space; Read the data object required to be accessed by the data access request from the first physical memory space based on the object physical address.

9. The method according to claim 6, wherein The reading of the data required to be accessed by the data access request from the first physical memory space based on the target virtual address using the data access granularity indicated by the data path flag includes: If the data path flag is used to indicate the second data access granularity, allocate a third physical memory space for the data page where the data object required to be accessed by the data access request is located; the third physical memory space is the physical memory space in the target memory server; Based on the target virtual address, obtain the target page physical address of the data page where the data object required to be accessed by the data access request is located; the target page physical address belongs to the physical address in the first physical memory space; Read the data page where the data object required to be accessed by the data access request is located from the first physical memory space using the second data access granularity based on the target page physical address; Store the read data page into the allocated third physical memory space, and modify the page physical address of the read data page from the target page physical address to the physical address of the third physical memory space; Obtain the data object required to be accessed by the data access request from the read data page stored in the third physical memory space.

10. The method according to claim 9, characterized in that, After the data page where the data object required to be accessed by the data access request is read and stored in the third physical memory space, the target page physical address is written into the metadata of the read data page; The method further includes: If the read data page is triggered for page recycling, obtain the target page physical address of the read data page in the first physical memory space from the metadata; Based on the obtained target page physical address, rewrite the read data page from the third physical memory space back to the first physical memory space, and rewrite the physical address of the read data page from the physical address of the third physical memory space back to the target page physical address.

11. The method according to claim 1, wherein The method further includes: Obtain the data volume of the surviving data corresponding to the target virtual memory space and the maximum data volume of the data corresponding to the target virtual memory space; the surviving data refers to the data in the data corresponding to the target virtual memory space that is not occupied; Calculate the data volume ratio between the data volume of the surviving data and the maximum data volume; If the data volume ratio is less than or equal to the ratio threshold, the surviving data corresponding to the target virtual memory space is merged.

12. The method according to claim 1, wherein, The target virtual memory space has a corresponding first access counter. The count value of the first access counter increases by a unit value when the data corresponding to the target virtual memory space is accessed, and decreases by the unit value when the data access ends. Among them, when the count value of the first access counter is the target count value, the data path flag of the target virtual memory space supports being switched; and when the count value of the first access counter is not the target count value, the data path flag of the target virtual memory space does not support being switched.

13. The method according to claim 1, characterized in that, The target virtual memory space corresponds to multiple data pages, and the multiple data pages are used to store the data corresponding to the target virtual memory space. Each of the multiple data pages has its own corresponding second access counter; the count value of the second access counter corresponding to any one of the multiple data pages increases by a unit value when the data in the any one of the data pages is accessed and enters the secure access space, and decreases by the unit value when the data access ends and exits the secure access space. Among them, when the count value of the second access counter corresponding to any one of the data pages is the target count value, the any one of the data pages supports being swapped out; and when the count value of the second access counter corresponding to any one of the data pages is not the target count value, the any one of the data pages does not support being swapped out.

14. The method according to claim 13, wherein The method further includes: Performing a summation process on the count values of the second access counters respectively possessed by the respective data pages corresponding to the target virtual memory space to obtain a summation count value. Among them, when the summation count value is the target count value, the data corresponding to the target virtual memory space supports being merged; and when the summation count value is not the target count value, the data corresponding to the target virtual memory space does not support being merged.

15. The method according to claim 1, wherein The method further includes: Initiating a target transaction to be executed based on the target virtual address; the target transaction is used to access the data to which the target virtual address belongs. If the target transaction is successfully executed, it is determined that the data to which the target virtual address belongs is located in the physical memory space of the target memory server. If the target transaction fails, it is determined that the data to which the target virtual address belongs is located in the physical memory space of other memory servers other than the target memory server among the multiple memory servers.

16. The method according to claim 1, wherein The N virtual memory spaces are obtained by partitioning the memory space of the target application. The data access request is sent by the application client of the target application, and the data access request is used to access the application page of the target application in the application client. The method further includes: Returning the data required to be accessed by the data access request read from the first physical memory space to the application client. Among them, the application client is used to render and display the application page of the target application based on the data returned by the target memory server.

17. A data access device, characterized in that, The distributed memory architecture includes multiple memory servers. The device is applied to the target memory server, which is the memory server that provides data processing resources among the multiple memory servers. There are N virtual memory spaces in the target memory server, where N is a positive integer. Each virtual memory space is used to indicate the accessible data corresponding to it. The data corresponding to each virtual memory space is respectively stored in the physical memory space associated with each virtual memory space. The physical memory spaces associated with the N virtual memory spaces are distributed among the multiple memory servers. The device includes: An acquisition module, configured to acquire the target virtual address of the data required to be accessed by the data access request in response to the data access request. A determination module, configured to determine, based on the target virtual address, the target virtual memory space corresponding to the data required to be accessed by the data access request from the N virtual memory spaces. The target virtual memory space has a data path flag, which is dynamically set for the target virtual memory space based on the memory access characteristics of the target virtual memory space. The data path flag is used to indicate the data access granularity to be adopted when accessing the data in the physical memory space associated with the target virtual memory space. An access module, configured to, if the data required to be accessed by the data access request is located in the first physical memory space associated with the target virtual memory space, and the first physical memory space is the physical memory space of other memory servers except the target memory server among the multiple memory servers, read the data required to be accessed by the data access request from the first physical memory space based on the data access granularity indicated by the data path flag according to the target virtual address.

18. A computer program product, characterized in that, It includes a computer program, which when executed by a processor, implements the steps of the method according to any one of claims 1-16.

19. A computer device, characterized in that, It includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute the steps of the method according to any one of claims 1-16.

20. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor to execute the method according to any one of claims 1-16.