Data storage method, apparatus, system, and medium

By differentiating between providing physical memory and SCM memory within the physical server, virtual servers can make rational use of memory resources, solving the problem of virtual servers being unable to distinguish memory types and improving the utilization efficiency of memory resources.

CN113918283BActive Publication Date: 2026-05-19JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
Filing Date
2021-10-09
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In existing technologies, virtual servers cannot distinguish between regular memory and SCM memory, resulting in the inefficient use of memory resources.

Method used

The physical server provides physical memory and SCM memory to the virtual server through memory chips and virtual block storage devices, respectively. Physical memory is presented as physical memory, and SCM memory is presented as memory swap space. The virtual server distinguishes memory types according to different methods.

Benefits of technology

This enables virtual servers to make reasonable use of memory resources, avoids the problem of virtual servers being unable to determine the data storage type, and improves the utilization efficiency of memory resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113918283B_ABST
    Figure CN113918283B_ABST
Patent Text Reader

Abstract

The application provides a data storage method, device, system and medium. In the method, the total amount of stored data in the physical memory is obtained, wherein the physical memory is the memory allocated by a physical server to a virtual server through a memory chip according to a first preset size; when the total amount of stored data is greater than a first preset threshold, target data with a read frequency less than a second preset threshold is determined from the stored data; and the target data is stored in a memory swap space, wherein the memory swap space is obtained by converting a storage-level memory, and the storage-level memory is the memory allocated by the physical server to the virtual server through a virtual block storage device according to a second preset size. Since the physical memory and the memory swap space are presented in different ways in the virtual server, the problem that the virtual server cannot distinguish between ordinary memory and SCM memory can be avoided, thereby achieving the purpose of optimizing memory use of the virtual server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more particularly to a data storage method, apparatus, system, and medium. Background Technology

[0002] With the development of cloud computing technology, cloud computing services are being used more and more. Virtual machines (VMs) are the most common computing resources in cloud computing. The resources of a virtual machine mainly include a central processing unit (CPU) and memory resources. Regarding memory resources, the memory resources on the physical server are provided to virtual servers on an on-demand basis. Memory released by one virtual server can be reallocated by the physical server to other virtual servers. Since physical servers require a large amount of memory, additional memory hardware can be added to the physical server to expand its memory capacity. However, the cost of memory hardware is high, limiting its widespread use.

[0003] In existing technologies, to address the aforementioned issues, a common approach is to expand the physical server's memory capacity using lower-cost Storage Class Memory (SCM). The physical server's regular memory serves as a cache layer for the SCM, storing frequently accessed data, while less frequently accessed content is stored in the SCM. However, in this method, all memory (including regular memory and SCM memory) is dynamically allocated. Furthermore, the physical server cannot fairly allocate memory to virtual servers, and some virtual servers, after receiving memory resources, cannot determine which type of memory resource to store their data on. Consequently, they cannot make efficient use of the allocated memory resources. Therefore, existing technologies suffer from the problem that virtual servers cannot distinguish between regular memory and SCM memory.

[0004] In summary, existing memory allocation schemes suffer from the problem that virtual servers cannot distinguish between regular memory and SCM memory. Summary of the Invention

[0005] This application provides a data storage method, apparatus, system, and medium to address the problem in existing memory allocation schemes where virtual servers cannot distinguish between ordinary memory and SCM memory.

[0006] In a first aspect, embodiments of this application provide a data storage method, the method comprising:

[0007] Obtain the total amount of data stored in physical memory, where physical memory is the memory allocated by the physical server to the virtual server through memory chips according to a first preset size;

[0008] When the total amount of stored data exceeds a preset first threshold, target data with a reading frequency lower than a preset second threshold is identified from the stored data.

[0009] The target data is stored in the memory swap space, which is obtained by converting storage-level memory. The storage-level memory is the memory allocated by the physical server to the virtual server through the virtual block storage device according to a second preset size.

[0010] In one specific implementation, the method further includes:

[0011] In response to deletion operations on stored data and target data, release the storage space of physical memory and memory swap space.

