CN113918283A - Data storage method, device, system and medium - Google Patents

Data storage method, device, system and medium Download PDF

Info

Publication number
CN113918283A
CN113918283A CN202111176162.7A CN202111176162A CN113918283A CN 113918283 A CN113918283 A CN 113918283A CN 202111176162 A CN202111176162 A CN 202111176162A CN 113918283 A CN113918283 A CN 113918283A
Authority
CN
China
Prior art keywords
memory
storage
data
physical
virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111176162.7A
Other languages
Chinese (zh)
Inventor
刘俊辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Information Technology Co Ltd
Priority to CN202111176162.7A priority Critical patent/CN113918283A/en
Publication of CN113918283A publication Critical patent/CN113918283A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The application provides a data storage method, a device, a system and a medium, in the method, the total amount of data of stored data in a physical memory is obtained, wherein the physical memory is a memory which is distributed to a virtual server by a physical server through a memory chip according to a first preset size; when the total data amount of the stored data is larger than a preset first threshold, determining target data of which the reading frequency is smaller than a preset second threshold in the stored data; and storing the target data into a memory exchange space, wherein the memory exchange space is obtained by converting a storage-class memory, the storage-class memory is a memory which is allocated to the virtual server by the physical server according to a second preset size through the virtual block storage device, and because the physical memory and the memory exchange space are presented in different modes in the virtual server, the problem that the virtual server cannot distinguish a common memory from an SCM memory can be avoided, so that the purpose of optimizing the use of the memory by the virtual server is achieved.

Description

