Memory management method and device, electronic equipment and readable medium
By monitoring memory load and redirecting traffic data in a distributed server cluster, the program pause problem caused by the automatic memory management mechanism is solved, enabling seamless operation during GC and improving the stability and responsiveness of the system.
Patent Information
- Application Number
- CN202211434814.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-16
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2042-11-16
AI Technical Summary
In existing technologies, automatic memory management mechanisms cause program lag when releasing memory, affecting business processes and user experience, and cannot completely avoid the pause problem during GC.
In a distributed server cluster, memory load is monitored by a load balancer. When the threshold is exceeded, the application stops running on the high-load server, traffic data is forwarded to the non-overloaded server, and the application is redeployed after the memory is released to ensure that the memory load is reduced below the threshold.
The architecture addresses the application pause issues caused by memory management, ensuring that the program does not pause during garbage collection (GC), thus improving system smoothness and business responsiveness.
Smart Images

Figure CN116107736B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of computers, and particularly relates to a memory management method and device, an electronic device and a readable medium. BACKGROUND
[0002] With the continuous development of information technology, the memory resource management mechanism has evolved from the traditional manual management by developers to the modern automatic memory management mechanism, and developers no longer need to write codes for performing memory management tasks.
[0003] The underlying way of the automatic memory management mechanism in the related art is to rely on a garbage collector (GC), and each program design language runtime has its own GC algorithm. However, since many objects and object references need to be checked in the process of releasing memory, the process of checking these objects can be very slow, which can cause the program to be stuck or run slowly, or even cause the program to temporarily stop and not respond to any requests from the user. Since today's Internet big data business is generally sensitive to delay, such temporary stop of the program can cause the business to stagnate, thereby causing economic losses to customers.
[0004] The GC algorithm is usually optimized in the prior art, which alleviates the pause time to some extent, but cannot completely avoid the pause. Therefore, there is an urgent need for an automatic memory management method that can ensure that the program does not pause during GC execution. SUMMARY
[0005] To solve the above problems, the embodiments of the present application provide a memory management method, device, electronic device and readable medium.
[0006] Some embodiments of the present application provide a memory management method, which comprises:
[0007] Obtaining the memory load of a first distributed server running an application, wherein the first distributed server is any distributed server in a distributed server cluster, and the application is deployed on each distributed server in the distributed server cluster respectively;
[0008] When the memory load exceeds a load threshold, instructing the first distributed server to stop running the application, and forwarding the traffic data sent to the first distributed server to a second distributed server, wherein the second distributed server is a distributed server in the distributed server cluster whose memory load does not exceed the load threshold;
[0009] re-deploying, on the first distributed server, starting the application after detecting that the first distributed server stops running the application, wherein the first distributed server releases allocated memory in the first distributed server while stopping running the application;
[0010] re-sending, to the first distributed server, the traffic data of the application.
[0011] Optionally, the re-sending, to the first distributed server, the traffic data of the application comprises:
[0012] adding the first distributed server to a set of available servers;
[0013] allowing the traffic data of the application to be distributed and sent to the first distributed server according to running states of the distributed servers in the set of available servers.
[0014] Optionally, the allowing the traffic data of the application to be distributed and sent to the first distributed server according to running states of the distributed servers in the set of available servers comprises:
[0015] evaluating a first amount of traffic data that can be carried by the first distributed server according to the running states of the distributed servers in the set of available servers and a total amount of traffic data of the application;
[0016] sending, to the first distributed server, traffic data not exceeding the first amount of traffic data.
[0017] Optionally, the evaluating a first amount of traffic data that can be carried by the first distributed server according to the running states of the distributed servers in the set of available servers and a total amount of traffic data of the application comprises:
[0018] filtering, from the set of available servers, a target distributed server having a healthy running state, wherein the healthy running state is used to represent a running state in which a memory load is less than a preset memory load, and the preset memory load is less than the memory load threshold;
[0019] equally distributing the total amount of traffic data of the application to each of the target distributed servers to obtain a first amount of traffic data that can be carried by each of the target distributed servers, wherein the target distributed servers include the first distributed server.
[0020] Optionally, the scheduling and forwarding, to a second distributed server, the traffic data to be sent to the first distributed server comprises:
[0021] eliminating the first distributed server from the set of available servers;
[0022] allocating, according to a running state of a second set of distributed servers remaining in the set of available servers and a second amount of traffic data that has been allocated to the first distributed server and not processed before the first distributed server is shut down, the second amount of traffic data to the second set of distributed servers, to obtain a third amount of traffic data corresponding to each second distributed server;
[0023] sending traffic data of the third amount of traffic data to the second distributed server.
[0024] Optionally, the re-deploying the starting of the application program on the first distributed server after detecting that the first distributed server stops running the application program comprises:
[0025] sending a program shutdown instruction to the first distributed server;
[0026] sending a program deployment instruction to the first distributed server when it is detected that the first distributed server has shut down the application program in response to the program shutdown instruction;
[0027] sending a program starting instruction to the first distributed server when it is detected that the first distributed server has completed the deployment operation of the application program in response to the program deployment instruction, the program starting instruction being used to instruct the first distributed server to start the application program.
[0028] Optionally, the obtaining of the memory load of the first distributed server running the application program comprises:
[0029] receiving the memory load sent by the first distributed server, the memory load being obtained by the first distributed server from its own memory proportion periodically and sent to the load balancing device.
[0030] Some embodiments of the present application provide a memory management device, the device comprising:
[0031] a receiving module configured to obtain a memory load of a first distributed server running an application program, wherein the first distributed server is any distributed server in a distributed server cluster, and the application program is deployed on each distributed server in the distributed server cluster respectively;
[0032] a scheduling module, configured to instruct the first distributed server to stop running the application and forward traffic data sent to the first distributed server to a second distributed server when the memory load exceeds the load threshold, wherein the second distributed server is a distributed server in the cluster of distributed servers whose memory load does not exceed the load threshold;
[0033] a deployment module, configured to redeploy the application on the first distributed server after detecting that the first distributed server stops running the application, wherein the first distributed server releases the allocated memory in the first distributed server when the first distributed server stops running the application;
[0034] The scheduling module is further configured to resend the traffic data of the application to the first distributed server.
[0035] Optionally, the scheduling module is further configured to:
[0036] add the first distributed server to a set of available servers;
[0037] allow the traffic data of the application to be distributed to the first distributed server according to the running state of each distributed server in the set of available servers.
[0038] Optionally, the scheduling module is further configured to:
[0039] evaluate a first amount of traffic data that can be carried by the first distributed server according to the running state of each distributed server in the set of available servers and the total amount of traffic data of the application;
[0040] send traffic data not exceeding the first amount of traffic data to the first distributed server.
[0041] Optionally, the scheduling module is further configured to:
[0042] select a target distributed server in the set of available servers whose running state is a healthy running state, wherein the healthy running state represents a running state in which the memory load is less than a preset memory load, and the preset memory load is less than the load threshold;
[0043] equally distribute the total amount of traffic data of the application to each target distributed server to obtain a first amount of traffic data that can be carried by each target distributed server, wherein the target distributed server includes the first distributed server.
[0044] Optionally, the scheduling module is further configured to:
[0045] eliminating the first distributed server from the set of available servers;
[0046] allocating, according to running states of a second set of distributed servers remaining in the set of available servers and a second amount of traffic data that has been allocated to the first distributed server and not processed before the first distributed server is closed, the second amount of traffic data to the second set of distributed servers, to obtain a third amount of traffic data corresponding to each second distributed server;
[0047] sending traffic data of the third amount of traffic data to the second distributed server corresponding to the third amount of traffic data.
[0048] Optionally, the deployment module is further configured to:
[0049] sending a program closing instruction to the first distributed server;
[0050] sending a program deployment instruction to the first distributed server when it is detected that the first distributed server has closed the application in response to the program closing instruction;
[0051] sending a program starting instruction to the first distributed server when it is detected that the first distributed server has completed the deployment operation of the application in response to the program deployment instruction, the program starting instruction being used to instruct the first distributed server to start the application.
[0052] Optionally, the receiving module is further configured to:
[0053] receiving a memory load sent by the first distributed server, the memory load being obtained by the first distributed server by periodically detecting a memory proportion of the first distributed server and sent to the load balancing device.
[0054] Some embodiments of the present application provide a computing processing device, comprising:
[0055] a memory, wherein computer readable code is stored in the memory;
[0056] one or more processors, when the computer readable code is executed by the one or more processors, the computing processing device performs the memory management method as described above.
[0057] Some embodiments of the present application provide a computer readable medium storing computer readable code, when the computer readable code is run on a computing processing device, causing the computing processing device to perform the memory management method as described above.
[0058] The application provides a memory management method and device, electronic equipment and readable medium, a distributed environment capable of running an application program and containing as many servers as possible is constructed, and then traffic data of the application program is forwarded from a current server that has exceeded a memory threshold to other distributed servers in a timely manner according to a memory usage ratio of the current server and the other distributed servers, so that an application program pause problem caused by memory resource management is solved from an architecture deployment level.
[0059] The above description is only a summary of the technical solutions of the application, in order to more clearly understand the technical means of the application, the specific embodiments of the application can be implemented according to the content of the description, and in order to make the above and other purposes, characteristics and advantages of the application more obvious and easy to understand, the following specific embodiments of the application are described. BRIEF DESCRIPTION OF DRAWINGS
[0060] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0061] Figure 1 The flowchart of the memory management method provided by the embodiment of the application is schematically shown;
[0062] Figure 2 The flowchart of another memory management method provided by the embodiment of the application is schematically shown;
[0063] Figure 3 The flowchart of another memory management method provided by the embodiment of the application is schematically shown;
[0064] Figure 4 The flowchart of another memory management method provided by the embodiment of the application is schematically shown;
[0065] Figure 5 The flowchart of another memory management method provided by the embodiment of the application is schematically shown;
[0066] Figure 6 The system flowchart of the memory management method provided by the embodiment of the application is schematically shown;
[0067] Figure 7 The structure diagram of the memory management device provided by the embodiment of the application is schematically shown;
[0068] Figure 8A block diagram of a computing processing device for performing the method according to an embodiment of the present disclosure is schematically shown;
[0069] Figure 9 A storage unit for holding or carrying program code implementing the method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0070] 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 described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0071] Figure 1 A flowchart of a memory management method provided by an embodiment of the present application is schematically shown, including the following steps:
[0072] In step 101, the memory load of a first distributed server running an application program is obtained, wherein the first distributed server is any distributed server in a distributed server cluster, and the application program is deployed on each distributed server in the distributed server cluster respectively.
[0073] It should be noted that the traditional program design language needs to be manually managed by the developer, such as malloc and free in C language, and the development steps are more cumbersome and very easy to cause memory resource leakage. Most modern program design languages provide an automatic memory management mechanism, that is, the developer does not have to write code to perform memory management tasks when writing an application program, and the automatic memory management can solve common problems, such as forgetting to release objects and causing memory leakage, or trying to access the memory of the released object. The underlying mechanism of such automatic memory management mechanism relies on a garbage collector (GC for short, hereinafter referred to as GC), and each language runtime has its own GC implementation algorithm, but the principles are similar. Since releasing memory must execute the program code of the GC algorithm module, this determines that they will inevitably cause the pause of program code execution, in other words, during the execution of GC, the program will be temporarily stopped and will not respond to any request from the user, thereby affecting the user's use, and further affecting the corresponding business process and business effect. The present application is from the architecture design and deployment level rather than the GC algorithm itself, to completely avoid the inevitable pause in the running process of the GC algorithm.
[0074] In the embodiments of the present application, the system can be a distributed environment for running an application, which contains as many distributed servers as possible, and the memory configurations of these servers are as large as possible (for example, 128 GB, 256 GB, 512 GB or more, which are not limited here) under the allowed conditions, and the collection of these distributed servers is the distributed server cluster. The system environment also includes a traffic load balancing device, which can be connected to all servers in the distributed environment at the network level. The traffic load balancing device can be installed on any server or separately arranged.
[0075] In the embodiments of the present application, the first distributed server can be any distributed server in the distributed server cluster, which continuously sends its memory usage ratio to the traffic load balancing device, and can also include more data, such as memory growth rate, to facilitate the load balancing device to make more accurate judgments. When the first distributed server sends a message to the load balancing device, it can use a conventional HTTP (Hyper Text Transfer Protocol) request communication method or implement a TCP (Transmission Control Protocol) based communication protocol by itself, and the message content can include the local IP address, the current date and time, the current memory usage ratio, the current memory growth rate, etc.
[0076] Step 102, when the memory load exceeds the load threshold, instructing the first distributed server to stop running the application, and forwarding the traffic data sent to the first distributed server to the second distributed server, wherein the second distributed server is a distributed server in the distributed server cluster whose memory load does not exceed the load threshold.
[0077] It should be noted that the memory load refers to the usage ratio of the memory in the distributed server, and the load threshold is determined based on the maximum memory usage ratio that will not affect the smoothness of program execution, which can be a value smaller than or approaching the maximum memory usage ratio. The distributed environment also has a program scheduling device, which can remotely deploy, start or stop the application on any server, and can detect whether the application exits.
[0078] In the embodiment of the present application, when the memory usage ratio of the first distributed server exceeds the originally preset load threshold, the degree scheduling device instructs the first distributed server to stop running the application program or the first distributed server actively stops running the application program, so that subsequent traffic data is no longer forwarded to the current server, i.e., the first distributed server, and the traffic data that has been allocated to the first distributed server but not processed by the first distributed server is forwarded to a second distributed server in the distributed server cluster whose memory load does not exceed the load threshold, so that the second distributed server continues to process the traffic data. The application program can also monitor the memory ratio used by itself in real time during execution, and when the ratio reaches a certain preset threshold, the application program actively notifies the load balancing device that subsequent traffic data is no longer forwarded to the first distributed server. By sending the traffic data of the application program to other servers in time when the memory usage ratio of the first distributed server is higher than the preset load threshold at which the application program will be paused, the pause problem of the application program is avoided from the hardware level, and there is no need to perform the GC algorithm.
[0079] Step 103, after detecting that the first distributed server stops running the application program, redeploying and starting the application program on the first distributed server, wherein the first distributed server releases the allocated memory in the first distributed server when stopping running the application program.
[0080] In the embodiment of the present application, when the program scheduling device detects that the application program exits, the memory will also be released accordingly, and the system can control the first distributed server to redeploy and start the application program. After redeploying the application program, the first distributed server releases the memory, so that the memory load is theoretically reduced to below the load threshold, so that the first distributed server re-meets the hardware requirements for processing the traffic data of the application program.
[0081] Step 104, re-sending the traffic data of the application program to the first distributed server.
[0082] In the embodiment of the present application, after redeploying and starting the application program on the first distributed server, the application program notifies the load balancing device that the application program has been started. When the load balancing device determines that the memory load of the first distributed server is below the load threshold, the IP of the first distributed server is added to the IP set for forwarding and processing the traffic data of the application program, so that the traffic data of the application program can be redistributed and sent to the first distributed server in subsequent allocation and sending of traffic data, so that the first distributed server can start processing the traffic data again when the memory load is below the load threshold.
[0083] Embodiments of the present application construct a distributed environment that can run an application program and contains as many servers as possible, and then according to the memory usage ratio of a currently used server and other available distributed servers, timely forward traffic data of the application program from the current server that has exceeded a memory threshold to the other distributed servers, thereby solving the application program pause problem caused by memory resource management from the architecture deployment level.
[0084] Optionally, step 104, as shown in Figure 2 , includes:
[0085] Step 1041, adding the first distributed server to the available server set.
[0086] In embodiments of the present application, since the first distributed server releases the related memory resources when stopping the application program, its running state naturally becomes better, and can be used again as a server that receives the traffic data of the application program, so the first distributed server that has stopped the application program and released the memory is added to the available server set.
[0087] Step 1042, according to the running state of each distributed server in the available server set, allowing the traffic data of the application program to be distributed and sent to the first distributed server.
[0088] It should be noted that since the first distributed server has released the memory and is added to the available server set, the traffic data of the application program will be sent to the first distributed server again, that is, the first distributed server in a healthy state can be selected from the available server set for the traffic data distribution operation of the application program, and the first distributed server can be any server in the available server set when initially selected.
[0089] In embodiments of the present application, by adding the first distributed server that has stopped the application program and released the memory to the available server set, the number of distributable servers is increased, so that the entire system operates more smoothly and the total traffic data that can be carried is increased.
[0090] Optionally, step 1042, as shown in Figure 3 , includes:
[0091] Step 1042A, according to the running state of each distributed server in the available server set and the total traffic data amount of the application program, evaluating a first traffic data amount of the first distributed server that can carry the traffic data.
[0092] It should be noted that the total traffic data amount of the application program is evenly distributed to each server, and according to the running state of each distributed server and the total traffic data amount of the application program, the first traffic data amount that can be carried by the first distributed server can be known, wherein if the remaining traffic data amount of the application program after distribution is greater than the first traffic data amount, the first traffic data amount corresponds to the memory threshold of the first distributed server, and if the remaining traffic data amount of the application program after distribution is less than the first traffic data amount, the first traffic data amount corresponds to the remaining traffic data amount of the application program after distribution.
[0093] In the embodiment of the application, the memory usage proportion of each server in the set of available servers is monitored, and based on the total traffic data amount of the application program, the first traffic data amount that can be carried by the first distributed server is calculated under the condition that the traffic data received by the first distributed server does not cause the memory load to exceed the preset memory load threshold.
[0094] Step 1042B, traffic data not exceeding the first traffic data amount is sent to the first distributed server.
[0095] In the embodiment of the application, after the first traffic data amount is known, traffic data not exceeding the first traffic data amount is sent to the first distributed server.
[0096] In the embodiment of the application, by evaluating the traffic data amount that can be carried by the first distributed server, reasonable low traffic distribution is realized, so that the server runs smoothly and the application program does not stop.
[0097] Optionally, step 1042A includes:
[0098] 1042A1, filtering out a target distributed server with a healthy running state from the set of available servers, wherein the healthy running state is used to represent a running state in which the memory load is less than a preset memory load, and the preset memory load is less than the memory load threshold.
[0099] 1042A2, evenly distributing the total traffic data amount of the application program to each target distributed server to obtain a first traffic data amount of traffic data that can be carried by each target distributed server, wherein the target distributed server includes the first distributed server.
[0100] In the embodiments of the present application, the healthy running state refers to that the memory usage ratio of the server is less than the full load running state, i.e., the memory usage ratio is less than the preset memory load, the preset memory load is set based on the hardware configuration condition of the specific server, and the preset memory load is less than the memory load threshold. Then, in the server in the healthy state, i.e., the target distributed server, the total traffic data of the application program is evenly distributed based on the principle that the fluency of the server running will not be affected, so that the application program will not have a pause phenomenon when running on the distributed server.
[0101] Optionally, step 102, as shown in the figure, includes the following steps. Figure 4
[0102] Step 1021: Eliminate the first distributed server from the set of available servers.
[0103] In the embodiments of the present application, since the memory load of the first distributed server exceeds the preset memory load threshold, the first distributed server is eliminated from the set of available servers.
[0104] Step 1022: According to the running state of the remaining second distributed server set in the set of available servers and the amount of second traffic data that has been allocated to the first distributed server but not processed before the first distributed server is closed, the second traffic data is allocated to the second distributed server set, to obtain a third traffic data amount corresponding to each second distributed server.
[0105] It should be noted that the amount of traffic data indicates the size of the traffic data, which indicates the amount of memory to be occupied by the traffic data. For example, the first traffic data amount can be 1G, 1T, or 1MB.
[0106] Since the first distributed server will be closed after accepting the first traffic data exceeding the memory load threshold of the first distributed server, the traffic data that has been allocated to the first distributed server but not processed subsequently due to the server being closed will be sent to other available distributed servers, i.e., the servers in the second distributed server set. The subsequent traffic data is the second traffic data. In the case where the content load of each second distributed server does not exceed the load threshold, the system divides the second traffic data according to the memory load of each second distributed server, to obtain the part of the second traffic data amount that each second distributed server needs to share, i.e., the third traffic data amount.
[0107] In the embodiments of the present application, the second traffic data that should be borne by the first distributed server after being closed is allocated to the remaining second distributed servers in the set of available data, to obtain a third traffic data amount corresponding to each second distributed server.
[0108] Step 1023 sends the traffic data matched with the third traffic data volume to the second distributed server.
[0109] In the embodiment of the present application, the traffic data matched with the third traffic data volume is sent to each second distributed server, so that each second distributed server shares the traffic data, avoiding the pause of the application during running.
[0110] Optionally, step 103, as shown in the figure, includes: Figure 5
[0111] Step 1031 sends a program closing instruction to the first distributed server.
[0112] In the embodiment of the present application, the application program notifies the load balancing device that the proportion of memory used by the load balancing device reaches the preset threshold, and the load balancing device sends a program closing instruction to the first distributed server.
[0113] Step 1032 sends a program deployment instruction to the first distributed server when it is detected that the first distributed server has closed the application program in response to the program closing instruction.
[0114] In the embodiment of the present application, after the closing instruction is detected, the program deployment instruction is sent to the first distributed server again because the memory is also released at the same time.
[0115] Step 1033 sends a program starting instruction to the first distributed server when it is detected that the first distributed server has completed the deployment operation of the application program in response to the program deployment instruction, and the program starting instruction is used to instruct the first distributed server to start the application program.
[0116] In the embodiment of the present application, after the program deployment instruction is received and the deployment operation is completed, the program starting instruction is sent to the first distributed server, which is used to start the application program.
[0117] Optionally, step 101 includes receiving the memory load sent by the first distributed server, and the memory load is obtained by the first distributed server periodically detecting the proportion of memory used by itself and sent to the load balancing device.
[0118] It should be noted that the memory load is the proportion of memory used, and the first distributed server will periodically detect the proportion of memory used by itself and send the proportion of memory used to the load balancing device, so that the load balancing device can timely schedule each distributed server to perform corresponding closing, deployment, starting and other operations.
[0119] In the embodiments of the present application, the first distributed server periodically detects the memory usage ratio of itself and sends the information to the load balancing device, facilitating timely replacement of available servers.
[0120] Figure 6 A system flowchart of a memory management method provided by the present application is schematically shown:
[0121] In the embodiments of the present application, processes 1 and 2 are performed simultaneously, process 1 is performed by the traffic load balancing device, the traffic load balancing device receives a normal service request, the normal service request is subsequently regarded as data traffic, and the traffic data is distributed and sent to each available distributed server according to the health status of the available distributed servers. In this process, the traffic load balancing device detects whether the memory load of the occupied memory of each distributed server exceeds the load threshold, and if it exceeds, the IP of the distributed server is automatically removed from the set of available distributed servers, and then the distributed server is taken over by process 2.
[0122] Process 2 is performed by the program scheduling device, which instructs the distributed server to close the application program to release the memory, and then the program scheduling device detects whether the application program on the distributed server has exited, if not, it will instruct again and wait for exit, if the application program on the distributed server has exited, it will continue to instruct the distributed server to redeploy and start the application program, and continuously detect whether the distributed server has started the application program. After the application program has been restarted on the distributed server, the program scheduling device will notify the traffic balancing device to re-add the IP of the distributed server to the set of available distributed servers, and the distributed server will be taken over by the traffic load balancing device, and the distributed server will exit process 2 and join process 1.
[0123] Figure 7 A structural schematic diagram of a memory management device 30 provided by the present application is schematically shown, the device comprises:
[0124] The receiving module 301 is configured to obtain the memory load of a first distributed server running an application program, wherein the first distributed server is any distributed server in a distributed server cluster, and each distributed server in the distributed server cluster respectively deploys the application program;
[0125] The scheduling module 302 is configured to instruct the first distributed server to stop running the application program when the memory load exceeds the load threshold, and to schedule and forward the traffic data sent to the first distributed server to a second distributed server, wherein the second distributed server is a distributed server in the distributed server cluster whose memory load does not exceed the load threshold;
[0126] deploying a module 303, configured to re-deploy the application on the first distributed server after detecting that the first distributed server stops running the application, wherein the first distributed server releases allocated memory in the first distributed server when the first distributed server stops running the application;
[0127] The scheduling module 302 is further configured to re-send the traffic data of the application to the first distributed server.
[0128] Optionally, the scheduling module 302 is further configured to:
[0129] add the first distributed server to a set of available servers;
[0130] allow the traffic data of the application to be distributed to the first distributed server according to the running state of each distributed server in the set of available servers.
[0131] Optionally, the scheduling module 302 is further configured to:
[0132] evaluate a first amount of traffic data that can be carried by the first distributed server according to the running state of each distributed server in the set of available servers and the total amount of traffic data of the application;
[0133] send traffic data not exceeding the first amount of traffic data to the first distributed server.
[0134] Optionally, the scheduling module 302 is further configured to:
[0135] select a target distributed server having a healthy running state from the set of available servers, wherein the healthy running state represents a running state in which the memory load is less than a preset memory load, and the preset memory load is less than the memory load threshold;
[0136] equally distribute the total amount of traffic data of the application to each target distributed server to obtain a first amount of traffic data that can be carried by each target distributed server, wherein the target distributed server includes the first distributed server.
[0137] Optionally, the scheduling module 302 is further configured to:
[0138] eliminate the first distributed server from the set of available servers;
[0139] According to a running state of a second remaining distributed server set in the available server set and a second traffic data amount that has been allocated to the first distributed server and not processed before the first distributed server is closed, the second traffic data amount is allocated to the second remaining distributed server set, so as to obtain a third traffic data amount corresponding to each second distributed server;
[0140] The traffic data of the third traffic data amount is sent to the second distributed server.
[0141] Optionally, the deployment module 303 is further configured to:
[0142] send a program closing instruction to the first distributed server;
[0143] send a program deployment instruction to the first distributed server when it is detected that the first distributed server has closed the application program in response to the program closing instruction;
[0144] send a program starting instruction to the first distributed server when it is detected that the first distributed server has completed the deployment operation of the application program in response to the program deployment instruction, and the program starting instruction is used to instruct the first distributed server to start the application program.
[0145] Optionally, the receiving module 301 is further configured to:
[0146] receive a memory load sent by the first distributed server, and the memory load is obtained by the first distributed server according to a periodic detection of a memory proportion of itself and sent to the load balancing device.
[0147] In the embodiments of the present application, a distributed environment that can run an application program and contains as many servers as possible is constructed, and then according to a memory usage proportion of a currently used server and other available distributed servers, the traffic data of the application program is forwarded from the current server that has exceeded a memory threshold to the other distributed servers in time, so as to solve the application program pause problem caused by the management of memory resources from the architecture deployment level.
[0148] The apparatus embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or distributed on multiple network units. According to actual needs, part or all of the modules can be selected to achieve the purpose of the embodiments. Those skilled in the art can understand and implement without creative labor.
[0149] The various component embodiments of this disclosure can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the computing processing device according to embodiments of this disclosure. This disclosure can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing some or all of the methods described herein. Such an implementation of this disclosure can be stored on a computer-readable medium or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0150] For example, Figure 8 A computing processing apparatus is shown that can implement the methods according to this disclosure. The computing processing apparatus conventionally includes a processor 410 and a computer program product or computer-readable medium in the form of a memory 420. The memory 420 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. The memory 420 has a storage space 430 for program code 431 for performing any of the method steps described above. For example, the storage space 430 for program code may include various program codes 431 respectively for implementing the various steps in the methods described above. These program codes can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, CDs, memory cards, or floppy disks. Such computer program products are typically as described in the references. Figure 9 The portable or fixed storage unit is described above. This storage unit may have the same characteristics as... Figure 8 The memory 420 in the computing processing device is similarly arranged as storage segments, storage spaces, etc. Program code can be compressed, for example, in an appropriate form. Typically, the storage unit includes computer-readable code 431', that is, code that can be read by a processor such as 410, which, when run by the computing processing device, causes the computing processing device to perform the various steps in the methods described above.
[0151] It should be understood that, although the steps in the flowcharts of the drawings are shown in a sequential order, the steps are not necessarily performed in the order shown by the arrows. Unless explicitly stated otherwise, the steps can be performed in other orders. Moreover, at least some of the steps in the flowcharts of the drawings can include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but can be performed at different times, and which are not necessarily performed sequentially, but can be performed alternately or in rotation with at least some of the steps or sub-steps or stages of other steps.
[0152] As used in this description, the terms "one embodiment", "an embodiment” or "one or more embodiments” mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the disclosure. The appearances of the phrase "in one embodiment” in various places in this description are not necessarily all referring to the same embodiment.
[0153] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the disclosure can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
[0154] In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising” does not exclude the presence of elements or steps other than those listed in a claim. The word "a” or "an” preceding an element does not exclude the presence of a plurality of such elements. The disclosure can be implemented by means of both hardware and software, and any combination thereof. In a unit claim, several devices can be listed with a comma. The use of "first”, "second”, "third”, etc. does not limit the number of devices. These designations are merely used as names for elements.
[0155] It should be noted that the above-mentioned embodiments are merely used to illustrate the technical solutions of the present disclosure, rather than limit the present disclosure; although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A memory management method characterized by comprising: The method comprises: acquiring a memory load of a first distributed server running an application, wherein the first distributed server is any distributed server in a distributed server cluster, and the application is deployed on each distributed server in the distributed server cluster respectively; when the memory load exceeds a load threshold, instructing the first distributed server to stop running the application, removing the first distributed server from a set of available servers, and forwarding traffic data sent to the first distributed server to a second distributed server, wherein the second distributed server is a distributed server in the distributed server cluster whose memory load does not exceed the load threshold; after detecting that the first distributed server stops running the application, redeploying the first distributed server to start the application, wherein the first distributed server releases allocated memory in the first distributed server while stopping running the application; adding the first distributed server to the set of available servers; selecting a target distributed server in a healthy running state from the set of available servers, wherein the healthy running state represents a running state in which a memory load is less than a preset memory load, and the preset memory load is less than the memory load threshold; according to running states of each distributed server in the set of available servers, allowing traffic data of the application to be sent to the first distributed server to avoid application downtime caused by managing memory resources at an architecture deployment level.
2. The method of claim 1, wherein, The allowing, according to the running states of each distributed server in the set of available servers, the traffic data of the application to be sent to the first distributed server comprises: evaluating a first amount of traffic data that can be carried by the first distributed server according to the running states of each distributed server in the set of available servers and a total amount of traffic data of the application; sending traffic data not exceeding the first amount of traffic data to the first distributed server.
3. The method of claim 2, wherein, The evaluating a first amount of traffic data that can be carried by the first distributed server according to the running states of each distributed server in the set of available servers and a total amount of traffic data of the application comprises: equally distributing the total amount of traffic data of the application to each target distributed server to obtain a first amount of traffic data that can be carried by each target distributed server, wherein the target distributed server includes the first distributed server.
4. The method of claim 1, wherein, The forwarding the traffic data sent to the first distributed server to a second distributed server comprises: according to running states of a set of remaining second distributed servers in the set of available servers and a second amount of traffic data that has been allocated to the first distributed server but not processed before being closed, allocating the second amount of traffic data to the set of second distributed servers to obtain a third amount of traffic data corresponding to each second distributed server; Correspondingly send the third amount of traffic data to the second distributed server.
5. The method of claim 1, wherein, The re-deploying and starting the application on the first distributed server after detecting that the first distributed server stops running the application comprises: sending a program closing instruction to the first distributed server; sending a program deployment instruction to the first distributed server when detecting that the first distributed server has closed the application in response to the program closing instruction; sending a program starting instruction to the first distributed server when detecting that the first distributed server has completed the deployment operation of the application in response to the program deployment instruction, the program starting instruction being used to instruct the first distributed server to start the application.
6. The method of claim 1, wherein, The obtaining of the memory load of the first distributed server running the application comprises: receiving the memory load sent by the first distributed server, the memory load being obtained by the first distributed server from its own memory proportion periodically and sent to the load balancing device.
7. A memory management device, characterized by The device comprises: a receiving module, configured to obtain a memory load of a first distributed server running an application, wherein the first distributed server is any distributed server in a distributed server cluster, and each distributed server in the distributed server cluster has the application deployed thereon respectively; a scheduling module, configured to instruct the first distributed server to stop running the application when the memory load exceeds a load threshold, to eliminate the first distributed server from an available server set, and to schedule and forward traffic data sent to the first distributed server to a second distributed server, wherein the second distributed server is a distributed server in the distributed server cluster whose memory load does not exceed the load threshold; a deployment module, configured to re-deploy and start the application on the first distributed server after detecting that the first distributed server stops running the application, wherein the first distributed server releases the allocated memory in the first distributed server when stopping running the application; The scheduling module is further configured to add the first distributed server to the available server set, to filter a target distributed server in a healthy running state from the available server set, wherein the healthy running state is used to represent a running state in which the memory load is less than a preset memory load, and the preset memory load is less than the memory load threshold, and to allow the traffic data of the application to be distributed and sent to the first distributed server according to the running states of the distributed servers in the available server set, so as to avoid application pause caused by management of memory resources from an architecture deployment level.
8. A computing processing device, comprising: comprise: a memory in which computer readable code is stored; one or more processors, when the computer readable code is executed by the one or more processors, the computing device performs the memory management method according to any one of claims 1-6.
9. A computer readable medium characterized by storing computer readable code which, when run on a computing processing device, causes the computing processing device to perform the memory management method as claimed in any one of claims 1-6.
Citation Information
Patent Citations
Optimizing memory management of an application running on a virtual machine
US20120137101A1
Dynamic Server Farms
US20130111467A1