[0012] In one specific implementation, before obtaining the amount of stored data in physical memory, the method further includes:

[0013] After the user obtains the virtual server, the corresponding operating system image is determined;

[0014] The storage-level memory is set up as a memory swap space using the operating system image.

[0015] In one specific implementation, setting up storage-level memory as a memory swap space via an operating system image includes:

[0016] When the operating system image is a user's private operating system image, storage-level memory is set on the virtual block storage device through the private operating system image;

[0017] Virtual block storage devices convert the storage boundary memory into memory swap space.

[0018] In one specific implementation, the virtual server further includes a virtual central processing unit allocated to the physical server according to a third preset size.

[0019] In one specific implementation, after releasing the storage space of physical memory and the storage space of memory swap space, the method further includes:

[0020] Release the processes running in the virtual central processing unit.

[0021] In one specific implementation, after storing the target data in the memory swap space, the method further includes:

[0022] In response to a storage operation on the data to be stored, the data to be stored is stored in physical memory, wherein the total amount of the data to be stored is less than or equal to the total amount of the target data.

[0023] Secondly, embodiments of this application provide a data storage device, including:

[0024] The acquisition module is used to acquire the total amount of data stored in physical memory, wherein physical memory is the memory allocated by the physical server to the virtual server through the memory chip according to a first preset size;

[0025] The first determining module is used to determine target data in the stored data whose reading frequency is less than a preset second threshold when the total amount of stored data is greater than a preset first threshold.

[0026] The first storage module is used to store the target data in the memory swap space, wherein the memory swap space is obtained by converting storage-level memory, and the storage-level memory is the memory allocated by the physical server to the virtual server through the virtual block storage device according to a second preset size.

[0027] In one specific embodiment, the device further includes:

[0028] The first release module is used to release the storage space of physical memory and the storage space of memory swap space in response to the deletion operation of stored data and target data.

[0029] In one specific embodiment, the device further includes:

[0030] The second determining module is used to determine the operating system image corresponding to the virtual server after the user obtains the virtual server.

[0031] The configuration module is used to convert storage-level memory into memory swap space using the operating system image.

[0032] In one specific implementation, the setting module further includes:

[0033] The first setting unit is used to set up storage-level memory on the virtual block storage device through the private operating system image when the operating system image is a user's private operating system image.

[0034] The second configuration unit is used to convert storage-level memory into memory swap space via a virtual block storage device.

[0035] In one specific implementation, the virtual server further includes a virtual central processing unit allocated to the physical server according to a third preset size.

[0036] In one specific embodiment, the device further includes:

[0037] The second release module is used to release the processes running in the virtual central processing unit after releasing the storage space of physical memory and the storage space of memory swap space.

[0038] In one specific embodiment, the device further includes:

[0039] The second storage module is used to store the target data into the memory swap space and, in response to the storage operation of the data to be stored, store the data to be stored into the physical memory, wherein the total amount of the data to be stored is less than or equal to the total amount of the target data.

[0040] Thirdly, embodiments of this application provide a data storage system, including:

[0041] A physical server and at least one virtual server;

[0042] The physical server is used to allocate physical memory to at least one virtual server according to a first preset size through memory chips, and to allocate storage-level memory to at least one virtual server according to a second preset size through virtual block storage devices.

[0043] At least one virtual server is used to execute the data storage method of the first aspect.

[0044] Fourthly, embodiments of this application provide a server, including:

[0045] Processor, memory, communication interface;

[0046] Memory is used to store the processor's executable instructions;

[0047] The processor is configured to execute the data storage method of the first aspect by executing executable instructions.

[0048] Fifthly, embodiments of this application provide a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the data storage method of the first aspect.

[0049] In a sixth aspect, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, is used to implement the data storage method of the first aspect.

