CN103870315B - A kind of JVM consumption control methods and device - Google Patents

A kind of JVM consumption control methods and device Download PDF

Info

Publication number
CN103870315B
CN103870315B CN201410117546.5A CN201410117546A CN103870315B CN 103870315 B CN103870315 B CN 103870315B CN 201410117546 A CN201410117546 A CN 201410117546A CN 103870315 B CN103870315 B CN 103870315B
Authority
CN
China
Prior art keywords
memory
jvm
virtualized
mapping table
energy consumption
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410117546.5A
Other languages
Chinese (zh)
Other versions
CN103870315A (en
Inventor
王少锋
张云勇
陶冶
张尼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN201410117546.5A priority Critical patent/CN103870315B/en
Publication of CN103870315A publication Critical patent/CN103870315A/en
Application granted granted Critical
Publication of CN103870315B publication Critical patent/CN103870315B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Memory System (AREA)

Abstract

The invention discloses the internal memory garbage reclamation situation in a kind of JVM consumption control methods and device, including monitoring JVM, to obtain the memory usage information of JVM;When JVM internal memories are idle, its corresponding physical memory is closed.The present invention is using using existing internal memory garbage reclamation mechanism in JVM, and according to the difference of Same Physical memory device energy consumption expense under resting state and idle condition, when JVM internal memories are idle, it is resting state to change corresponding physical memory state, simply and efficiently control the energy consumption problem with calculating platform, system energy consumption is effectively reduced, the purpose of energy consumption of memory is reduced so as to reach.

Description

JVM energy consumption control method and device
Technical Field
The invention relates to a computer information processing technology, in particular to a method and a device for controlling energy consumption of a Java Virtual Machine (JVM) in a cloud computing platform.
Background
Cloud computing, as a novel computing method, has rapidly become a research hotspot in academic circles and industrial circles due to its advantages of high scalability, high availability, and the like. With the rapid development of cloud computing, the number and the scale of data centers are also rapidly increased, and the problem of energy consumption is more prominent. From 2005 to 2010, data centers around the globe have increased by about 56%. It is estimated that a data center with 50000 computing nodes consumes more than 1 hundred million kilowatt-hours per year. High energy consumption has become a major problem of cloud computing systems, and with the recent increasing expansion of cloud computing scale, the energy consumption overhead is also increasing. Energy consumption management in cloud computing platforms has become one of the most challenging research topics.
According to the operation statistical data of the cloud platform, the electric energy consumption is mainly distributed in the following three aspects: the IT main equipment such as a Java virtual machine is used for about 45% -55%; the electricity utilization of the machine room environment mainly comprises machine room illumination, air-conditioning refrigeration, heating and the like, wherein the electricity utilization of the air conditioner is more than about 40% of the total electricity consumption; the power system power usage is close to 10% of the total power usage. At present, in many researches for realizing the purposes of energy conservation and emission reduction, the adopted operation measures mainly focus on two aspects of electricity utilization of a machine room environment and electricity utilization of a power supply system, and an effective control means is lacked for the electricity utilization of IT main equipment. And according to the empirical data, the energy consumption of one unit IT main device is reduced, which is equivalent to the reduction of the energy consumption of 2-3 unit environment systems, so that the key point of reducing the overall energy consumption index is to control the electricity consumption of the IT main device.
At present, aiming at the energy consumption problem of a cloud computing platform, various methods are proposed at home and abroad, and the methods generally comprise the following steps:
one is a Dynamic Voltage Scaling (DVS) method. DVS technology is primarily directed to voltage/frequency adjustable IT devices such as processors. In the case of accomplishing the same task, the energy consumption of IT equipment is low when IT is stabilized at a low frequency. System power consumption may be reduced if the performance requirements of the tasks can be met at a lower processor frequency. The key to the DVS approach is to correctly predict the workload demands on the IT devices and reasonably allocate quotas, which is difficult to implement.
Another is a dynamic power management technique. Many components in a cloud computing system, such as disk drives, communication network cards, memory, etc., have multiple Power consumption modes, and such components are also referred to as Power Management Components (PMC). Experimental observations have found that many components of a computer system are idle most of the time. Generally, the PMC sleep mode has much lower power consumption than the run mode, and the system can reduce the power consumption of the PMC idle time by setting the idle PMC to the low power sleep mode. The key problem of this method is to solve how to know when the system component is in an idle state, i.e. to design an additional memory monitoring mechanism, which increases the complexity of the system.
Yet another is a resource scheduling algorithm. The cloud computing platform integrates various computing resources, storage resources and network resources to form a resource pool. Energy consumption of different resources is usually different, and a poor resource scheduling mode enables tasks which can be executed by using resources with lower energy consumption to call resources with high energy consumption, which is one of the reasons for forming high energy consumption of the cloud computing system. Therefore, the energy consumption of the resources can be reduced by reasonably distributing and scheduling the resources, but because the resources are various and large in scale, the tasks and the resources are often in a many-to-many relationship, and certain difficulty is brought to the scheduling of the resources. At present, no good resource scheduling solution is proposed.
Disclosure of Invention
In order to solve the technical problems, the invention provides a JVM energy consumption control method and a JVM energy consumption control device, which can simply and efficiently control the energy consumption of a cloud computing platform and effectively reduce the energy consumption of a system.
In order to achieve the purpose of the invention, the invention provides a consumption control method of a JVM Java virtual machine, which comprises the following steps:
monitoring the memory garbage collection condition in the JVM to acquire the memory use information of the JVM;
and when the memory of the JVM is idle, closing the corresponding physical memory of the JVM.
For each JVM in the JVM cluster where the JVM is located, the method further includes, before:
initializing a system, and closing the unused physical memory;
initializing a virtualized memory mapping table for storing a mapping relation between a JVM memory and a virtualized memory, and a physical memory mapping table for storing a mapping relation between a virtualized memory and a physical memory; acquiring virtual machine IDs of all JVMs;
and setting a memory monitoring time interval T and an old area memory idle allowable threshold value V.
The acquiring memory use information in the JVM includes:
monitoring the memory garbage collection condition in the JVM according to a preset time interval T to acquire JVM memory use information corresponding to the virtual machine IDs of all JVMs in the JVM cluster;
the JVM memory usage information at least comprises the type and time of garbage collection, the used proportion of the memory of the old generation, the residual size of the memory of the old generation, the garbage fragment ratio and other related information.
The determining whether the JVM is idle comprises:
putting all virtual machine IDs in the JVM cluster into a queue Q, giving a value of a queue head element in the queue Q to a variable v, and determining that a memory of the JVM is free when judging that the JVM corresponding to the variable v does not perform secondary garbage collection minor GC and the JVM corresponding to the variable v performs global garbage collection Full GC;
the method further comprises the following steps: and updating the physical memory mapping table.
Before closing the physical memory corresponding to the JVM free memory, the method further includes: and removing the memory garbage fragments, closing the physical memory blocks by moving the virtualized memory, and updating the virtualized memory mapping table.
If the JVM corresponding to the variable v is judged to have undergone minor GC and an object enters the old age from the new age, acquiring the used proportion r of the memory of the old age and the current residual space size S of the old age;
the method further comprises the following steps: and when the size of the current residual space of the old age generation is smaller than a preset old age area memory idle allowable threshold, converting the state of the physical memory block in the dormant state into an enabling state.
Before the physical memory block in the sleep state is converted into the enabled state, the method further includes: and moving the virtualized memory and updating the virtualized memory mapping table.
When the JVM corresponding to the variable v is judged to have performed minor GC, but no object enters the old from the new generation; or when the size of the current residual space of the old age generation is judged to be not smaller than a preset memory free allowable threshold of the old age area; or when the JVM corresponding to the variable v is judged to have performed the minorGC, but the JVM corresponding to the variable v does not perform the Full GC; or, under the condition that the size of the current residual space of the old age group is smaller than a preset old age area memory idle allowable threshold, after the virtualized memory mapping table is updated; or after the physical memory mapping table is updated; or when no physical memory block can be closed when judging that the JVM corresponding to the variable v does not perform minor GC and the JVM corresponding to the variable v performs Full GC; the method further comprises the following steps:
and judging whether the polling of the JVMs in the JVM cluster is finished, if not, continuing to monitor the next JVM in the JVM cluster until the polling of the JVMs in the JVM cluster is finished.
The invention also provides a JVM energy consumption control device, which at least comprises a memory garbage monitoring unit, a virtualized memory management unit and a processing unit, wherein,
the memory garbage monitoring unit is used for monitoring the memory garbage recycling condition of the JVM in the JVM cluster and sending the memory use information of the JVM to the virtualized memory management unit;
the virtualized memory management unit is used for moving the virtualized memory and updating the virtualized memory mapping table when the virtualized memory can be processed according to the received JVM memory use information; when the self cannot process, notifying a processing unit; managing a virtualized memory mapping table and a physical memory mapping table stored by the processing unit according to the feedback information from the processing unit;
and the processing unit is used for receiving the notification from the virtualized memory management unit, controlling the state change of the physical memory, including state control between a dormant state and a starting state, and feeding back the processed information to the virtualized memory management unit.
The memory garbage monitoring unit is specifically configured to obtain, according to a preset time interval T, JVM memory use conditions corresponding to virtual machine IDs of all JVMs in a JVM cluster, place all the virtual machine IDs in a queue Q, and assign a value of a head element in the queue Q to a variable v; when judging that the JVM corresponding to the variable v has carried out minor GC and an object enters the old from the new generation, acquiring the used proportion r of the memory of the old and the current residual space size S; when the current residual space S is smaller than the memory free allowable threshold V of the old area, sending a first notice to the virtualized memory management unit; if the JVM corresponding to the variable v is judged not to perform minor GC and the JVM corresponding to the variable v performs global GC, removing memory garbage fragments and sending a third notification to the virtualized memory management unit;
the virtualized memory management unit is specifically configured to receive a first notification from the memory garbage monitoring unit, determine that the virtualized memory can be solved by itself through the virtualized memory, move the virtualized memory, and update the virtualized memory mapping table; if the processing unit judges that the processing unit can not solve the problem through the virtualized memory, a second notice is sent to the processing unit; receiving a third notice from the memory garbage monitoring unit, judging that the physical memory block can be closed by moving the virtualized memory, and moving the virtualized memory and updating a virtualized memory mapping table; judging that a physical memory block can be closed, and sending a fourth notification to the processing unit;
the processing unit is specifically configured to receive a second notification from the virtualized memory management unit, convert the state of the physical memory block in the dormant state into a enabled state, and notify the virtualized memory management unit to update the physical memory mapping table; receiving a fourth notification from the virtualized memory management unit, converting the idle memory block from a enabled state to a dormant state, and notifying the virtualized memory management unit to update the physical memory mapping table.
Compared with the prior art, the method and the device only need to monitor the memory garbage recycling condition in the JVM to acquire the memory use information of the JVM; and when the memory of the JVM is idle, closing the corresponding physical memory of the JVM. The invention utilizes the existing memory garbage recycling mechanism in the JVM and converts the corresponding physical memory state into the dormant state when the memory of the JVM is idle according to the difference of the energy consumption overhead of the same physical memory device in the dormant state and the idle state, thereby simply and efficiently controlling the energy consumption problem of a computing platform, effectively reducing the energy consumption of the system and further achieving the aim of reducing the energy consumption of the memory.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the example serve to explain the principles of the invention and not to limit the invention.
FIG. 1 is a schematic diagram of a component structure of a JVM energy consumption control apparatus according to the present invention;
FIG. 2 is a flow chart of the JVM energy consumption control method of the present invention;
FIG. 3 is a flowchart of an embodiment of a JVM energy consumption control method of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
The steps illustrated in the flow charts of the figures may be performed in a computer system such as a set of computer-executable instructions. Also, while a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.
For the energy consumption of the cloud computing platform, a large part of the energy consumption is consumed on devices, including CPUs, memories, disk devices, network devices, and the like, and for the physical devices, there may be states of off, sleep, idle, work, and the like, where the energy consumption in the off state and the sleep state is far lower than the energy consumption in the idle state and the work state. For the memory, converting the state of the free memory subblock into the dormant state is the most direct method for reducing power consumption.
The memory of a Java Virtual Machine (JVM) is divided into a method area, a stack, a heap, a register, and the like, and the JVM mainly performs a memory Garbage Collection (GC) on the part of the memory of the heap. Currently, garbage Collection in commercial JVMs mostly employs a Generational Collection (Generational Collection) algorithm. The generation-based algorithm divides the heap into two or more objects, the objects are grouped according to lifetime, and each sub-heap serves a "generation" of objects. The garbage collector will collect these objects from the youngest sub-heap (this sub-heap is called the new generation), and if an object survives several garbage collections, it will grow into a generation with a higher lifetime, and when a preset lifetime threshold is exceeded, it will be transferred to another sub-heap (this sub-heap is called the old generation).
The generation-based garbage recycling algorithm comprises secondary garbage recycling (minor GC) and global garbage recycling (fullGC), wherein the minor GC mainly recycles the memory garbage of the new generation, and transfers the object reaching a certain life cycle to the old generation, and the frequency of the minor GC is high; and full GC simultaneously recovers the memory garbage of the new generation and the old generation.
According to practical application of Java, the inventor finds that, for a Java application system, when there is a lot of memory in the old generation memory for a long time, the JVM hardly performs global memory garbage collection, or the time interval for performing global memory garbage collection is long, and the like, and at this time, the inventor thinks that the part of memory can be switched to a dormant state, so as to reduce system energy consumption.
Fig. 1 is a schematic diagram of a structure of a JVM power consumption control apparatus of the present invention, as shown in fig. 1, which at least includes a memory garbage monitor unit, a virtualized memory management unit, and a processing unit, wherein,
and the memory garbage monitoring unit is used for monitoring the memory garbage recycling condition in the JVM and sending the memory use information of the JVM to the virtualized memory management unit. Specifically, the memory usage of each JVM in the JVM cluster is monitored, and the memory usage information of the JVMs at least includes the type and time of garbage collection, the used proportion of the memory of the older generation, the remaining size of the memory of the older generation, the garbage fragment ratio, and other related information.
The virtualized memory management unit is used for moving the virtualized memory and updating the virtualized memory mapping table when the virtualized memory can be processed according to the received JVM memory use information; when the self cannot process, notifying a processing unit; and managing a virtualized memory mapping table and a physical memory mapping table stored by the processing unit according to the feedback information from the processing unit. Wherein,
the virtual memory mapping table is used for storing the mapping relation between the JVM memory and the virtual memory; the physical memory mapping table is used for storing the mapping relation between the virtualized memory and the physical memory. Virtualized memory refers to virtualized memory resources. Physical memory refers to the physical memory base resources.
And the processing unit is used for receiving the notification from the virtualized memory management unit, controlling the state change of the physical memory, including state control between a dormant state and a starting state, and feeding back the processed information to the virtualized memory management unit.
In particular, the amount of the solvent to be used,
the memory garbage monitoring unit is used for acquiring JVM memory use conditions corresponding to all vmids (used for identifying different JVMs in the JVM cluster) in the JVM cluster according to a preset time interval T, putting all the vmids into a queue Q, assigning the value of a head element in the queue Q to a variable v, and acquiring the used proportion r of the memory of the old age and the current residual space size S when judging that the JVM corresponding to the variable v has performed minor GC and an object enters the old age from the new age; when the current residual space S is smaller than the memory free allowable threshold V of the old area, sending a first notice to a virtualized memory management unit; if the JVM corresponding to the variable v is judged not to perform minor GC and the JVM corresponding to the variable v performs global GC, moving the memory garbage fragments and sending a third notification to the virtualized memory management unit;
the virtualized memory management unit receives the first notification from the memory garbage monitoring unit, judges that the virtualized memory can be solved by the virtualized memory (namely the virtualized memory which is idle by the virtualized memory is larger than the difference value between the idle allowable threshold value V of the old memory and the size S of the residual space in the current year), moves the virtualized memory and updates a virtualized memory mapping table; if the processing unit judges that the processing unit can not solve the problem through the virtualized memory, a second notice is sent to the processing unit; receiving a third notification from the memory garbage monitoring unit, judging that the physical memory block can be closed by moving the virtualized memory (namely judging that the original corresponding physical memory block can be closed after the idle virtualized memory moves after the memory garbage fragments are cleared), and moving the virtualized memory and updating a virtualized memory mapping table; judging that a physical memory block can be closed, and sending a fourth notification to the processing unit;
the processing unit receives a second notification from the virtualized memory management unit, converts the state of the physical memory block in the dormant state into a starting state, and notifies the virtualized memory management unit to update the physical memory mapping table; receiving a fourth notification from the virtualized memory management unit, converting the idle memory block from the enabled state to the dormant state, and notifying the virtualized memory management unit to update the physical memory mapping table.
It should be noted that, when the system is initialized, the physical memory that is not used temporarily is closed; initializing a virtualized memory mapping table and a physical memory mapping table; acquiring virtual machine IDs (vmids) of all JVMs; and setting a memory monitoring time interval T and an old area memory idle allowable threshold value V. The detailed implementation is a matter of routine skill for those skilled in the art, and is not intended to limit the scope of the present invention, which is not described herein.
The device of the invention utilizes the existing memory garbage recycling mechanism in the JVM and converts the corresponding physical memory state into the dormant state when the memory of the JVM is idle according to the difference of the energy consumption overhead of the same physical memory device in the dormant state and the idle state, thereby simply and efficiently controlling the energy consumption problem of a computing platform, effectively reducing the energy consumption of the system and further achieving the purpose of reducing the energy consumption of the memory.
FIG. 2 is a flowchart of a JVM energy consumption control method of the present invention, as shown in FIG. 2, including:
step 200: and monitoring the memory garbage collection condition in the JVM to acquire the memory use information of the JVM.
The method also comprises the following steps: initializing a system, and closing the unused physical memory; initializing a virtualized memory mapping table and a physical memory mapping table; acquiring virtual machine IDs (vmids) of all JVMs; and setting a memory monitoring time interval T and an old area memory idle allowable threshold value V. The virtual memory mapping table is used for storing the mapping relation between the JVM memory and the virtual memory; the physical memory mapping table is used for storing the mapping relation between the virtualized memory and the physical memory. Virtualized memory refers to virtualized memory resources. Physical memory refers to the physical memory base resources.
The method specifically comprises the following steps: and monitoring the memory garbage collection condition in the JVM according to a preset time interval T to acquire JVM memory use information corresponding to all vmids in the JVM cluster, wherein the JVM memory use information at least comprises the type and time of garbage collection, the used proportion of old generation memory, the residual size of old generation memory, the garbage fragment ratio, other related information and the like.
Step 201: and when the memory of the JVM is idle, closing the corresponding physical memory of the JVM.
Determining whether the JVM is idle in this step includes:
and putting all vmids into a queue Q, giving the value of a head element in the queue Q to a variable v, determining that a memory of the JVM is free when judging that the JVM corresponding to the variable v does not perform minor GC and the JVM corresponding to the variable v performs global GC, closing a physical memory corresponding to the free memory of the JVM, and updating a physical memory mapping table. How to close the physical memory corresponding to the JVM free memory is a conventional technical means for those skilled in the art, and the specific implementation is not used to limit the protection scope of the present invention, and is not described herein again.
Before closing the physical memory corresponding to the JVM free memory, the method further includes: and removing the memory garbage fragments, closing the physical memory blocks by moving the virtualized memory, and updating the virtualized memory mapping table. The specific implementation belongs to the common technical means of those skilled in the art, and is not described in detail herein.
Further, if the JVM corresponding to the variable v is judged to be subjected to minor GC, and an object enters an old age from a new age, acquiring the used proportion r of the memory of the old age and the current residual space size S of the old age; the method of the invention also comprises the following steps: and when the size of the current residual space of the old age generation is smaller than a preset old age area memory idle allowable threshold, converting the state of the physical memory block in the dormant state into an enabling state. Before converting the physical memory block in the sleep state into the enabled state, the method further includes: the virtualized memory is moved and the virtualized memory mapping table is updated.
The method of the invention also comprises the following steps: when judging that the JVM corresponding to the variable v carries out minor GC, but no object enters the old from the new generation; or when the size of the current residual space of the old age generation is judged to be not smaller than a preset memory free allowable threshold of the old age area; or when the JVM corresponding to the variable v is judged to be subjected to minor GC but not subjected to Full GC; or under the condition that the size of the current residual space of the old age generation is smaller than a preset old age area memory idle allowable threshold, updating the virtualized memory mapping table; or after updating the physical memory mapping table; or, when it is determined that the JVM corresponding to the variable v does not perform minor GC and the JVM corresponding to the variable v performs Full GC, and no physical memory block can be closed, the method of the present invention further includes: and judging whether the JVM polling in the JVM cluster is finished or not, if not, returning to the step 200 to continue monitoring the next JVM until the JVM polling in the JVM cluster is finished.
The method of the invention utilizes the existing memory garbage recycling mechanism in the JVM and converts the corresponding physical memory state into the dormant state when the memory of the JVM is idle according to the difference of the energy consumption overhead of the same physical memory device in the dormant state and the idle state, thereby simply and efficiently controlling the energy consumption problem of a computing platform, effectively reducing the energy consumption of the system and further achieving the purpose of reducing the energy consumption of the memory.
The process of the present invention will be described in detail with reference to examples.
FIG. 3 is a flowchart of an embodiment of a JVM energy consumption control method of the present invention, as shown in FIG. 3, including:
step 300: the system initialization specifically comprises the following steps: initializing a virtualized memory mapping table and a physical memory mapping table; and acquiring virtual machine IDs (vmids) of all JVMs in the JVM cluster, and setting a memory monitoring time interval T and a memory idle allowable threshold V of the old area.
Step 301: the virtualized memory management unit optimizes a virtualized memory mapping table and a physical memory mapping table according to the allocation of the JVM; the processing unit shuts down the physical memory that is not used.
The optimizing the virtualized memory mapping table and the physical memory mapping table specifically includes: according to the JVM allocation condition, finding which JVM memories have idle JVM memories, and moving the virtualized memories corresponding to the part of JVM memories to optimize a virtualized memory mapping table; meanwhile, after the virtualized memory corresponding to the free memory is moved, the physical memory block corresponding to the virtualized memory is adjusted to optimize the physical memory mapping table. .
Step 302: and the memory garbage monitoring unit acquires the JVM memory use conditions corresponding to all vmids according to a preset time interval T, and puts all vmids into a queue Q.
Step 303: the system removes the head element in queue Q and assigns a variable v.
Step 304: the memory garbage monitoring unit judges whether the JVM corresponding to the variable v performs minorpc, and if so, the process goes to step 305; otherwise step 313 is entered.
Step 305: the memory garbage monitoring unit judges whether an object enters the old from the new generation or not, and if so, the step 306 is carried out; otherwise step 24 is entered.
Step 306: the memory garbage monitoring unit acquires the used proportion r of the memory of the old generation and the current residual space size S.
Step 307: the system management module judges whether the current residual space size S of the old age is smaller than a preset old age area memory free allowable threshold value V or not, and if so, the step 308 is executed; if not, step 24 is performed.
Step 308: the virtualized memory management unit determines whether the solution can be resolved by moving the virtualized memory, and if so, proceeds to step 309; otherwise, go to step 311.
Step 309: the virtualized memory management unit moves the virtualized memory.
Step 310: and updating the virtualized memory mapping table. And then proceeds to step 24.
Step 311: the processing unit turns one or more physical memory blocks in the sleep state into the enabled state.
Step 312: and updating the physical memory mapping table. And then proceeds to step 24.
Step 313: the memory garbage monitoring unit judges whether the JVM corresponding to the variable v performs global GC, and if so, the step 314 is entered; otherwise, go to step 24.
Step 314: memory garbage collector of JVM (Java virtual machine) for memory garbage fragment movement
Step 315: the virtualized memory management unit determines whether the physical memory block can be closed by moving the virtualized memory, and if yes, proceeds to step 316; otherwise, return to step 312.
Step 316: the virtualized memory management unit moves the virtualized memory.
Step 317: and modifying the virtualized memory mapping table.
Step 318: the virtualized memory management unit determines whether there is a physical memory block that can be closed, and if so, proceeds to step 319; otherwise go to step 24.
Step 319: the processing unit transfers the idle memory blocks from the enabling state to the dormant state. And then returns to step 312.
Step 320: the system determines whether the queue Q is empty, and if so, proceeds to step 321; otherwise, the procedure returns to step 303.
Step 321: and judging whether the optimization is finished or not, if so, finishing the optimization, and otherwise, returning to the step 302. That is, it ends after polling all JVMs in the JVM cluster is complete.
The method of the invention utilizes the existing memory garbage recycling mechanism in the JVM and converts the corresponding physical memory state into the dormant state when the memory of the JVM is idle according to the difference of the energy consumption overhead of the same physical memory device in the dormant state and the idle state, thereby simply and efficiently controlling the energy consumption problem of a computing platform, effectively reducing the energy consumption of the system and further achieving the purpose of reducing the energy consumption of the memory.
Although the embodiments of the present invention have been described above, the above description is only for the convenience of understanding the present invention, and is not intended to limit the present invention. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A JVM Java virtual machine power consumption control method is characterized by comprising the following steps:
monitoring the memory garbage collection condition in the JVM to acquire the memory use information of the JVM;
when the memory of the JVM is idle, closing the corresponding physical memory;
determining whether the JVM is idle includes:
and putting all virtual machine IDs in a JVM cluster where the JVM is located into a queue Q, assigning a value of a head element in the queue Q to a variable v, and determining that the JVM corresponding to the variable v is idle when judging that the JVM corresponding to the variable v does not perform secondary garbage collection minor GC and the JVM corresponding to the variable v performs global garbage collection Full GC.
2. The JVM energy consumption control method of claim 1, wherein for each JVM in the JVM cluster in which the JVM is located, the method further comprises:
initializing a system, and closing the unused physical memory;
initializing a virtualized memory mapping table for storing a mapping relation between a JVM memory and a virtualized memory, and a physical memory mapping table for storing a mapping relation between a virtualized memory and a physical memory; acquiring virtual machine IDs of all JVMs;
and setting a memory monitoring time interval T and an old area memory idle allowable threshold value V.
3. The JVM energy consumption control method according to claim 2, wherein the obtaining memory usage information in the JVM comprises:
monitoring the memory garbage collection condition in the JVM according to a preset time interval T to acquire JVM memory use information corresponding to the virtual machine IDs of all JVMs in the JVM cluster;
the JVM memory usage information at least comprises the type and time of garbage collection, the used proportion of the memory of the old generation, the residual size of the memory of the old generation, the garbage fragment ratio and other related information.
4. The JVM energy consumption control method of claim 3,
the method further comprises the following steps: and updating the physical memory mapping table.
5. The JVM energy consumption control method of claim 4, further comprising, before closing the physical memory corresponding to the JVM free memory: and removing the memory garbage fragments, closing the physical memory blocks by moving the virtualized memory, and updating the virtualized memory mapping table.
6. The JVM energy consumption control method of claim 4, wherein if it is determined that the JVM corresponding to the variable v has performed minor GC and an object enters an old age from a new age, acquiring a used proportion r of a memory of the old age and a current remaining space size S of the old age;
the method further comprises the following steps: and when the size of the current residual space of the old age generation is smaller than a preset old age area memory idle allowable threshold, converting the state of the physical memory block in the dormant state into an enabling state.
7. The JVM energy consumption control method of claim 6, wherein before the converting the physical memory block in the sleep state to the enabled state, the method further comprises: and moving the virtualized memory and updating the virtualized memory mapping table.
8. The JVM energy consumption control method according to any of claims 4 to 7, wherein when it is determined that the JVM corresponding to the variable v has performed minor GC, but no object enters an old age from a new age; or when the size of the current residual space of the old age generation is judged to be not smaller than a preset memory free allowable threshold of the old age area; or when the JVM corresponding to the variable v is judged to have performed minor GC, but the JVM corresponding to the variable v has not performed Full GC; or, under the condition that the size of the current residual space of the old age group is smaller than a preset old age area memory idle allowable threshold, after the virtualized memory mapping table is updated; or after the physical memory mapping table is updated; or when no physical memory block can be closed when judging that the JVM corresponding to the variable v does not perform minor GC and the JVM corresponding to the variable v performs Full GC; the method further comprises the following steps:
and judging whether the polling of the JVMs in the JVM cluster is finished, if not, continuing to monitor the next JVM in the JVM cluster until the polling of the JVMs in the JVM cluster is finished.
9. A JVM energy consumption control device at least comprises a memory garbage monitoring unit, a virtualized memory management unit and a processing unit, wherein,
the memory garbage monitoring unit is used for monitoring the memory garbage recycling condition of the JVM in the JVM cluster and sending the memory use information of the JVM to the virtualized memory management unit;
the virtualized memory management unit is used for moving the virtualized memory and updating the virtualized memory mapping table when the virtualized memory can be processed according to the received JVM memory use information; when the self cannot process, notifying a processing unit; managing a virtualized memory mapping table and a physical memory mapping table stored by the processing unit according to the feedback information from the processing unit;
and the processing unit is used for receiving the notification from the virtualized memory management unit, controlling the state change of the physical memory, including state control between a dormant state and a starting state, and feeding back the processed information to the virtualized memory management unit.
10. The JVM energy consumption control apparatus of claim 9,
the memory garbage monitoring unit is specifically configured to obtain, according to a preset time interval T, JVM memory use conditions corresponding to virtual machine IDs of all JVMs in a JVM cluster, place all the virtual machine IDs in a queue Q, and assign a value of a head element in the queue Q to a variable v; when judging that the JVM corresponding to the variable v has carried out minor GC and an object enters the old from the new generation, acquiring the used proportion r of the memory of the old and the current residual space size S; when the current residual space S is smaller than the memory free allowable threshold V of the old area, sending a first notice to the virtualized memory management unit; if the JVM corresponding to the variable v is judged not to perform minor GC and the JVM corresponding to the variable v performs global GC, removing memory garbage fragments and sending a third notification to the virtualized memory management unit;
the virtualized memory management unit is specifically configured to receive a first notification from the memory garbage monitoring unit, determine that the virtualized memory can be solved by itself through the virtualized memory, move the virtualized memory, and update the virtualized memory mapping table; if the processing unit judges that the processing unit can not solve the problem through the virtualized memory, a second notice is sent to the processing unit; receiving a third notice from the memory garbage monitoring unit, judging that the physical memory block can be closed by moving the virtualized memory, and moving the virtualized memory and updating a virtualized memory mapping table; judging that a physical memory block can be closed, and sending a fourth notification to the processing unit;
the processing unit is specifically configured to receive a second notification from the virtualized memory management unit, convert the state of the physical memory block in the dormant state into a enabled state, and notify the virtualized memory management unit to update the physical memory mapping table; receiving a fourth notification from the virtualized memory management unit, converting the idle memory block from a enabled state to a dormant state, and notifying the virtualized memory management unit to update the physical memory mapping table.
CN201410117546.5A 2014-03-26 2014-03-26 A kind of JVM consumption control methods and device Active CN103870315B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410117546.5A CN103870315B (en) 2014-03-26 2014-03-26 A kind of JVM consumption control methods and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410117546.5A CN103870315B (en) 2014-03-26 2014-03-26 A kind of JVM consumption control methods and device

Publications (2)

Publication Number Publication Date
CN103870315A CN103870315A (en) 2014-06-18
CN103870315B true CN103870315B (en) 2017-05-31

Family

ID=50908882

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410117546.5A Active CN103870315B (en) 2014-03-26 2014-03-26 A kind of JVM consumption control methods and device

Country Status (1)

Country Link
CN (1) CN103870315B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107220077B (en) 2016-10-20 2019-03-19 华为技术有限公司 Using the management-control method and management and control devices of starting
US10628306B2 (en) * 2017-02-01 2020-04-21 Microsoft Technology Licensing, Llc Garbage collector
CN109658541B (en) * 2017-10-11 2021-11-12 株洲中车时代电气股份有限公司 Method and device for monitoring idle energy consumption of locomotive
CN107766123B (en) * 2017-10-11 2020-10-27 苏州浪潮智能科技有限公司 JVM (JVM) tuning method
CN108255582B (en) * 2018-01-16 2021-02-02 携程旅游信息技术(上海)有限公司 Method, system, equipment and storage medium for garbage recovery of java virtual machine
CN113778740B (en) * 2021-11-10 2022-08-02 中航金网(北京)电子商务有限公司 Exception handling method and device based on garbage collection log
CN115080192A (en) * 2022-08-23 2022-09-20 中建电子商务有限责任公司 JVM performance monitoring method, system, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101281458A (en) * 2008-05-14 2008-10-08 华为技术有限公司 Apparatus, system and for recycling rubbish
CN101859279A (en) * 2010-05-21 2010-10-13 北京星网锐捷网络技术有限公司 Memory allocation and release method and device
CN103514102A (en) * 2013-10-25 2014-01-15 中国联合网络通信集团有限公司 Memory garbage collecting method and device for Java virtual machine
CN103577335A (en) * 2013-10-23 2014-02-12 中国科学院计算技术研究所 Memory garbage recycling system and method
CN103593298A (en) * 2013-10-16 2014-02-19 北京航空航天大学 Memory recovery method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102262591B (en) * 2010-05-31 2014-03-19 国际商业机器公司 Garbage collection method and system for memory copy system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101281458A (en) * 2008-05-14 2008-10-08 华为技术有限公司 Apparatus, system and for recycling rubbish
CN101859279A (en) * 2010-05-21 2010-10-13 北京星网锐捷网络技术有限公司 Memory allocation and release method and device
CN103593298A (en) * 2013-10-16 2014-02-19 北京航空航天大学 Memory recovery method and device
CN103577335A (en) * 2013-10-23 2014-02-12 中国科学院计算技术研究所 Memory garbage recycling system and method
CN103514102A (en) * 2013-10-25 2014-01-15 中国联合网络通信集团有限公司 Memory garbage collecting method and device for Java virtual machine

Also Published As

Publication number Publication date
CN103870315A (en) 2014-06-18

Similar Documents

Publication Publication Date Title
CN103870315B (en) A kind of JVM consumption control methods and device
CN102868763B (en) The dynamic adjusting method that under a kind of cloud computing environment, virtual web application cluster is energy-conservation
US8352942B2 (en) Virtual-machine control apparatus and virtual-machine moving method
CN103188277B (en) load energy consumption management system, method and server
CN103345298B (en) Method of data center energy saving system based on virtual IT resource distribution technology
WO2023015788A1 (en) Serverless computing resource allocation system for energy consumption optimization
CN103684916A (en) Method and system for intelligent monitoring and analyzing under cloud computing
CN102158513A (en) Service cluster and energy-saving method and device thereof
CN102426475A (en) Energy saving method, energy saving management server and system under desktop virtual environment
US20100235669A1 (en) Memory power consumption reduction system, and method and program therefor
WO2013097396A1 (en) Virtual cluster integration method, device, and system
CN102385554A (en) Method for optimizing duplicated data deletion system
CN103179048A (en) Method and system for changing main machine quality of service (QoS) strategies of cloud data center
US9614728B2 (en) Identifying network communication patterns
CN110162396A (en) Method for recovering internal storage, device, system and storage medium
CN103645956A (en) Intelligent cluster load management method
CN114661482A (en) GPU computing power management method, medium, equipment and system
CN104850423B (en) The method for identifying the application program launching stage under Android system
CN103336574A (en) Energy-saving control method and device of data center
Zhang et al. CloudGC: Recycling idle virtual machines in the cloud
CN118113432A (en) K8s cluster updating and scheduling method, equipment and storage medium
CN109819674A (en) Computer storage medium, embedded dispatching method and system
CN115530699B (en) Cleaning control method and device for floor cleaning machine, computer equipment and storage medium
CN103092677A (en) Internal storage energy-saving system and method suitable for virtualization platform
Shelar et al. Autonomic and energy-aware resource allocation for efficient management of cloud data centre

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant