Memory adjustment method and device, server and storage medium
By obtaining memory statistics of virtual terminals and adjusting their memory configuration, the problem of low memory resource utilization in cloud desktop technology is solved, achieving more efficient memory resource utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2026-03-10
AI Technical Summary
In cloud desktop technology, the low utilization rate of memory resources allocated to virtual machines leads to a waste of memory resources.
By obtaining memory statistics of virtual terminals, elastic memory is determined, and the memory configuration of virtual terminals is adjusted according to the space size and weight of different types of memory, giving priority to free memory and process memory usage, and reducing file cache memory usage.
It improves the utilization of virtual machine memory resources, avoids memory waste, and ensures that the user experience is not degraded.
Smart Images

Figure CN121636048A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular to a memory adjustment method, apparatus, server, and storage medium. Background Technology
[0002] With the development of technology, cloud desktop technology is constantly maturing. Using cloud desktop technology, users can access their remote desktops anytime, anywhere through various devices. Cloud desktop technology provides users with a flexible way of working, and therefore, it has been widely deployed.
[0003] When a server allocates memory to virtual machines corresponding to multiple cloud desktops, it usually allocates the same amount of memory to each virtual machine. However, in some scenarios or for some users, the memory resources required are far less than the memory allocated to the virtual machine by the server, resulting in low memory resource utilization in the virtual machine and wasting memory resources. Summary of the Invention
[0004] To address the problems in the prior art, this application provides a memory adjustment method, apparatus, server, and storage medium that can improve the resource utilization of virtual machines.
[0005] In a first aspect, embodiments of this application provide a memory adjustment method that can be applied to a server, including:
[0006] Obtain memory statistics information of the first virtual terminal; the first virtual terminal is created by the server; the memory statistics information includes the space size of multiple types of memory;
[0007] The elastic memory of the first virtual terminal is determined based on the space size of the multiple types of memory.
[0008] The adjusted memory of the first virtual terminal is determined based on the elastic memory and the initial memory; the initial memory is the memory configured by the server for the first virtual terminal when it is created.
[0009] In one possible implementation, the plurality of memory types include at least: free memory and a first type of memory; the first type of memory has a lower priority than the free memory.
[0010] In one possible implementation, the plurality of memory types further includes a second type of memory; the second type of memory has a lower priority than the first type of memory.
[0011] In one possible implementation, the first type of memory is memory occupied by processes; the second type of memory is memory occupied by file cache.
[0012] In one possible implementation, determining the elastic memory of the first virtual terminal based on the space size of the plurality of memory types includes:
[0013] Based on the memory statistics of the first virtual terminal, determine the memory usage ratio between the memory already occupied in the first virtual terminal and the initial memory;
[0014] The elastic memory of the first virtual terminal is determined based on the memory usage ratio.
[0015] In one possible implementation, determining the elastic memory of the first virtual terminal based on the memory usage ratio includes:
[0016] If the memory usage ratio is less than or equal to the first threshold, then the elastic memory is determined based on the size of the free memory, the memory used by the process, and the memory used by the file cache.
[0017] If the memory usage ratio is greater than the first threshold and less than the second threshold, then the elastic memory is determined based on the size of the free memory and the memory occupied by the process.
[0018] If the memory usage ratio is greater than or equal to the second threshold, then the elastic memory is determined based on the size of the free memory.
[0019] In one possible implementation, determining the elastic memory based on the size of the free memory, the memory occupied by the process, and the memory occupied by the file cache includes:
[0020] Multiply the size of the free memory by the first weight to obtain the first product;
[0021] Multiply the memory size occupied by the process by the second weight to obtain the second product;
[0022] Multiply the memory size occupied by the file cache by the third weight to obtain the third product;
[0023] The sum of the first product, the second product, and the third product is used as the elastic memory of the first virtual terminal.
[0024] In one possible implementation, the first weight corresponding to the free memory is greater than the second weight corresponding to the memory occupied by the process; the second weight corresponding to the memory occupied by the process is greater than the third weight corresponding to the memory occupied by the file cache.
[0025] In one possible implementation, obtaining the memory statistics information of the first virtual terminal includes:
[0026] At set intervals, an information acquisition instruction is sent to the first virtual terminal through an information acquisition process; the information acquisition instruction is used to instruct the first virtual terminal to send memory statistics information to the server;
[0027] Receive memory statistics information sent by the first virtual terminal to the server.
[0028] In one possible implementation, determining the adjusted memory of the first virtual terminal based on the elastic memory and the initial memory includes:
[0029] The difference between the initial memory and the elastic memory is used as the adjusted memory for the first virtual terminal.
[0030] Secondly, embodiments of this application provide a memory adjustment device, comprising:
[0031] A memory information acquisition unit is used to acquire memory statistics information of a first virtual terminal; the first virtual terminal is created by the server; the memory statistics information includes the space size of multiple types of memory;
[0032] The elastic memory determination unit is used to determine the elastic memory of the first virtual terminal based on the space size of the plurality of memory types;
[0033] The differential memory adjustment unit is used to determine the adjusted memory of the first virtual terminal based on the elastic memory and the initial memory; the initial memory is configured by the server for the first virtual terminal when the first virtual terminal is created.
[0034] Thirdly, embodiments of this application provide a server, including:
[0035] Memory, used to store computer programs;
[0036] The processor, when executing a computer program stored in the memory, implements the above-described memory adjustment method.
[0037] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described memory adjustment method.
[0038] Fifthly, embodiments of this application provide a computer program product, the computer program product comprising: computer program code, which, when run on a computer, causes the computer to implement the above-described memory adjustment method.
[0039] This application provides a memory adjustment method, apparatus, server, and storage medium. The server can obtain memory statistics information from a first virtual terminal created by the server, and determine the size of the elastic memory in the first virtual terminal based on the size of each type of memory included in the memory statistics information. When the server creates the first virtual terminal, it configures initial memory for the first virtual terminal. Therefore, the adjusted memory size of the first virtual terminal can be determined based on the initial memory and the size of the elastic memory. By determining the elastic memory in the first virtual terminal and compressing the elastic memory, the memory in the first virtual terminal can be made closer to the memory resources consumed by the first virtual terminal, solving the problem of low memory resource utilization and wasted memory resources in virtual machines. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 A schematic diagram illustrating an application scenario of a memory adjustment method provided in this application embodiment;
[0042] Figure 2 A flowchart illustrating a memory adjustment method provided in an embodiment of this application;
[0043] Figure 3 A specific virtual machine structure diagram provided for an embodiment of this application;
[0044] Figure 4 A flowchart illustrating a specific memory adjustment method provided in this application embodiment;
[0045] Figure 5 This is a schematic diagram of the structure of a memory adjustment device provided in an embodiment of this application;
[0046] Figure 6 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation
[0047] 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. The described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0048] Furthermore, in the description of the embodiments of this application, unless otherwise stated, "and" means "or", for example, A / B can mean A or B; "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone.
[0049] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined with "first" and "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0050] Specifically, in the description of this application, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," and "counterclockwise," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application. Furthermore, the terms "connection" and "linkage" used in this application, unless otherwise specified, include both direct and indirect connections (linkages).
[0051] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0052] Figure 1 The illustration shows an application scenario of a memory adjustment method provided in an embodiment of this application, such as... Figure 1 As shown, the scenario includes multiple virtual terminals 110, such as virtual terminal 1 111, virtual terminal 2 112, virtual terminal 3 113, ..., virtual terminal n, and server 100, wherein multiple virtual terminals 110 are created by server 100.
[0053] Multiple virtual terminals 110 can be configured on multiple terminal devices. These terminal devices can access the network and communicate with the server 100 via cellular mobile communication technology, which may include 5th Generation Mobile Networks (5G) technology. Alternatively, multiple terminals can access the network and communicate with the server 100 via short-range wireless communication, which may include Wireless Fidelity (Wi-Fi) technology. A terminal device is a device that can provide voice and / or data connectivity to a user, including handheld terminal devices with wireless connectivity, vehicle-mounted terminal devices, etc.
[0054] Furthermore, multiple terminals include, but are not limited to: mobile phones, tablets, laptops, handheld computers, mobile internet devices (MID), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminal devices in industrial control, wireless terminal devices in autonomous driving, wireless terminal devices in smart grids, wireless terminal devices in transportation safety, wireless terminal devices in smart cities, or wireless terminal devices in smart homes, etc.
[0055] Server 100 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0056] In one possible implementation, when the server allocates memory to multiple virtual terminals, it typically allocates the same amount of memory to each virtual terminal. However, in some scenarios or for some users, the memory resources required are far less than the memory allocated to the virtual terminals by the server, resulting in low memory resource utilization in the virtual terminals and wasting memory resources.
[0057] Therefore, in order to solve the above problems, embodiments of this application provide a memory adjustment method. Figure 2 A flowchart of a memory adjustment method provided in an embodiment of this application is shown, as follows: Figure 2 As shown, the method may include the following steps:
[0058] Step S201: Obtain memory statistics information of the first virtual terminal.
[0059] In one possible embodiment, the first virtual terminal can be any one of multiple virtual terminals created by the server. Therefore, the server can access each created virtual terminal, including the first virtual terminal. The server can determine the memory statistics of the first virtual terminal in various ways. For example, the server can send an information retrieval command to the first virtual terminal after a set time interval. After receiving the information retrieval command, the first virtual terminal can send memory statistics to the server, and the server can receive the memory statistics sent by the first virtual terminal. The server can also view the performance and memory usage of the virtual terminal through VMware's vSphere Client or vCenter Server. The server can also use PowerCLI scripts to obtain detailed memory statistics. The server can also use API interfaces provided by various platforms to obtain the memory statistics of the virtual terminal. In Windows systems, the server can use PowerShell to view memory statistics, and in Linux systems, the `free -m` command can be used to view memory statistics. This application does not limit the specific method by which the server obtains memory statistics.
[0060] In one possible embodiment, the memory statistics obtained by the server may include the size of multiple types of memory space. These multiple types of memory include at least free memory and first-class memory. The priority of first-class memory is lower than that of free memory. That is, in determining elastic memory, we can first consider how much free memory can be used as elastic memory, and then consider how much first-class memory can be used as elastic memory. For example, when the size of free memory and first-class memory is the same, the elastic memory that can be converted from free memory is greater than the elastic memory that can be converted from first-class memory. Therefore, we can prioritize considering how much free memory can be used as elastic memory, and then consider how much first-class memory can be used as elastic memory. Here, the first-class memory may be the memory occupied by processes. Multiple types of memory can also include a second type of memory, where the priority of the second type of memory is lower than that of the first type of memory. That is, in determining the elastic memory, we can first consider how much of the first type of memory can be used as elastic memory, and then consider how much of the second type of memory can be used as elastic memory. For example, when the size of the second type of memory and the first type of memory are the same, the elastic memory that the first type of memory can be converted into is greater than the elastic memory that the second type of memory can be converted into. Therefore, we can first consider how much of the first type of memory can be used as elastic memory, and then consider how much of the second type of memory can be used as elastic memory. The second type of memory can be the memory occupied by file cache.
[0061] Specifically, process memory usage refers to the amount of memory used by a running process in the system. This can include dynamic data during program execution, memory used to store local variables during program calls, etc. File cache memory usage refers to the memory used by the operating system to cache frequently used data in the file system (such as file content, directory structure, etc.). When a process requests to read a file, the operating system can directly provide the data from the cache instead of reading it from the disk every time. Caching can significantly improve file access speed. Therefore, compared to the other two types of memory, the proportion of file cache memory usage can be reduced by compressing it.
[0062] In addition to the size of various types of memory space, the memory statistics obtained by the server can also include statistics on the used memory and the initial memory configured by the server for the first virtual terminal when it is created.
[0063] Step S202: Determine the elastic memory of the first virtual terminal based on the space size of multiple types of memory.
[0064] In one possible embodiment, the memory usage ratio of the first virtual terminal can be determined first based on the memory statistics of the first virtual terminal. For example, if the memory statistics include 6G of used memory and the server configures 8G of initial memory for the first virtual terminal when creating it, then the memory usage ratio of the first virtual terminal can be determined to be 6G / 8G = 75%.
[0065] After determining the memory usage ratio of the first virtual terminal, the elastic memory allocation strategy can be further determined. Typically, two thresholds can be set: a first threshold and a second threshold, to detect whether there is memory pressure in the first virtual terminal. If the memory usage ratio is less than or equal to the first threshold, the elastic memory allocation strategy can be determined as the first strategy, which is Mi_qos = (free*A + anon*B + file*C), where Mi_qos is the size of elastic memory, free is the size of free memory, A is the first weight corresponding to free memory, anon is the size of memory occupied by processes in the first virtual terminal, B is the second weight corresponding to memory occupied by processes, file is the size of memory occupied by file cache in the first virtual terminal, and C is the size of memory occupied by file cache. The corresponding third weight is stored. Since the memory usage ratio is relatively small, the first strategy, which has a greater impact on the use of the first virtual terminal, can be selected. If the memory usage ratio is greater than the first threshold but less than the second threshold, the elastic memory determination strategy can be determined as the second strategy, which is Mi_qos = (free * A + anon * B), where Mi_qos, free, anon, A, and B are the same as those represented in the first strategy. The second strategy has a smaller impact on the use of the first virtual terminal. If the memory usage ratio is greater than or equal to the second threshold, the elastic memory determination strategy can be determined as the third strategy, which is Mi_qos = free * A, where Mi_qos, free, and A are the same as those represented in the first strategy. The third strategy has no impact on the use of the first virtual terminal.
[0066] It should be noted that A, B, and C can be any numbers from 0% to 100%. Generally, A>B>C, but this application does not limit the specific values of A, B, and C. Furthermore, this application currently classifies memory types into three categories, and can classify memory types into more categories as well. Moreover, the memory usage ratio of the first virtual terminal can be divided into more levels, thereby generating more flexible memory determination strategies.
[0067] For example, if the first threshold is 30% and the second threshold is 60%, and a virtual terminal has a memory usage ratio of 25%, where the size of free memory is 5G (the first weight of free memory is 80%), the size of memory used by processes is 2G (the second weight of process memory usage is 50%), and the size of memory used by file cache is 1G (the third weight of file cache memory usage is 30%), then the elastic memory in this virtual terminal can be determined to be (5G*80%+2G*50%+1G*30%) = 5.3G. It should be noted that the values of the first and second thresholds are not limited. The first threshold can be 35%, 25%, or other values, and the second threshold can be 55%, 65%, or other values. However, the first threshold must be less than the second threshold to ensure the determination of the memory usage ratio.
[0068] Step S203: Determine the adjusted memory of the first virtual terminal based on the elastic memory and the initial memory.
[0069] In one possible implementation, after determining the elastic memory, the difference between the initial memory and the elastic memory can be used as the adjusted memory for the first virtual terminal. For example, if the server allocates 16GB of memory to the first virtual terminal when it is created (meaning the initial memory of the first virtual terminal is 16GB), and the elastic memory is determined to be 5.3GB, then the memory of the first virtual terminal can be adjusted to 16GB - 5.3GB = 10.7GB. It should be noted that if the elastic memory of the first virtual terminal is negative or close to zero, certain memory resources can be added to the first virtual terminal to ensure a good user experience.
[0070] In another possible implementation, the server can determine the fluctuation coefficient β based on the elastic memory, initial memory, and memory reservation buffer. The memory reservation buffer can be used to meet the user's memory needs for a future period; that is, with the memory reservation buffer, even if the user opens other files, there will be no lag or other issues. The memory reservation buffer can be used to cache other file pages. If the memory reservation buffer is represented as m, the elastic memory as Mi_qos, and the initial memory as Mi, then the fluctuation coefficient β can be determined as (Mi_qos - m) / Mi. After determining the fluctuation coefficient of the first virtual terminal, the fluctuation coefficient can be sent to the cloud platform's memory elasticity service, which can adjust the memory of the first virtual terminal based on the fluctuation coefficient.
[0071] The influence of elastic memory and initial memory factors is considered to make the determined amount of memory elasticity more reasonable. This makes it easier to appropriately extract memory resources from the target virtual machine in the future, while ensuring that the memory service quality of the target virtual machine running in the future (e.g., memory elasticity rate up to X GiB / s, CPU computing power consumption not exceeding η, and no lag for users) does not decrease, and also maximizes the utilization of memory resources.
[0072] It should be noted that, Figure 2 This example uses a single virtual machine for illustration. In cases where multiple virtual machines exist, the following can be referenced: Figure 2 The method shown applies memory adjustments to multiple virtual machines simultaneously to improve memory utilization for each virtual machine and prevent resource waste.
[0073] Figure 3 This application provides a specific virtual terminal structure diagram, as shown in the embodiment of the present application. Figure 3 As shown, the server allocates an initial 8GB of memory to the virtual terminal, and the virtual terminal has already used 4GB of memory. Inside the virtual terminal, a front-end driver runs, which can acquire memory statistics of the virtual terminal and send them to the corresponding components in the server. The memory statistics include the size of multiple types of memory space. In the server, a back-end device runs, which can execute a memory adjustment method provided in this embodiment. The back-end device receives the memory statistics sent by the front-end driver and determines the elastic memory of the virtual terminal based on the size of multiple types of memory space included in the acquired memory statistics. Based on the elastic memory and the initial memory, it determines the adjusted memory of the first virtual terminal. Through the cooperation of the front-end driver and the back-end device, the memory adjustment method provided in this embodiment can be applied to the server.
[0074] It should be noted that, Figure 3 This example uses a single virtual machine for illustration. In cases where multiple virtual machines exist, the following can be referenced: Figure 3 At the same time, the structure diagrams of multiple virtual machines are determined.
[0075] In one specific implementation, the flow of a memory adjustment method provided in this application embodiment can be as follows: Figure 4 As shown, it includes the following steps:
[0076] Step S401: At set intervals, send an information acquisition instruction to the first virtual terminal through the information acquisition process.
[0077] Step S402: Receive memory statistics information sent by the first virtual terminal.
[0078] Step S403: Based on the memory statistics of the first virtual terminal, determine the memory usage ratio between the memory already occupied in the first virtual terminal and the initial memory. If the memory usage ratio is less than or equal to a first threshold, proceed to step S404; if the memory usage ratio is greater than the first threshold but less than a second threshold, proceed to step S405; if the memory usage ratio is greater than or equal to the second threshold, proceed to step S406.
[0079] Step S404: Determine the elastic memory based on the size of free memory, process memory usage, and file cache memory usage. After executing step S404, proceed to step S407.
[0080] Step S405: Determine the elastic memory based on the amount of free memory and the amount of memory used by processes. After executing step S405, proceed to step S407.
[0081] Step S406: Determine the elastic memory based on the size of the free memory.
[0082] Step S407: The difference between the initial memory and the elastic memory is used as the adjusted memory for the first virtual terminal.
[0083] Based on the same inventive concept, this application also provides a memory adjustment device that can be applied in servers, such as... Figure 5 As shown, the memory adjustment device 500 may include:
[0084] The memory information acquisition unit 501 is used to acquire memory statistics information of the first virtual terminal; the first virtual terminal is created by the server; the memory statistics information includes the space size of multiple types of memory;
[0085] The elastic memory determination unit 502 is used to determine the elastic memory of the first virtual terminal based on the space size of the plurality of memory types;
[0086] The differential memory adjustment unit 503 is used to adjust the memory of the first virtual terminal to the difference between the initial memory and the elastic memory; the initial memory is configured by the server for the first virtual terminal when the first virtual terminal is created.
[0087] In one possible implementation, the elastic memory determination unit 502 is specifically used to determine the memory usage ratio between the memory already occupied in the first virtual terminal and the initial memory based on the memory statistics information of the first virtual terminal.
[0088] The elastic memory of the first virtual terminal is determined based on the memory usage ratio.
[0089] In one possible implementation, the elastic memory determination unit 502 is specifically used to determine the elastic memory based on the size of the free memory, the memory occupied by the process, and the memory occupied by the file cache;
[0090] If the memory usage ratio is greater than the first threshold and less than the second threshold, then the elastic memory is determined based on the size of the free memory and the memory occupied by the process.
[0091] If the memory usage ratio is greater than or equal to the second threshold, then the elastic memory is determined based on the size of the free memory.
[0092] In one possible implementation, the elastic memory determination unit 502 is specifically used to multiply the size of the free memory by a first weight to obtain a first product;
[0093] Multiply the memory size occupied by the process by the second weight to obtain the second product;
[0094] Multiply the memory size occupied by the file cache by the third weight to obtain the third product;
[0095] The sum of the first product, the second product, and the third product is used as the elastic memory of the first virtual terminal.
[0096] In one possible implementation, the memory information acquisition unit 501 is specifically used to send an information acquisition instruction to the first virtual terminal through an information acquisition process at set intervals; the information acquisition instruction is used to instruct the first virtual terminal to send memory statistics information to the server.
[0097] Receive memory statistics information sent by the first virtual terminal to the server.
[0098] In one possible implementation, the difference memory adjustment unit 503 is specifically used to use the difference between the initial memory and the elastic memory as the adjusted memory of the first virtual terminal.
[0099] Based on the same technical concept, this application also provides a server that can implement the functions of the aforementioned memory adjustment device.
[0100] Figure 6 An exemplary schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown.
[0101] At least one processor 601 and a memory 602 connected to at least one processor 601. In this embodiment, the specific connection medium between the processor 601 and the memory 602 is not limited. Figure 6The example shown is the connection between processor 601 and memory 602 via bus 600. Bus 600 is... Figure 6 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The 600 bus can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 6 The term "processor" is represented by a single thick line, but this does not imply that there is only one bus or one type of bus. Alternatively, the processor 601 can also be called a controller; there is no restriction on the name.
[0102] In this embodiment, memory 602 stores instructions executable by at least one processor 601. By executing the instructions stored in memory 602, at least one processor 601 can perform a memory adjustment method described above. Processor 601 can implement... Figure 5 The functions of each module in the device shown.
[0103] The processor 601 is the control center of the device. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in memory 602 and calling data stored in memory 602, the processor can perform various functions and process data, thereby monitoring the device as a whole.
[0104] In this embodiment, processor 601 may include one or more processing units. Processor 601 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into processor 601. In some embodiments, processor 601 and memory 602 may be implemented on the same chip; in other embodiments, they may be implemented on separate chips.
[0105] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing 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. The steps of a memory adjustment method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or as a combination of hardware and software modules within the processor.
[0106] Memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 602 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 602 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 602 may also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0107] By designing and programming the processor 601, the code corresponding to the memory adjustment method described in the foregoing embodiments can be embedded into the chip, enabling the chip to execute it during operation. Figure 2 This illustrates a memory adjustment method. How to design and program the processor 601 is a technique well-known to those skilled in the art and will not be elaborated upon here.
[0108] It should be noted that the server provided in this application embodiment can implement all the method steps implemented in the above method embodiment and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.
[0109] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium. The computer program product includes computer program code, which, when executed on a computer, causes the computer to perform any of the memory adjustment methods discussed above. Since the principle by which the above-described computer-readable storage medium solves the problem is similar to that of the memory adjustment method, the implementation of the above-described computer-readable storage medium can be found in the implementation of the method; repeated details will not be elaborated further.
[0110] Based on the same inventive concept, this application provides a computer program product comprising: computer program code, which, when executed on a computer, causes the computer to implement the aforementioned memory adjustment method. Since the principle by which the above-described computer program product solves the problem is similar to that of the memory adjustment method, the implementation of the above-described computer program product can be referred to the implementation of the method, and repeated details will not be elaborated further.
[0111] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0112] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0113] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0114] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0115] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A memory adjustment method, characterized by, Applied to a server, comprising: obtaining memory statistics of a first virtual terminal; the first virtual terminal is created by the server; the memory statistics includes space sizes of multiple types of memory; determining elastic memory of the first virtual terminal according to the space sizes of the multiple types of memory; determining adjusted memory of the first virtual terminal based on the elastic memory and initial memory; the initial memory is configured for the first virtual terminal when the server creates the first virtual terminal.
2. The method of claim 1, wherein, The multiple types of memory at least include idle memory and first type memory; the priority of the first type memory is lower than the priority of the idle memory.
3. The method of claim 2, wherein, The multiple types of memory further include second type memory; the priority of the second type memory is lower than the priority of the first type memory.
4. The method of claim 3, wherein, The first type memory is process occupied memory; the second type memory is file cache occupied memory.
5. The method of claim 4, wherein, The determining of the elastic memory of the first virtual terminal according to the space sizes of the multiple types of memory comprises: determining memory occupation ratio between occupied memory in the first virtual terminal and the initial memory according to the memory statistics of the first virtual terminal; determining the elastic memory of the first virtual terminal based on the memory occupation ratio.
6. The method of claim 5, wherein, The determining of the elastic memory of the first virtual terminal based on the memory occupation ratio comprises: if the memory occupation ratio is less than or equal to a first threshold, determining the elastic memory according to the sizes of the idle memory, the process occupied memory and the file cache occupied memory; if the memory occupation ratio is greater than the first threshold and less than a second threshold, determining the elastic memory according to the sizes of the idle memory and the process occupied memory; if the memory occupation ratio is greater than or equal to the second threshold, determining the elastic memory according to the size of the idle memory.
7. The method of claim 6, wherein, The determining of the elastic memory according to the sizes of the idle memory, the process occupied memory and the file cache occupied memory comprises: multiplying the size of the idle memory by a first weight to obtain a first product; multiplying the size of the process occupied memory by a second weight to obtain a second product; multiplying the size of the file cache occupied memory by a third weight to obtain a third product; adding the first product, the second product and the third product to obtain a sum as the elastic memory of the first virtual terminal.
8. The method of claim 7, wherein, The first weight corresponding to the idle memory is greater than the second weight corresponding to the process occupied memory; the second weight corresponding to the process occupied memory is greater than the third weight corresponding to the file cache occupied memory.
9. The method of claim 1, wherein, The obtaining of the memory statistics of the first virtual terminal comprises: sending an information acquisition instruction to the first virtual terminal through an information acquisition process every interval of a set time length; the information acquisition instruction is used to instruct the first virtual terminal to send memory statistics to the server; receiving the memory statistics sent by the first virtual terminal to the server.
10. The method of claim 1, wherein, The determining of the adjusted memory of the first virtual terminal based on the elastic memory and the initial memory comprises: A difference between the initial memory and the elastic memory is taken as the adjusted memory of the first virtual terminal.
11. A memory adjustment apparatus, comprising: The method comprises the steps of: acquiring memory statistical information of a first virtual terminal; the first virtual terminal is created by a server; the memory statistical information comprises space sizes of a plurality of types of memory; determining an elastic memory of the first virtual terminal according to the space sizes of the plurality of types of memory; determining an adjusted memory of the first virtual terminal based on the elastic memory and an initial memory; the initial memory is configured for the first virtual terminal by the server when the first virtual terminal is created.
12. A server, characterized by The method comprises the steps of: a memory for storing a computer program; a processor for executing the computer program stored on the memory to implement the method of any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer program is stored in the computer readable storage medium, and the computer program is executed by the processor to implement the method of any one of claims 1-10.
14. A computer program product, characterised in that, The computer program product comprises computer program code, which, when executed on a computer, causes the computer to perform the method of any one of claims 1-10.