Data storage method, device, system and medium
Technical Field
The present application relates to the field of computers, and in particular, to a data storage method, apparatus, system, and medium.
Background
With the development of cloud computing technology, cloud computing services are increasingly used, and Virtual Machines (VMs) are the most common computing resources in the cloud computing services. The resources of the virtual server mainly include a Central Processing Unit (CPU) and memory resources. For the memory resources, the memory resources on the physical servers are provided for the virtual servers in an allocation-on-demand manner, and the memory released by one virtual server can be reallocated to other virtual servers by the physical servers. Because the physical server needs a larger memory capacity, in order to expand the memory capacity of the physical server, a memory hardware can be added to the physical server, but the memory hardware has higher cost and cannot be used in large quantities.
In the prior art, in order to solve the above problems, a Storage Class Memory (SCM) with a low cost is usually used to expand the Memory capacity of a physical server, a common Memory in the physical server is used as a cache layer of the SCM to store frequently accessed data, and contents with a relatively low access frequency are stored in the SCM. However, in this method, all memories (including the normal memory and the SCM memory) are dynamically allocated, and the physical server cannot perform fair allocation when dynamically allocating the memories to the virtual server, and after some virtual servers allocate memory resources, it cannot be determined which type of memory resources the data is stored in, so that the obtained memory resources cannot be reasonably used.
In summary, in the scheme for performing memory allocation in the prior art, there is a problem that the virtual server cannot distinguish the ordinary memory from the SCM memory.
Disclosure of Invention
Embodiments of the present application provide a data storage method, apparatus, system, and medium, which solve the problem that a virtual server cannot distinguish between a normal memory and an SCM memory in a scheme for performing memory allocation in the prior art.
In a first aspect, an embodiment of the present application provides a data storage method, where the method includes:
acquiring the total data amount of stored data in a physical memory, wherein the physical memory is a memory allocated to a virtual server by a physical server through a memory chip according to a first preset size;
when the total data amount of the stored data is larger than a preset first threshold, determining target data of which the reading frequency is smaller than a preset second threshold in the stored data;
and storing the target data into a memory exchange space, wherein the memory exchange space is obtained by converting a storage-class memory, and the storage-class memory is a memory which is allocated to the virtual server by the physical server through the virtual block storage device according to a second preset size.
In one embodiment, the method further comprises:
and releasing the storage space of the physical memory and the storage space of the memory exchange space in response to the deletion operation of the stored data and the target data.
In a specific embodiment, before obtaining the storage amount of the storage data in the physical memory, the method further includes:
after a user acquires a virtual server, determining an operating system mirror image corresponding to the virtual server;
the storage class memory is set to a memory swap space by operating system mirroring.
In one embodiment, the setting of storage class memory as a memory swap space by an operating system image comprises:
when the operating system mirror image is a private operating system mirror image of a user, setting a storage-level memory on the virtual block storage device through the private operating system mirror image;
and converting the memory of the storage boundary into a memory exchange space through the virtual block storage device.
In a specific embodiment, the virtual server further includes a virtual central processing unit, where the physical server is allocated according to a third preset size.
In one embodiment, after the storage space of the physical memory and the storage space of the memory swap space are released, the method further includes:
and releasing the process running in the virtual central processing unit.
In one embodiment, after storing the target data in the memory swap space, the method further comprises:
and responding to the storage operation of the data to be stored, and storing the data to be stored into the physical memory, wherein the total data amount of the data to be stored is less than or equal to that of the target data.
In a second aspect, an embodiment of the present application provides a data storage device, including:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring the total data amount of stored data in a physical memory, and the physical memory is a memory which is distributed to a virtual server by a physical server through a memory chip according to a first preset size;
the first determining module is used for determining target data of which the reading frequency is less than a preset second threshold in the stored data when the total data amount of the stored data is greater than a preset first threshold;
the first storage module is used for storing the target data to a memory exchange space, wherein the memory exchange space is obtained by converting a storage-class memory, and the storage-class memory is a memory allocated to the virtual server by the physical server through the virtual block storage device according to a second preset size.
In one embodiment, the apparatus further comprises:
the first releasing module is used for responding to the deleting operation of the stored data and the target data and releasing the storage space of the physical memory and the storage space of the memory exchange space.
In one embodiment, the apparatus further comprises:
the second determining module is used for determining an operating system mirror image corresponding to the virtual server after the user acquires the virtual server;
and the setting module is used for converting the storage-level memory into a memory exchange space through the operating system mirror image.
In a specific embodiment, the setting module further comprises:
the first setting unit is used for setting a storage-level memory on the virtual block storage device through the private operating system mirror image when the operating system mirror image is the private operating system mirror image of the user;
and the second setting unit is used for converting the storage-level memory into a memory swap space through the virtual block storage device.
In a specific embodiment, the virtual server further includes a virtual central processing unit, where the physical server is allocated according to a third preset size.
In one embodiment, the apparatus further comprises:
and the second releasing module is used for releasing the process operated in the virtual central processing unit after the storage space of the physical memory and the storage space of the memory exchange space are released.
In one embodiment, the apparatus further comprises:
and the second storage module is used for responding to the storage operation of the data to be stored after the target data is stored in the memory exchange space, and storing the data to be stored in the physical memory, wherein the total data amount of the data to be stored is less than or equal to that of the target data.
In a third aspect, an embodiment of the present application provides a data storage system, including:
a physical server and at least one virtual server;
the physical server is used for allocating physical memory to at least one virtual server according to a first preset size through a memory chip and allocating 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 data storage method of the first aspect.
In a fourth aspect, an embodiment of the present application provides a server, including:
a processor, a memory, a communication interface;
the memory is used for storing executable instructions of the processor;
wherein the processor is configured to perform the data storage method of the first aspect via execution of the executable instructions.
In a fifth aspect, the present application provides a readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the data storage method of the first aspect.
In a sixth aspect, the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the computer program is used to implement the data storage method of the first aspect.
According to the data storage method, the data storage device, the data storage system and the data storage medium, the total amount of data of stored data in a physical memory is obtained, wherein the physical memory is a memory which is allocated to a virtual server by a physical server through a memory chip according to a first preset size; when the total data amount of the stored data is larger than a preset first threshold, determining target data of which the reading frequency is smaller than a preset second threshold in the stored data; and storing the target data into a memory exchange space, wherein the memory exchange space is obtained by converting a storage-class memory, the storage-class memory is a memory which is allocated to the virtual server by the physical server according to a second preset size through the virtual block storage device, and because the physical memory and the memory exchange space are presented in different modes in the virtual server, the problem that the virtual server cannot distinguish a common memory from an SCM memory can be avoided, so that the purpose of optimizing the use of the memory by the virtual server is achieved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
FIG. 1 is a schematic structural diagram of a data storage system according to an embodiment of the present application;
fig. 2 is an application scenario diagram of a data storage method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of an embodiment of a data storage method according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of an embodiment of a data storage device according to the present disclosure;
fig. 5 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments that can be made by one skilled in the art based on the embodiments in the present application in light of the present disclosure are within the scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the prior art, in a cloud computing service, a virtual server is the most common computing resource, a cloud computing platform provides a plurality of virtual servers with the same or different specifications for a plurality of users by using physical server resources through a virtualization technology, the resources (mainly central processing units and memory resources) of the virtual servers are provided by the physical server where the virtual servers are located, and the cloud computing platform ensures the resource requirements of the virtual servers according to convention and dynamically allocates the resources to the maximum extent so as to fully utilize the hardware resources, thereby reducing the use cost of the users. A plurality of virtual servers running on one physical server share the central processing unit and the memory resources on the physical server.
For the memory resources, the memory resources on the physical server are provided for the virtual server to use in an on-demand allocation manner. The memory released by one virtual server may be reallocated to other virtual servers. Under the condition that the virtual servers do not apply for and release the memories at the same time, the memories on the physical servers can be multiplexed to different virtual servers in a time-sharing manner, so that the memory requirements of the virtual servers are met with less total memory. However, the operating system of the virtual server usually does not release the unnecessary memory in time, and when the virtual server considers that there is free memory, the virtual server tends to use the memory as a cache of the disk file, so as to reduce disk access and speed up reading of the file. If more memory needs to be allocated to the application at this time, the operating system releases part of the memory used as the file cache, and swaps part (which the operating system considers to be unusual) of the memory to a swap space (swap space), which is usually provided by a disk, the performance is much lower than that of the memory, and if a large amount of memory data is frequently swapped to the swap space, the operating system performance of the virtual server is very significantly degraded.
In order to enable the virtual server to release the memory used as the file cache in time, memory hardware may be added to the physical server to expand the storage space, but the cost of the memory hardware is higher, and the cost of the physical server accounts for a greater proportion, so in the prior art, an SCM memory is usually added, and compared with the ordinary memory hardware, the cost of the SCM memory is greatly reduced, but the SCM memory has lower access performance, and the access delay is about 3 times that of the ordinary memory hardware. Therefore, the ordinary memory and the SCM can be mixed for use, the ordinary memory is used as a cache layer of the SCM and stores frequently accessed data, and contents with relatively low access frequency are stored in the SCM.
However, in the above method, all memories (including the normal memory and the SCM memory) are dynamically allocated, and when the virtual server contends for the memory access, the physical server cannot control fair allocation of the high-speed memory, that is, when the physical server dynamically allocates the memory, fair allocation cannot be performed, so that part of the virtual servers cannot contend for the memory access bandwidth, that is, part of the virtual servers cannot allocate the corresponding memory. Even if some virtual servers can allocate memory resources, the virtual servers cannot distinguish between the ordinary memory and the SCM memory, and when data is stored, the virtual servers cannot determine which type of memory resource the data is stored in, so that the acquired memory resource cannot be reasonably used, and therefore, the problem that the virtual servers cannot distinguish between the ordinary memory and the SCM memory exists.
Aiming at the problems in the prior art, the application provides a data storage method, an object server provides physical memory and storage-class memory (SCM memory) for different virtual servers according to preset size, the physical memory exists in the virtual server in a physical memory mode, the SCM memory exists in the virtual server in a memory exchange space mode, so that the physical server can provide corresponding physical memory and SCM memory for different virtual servers, after the virtual server acquires the physical memory and the SCM memory, the physical memory and the SCM memory are presented in the virtual server in different modes, so that the virtual server can better distinguish the physical memory and the SCM memory, and when the physical memory is determined to have higher storage pressure, data with lower access frequency in the physical memory is stored in the memory exchange space, the reasonable use of the memory resources is better realized.
In the process of researching a related scheme for providing the memory resource for the virtual server by the physical server, the applicant finds that if the physical server is provided in different modes when the physical server allocates the physical memory and the SCM memory, the physical memory and the SCM memory are presented in different modes in the virtual server, so that the rationality of allocating the memory resource by the physical server can be realized, the physical memory and the SCM memory can be ensured to be distinguished by the virtual server, and the memory resource can be better used. Based on the application concept, the data storage system and the data storage method in the application are designed. The terms referred to in the present application are explained first below.
Physical memory: refers to the memory space obtained by physical memory banks, and is a means for storing programs and data.
SCM: storage class memory refers to memory devices that are close to the speed of memory access.
Virtual Central Processing Unit (CPU): the virtual central processing unit in the present application refers to a virtual central processing unit in a virtual server, which is an operation and control core of an operating system of the virtual server, and executes information processing and program operation.
Cache (Cache): the mapping of the data of the file system in the memory can reduce the access to the disk and accelerate the access speed when the file is frequently read and written.
Memory Swap space (Swap partition space): when the available memory in the operating system is insufficient, the memory is used for saving partial memory content, thereby freeing up partial memory space, which is usually carried by a disk (block storage device).
Virtual Machine (VM): the method is also called as a virtual machine, and is a way for flexibly providing computing resources in cloud computing.
Fig. 1 is a schematic structural diagram of a data storage system according to an embodiment of the present application, and as shown in fig. 1, the data storage system includes: a physical server 101 and at least one virtual server 102 (only two of which are shown in fig. 1 and are respectively denoted by 102A and 102B), the physical server 101 allocates physical memory 103 to the at least one virtual server 102 through a memory chip and according to a first preset size (in fig. 1, the physical memory of the virtual server 102A is denoted by 103A, and the physical memory of the virtual server 102B is denoted by 103B), allocates SCM memory 104 to the at least one virtual server 102 through a virtual block storage device and according to a second preset size (in fig. 1, the SCM memory of the virtual server is represented by a memory swap space, the memory swap space of the virtual server 102A is denoted by 105A, the memory swap space of the virtual server 102B is denoted by 105B), in the at least one virtual server 102, the physical memory 103A and the physical memory 103B are represented by a memory entity (normal memory), the SCM memory of both virtual server 102A and virtual server 102B is presented as a memory swap space.
In the data storage system provided by the embodiment of the application, the object server provides the physical memory and the SCM memory to different virtual servers according to the preset size, the physical memory exists in the virtual server in a physical memory mode, and the SCM memory exists in the virtual server in a memory exchange space mode, so that the physical server can provide the corresponding physical memory and the SCM memory for different virtual servers, and after the virtual server acquires the physical memory and the SCM memory, the physical memory and the SCM memory are presented in the virtual server in different modes, so that the virtual server can better distinguish the physical memory and the SCM memory, thereby avoiding the problem that the virtual server cannot distinguish the common memory and the SCM memory, and achieving the purpose that the virtual server uses memory resources more reasonably.
In a specific implementation, the data storage method may be applied in an application scenario. Fig. 2 is a diagram of an application scenario of the data storage method provided in the embodiment of the present application, as shown in fig. 2, in the scenario, taking a physical server as an example to provide memory resources to two virtual servers, the physical server divides a common memory (that is, a physical memory) and an SCM memory of the physical server into two physical memories with different sizes, and then provides the two physical memories to the two virtual servers respectively, where the common memory is also presented in a physical memory manner in the virtual server, and the SCM memory is presented in a memory swap space manner in the SCM memory. When the storage pressure of the ordinary memory in the virtual server occurs, the operating system of the virtual server determines data with low access frequency from the stored data of the ordinary memory, and then places the data in the memory exchange space converted by the SCM memory, so that a part of storage space in the ordinary memory is vacant to be convenient for storing other data.
With reference to the system structure diagram shown in fig. 1 and the above scenario, the following describes in detail a technical solution of the data storage method provided in this embodiment by using several specific embodiments.
Fig. 3 is a schematic flowchart of an embodiment of a data storage method provided in an embodiment of the present application, and as shown in fig. 3, the data storage method specifically includes the following steps:
s301: and acquiring the total data amount of the stored data in the physical memory.
In this step, the physical memory is a memory allocated to the virtual server by the physical server through the memory chip according to the first preset size, and the physical memory exists in the virtual server and is presented in a memory entity mode. 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 stored data in the physical memory, and obtain the total amount of data of the stored data in the current physical memory, so as to determine whether there is excess space in the physical memory for storing other data.
S302: and when the total data amount of the stored data is greater than a preset first threshold, determining target data of which the reading frequency is less than a preset second threshold in the stored data.
In this step, a first threshold may be determined for the storage amount of the physical memory of the virtual server, and whether a storage pressure occurs in the physical memory is determined by the first threshold, where when the storage pressure occurs in the physical memory of the virtual server, that is, the total amount of data of the data stored in the physical memory of the virtual server is greater than the first threshold, at this time, if data is to be stored in the physical memory again, the data cannot be stored in the physical memory due to insufficient storage space, or after the data is stored, the performance of the physical memory is degraded due to excessive data. Therefore, when the total amount of the stored data is greater than the preset first threshold, the virtual server needs to extract the infrequent data in the stored data in the physical memory through the operating system, that is, the target data with the reading frequency less than the preset second threshold in the stored data, so that a part of storage space is left in the physical memory for storing other data to be stored.
S303: and storing the target data to the memory exchange space.
In this step, the memory swap space is obtained by converting a storage class memory, where the storage class memory is a memory allocated to the virtual server by the physical server according to a second preset size through the virtual block storage device, and the storage class memory is presented in the virtual server in a memory swap space manner. When the physical memory of the virtual server has storage pressure, the operating system stores the target data with the reading frequency smaller than the preset second threshold value in the physical memory into the memory exchange space, so that other data can be stored in the physical memory, and the purpose that the virtual memory can use memory resources more reasonably is ensured.
According to the data storage method provided by the embodiment of the application, the total data amount of the stored data in the physical memory is obtained, wherein the physical memory is a memory distributed to the virtual server by the physical server through the memory chip according to a first preset size; when the total data amount of the stored data is larger than a preset first threshold, determining target data of which the reading frequency is smaller than a preset second threshold in the stored data; and storing the target data into a memory exchange space, wherein the memory exchange space is obtained by converting a storage-class memory, and the storage-class memory is a memory allocated to the virtual server by the physical server through the virtual block storage device according to a second preset size. By the mode, the physical server can more reasonably distribute the common memory and the SCM memory to the plurality of virtual servers, and the virtual servers can distinguish the physical memory from the SCM memory in different modes presented by the physical memory and the SCM memory, so that the problem that the data cannot be stored in which type of memory because the virtual server cannot distinguish the common memory from the SCM memory can be avoided, and the purpose that the virtual server uses the memory resources more reasonably is achieved.
In one implementation, the method further comprises: and releasing the storage space of the physical memory and the storage space of the memory exchange space in response to the deletion operation of the stored data and the target data.
In the scheme, when a user wants to release the memory space in the virtual server, the data stored in the virtual server can be deleted through the data platform, and the virtual server releases the storage space of the physical memory and the storage space of the memory exchange space after responding to the operation that the user deletes the stored data in the physical memory and the target data in the memory exchange space, so that when a subsequent user needs to purchase other virtual servers, the physical server can allocate the physical memory with the released storage space and the SCM memory corresponding to the memory exchange space to other virtual servers, and the reasonable reuse of the memory resources of the physical server is realized.
In one specific implementation, before obtaining the storage amount of the storage data in the physical memory, the method further includes: after a user acquires a virtual server, determining an operating system mirror image corresponding to the virtual server; the storage class memory is converted to a memory swap space by operating system mirroring.
In this scheme, the virtual server needs to be purchased and used by a user, the user purchases a virtual server of a specified type, the virtual server needs to allocate an SCM memory (storage class memory) in addition to the normal memory, and the virtual servers of different specifications have preset normal memory capacity and SCM memory capacity, that is, when the physical server allocates the memory to the virtual server, the virtual servers of different specifications need to be allocated according to the preset size. After the user acquires the virtual server, the virtual server needs to determine an operating system image corresponding to the virtual server, and the storage-level memory allocated by the physical server is set as a memory exchange space through the operating system image, so that data with low access frequency in the physical memory can be stored.
In one embodiment, converting storage class memory to memory swap space via operating system mirroring comprises: when the operating system mirror image is a private operating system mirror image of a user, setting a storage-level memory on the virtual block storage device through the private operating system mirror image; and converting the storage-class memory into a memory swap space through the virtual block storage device.
In the scheme, after a user acquires a virtual server, an operating system image corresponding to the virtual server can be matched with the virtual server or a private operating system image of the user, and when the operating system image is matched with the virtual server, the virtual server can automatically set an SCM memory into a memory exchange space (swap partition) directly through the operating system image; when the operating system mirror image is the private operating system mirror image of the user, the storage-class memory needs to be set on the virtual block storage device supporting the storage-class memory on the virtual server through the private operating system mirror image, and then the storage-class memory of the virtual server is converted into the memory exchange space through the virtual block storage device, so that the user can use the own operating system mirror image to use the virtual server.
In one specific implementation, the virtual server further includes a virtual central processing unit to which the physical server is allocated according to a third preset size.
In this solution, when the physical server provides a plurality of virtual servers with the same or different specifications for a plurality of users, it needs to provide virtual CPU resources in addition to the memory resources (physical memory and SCM memory) of the virtual servers. As with the foregoing memory resource allocation, when allocating virtual CPU resources to virtual servers of different specifications, the physical server needs to determine how much CPU resources to allocate to each virtual server according to the different specifications of the virtual servers. For example, for a small-sized virtual server, the physical server provides 1 virtual CPU, 1G physical memory and 1G swap partition space, and for a large-sized virtual server, the physical server provides 4 virtual CPUs, 4G physical memory and 4G swap partition space.
In one embodiment, after releasing the storage space of the physical memory and the storage space of the storage class memory, the method further includes: and releasing the process running in the virtual central processing unit.
In the scheme, when a user wants to release the memory space in the virtual server, the process running in the virtual CPU in the virtual server is released at the same time, at the moment, the virtual CPU resource is an idle resource, so that when a subsequent user needs to purchase other virtual servers, the physical server can allocate the virtual CPU to other virtual servers for use, and the reasonable reuse of the CPU resource of the physical server is realized.
In one specific implementation, after storing the target data in the memory swap space, the method further includes: and responding to the storage operation of the data to be stored, and storing the data to be stored into the physical memory, wherein the total data amount of the data to be stored is less than or equal to that of the target data.
In the scheme, after the virtual server stores the data (target data) with lower access frequency in the physical memory into the memory exchange space through the operating system, the storage space in the physical memory is partially freed, the partial storage space can be used for storing the content which the subsequent user wants to store, and when the user wants to store the data to be stored into the physical memory, the corresponding data to be stored can be stored according to the size of the vacated storage space.
In the data storage method provided by the embodiment of the application, the physical server provides the physical memory to the virtual server in a memory chip mode, the virtual server provides the SCM memory in a virtual block storage device mode, so that the physical server can more reasonably distribute the common memory and the SCM memory to a plurality of virtual servers, and, in a virtual server, physical memory is presented as physical memory, SCM memory is presented as a memory swap space (swap partition space), so that the virtual server may also behave in different ways presented by the physical memory and the SCM memory, the physical memory and the SCM memory are distinguished, so that the problem that the data can not be stored in which type of memory can not be determined due to the fact that the virtual server cannot distinguish the common memory from the SCM memory can be solved, and the purpose that the virtual server uses memory resources more reasonably is achieved.
In summary, in the technical solution provided by the present application, a physical server provides a physical memory to a virtual server according to a first preset size by means of a memory chip, and provides an SCM memory to the virtual server according to a second preset size by means of a virtual block storage device, the physical memory in the virtual server is presented in a physical memory manner, and the SCM memory is presented in a memory swap space (swap partition space), which is a technical implementation method that can not only realize rationality of allocating memory resources by the physical server, but also ensure that the virtual server can distinguish the physical memory from the virtual memory, thereby realizing better use of the memory resources.
Fig. 4 is a schematic structural diagram of an embodiment of a data storage device provided in the present application, and as shown in fig. 4, the data storage device 40 includes:
an obtaining module 41, configured to obtain a total amount of data of stored data in a physical memory, where the physical memory is a memory allocated to a virtual server by a physical server through a memory chip according to a first preset size;
the first determining module 42 is configured to determine, when the total data amount of the stored data is greater than a preset first threshold, target data of which the reading frequency is less than a preset second threshold in the stored data;
the first storage module 43 is configured to store the target data in a memory swap space, where the memory swap space is obtained by converting a storage-class memory, and the storage-class memory is a memory allocated to the virtual server by the physical server according to a second preset size through the virtual block storage device.
Optionally, the apparatus further comprises:
the first releasing module is used for responding to the deleting operation of the stored data and the target data and releasing the storage space of the physical memory and the storage space of the memory exchange space.
Optionally, the apparatus further comprises:
the second determining module is used for determining an operating system mirror image corresponding to the virtual server after the user acquires the virtual server;
and the setting module is used for converting the storage-level memory into a memory exchange space through the operating system mirror image.
Optionally, the setting module further includes:
the first setting unit is used for setting a storage-level memory on the virtual block storage device through the private operating system mirror image when the operating system mirror image is the private operating system mirror image of the user;
and the second setting unit is used for converting the storage-level memory into a memory swap space through the virtual block storage device.
Optionally, the virtual server further includes a virtual central processing unit, where the physical server performs allocation according to a third preset size.
Optionally, the apparatus further comprises:
and the second releasing module is used for releasing the process operated in the virtual central processing unit after the storage space of the physical memory and the storage space of the memory exchange space are released.
Optionally, the apparatus further comprises:
and the second storage module is used for responding to the storage operation of the data to be stored after the target data is stored in the memory exchange space, and storing the data to be stored in the physical memory, wherein the total data amount of the data to be stored is less than or equal to that of the target data.
The data storage device provided in this embodiment is used for implementing the technical solution of the data storage method in the foregoing method embodiments, and the implementation principle and technical effect are similar, which are not described herein again.
An embodiment of the present application further provides a data storage system, including: a physical server and at least one virtual server; the physical server is used for allocating physical memory to at least one virtual server according to a first preset size through a memory chip and allocating 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 for executing the technical scheme of the data storage method in the foregoing method embodiment.
The data storage system provided in this embodiment is used for implementing the technical solution of the data storage method in the foregoing method embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
Fig. 5 is a schematic structural diagram of a server according to an embodiment of the present application, and as shown in fig. 5, the server 500 includes:
a processor 511, a memory 512, and a communication interface 513;
the memory 512 is used for storing executable instructions of the processor 511;
wherein the processor 511 is configured to execute the technical solution of the data storage method in the foregoing method embodiments via executing the executable instructions.
In the server, the memory 512 and the processor 511 are electrically connected directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines, such as a bus. The memory 512 stores computer-executable instructions for implementing the data access control method, including at least one software functional module that can be stored in the memory in the form of software or firmware, and the processor 511 executes various functional applications and data processing by running software programs and modules stored in the memory 512.
The Memory may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory is used for storing programs, and the processor executes the programs after receiving the execution instructions. Further, the software programs and modules within the aforementioned memories may also include an operating system, which may include various software components and/or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide an operating environment for other software components.
The processor may be an integrated circuit chip having signal processing capabilities. The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The server is used for executing the technical scheme of the data storage method in the foregoing method embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
The embodiment of the present application further provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the technical solution of the data storage method in the foregoing method embodiments is implemented.
The embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the computer program is used to implement the technical solution of the data storage method in the foregoing method embodiment.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (18)