[0050] The data storage method, apparatus, system, and medium provided in this application embodiment obtain the total amount of data stored in physical memory, wherein physical memory is memory allocated by the physical server to the virtual server through memory chips according to a first preset size; when the total amount of stored data is greater than a preset first threshold, target data with a read frequency less than a preset second threshold is determined from the stored data; the target data is stored in the memory swap space, wherein the memory swap space is converted from storage-level memory, and storage-level memory is memory allocated by the physical server to the virtual server through virtual block storage devices according to a second preset size. Since physical memory and memory swap space are presented in different ways in the virtual server, the problem of the virtual server being unable to distinguish between ordinary memory and SCM memory can be avoided, thereby achieving the purpose of optimizing memory usage in the virtual server. Attached Figure Description

[0051] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0052] Figure 1 This is a schematic diagram of the data storage system provided in an embodiment of this application;

[0053] Figure 2 This is an application scenario diagram of the data storage method provided in the embodiments of this application;

[0054] Figure 3 This is a flowchart illustrating an embodiment of the data storage method provided in this application.

[0055] Figure 4 This is a schematic diagram of the structure of a data storage device embodiment provided in this application.

[0056] Figure 5 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments made by those skilled in the art under the guidance of these embodiments are within the scope of protection of this application.

[0058] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0059] In existing technologies, virtual servers are the most common computing resources in cloud computing services. Cloud computing platforms use virtualization technology to provide multiple users with several virtual servers of the same or different specifications using physical server resources. The resources of these virtual servers (mainly CPU and memory resources) are provided by the physical server they reside on. While ensuring the resource needs of the virtual servers according to the agreement, the cloud computing platform dynamically allocates resources to the greatest extent possible to fully utilize hardware resources, thereby reducing user costs. Several virtual servers running on a single physical server share the CPU and memory resources of that physical server.

[0060] Regarding memory resources, physical server memory is allocated to virtual servers on demand. Memory released by one virtual server can be reallocated to other virtual servers. When virtual servers do not simultaneously request and release memory, physical server memory can be time-sharing across different virtual servers, thus meeting the memory needs of virtual servers with a smaller total memory allocation. However, the operating system of a virtual server typically does not release unused memory promptly. When a virtual server perceives free memory, it tends to use this memory as a cache for disk files to reduce disk access and accelerate file reading. If more memory needs to be allocated to the application, the operating system will release some memory used for file caching and swap some (deemed infrequently used) memory to swap space. Swap space is typically provided by disk, and its performance is far inferior to that of memory. If large amounts of memory data are frequently swapped to swap space, the performance of the virtual server's operating system will significantly degrade.

[0061] To ensure virtual servers can promptly release memory used for file caching, additional memory hardware can be added to the physical server to expand storage space. However, memory hardware is expensive, accounting for a significant portion of the physical server's cost. Therefore, current technologies typically involve adding SCM (Supply Chain Memory) memory. SCM memory offers a substantial cost reduction compared to regular memory hardware, but its access performance is lower, with access latency approximately three times that of regular memory hardware. Therefore, a hybrid approach can be adopted, using regular memory as a caching layer for SCM, storing frequently accessed data, while less frequently accessed content is stored in SCM.

[0062] However, in the above method, all memory (including ordinary memory and SCM memory) is dynamically allocated. When virtual servers compete for memory access, the physical server cannot control the fair allocation of its high-speed memory. In other words, the physical server cannot perform fair allocation when dynamically allocating memory, causing some virtual servers to fail to compete for memory access bandwidth. Even if some virtual servers are allocated memory resources, because they cannot distinguish between ordinary memory and SCM memory, they cannot determine which type of memory resource to store data on, thus failing to make reasonable use of the acquired memory resources. Therefore, there is a problem that virtual servers cannot distinguish between ordinary memory and SCM memory.

[0063] To address the problems existing in the prior art, this application provides a data storage method in which an object server provides physical memory and storage-class memory (SCM memory) to different virtual servers according to a pre-set size. Physical memory exists in the virtual server as physical memory, while SCM memory exists in the virtual server as swap space. In this way, the physical server can provide corresponding physical memory and SCM memory to different virtual servers. After the virtual server obtains the physical memory and SCM memory, since physical memory and SCM memory are presented in different ways in the virtual server, the virtual server can better distinguish between physical memory and SCM memory. Therefore, when it is determined that the storage pressure in physical memory is high, the data with low access frequency in physical memory is stored in the swap space, thereby achieving better and more rational use of memory resources.

[0064] During the research on schemes for providing memory resources from physical servers to virtual servers, the applicant discovered that if the physical server provides physical memory and SCM memory in different ways when allocating them, so that physical memory and SCM memory are presented differently in the virtual server, this can ensure the rationality of memory resource allocation by the physical server and also ensure that the virtual server can distinguish between physical memory and SCM memory, thus achieving better utilization of memory resources. Based on the above concept, the data storage system and data storage method described in this application were designed. The following section first explains the terms used in this application.

[0065] Physical memory: refers to the memory space obtained through physical memory modules, which is used to store programs and data.

[0066] SCM: Storage Class Memory, refers to storage devices with access speeds close to those of RAM.

[0067] Virtual central processing unit (CPU): In this application, the virtual central processing unit refers to the virtual central processing unit in the virtual server, which is the computing and control core of the virtual server's operating system, performing information processing and program execution.

[0068] Cache: refers to the mapping of file system data in memory. When frequently reading and writing files, it can reduce disk access and speed up access.

[0069] Swap space: Used to save part of the memory content when the available memory in the operating system is insufficient, thereby freeing up some memory space. It is usually carried by a disk (block storage device).

[0070] Virtual Machine (VM): Also known as a virtual machine, it is a flexible way to provide computing resources in cloud computing.

[0071] Figure 1 This is a schematic diagram of the data storage system provided in the embodiments of this application, such as... Figure 1 As shown, the data storage system includes: a physical server 101 and at least one virtual server 102 (in... Figure 1 Only two are shown in the diagram, denoted as 102A and 102B respectively. Physical server 101 allocates physical memory 103 to at least one virtual server 102 via memory chips and according to a first preset size. Figure 1 In the diagram, the physical memory of virtual server 102A is represented by 103A, and the physical memory of virtual server 102B is represented by 103B. SCM memory 104 is allocated to at least one virtual server 102 through a virtual block storage device according to a second preset size. Figure 1 In the above, the SCM memory of the virtual server is presented as a memory swap space (the memory swap space of virtual server 102A is represented by 105A, and the memory swap space of virtual server 102B is represented by 105B). In at least one virtual server 102, physical memory 103A and physical memory 103B are presented as memory entities (ordinary memory). The SCM memory of virtual server 102A and virtual server 102B are both presented as memory swap space.

[0072] The data storage system provided in this application embodiment provides physical memory and SCM memory to different virtual servers according to a pre-set size. Physical memory exists in the virtual server as physical memory, and SCM memory exists in the virtual server as memory swap space. In this way, the physical server can provide corresponding physical memory and SCM memory for different virtual servers. After the virtual server obtains the physical memory and SCM memory, since the physical memory and SCM memory are presented in different ways in the virtual server, the virtual server can better distinguish between physical memory and SCM memory, thereby avoiding the problem that the virtual server cannot distinguish between ordinary memory and SCM memory, and achieving the goal of more rational use of memory resources by the virtual server.

[0073] In a specific implementation, this data storage method can be applied in a specific application scenario. Figure 2 An application scenario diagram of the data storage method provided in the embodiments of this application, such as... Figure 2 As shown, in this scenario, taking the provision of memory resources from a physical server to two virtual servers as an example, the physical server divides its ordinary memory (i.e., physical memory) and SCM memory into two physical memory modules of different sizes, and then provides them to the two virtual servers respectively. When the virtual servers present ordinary memory, it does so as physical memory; when presenting SCM memory, it does so as swap space. When storage pressure occurs in the ordinary memory of the virtual servers, the operating system of the virtual servers identifies data with low access frequency from the existing data in ordinary memory, and then places this data in the swap space converted from SCM memory. This frees up some storage space in ordinary memory to store other data.

[0074] Combination Figure 1 The system structure diagram shown and the scenario described above will be used to illustrate the technical solution of the data storage method provided in this application through several specific embodiments.

[0075] Figure 3 This is a flowchart illustrating an embodiment of the data storage method provided in this application. Figure 3As shown, this data storage method specifically includes the following steps:

[0076] S301: Get the total amount of data stored in physical memory.

[0077] In this step, physical memory refers to the memory allocated by the physical server to the virtual server through memory chips according to a first preset size. This physical memory is represented as a memory entity within the virtual server. When data needs to be stored in the physical memory of the virtual server, the operating system in the virtual server needs to determine the amount of data already stored in the physical memory, obtaining the total amount of data currently stored in the physical memory, in order to determine whether there is any extra space in the physical memory to store other data.

[0078] S302: When the total amount of stored data is greater than a preset first threshold, determine the target data in the stored data whose reading frequency is less than a preset second threshold.

[0079] In this step, a first threshold can be defined for the physical memory storage capacity of the virtual server. This first threshold is used to determine whether the physical memory is under storage pressure. When the virtual server's physical memory is under storage pressure, meaning the total amount of data already stored in the physical memory exceeds the first threshold, further storage will lead to insufficient storage space, preventing data from being stored, or causing performance degradation due to excessive data after storage. Therefore, when the total amount of stored data exceeds the preset first threshold, the virtual server needs to use the operating system to extract infrequently used data from the stored physical memory—that is, target data whose access frequency is less than a preset second threshold. This frees up some storage space in the physical memory for storing other data that needs to be stored.

[0080] S303: Store the target data in the memory swap space.

[0081] In this step, the swap space is obtained by converting storage-class memory. Storage-class memory is the memory allocated to the virtual server by the physical server through a virtual block storage device according to a second preset size. This storage-class memory is presented as swap space within the virtual server. When the virtual server's physical memory experiences storage pressure, the operating system will store target data from physical memory with a read frequency lower than a preset second threshold into the swap space. This allows other data to be stored in physical memory, thus ensuring that the virtual memory can use memory resources more efficiently.

[0082] The data storage method provided in this application involves obtaining the total amount of data stored in physical memory, where physical memory is the memory allocated by the physical server to the virtual server through memory chips according to a first preset size; when the total amount of stored data exceeds a preset first threshold, identifying target data among the stored data whose read frequency is less than a preset second threshold; and storing the target data in a memory swap space, where the memory swap space is converted from storage-level memory (SCM), which is the memory allocated by the physical server to the virtual server through a virtual block storage device according to a second preset size. In this way, the physical server can more rationally allocate ordinary memory and SCM memory to multiple virtual servers, and the virtual servers can also distinguish between physical memory and SCM memory based on their different presentation. This avoids the problem of virtual servers being unable to distinguish between ordinary memory and SCM memory, leading to uncertainty about which type of memory to store data in, thereby achieving the goal of more rationally utilizing memory resources by virtual servers.

[0083] In one specific implementation, the method further includes: releasing the storage space of physical memory and the storage space of memory swap space in response to the deletion operation of stored data and target data.

[0084] In this scheme, when a user wants to release memory space in a virtual server, they can delete the data stored in the virtual server through the data platform. After the virtual server responds to the user's operation of deleting the stored data in physical memory and the target data in the memory swap space, it will release the storage space of physical memory and memory swap space. In this way, when the user needs to purchase other virtual servers in the future, the physical server can allocate the SCM memory corresponding to the released physical memory and memory swap space to other virtual servers, thereby realizing the reasonable reuse of physical server memory resources.

[0085] In one specific implementation, before obtaining the amount of stored data in physical memory, the method further includes: after the user obtains the virtual server, determining the operating system image corresponding to the virtual server; and converting the storage-level memory into memory swap space through the operating system image.

[0086] In this solution, users need to purchase and use virtual servers. Users purchase a specific type of virtual server, which, in addition to regular memory, requires SCM (Storage Class Memory) allocated from the physical server. Different virtual server specifications have preset sizes for both regular memory and SCM memory. This means that when allocating memory to the virtual server, the physical server needs to allocate memory according to these preset sizes for different virtual server specifications. After obtaining the virtual server, the user needs to determine its corresponding operating system image. This operating system image is then used to set up the allocated SCM on the physical server as swap space to store infrequently accessed data from the physical memory.

[0087] In one specific implementation, converting storage-class memory into memory swap space via an operating system image includes: when the operating system image is a user's private operating system image, setting up storage-class memory on a virtual block storage device via the private operating system image; and converting storage-class memory into memory swap space via the virtual block storage device.

[0088] In this solution, after a user obtains a virtual server, the corresponding operating system image can be either compatible with the virtual server or the user's own private operating system image. When the operating system image is compatible with the virtual server, the virtual server can automatically set the SCM memory as a swap space (memory swap partition) directly through the operating system image. When the operating system image is the user's private operating system image, the user needs to configure the storage-level memory on the virtual block storage device that supports storage-level memory on the virtual server through the private operating system image, and then convert the virtual server's storage-level memory into a swap space through the virtual block storage device. This allows the user to use the virtual server using their own operating system image.

[0089] In one specific implementation, the virtual server also includes a virtual central processing unit allocated by the physical server according to a third preset size.

[0090] In this scheme, when a physical server provides several virtual servers of the same or different specifications to multiple users, it needs to provide virtual CPU resources in addition to the memory resources (physical memory and SCM memory) for the virtual servers. Similar to the allocation of memory resources, when allocating virtual CPU resources to virtual servers of different specifications, the physical server needs to determine how much CPU resource to allocate to each virtual server based on its specific specifications. For example, for a small virtual server, the physical server provides it with 1 virtual CPU, 1GB of physical memory, and 1GB of swap space; for a large virtual server, the physical server provides it with 4 virtual CPUs, 4GB of physical memory, and 4GB of swap space.

[0091] In one specific implementation, after releasing the storage space of physical memory and storage-level memory, the method further includes: releasing the processes running in the virtual central processing unit.

[0092] In this scheme, when a user wants to release the memory space in the virtual server, the processes running in the virtual CPU of the virtual server will also be released at the same time. At this time, the virtual CPU resource is an idle resource. In this way, when the user needs to purchase other virtual servers in the future, the physical server can allocate the virtual CPU to other virtual servers for use, thereby realizing the reasonable reuse of the physical server's CPU resources.

[0093] In one specific implementation, after storing the target data in the memory swap space, the method further includes: in response to a storage operation on the data to be stored, storing the data to be stored in physical memory, wherein the total amount of the data to be stored is less than or equal to the total amount of the target data.

[0094] In this scheme, after the virtual server stores the data (target data) that is accessed less frequently in physical memory to the memory swap space through the operating system, a portion of the storage space in physical memory will be freed up. This portion of storage space can be used to store the content that users want to store later. When users want to store data to be stored in physical memory, the corresponding data to be stored can be stored according to the size of the freed storage space.

[0095] The data storage method provided in this application embodiment provides physical memory to the virtual server via memory chips and SCM memory via virtual block storage devices. This allows the physical server to allocate ordinary memory and SCM memory to multiple virtual servers more rationally. Furthermore, in the virtual server, physical memory is presented as physical memory, while SCM memory is presented as swap space. This allows the virtual server to distinguish between physical memory and SCM memory based on their different presentation methods. This avoids the problem of the virtual server being unable to distinguish between ordinary memory and SCM memory, which would lead to the inability to determine which type of memory to store data in, thus achieving the goal of more rational use of memory resources by the virtual server.

[0096] In general, the technical solution provided in this application provides physical memory to the virtual server in the form of memory chips according to a first preset size, and provides SCM memory to the virtual server in the form of virtual block storage devices according to a second preset size. The physical memory in the virtual server is presented as physical memory, and the SCM memory is presented as memory swap space (swap partition space). This is a technical implementation method that can both ensure the rational allocation of memory resources by the physical server and ensure that the virtual server can distinguish between physical memory and virtual memory, thereby achieving better use of memory resources.

[0097] Figure 4 This is a schematic diagram of the structure of a data storage device embodiment provided in this application, as shown below. Figure 4 As shown, the data storage device 40 includes:

[0098] The acquisition module 41 is used to acquire the total amount of data stored in the physical memory, wherein the physical memory is the memory allocated by the physical server to the virtual server through the memory chip according to a first preset size;

[0099] The first determining module 42 is used to determine target data in the stored data whose reading frequency is less than a preset second threshold when the total amount of stored data is greater than a preset first threshold.

[0100] The first storage module 43 is used to store the target data to the memory swap space, wherein the memory swap space is obtained by converting storage-level memory, and the storage-level memory is the memory allocated by the physical server to the virtual server through the virtual block storage device according to the second preset size.

[0101] Optionally, the device may also include:

[0102] The first release module is used to release the storage space of physical memory and the storage space of memory swap space in response to the deletion operation of stored data and target data.

[0103] Optionally, the device may also include:

[0104] The second determining module is used to determine the operating system image corresponding to the virtual server after the user obtains the virtual server.

[0105] The configuration module is used to convert storage-level memory into memory swap space using the operating system image.

[0106] Optionally, the settings module also includes:

[0107] The first setting unit is used to set up storage-level memory on the virtual block storage device through the private operating system image when the operating system image is a user's private operating system image.

[0108] The second configuration unit is used to convert storage-level memory into memory swap space via a virtual block storage device.

[0109] Optionally, the virtual server may also include a virtual central processing unit allocated to the physical server according to a third preset size.

[0110] Optionally, the device may also include:

[0111] The second release module is used to release the processes running in the virtual central processing unit after releasing the storage space of physical memory and the storage space of memory swap space.

[0112] Optionally, the device may also include:

[0113] The second storage module is used to store the target data into the memory swap space and, in response to the storage operation of the data to be stored, store the data to be stored into the physical memory, wherein the total amount of the data to be stored is less than or equal to the total amount of the target data.

[0114] The data storage device provided in this embodiment is used to execute the data storage method in the aforementioned method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.

[0115] This application also provides a data storage system, including: a physical server and at least one virtual server; wherein, the physical server is used to allocate physical memory to at least one virtual server according to a first preset size through a memory chip, and to allocate storage-level memory to at least one virtual server according to a second preset size through a virtual block storage device; at least one virtual server is used to execute the technical solution of the data storage method in the foregoing method embodiments.

[0116] The data storage system provided in this embodiment is used to execute the data storage method in the aforementioned method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.

[0117] Figure 5 This application provides a schematic diagram of the structure of a server, as shown in the embodiment of the present application. Figure 5 As shown, the server 500 includes:

[0118] Processor 511, memory 512, and communication interface 513;

[0119] The memory 512 is used to store the executable instructions of the processor 511;

[0120] The processor 511 is configured to execute the data storage method in the aforementioned method embodiments by executing executable instructions.

[0121] In the aforementioned server, the memory 512 and the processor 511 are electrically connected directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines, such as a bus connection. The memory 512 stores computer-executable instructions that implement data access control methods, including at least one software functional module that can be stored in the memory in the form of software or firmware. The processor 511 executes various functional applications and data processing by running the software programs and modules stored in the memory 512.

[0122] The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), and Electrically Erasable Programmable Read-Only Memory (EEPROM). The memory stores programs, which are then executed by the processor upon receiving execution instructions. Furthermore, the software programs and modules within the memory may include an operating system, which can include various software components and / or drivers for managing system tasks (e.g., memory management, storage device control, power management), and can communicate with various hardware or software components to provide an operating environment for other software components.

[0123] A processor can be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.

[0124] The server is used to execute the data storage method in the aforementioned method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.

[0125] This application also provides a readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, it implements the data storage method in the foregoing method embodiments.

[0126] This application also provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the data storage method in the foregoing method embodiments.

[0127] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A data storage method, characterized in that, Applied to a virtual server, the method includes: Obtain the total amount of data stored in physical memory, wherein the physical memory is the memory allocated by the physical server to the virtual server through memory chips according to a first preset size, and the physical memory is presented in the virtual server as physical memory; When the total amount of stored data is greater than a preset first threshold, target data with a reading frequency less than a preset second threshold is identified from the stored data. The target data is stored in the memory swap space, wherein the memory swap space is obtained by converting storage-level memory, and the storage-level memory is the memory allocated by the physical server to the virtual server through the virtual block storage device according to a second preset size, and the storage-level memory is presented in the virtual server in the form of memory swap space; Before obtaining the total amount of data already stored in physical memory, the method further includes: After the user obtains the virtual server, the operating system image corresponding to the virtual server is determined; The storage-level memory is set up as the memory swap space through the operating system image.

2. The method according to claim 1, characterized in that, The method further includes: In response to the deletion operation of the stored data and the target data, the storage space of the physical memory and the storage space of the memory swap space are released.

3. The method according to claim 1, characterized in that, Setting the storage-level memory as the memory swap space through the operating system image includes: When the operating system image is the user's private operating system image, the storage-level memory is configured on the virtual block storage device through the private operating system image. The storage-level memory is converted into the memory swap space through the virtual block storage device.

4. The method according to any one of claims 1 to 3, characterized in that, The virtual server also includes a virtual central processing unit allocated to the physical server according to a third preset size.

5. The method according to claim 2, characterized in that, After releasing the storage space of the physical memory and the storage space of the memory swap space, the method further includes: Release the processes running in the virtual central processing unit.

6. The method according to claim 1, characterized in that, After storing the target data in the memory swap space, the method further includes: In response to a storage operation on the data to be stored, the data to be stored is stored in the physical memory, wherein the total amount of the data to be stored is less than or equal to the total amount of the target data.

7. A data storage device, characterized in that, include: The acquisition module is used to acquire the total amount of data stored in the physical memory, wherein the physical memory is the memory allocated by the physical server to the virtual server through the memory chip according to a first preset size, and the physical memory is presented in the virtual server as physical memory; The first determining module is used to determine target data in the stored data whose reading frequency is less than a preset second threshold when the total amount of stored data is greater than a preset first threshold. The first storage module is used to store the target data in a memory swap space, wherein the memory swap space is obtained by converting storage-level memory, and the storage-level memory is the memory allocated by the physical server to the virtual server through a virtual block storage device according to a second preset size, and the storage-level memory is presented in the virtual server as a memory swap space; The device further includes: The second determining module is used to determine the operating system image corresponding to the virtual server after the user obtains the virtual server; The configuration module is used to convert the storage-level memory into the memory swap space through the operating system image.

8. The apparatus according to claim 7, characterized in that, The device further includes: The first release module is used to release the storage space of the physical memory and the storage space of the memory swap space in response to the deletion operation of the stored data and the target data.

9. The apparatus according to claim 7, characterized in that, The settings module also includes: The first setting unit is used to set the storage-level memory on the virtual block storage device through the private operating system image when the operating system image is the user's private operating system image. The second setting unit is used to convert the storage-level memory into the memory swap space through the virtual block storage device.

10. The apparatus according to any one of claims 7 to 9, characterized in that, The virtual server also includes a virtual central processing unit allocated to the physical server according to a third preset size.

11. The apparatus according to claim 8, characterized in that, The device further includes: The second release module is used to release the processes running in the virtual central processing unit after releasing the storage space of the physical memory and the storage space of the memory swap space.

12. The apparatus according to claim 8, characterized in that, The device further includes: The second storage module is used to store the target data into the memory swap space after storing the target data into the memory swap space, and in response to the storage operation of the data to be stored, store the data to be stored into the physical memory, wherein the total amount of the data to be stored is less than or equal to the total amount of the target data.

13. A data storage system, characterized in that, include: A physical server and at least one virtual server; The physical server is used to allocate physical memory to the at least one virtual server according to a first preset size through a memory chip, and to allocate storage-level memory to the at least one virtual server according to a second preset size through a virtual block storage device; The at least one virtual server is used to implement the data storage method according to any one of claims 1 to 6.

14. A server, characterized in that, include: Processor, memory, communication interface; The memory is used to store the executable instructions of the processor; The processor is configured to execute the data storage method according to any one of claims 1 to 6 by executing the executable instructions.

15. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data storage method according to any one of claims 1 to 6.

16. A computer program product, characterized in that, It includes a computer program, which, when executed by a processor, is used to implement the data storage method according to any one of claims 1 to 6.