1. A data storage method is applied to a virtual server, and the method comprises the following steps:
acquiring the total data amount of stored data in a physical memory, wherein the physical memory is a memory allocated to the virtual server by a physical server through a memory chip according to a first preset size;
when the total data amount of the stored data is larger than a preset first threshold, determining target data of which the reading frequency is smaller than a preset second threshold in the stored data;
and storing the target data to a memory exchange space, wherein the memory exchange space is obtained by converting a storage-class memory, and the storage-class memory is a memory allocated to the virtual server by the physical server through a virtual block storage device according to a second preset size.
2. The method of claim 1, further comprising:
and responding to the deletion operation of the stored data and the target data, and releasing the storage space of the physical memory and the storage space of the memory exchange space.
3. The method of claim 1, wherein before obtaining the amount of storage of the stored data in the physical memory, the method further comprises:
after a user acquires the virtual server, determining an operating system image corresponding to the virtual server;
and setting the storage-level memory as the memory swap space through the operating system image.
4. The method of claim 3, wherein said setting said storage class memory to said memory swap space via said operating system image comprises:
when the operating system mirror image is the private operating system mirror image of the user, setting the storage-level memory on the virtual block storage device through the private operating system mirror image;
converting the storage class memory into the memory swap space through the virtual block storage device.
5. The method according to any one of claims 1 to 4, wherein the virtual server further comprises a virtual central processor allocated by the physical server according to a third preset size.
6. The method of claim 5, wherein after releasing the storage space of the physical memory and the storage space of the memory swap space, the method further comprises:
and releasing the process running in the virtual central processing unit.
7. The method of claim 1, wherein after storing the target data to the memory swap space, the method further comprises:
and responding to the storage operation of the data to be stored, and storing the data to be stored into the physical memory, wherein the total data amount of the data to be stored is less than or equal to that of the target data.
8. A data storage device, comprising:
the device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring the total data amount of stored data in a physical memory, and the physical memory is a memory which is distributed to a virtual server by a physical server through a memory chip according to a first preset size;
the first determining module is used for determining target data of which the reading frequency is smaller than a preset second threshold in the stored data when the total data amount of the stored data is larger than a preset first threshold;
the first storage module is configured to store the target data to a memory exchange space, where the memory exchange space is obtained by converting a storage-class memory, and the storage-class memory is a memory allocated to the virtual server by the physical server through a virtual block storage device according to a second preset size.
9. The apparatus of claim 8, further comprising:
a first releasing module, configured to release a storage space of the physical memory and a storage space of the memory swap space in response to a delete operation on the stored data and the target data.
10. The apparatus of claim 8, further comprising:
the second determining module is used for determining an operating system mirror image corresponding to the virtual server after the user acquires the virtual server;
and the setting module is used for converting the storage-level memory into the memory exchange space through the operating system mirror image.
11. The apparatus of claim 9, wherein the setup module further comprises:
a first setting unit, configured to set the storage class memory on the virtual block storage device through the private operating system image when the operating system image is the private operating system image of the user;
a second setting unit, configured to convert the storage-class memory into the memory swap space through the virtual block storage device.
12. The apparatus of any of claims 8 to 11, wherein the virtual server further comprises a virtual central processor to which the physical server is allocated according to a third preset size.
13. The apparatus of claim 12, further comprising:
and the second releasing module is used for releasing the process operated in the virtual central processing unit after the storage space of the physical memory and the storage space of the memory exchange space are released.
14. The apparatus of claim 9, further comprising:
and the second storage module is used for responding to the storage operation of the data to be stored after the target data is stored in the memory exchange space, and storing the data to be stored in the physical memory, wherein the total data amount of the data to be stored is less than or equal to that of the target data.
15. A data storage system, comprising:
a physical server and at least one virtual server;
the physical server is used for allocating physical memory to the at least one virtual server according to a first preset size through a memory chip and allocating storage-class 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 for implementing the data storage method of any one of claims 1 to 7.
16. A server, comprising:
a processor, a memory, a communication interface;
the memory is used for storing executable instructions of the processor;
wherein the processor is configured to perform the data storage method of any of claims 1 to 7 via execution of the executable instructions.
17. A readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing the data storage method of any one of claims 1 to 7.
18. A computer program product comprising a computer program which, when executed by a processor, is adapted to carry out the data storage method of any one of claims 1 to 7.
CN202111176162.7A 2021-10-09 2021-10-09 Data storage method, device, system and medium Pending CN113918283A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111176162.7A CN113918283A (en) 2021-10-09 2021-10-09 Data storage method, device, system and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111176162.7A CN113918283A (en) 2021-10-09 2021-10-09 Data storage method, device, system and medium

Publications (1)

Publication Number Publication Date
CN113918283A true CN113918283A (en) 2022-01-11

Family

ID=79238766

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111176162.7A Pending CN113918283A (en) 2021-10-09 2021-10-09 Data storage method, device, system and medium

Country Status (1)

Country Link
CN (1) CN113918283A (en)

Similar Documents

Publication Publication Date Title
JP5510556B2 (en) Method and system for managing virtual machine storage space and physical hosts
US20190220418A1 (en) Memory Management Method and Apparatus
EP3631628A1 (en) Method and apparatus for implementing virtual gpu and system
US8312201B2 (en) Managing memory allocations loans
CN112148422A (en) IO processing method and device
WO2021057489A1 (en) Method and device for virtual machine memory management
EP4187386A1 (en) Interprocess communication method and apparatus
CN109960569B (en) Virtualization processing method and device
CN107077376B (en) Frame buffer implementation method and device, electronic equipment and computer program product
CN111104219A (en) Binding method, device, equipment and storage medium of virtual core and physical core
CN111209080A (en) Transparent transmission method for graphic processor
JP6974510B2 (en) Methods, devices, devices and media for processing data
WO2017166997A1 (en) Inic-side exception handling method and device
JP7058658B2 (en) Video display methods, devices, electronic devices and computer program products
CN109558210B (en) Method and system for virtual machine to apply GPU (graphics processing Unit) equipment of host
CN113268356B (en) LINUX system-based multi-GPU board card bounding system, method and medium
CN110447019B (en) Memory allocation manager and method for managing memory allocation performed thereby
CN113918283A (en) Data storage method, device, system and medium
CN110704163A (en) Server and virtual storage method and device thereof
CN109032510B (en) Method and device for processing data based on distributed structure
CN109002347B (en) Virtual machine memory allocation method, device and system
CN116324706A (en) Split memory pool allocation
CN114281516A (en) Resource allocation method and device based on NUMA attribute
CN112801856A (en) Data processing method and device
CN113691465A (en) Data transmission method, intelligent network card, computing device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination