CN103870315A - JVM energy consumption control method and device - Google Patents

JVM energy consumption control method and device Download PDF

Info

Publication number
CN103870315A
CN103870315A CN201410117546.5A CN201410117546A CN103870315A CN 103870315 A CN103870315 A CN 103870315A CN 201410117546 A CN201410117546 A CN 201410117546A CN 103870315 A CN103870315 A CN 103870315A
Authority
CN
China
Prior art keywords
jvm
memory
internal memory
virtual
mapping table
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.)
Granted
Application number
CN201410117546.5A
Other languages
Chinese (zh)
Other versions
CN103870315B (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

Images

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

Abstract

The invention discloses a JVM energy consumption control method and device. The JVM energy consumption control method includes the steps that the memory garbage collection condition of a JVM is monitored so as to acquire memory usage information of the JVM; when an idle memory of the JVM exists, a physical memory corresponding to the idle memory is shut off. According to the JVM energy consumption control method and device, when the idle memory of the JVM exists, the state of the physical memory corresponding to the idle memory is converted into a dormant state through an existing memory garbage collection mechanism in the JVM according to the difference between energy consumption overheads of the same physical memory when the physical memory is in a dormant state and an idle state respectively, energy consumption of a cloud computing platform is easily and efficiently controlled, energy consumption of a system is effectively reduced, and therefore energy consumption of the memories is reduced.

Description

A kind of JVM consumption control method and device
Technical field
The present invention relates to Computerized Information Processing Tech, Java Virtual Machine (JVM, Java Virtual Machine) consumption control method and device in espespecially a kind of cloud computing platform.
Background technology
Cloud computing, as a kind of novel account form, becomes rapidly the study hotspot of academia and industrial community with advantages such as its enhanced scalability and high availability.Along with developing rapidly of cloud computing, also rapid growth of the quantity of data center and scale, energy consumption problem is also more aobvious outstanding.From 2005 to 2010, the data center in the whole world increased approximately 56%.According to estimates, the annual power consumption of data center that has 50000 computing nodes exceedes 100,000,000 kilowatt hours.High energy consumption has become a subject matter of cloud computing system, and along with the expanding day of cloud computing scale in recent years, its energy consumption expense is also further serious.Managing power consumption in cloud computing platform has become one of challenging research topic of tool.
According to cloud platform operation statistics, power consumption is mainly distributed in following three aspects: as Java Virtual Machine, electricity consumption accounts for 45%-55% to IT main equipment; Building environment electricity consumption mainly comprises machine room illumination, air conditioner refrigerating and heats etc., and wherein air conditioning electricity has exceeded approximately more than 40% of total electricity consumption; Power-supply system electricity consumption approaches 10% of total electricity consumption.At present, much, for to realize in the research of target for energy-saving and emission-reduction, the operation measure of taking has focused on building environment electricity consumption and power-supply system electricity consumption two aspects, and for IT main equipment, electricity consumption lacks effective control device.And data rule of thumb reduce the energy consumption of the IT of a unit main equipment, be equivalent to reduce the energy consumption of 2~3 unit environmental systems, therefore, control the electricity consumption of IT main equipment and be only the key point that reduces overall energy consumption index.
At present, for the energy consumption problem of cloud computing platform, propose several different methods both at home and abroad, roughly comprised:
One is dynamic electric voltage adjustment (DVS, Dynamic Voltage Scaling) method.DVS technology is mainly for the adjustable information technoloy equipment of the voltage/frequencies such as processor.In the situation that completing same task, when information technoloy equipment is stabilized in low frequency, energy consumption can be lower.If can manage device frequency and meet with lower the performance requirement of task, can reduce system energy consumption.The key of DVS method is to want the demand of correct Prediction operating load to information technoloy equipment, and reasonable distribution quota, and this is difficult to realize.
Another kind is dynamic power management technology.Many parts in cloud computing system, as disc driver, communication network interface card, internal memory etc. have multiple power consumption mode, this base part can management component (PMC, Power Manageable Component) also referred to as power.Experiment is observed and is found, many parts mosts of the time of computer system are all in idle condition.Usually, the power dissipation ratio operational mode of PMC park mode is much lower, and system can be set to low-power consumption park mode by idle PMC, to reduce the power consumption of PMC free time.The key issue of this method is will solve how to know that when system unit is in idle condition, will design extra internal memory monitoring mechanism, has increased the complexity of system.
Also having one is resource scheduling algorithm.Cloud computing platform together with network resource integration, forms resource pool by various computational resources, storage resources.The energy consumption of different resource is conventionally not identical, high energy consumption resource that bad source scheduling mode can make to use the task call that just can carry out compared with low energy consumption resource, and this is one of reason forming cloud computing system high energy consumption.Therefore, by the reasonable distribution to resource and scheduling, can reduce the energy consumption of resource, still, because resource kind is many, scale is large, the relation of multi-to-multi often between task and resource, therefore, has brought certain difficulty to the scheduling of resource.The scheduling of resource solution also not proposing at present.
Summary of the invention
In order to solve the problems of the technologies described above, the invention provides a kind of JVM consumption control method and device, can control simply, efficiently the energy consumption problem of cloud computing platform, effectively reduce system energy consumption.
In order to reach the object of the invention, the invention provides a kind of JVM Java Virtual Machine consumption control method, comprising:
Internal memory garbage reclamation situation in monitoring JVM, to obtain the memory usage information of JVM;
In the time that JVM internal memory is idle, close its corresponding physical memory.
For the each JVM in the JVM cluster of described JVM place, before the method, also comprise:
System initialization, closes temporary no physical memory;
Initialization is for storing the virtual memory mapping table of the mapping relations between JVM internal memory and virtual internal memory, physical memory mapping table for the mapping relations between Storage Virtualization internal memory and physical memory; Obtain the virtual machine ID of all JVM;
Internal memory monitoring time interval T is set, and the idle threshold value V that allows of old district internal memory.
Memory usage information in the described JVM of obtaining comprises:
According to the time interval T setting in advance, monitor the internal memory garbage reclamation situation in described JVM, to obtain JVM memory usage information corresponding to virtual machine ID of all JVM in described JVM cluster;
Described JVM memory usage information at least comprises type and the time, old for internal memory usage ratio, old for internal memory residue size, rubbish fragment ratio and other relevant information of garbage reclamation.
Whether the free time comprises described definite JVM:
All virtual machine ID in described JVM cluster are put into queue Q, the value of queue Q squadron header element is assigned to variable v, JVM that variable v is corresponding does not carry out less important garbage reclamation minor GC and JVM corresponding to variable v carried out overall garbage reclamation Full GC judging, and determines that JVM internal memory is available free;
The method also comprises: upgrade described physical memory mapping table.
Before closing the physical memory that described JVM free memory is corresponding, also comprise: mobile internal memory rubbish fragment, close physical memory piece by mobile virtual internal memory, and upgrade described virtual memory mapping table.
Carried out minor GC if judge the JVM that described variable v is corresponding, and had object to enter old generation from the Cenozoic, obtain old for internal memory usage ratio r, the current residual space size S in old generation;
The method also comprises: in the time that be less than for current residual space size the idle permission of the old district internal memory threshold value setting in advance old age, will be converted to initiate mode in the state of dormant state physical memory piece.
Described will be before dormant state physical memory piece be converted to initiate mode, the method also comprises: mobile virtual internal memory, and upgrade described virtual memory mapping table.
Carried out minor GC judging the JVM that variable v is corresponding, but do not have object from the Cenozoic enter old for time; Or, judge old while being not less than for current residual space size that the old district internal memory setting in advance is idle allows threshold value; Or, carry out minorGC judging the JVM that variable v is corresponding, but when JVM corresponding to variable v do not carry out Full GC; Or, be less than for current residual space size the idle permission of the old district internal memory threshold value setting in advance, after the virtual memory mapping table of described renewal in the case of in old age; Or, after described renewal physical memory mapping table; Or in the case of judging, JVM that variable v is corresponding does not carry out minor GC and JVM corresponding to variable v carried out Full GC, while not having physical memory piece to close; The method also comprises:
Judge whether poll completes to the JVM in described JVM cluster, if do not had, continue the next JVM in described JVM cluster to monitor, until the JVM poll in described JVM cluster completes.
The present invention also provides a kind of JVM energy consumption control apparatus, at least comprises internal memory garbage monitoring unit, virtual memory management unit, and processing unit, wherein,
Internal memory garbage monitoring unit, for monitoring the internal memory garbage reclamation situation of JVM cluster JVM, and sends to virtual memory management unit by JVM memory usage information;
Virtual memory management unit, for according to the JVM memory usage information receiving, in the time that self can process, mobile virtual internal memory, and upgrade virtual memory mapping table; In the time that self can not process, notifier processes unit; According to virtual memory mapping table, the physical memory mapping table of the feedback information management from processing unit self storage;
Processing unit, for receiving the notice from virtual memory management unit, controls the state variation of physical memory, comprises the state control between dormant state and initiate mode, and information after processing is fed back to virtual memory management unit.
Described internal memory garbage monitoring unit, specifically for the time interval T according to setting in advance, obtain JVM internal memory service condition corresponding to virtual machine ID of all JVM in JVM cluster, all virtual machine ID are put into queue Q, the value of queue Q squadron header element is assigned to variable v; Carried out minor GC judging the JVM that variable v is corresponding, and had object to enter old generation from the Cenozoic, obtain old for internal memory usage ratio r, current residual space size S; In the time that current residual space size S is less than the idle permission of old district internal memory threshold value V, send the first notice to described virtual memory management unit; Do not carry out minor GC judging the JVM that variable v is corresponding, and JVM corresponding to variable v carried out overall GC, mobile internal memory rubbish fragment, sends third notice to described virtual memory management unit;
Described virtual memory management unit, specifically for receiving the first notice from internal memory garbage monitoring unit, judging self can solve by virtual internal memory, mobile virtual internal memory, and upgrade virtual memory mapping table; Can not solve by virtual internal memory if judge self, send the second notice to described processing unit; Receive the third notice from internal memory garbage monitoring unit, judge self and can close physical memory piece by mobile virtual internal memory, mobile virtual internal memory upgrade virtual memory mapping table; Having judged physical memory piece can close, and sends four-way know to described processing unit;
Described processing unit, specifically for receiving the second notice from virtual memory management unit, is converted to initiate mode by the state of the physical memory piece in dormant state, and notifies described virtual memory management unit to upgrade physical memory mapping table; Receive from the four-way of described virtual memory management unit and know, idle memory block is converted to dormant state from initiate mode, and notify described virtual memory management unit to upgrade physical memory mapping table.
Compared with prior art, the present invention only need be by the internal memory garbage reclamation situation in monitoring JVM, to obtain the memory usage information of JVM; In the time that JVM internal memory is idle, close its corresponding physical memory.The present invention utilizes existing internal memory garbage reclamation mechanism in JVM, and according to the difference of Same Physical memory device energy consumption expense under dormant state and idle condition, in the time that JVM internal memory is idle, changing corresponding physical memory state is dormant state, control simply, efficiently the energy consumption problem with computing platform, effectively reduce system energy consumption, thereby reached the object that reduces internal memory energy consumption.
Other features and advantages of the present invention will be set forth in the following description, and, partly from instructions, become apparent, or understand by implementing the present invention.Object of the present invention and other advantages can be realized and be obtained by specifically noted structure in instructions, claims and accompanying drawing.
Brief description of the drawings
Accompanying drawing is used to provide the further understanding to technical solution of the present invention, and forms a part for instructions, is used from and explains technical scheme of the present invention with the application's embodiment mono-, does not form the restriction to technical solution of the present invention.
Fig. 1 is the composition structural representation of JVM energy consumption control apparatus of the present invention;
Fig. 2 is the process flow diagram of JVM consumption control method of the present invention;
Fig. 3 is the process flow diagram of the embodiment of JVM consumption control method of the present invention.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, hereinafter in connection with accompanying drawing, embodiments of the invention are elaborated.It should be noted that, in the situation that not conflicting, the combination in any mutually of the feature in embodiment and embodiment in the application.
Can in the computer system such as one group of computer executable instructions, carry out in the step shown in the process flow diagram of accompanying drawing.And, although there is shown logical order in flow process, in some cases, can carry out shown or described step with the order being different from herein.
For the energy consumption of cloud computing platform, having most is to consume on equipment, comprise CPU, internal memory, disk unit, the network equipment etc., and for these physical equipments, can close, the state such as dormancy, free time, work, wherein, the energy consumption of closed condition and dormant state will be far below the energy consumption of idle condition and duty.And for internal memory, it is to reduce the most direct method of power consumption that the state of free memory sub-block is converted to dormant state.
The internal memory of Java Virtual Machine (JVM, Java Virtual Machine) is divided into method district, stack, heap, register etc., and JVM, in the time carrying out internal memory garbage reclamation (GC, Garbage Collection), mainly carries out for " heap " this part internal memory.At present, the refuse collection of commercial JVM mostly adopts generation collection (Generational Collection) algorithm.Heap is divided into two or more objects by Generation algorithm, and object is according to dividing into groups life cycle, and each height heap is one " generation " objects services.Garbage collector will be collected these objects from minimus son heap (this height heap is called the Cenozoic), if an object is still survived after having experienced refuse collection several times, so, this object is just grown into higher generation life cycle, when exceeding default life cycle when threshold value, this object can be transferred in another one heap (this height heap is called old generation) and goes.
Divide and comprise less important garbage reclamation (minor GC) and overall garbage reclamation (full GC) for the realization of garbage reclamation algorithm, minor GC mainly reclaims neozoic internal memory rubbish, and the object that arrives certain life cycle is transferred to old generation, and the frequency that minor GC carries out is higher; Full GC reclaims the internal memory rubbish in the Cenozoic and old generation simultaneously.
According to the application in practice of Java, inventor finds, for Java application system, have that old JVM carries out global memory's garbage reclamation hardly for there being more internal memory long-time when idle in internal memory, or, the features such as the time interval of carrying out global memory's garbage reclamation is long, now, inventor thinks that this part internal memory can proceed to dormant state, to reduce system energy consumption.
Fig. 1 is the composition structural representation of JVM energy consumption control apparatus of the present invention, as shown in Figure 1, at least comprises internal memory garbage monitoring unit, virtual memory management unit, and processing unit, wherein,
Internal memory garbage monitoring unit, for monitoring the internal memory garbage reclamation situation of JVM, and sends to virtual memory management unit by JVM memory usage information.Particularly, internal memory service condition to each JVM in JVM cluster is monitored, and JVM memory usage information at least comprises type and the time, old for internal memory usage ratio, old for internal memory residue size, rubbish fragment ratio and other relevant information etc. of garbage reclamation.
Virtual memory management unit, for according to the JVM memory usage information receiving, in the time that self can process, mobile virtual internal memory, and upgrade virtual memory mapping table; In the time that self can not process, notifier processes unit; According to virtual memory mapping table, the physical memory mapping table of the feedback information management from processing unit self storage.Wherein,
Virtual memory mapping table is for storing the mapping relations between JVM internal memory and virtual internal memory; Physical memory mapping table is for the mapping relations between Storage Virtualization internal memory and physical memory.Virtual internal memory refers to virtualized memory source.Physical memory refers to physical memory basic resource.
Processing unit, for receiving the notice from virtual memory management unit, controls the state variation of physical memory, comprises the state control between dormant state and initiate mode, and information after processing is fed back to virtual memory management unit.
Particularly,
Internal memory garbage monitoring unit, according to the time interval T setting in advance, obtain all vmid(in JVM cluster for identifying the different JVM of JVM cluster) corresponding JVM internal memory service condition, all vmid are put into queue Q, the value of queue Q squadron header element is assigned to variable v, has carried out minor GC judging the JVM that variable v is corresponding, and have object to enter old generation from the Cenozoic, obtain old age for internal memory usage ratio r, current residual space size S; In the time that current residual space size S is less than the idle permission of old district internal memory threshold value V, send the first notice to virtual memory management unit; Do not carry out minor GC judging the JVM that variable v is corresponding, and JVM corresponding to variable v carried out overall GC, mobile internal memory rubbish fragment, sends third notice to virtual memory management unit;
Virtual memory management unit, receive the first notice from internal memory garbage monitoring unit, judging and self can solving by virtual internal memory (is the virtual internal memory of self free time, be greater than old for idle threshold value V and the value of the difference of remaining space size S then of allowing of internal memory), mobile virtual internal memory, and upgrade virtual memory mapping table; Can not solve by virtual internal memory if judge self, send the second notice to processing unit; Receive the third notice from internal memory garbage monitoring unit, judge and self can close physical memory piece by mobile virtual internal memory (i.e. judgement is when clearing up after internal memory rubbish fragment, after this part idle virtual internal memory moves, can close originally corresponding physical memory piece), mobile virtual internal memory upgrade virtual memory mapping table; Having judged physical memory piece can close, and sends four-way know to processing unit;
Processing unit, receives the second notice from virtual memory management unit, the state of the physical memory piece in dormant state is converted to initiate mode, and notifies virtual memory management unit to upgrade physical memory mapping table; Receive from the four-way of virtual memory management unit and know, idle memory block is converted to dormant state from initiate mode, and notify described virtual memory management unit to upgrade physical memory mapping table.
It should be noted that, in the time of system initialization, can close temporary no physical memory; The virtual memory mapping table of initialization, physical memory mapping table; Obtain the virtual machine ID(vmid of all JVM); Internal memory monitoring time interval T is set, and the idle threshold value V that allows of old district internal memory.Specific implementation belongs to those skilled in the art's conventional techniques means, is also not intended to limit the scope of the invention, and repeats no more here.
Apparatus of the present invention are utilized existing internal memory garbage reclamation mechanism in JVM, and according to the difference of Same Physical memory device energy consumption expense under dormant state and idle condition, in the time that JVM internal memory is idle, changing corresponding physical memory state is dormant state, control simply, efficiently the energy consumption problem with computing platform, effectively reduce system energy consumption, thereby reached the object that reduces internal memory energy consumption.
Fig. 2 is the process flow diagram of JVM consumption control method of the present invention, as shown in Figure 2, comprising:
Step 200: the internal memory garbage reclamation situation in monitoring JVM, to obtain the memory usage information of JVM.
Before this step, also comprise: system initialization, close temporary no physical memory; The virtual memory mapping table of initialization, physical memory mapping table; Obtain the virtual machine ID(vmid of all JVM); Internal memory monitoring time interval T is set, and the idle threshold value V that allows of old district internal memory.Wherein, virtual memory mapping table is for storing the mapping relations between JVM internal memory and virtual internal memory; Physical memory mapping table is for the mapping relations between Storage Virtualization internal memory and physical memory.Virtual internal memory refers to virtualized memory source.Physical memory refers to physical memory basic resource.
This step specifically comprises: according to the time interval T setting in advance, internal memory garbage reclamation situation in monitoring JVM, to obtain the JVM memory usage information that in JVM cluster, all vmid are corresponding, at least comprise type and the time, old for internal memory usage ratio, old for internal memory residue size, rubbish fragment ratio and other relevant information etc. of garbage reclamation.
Step 201: in the time that JVM internal memory is idle, close its corresponding physical memory.
In this step, determine whether the free time comprises JVM:
All vmid are put into queue Q, the value of queue Q squadron header element is assigned to variable v, judging, JVM that variable v is corresponding does not carry out minor GC and JVM corresponding to variable v carried out overall GC, determine that JVM internal memory is available free, now close the physical memory that this JVM free memory is corresponding, and upgrade physical memory mapping table.Wherein, how closing the physical memory that JVM free memory is corresponding, is those skilled in the art's conventional techniques means, and the protection domain that specific implementation is not intended to limit the present invention, repeats no more here.
Before closing the physical memory that JVM free memory is corresponding, this step also comprises: mobile internal memory rubbish fragment, and close physical memory piece by mobile virtual internal memory, and upgrade virtual memory mapping table.Specific implementation belongs to those skilled in the art's common technology means, repeats no more here.
Further, carried out minor GC if judge the JVM that variable v is corresponding, and had object to enter old generation from the Cenozoic, obtain old for internal memory usage ratio r, the current residual space size S in old generation; The inventive method also comprises: in the time that be less than for current residual space size the idle permission of the old district internal memory threshold value setting in advance old age, will be converted to initiate mode in the state of dormant state physical memory piece.Wherein, will be before dormant state physical memory piece is converted to initiate mode, the method also comprises: mobile virtual internal memory, and upgrade virtual memory mapping table.
The inventive method also comprises: carried out minor GC judging the JVM that variable v is corresponding, but do not have object from the Cenozoic enter old for time; Or, judge old while being not less than for current residual space size that the old district internal memory setting in advance is idle allows threshold value; Or, carry out minor GC judging the JVM that variable v is corresponding, but when JVM corresponding to variable v do not carry out Full GC; Or,, threshold value, upgrade after virtual memory mapping table in the case of being less than idle permission of the old district internal memory setting in advance for current residual space size old age; Or, upgrade after physical memory mapping table; Or, in the case of judging, JVM that variable v is corresponding does not carry out minor GC and JVM corresponding to variable v carried out Full GC, while not having physical memory piece to close, the inventive method also comprises: judge whether poll completes to the JVM in JVM cluster, continue next JVM to monitor if do not return to step 200, until the JVM poll in JVM cluster completes.
The inventive method is utilized existing internal memory garbage reclamation mechanism in JVM, and according to the difference of Same Physical memory device energy consumption expense under dormant state and idle condition, in the time that JVM internal memory is idle, changing corresponding physical memory state is dormant state, control simply, efficiently the energy consumption problem with computing platform, effectively reduce system energy consumption, thereby reached the object that reduces internal memory energy consumption.
Below in conjunction with embodiment, the inventive method is described in detail.
Fig. 3 is the process flow diagram of the embodiment of JVM consumption control method of the present invention, as shown in Figure 3, comprising:
Step 300: system initialization, specifically comprises: the virtual memory mapping table of initialization, physical memory mapping table; Obtain the virtual machine ID(vmid of all JVM in JVM cluster) internal memory monitoring time interval T is set, and the idle threshold value V that allows of old district internal memory.
Step 301: virtual memory management unit, according to the distribution of JVM, is optimized virtual memory mapping table, physical memory mapping table; Processing unit is closed temporary no physical memory.
Wherein, optimize virtual memory mapping table, physical memory mapping table specifically comprises: according to JVM distribution condition, find available free JVM internal memory in which JVM, virtual internal memory corresponding to mobile this part JVM internal memory, to optimize virtual memory mapping table; Meanwhile, after virtual internal memory corresponding to free memory moves, adjust the physical memory piece that this virtual internal memory is corresponding, to optimize physical memory mapping table.。
Step 302: internal memory garbage monitoring unit, according to the time interval T setting in advance, obtains the JVM internal memory service condition that all vmid are corresponding, and all vmid are put into queue Q.
Step 303: system removes queue Q squadron's header element assignment to variable v.
Step 304: whether the JVM that internal memory garbage monitoring unit judges variable v is corresponding has carried out minorGC, if carried out, enters step 305; Otherwise enter step 313.
Step 305: whether internal memory garbage monitoring unit judges has object to enter old generation from the Cenozoic, if had, carry out step 306; Otherwise enter step 24.
Step 306: internal memory garbage monitoring unit obtains old for internal memory usage ratio r, and current residual space size S.
Step 307: system management module judges whether that whether the current residual space size S in old generation is less than the idle threshold value V that allows of the old district internal memory setting in advance, if be less than, enters step 308; If be not less than, carry out step 24.
Step 308: virtual memory management unit judges whether to solve by mobile virtual internal memory, if can, step 309 entered; Otherwise enter step 311.
Step 309: virtual memory management unit mobile virtual internal memory.
Step 310: upgrade virtual memory mapping table.Proceed to afterwards step 24.
Step 311: processing unit transfers one or more dormant state physical memory pieces to initiate mode.
Step 312: upgrade physical memory mapping table.Proceed to afterwards step 24.
Step 313: whether the JVM that internal memory garbage monitoring unit judges variable v is corresponding has carried out overall GC, if to carry out, enter step 314; Otherwise, forward step 24 to.
The internal memory Garbage Collector of step 314:JVM carries out internal memory rubbish fragment and moves
Step 315: virtual memory management unit judges whether to close physical memory piece by mobile virtual internal memory, if can, step 316 entered; Otherwise return to step 312.
Step 316: virtual memory management unit mobile virtual internal memory.
Step 317: revise virtual memory mapping table.
Step 318: virtual memory management unit has judged whether that physical memory piece can close, if had, enters step 319; Otherwise forward step 24 to.
Step 319: processing unit transfers idle memory block to dormant state from initiate mode.Return to afterwards step 312.
Step 320: system judges whether queue Q is empty, empty if, enters step 321; Otherwise return to step 303.
Step 321: judge whether to finish, if internal memory optimization is complete, finish, otherwise return to step 302.Also just say, after all JVM polls in JVM cluster are completed, finish.
The inventive method is utilized existing internal memory garbage reclamation mechanism in JVM, and according to the difference of Same Physical memory device energy consumption expense under dormant state and idle condition, in the time that JVM internal memory is idle, changing corresponding physical memory state is dormant state, control simply, efficiently the energy consumption problem with computing platform, effectively reduce system energy consumption, thereby reached the object that reduces internal memory energy consumption.
Although the disclosed embodiment of the present invention as above, the embodiment that described content only adopts for ease of understanding the present invention, not in order to limit the present invention.Those of skill in the art under any the present invention; do not departing under the prerequisite of the disclosed spirit and scope of the present invention; can in the form of implementing and details, carry out any amendment and variation; but scope of patent protection of the present invention, still must be as the criterion with the scope that appending claims was defined.

Claims (10)

1. a JVM Java Virtual Machine consumption control method, is characterized in that, comprising:
Internal memory garbage reclamation situation in monitoring JVM, to obtain the memory usage information of JVM;
In the time that JVM internal memory is idle, close its corresponding physical memory.
2. JVM consumption control method according to claim 1, is characterized in that, for the each JVM in the JVM cluster of described JVM place, before the method, also comprises:
System initialization, closes temporary no physical memory;
Initialization is for storing the virtual memory mapping table of the mapping relations between JVM internal memory and virtual internal memory, physical memory mapping table for the mapping relations between Storage Virtualization internal memory and physical memory; Obtain the virtual machine ID of all JVM;
Internal memory monitoring time interval T is set, and the idle threshold value V that allows of old district internal memory.
3. JVM consumption control method according to claim 2, is characterized in that, described in the memory usage information that obtains in JVM comprise:
According to the time interval T setting in advance, monitor the internal memory garbage reclamation situation in described JVM, to obtain JVM memory usage information corresponding to virtual machine ID of all JVM in described JVM cluster;
Described JVM memory usage information at least comprises type and the time, old for internal memory usage ratio, old for internal memory residue size, rubbish fragment ratio and other relevant information of garbage reclamation.
4. JVM consumption control method according to claim 3, is characterized in that, whether the free time comprises described definite JVM:
All virtual machine ID in described JVM cluster are put into queue Q, the value of queue Q squadron header element is assigned to variable v, JVM that variable v is corresponding does not carry out less important garbage reclamation minor GC and JVM corresponding to variable v carried out overall garbage reclamation Full GC judging, and determines that JVM internal memory is available free;
The method also comprises: upgrade described physical memory mapping table.
5. JVM consumption control method according to claim 4, it is characterized in that, before closing the physical memory that described JVM free memory is corresponding, also comprise: mobile internal memory rubbish fragment, close physical memory piece by mobile virtual internal memory, and upgrade described virtual memory mapping table.
6. JVM consumption control method according to claim 4, it is characterized in that, carried out minor GC if judge the JVM that described variable v is corresponding, and have object to enter old generation from the Cenozoic, obtain old age for internal memory usage ratio r, the current residual space size S in old generation;
The method also comprises: in the time that be less than for current residual space size the idle permission of the old district internal memory threshold value setting in advance old age, will be converted to initiate mode in the state of dormant state physical memory piece.
7. JVM consumption control method according to claim 6, is characterized in that, described will be before dormant state physical memory piece be converted to initiate mode, the method also comprises: mobile virtual internal memory, and upgrade described virtual memory mapping table.
8. according to the JVM consumption control method described in claim 4~7 any one, it is characterized in that, carried out minor GC judging the JVM that variable v is corresponding, but do not have object from the Cenozoic enter old for time; Or, judge old while being not less than for current residual space size that the old district internal memory setting in advance is idle allows threshold value; Or, carry out minor GC judging the JVM that variable v is corresponding, but when JVM corresponding to variable v do not carry out Full GC; Or, be less than for current residual space size the idle permission of the old district internal memory threshold value setting in advance, after the virtual memory mapping table of described renewal in the case of in old age; Or, after described renewal physical memory mapping table; Or in the case of judging, JVM that variable v is corresponding does not carry out minor GC and JVM corresponding to variable v carried out Full GC, while not having physical memory piece to close; The method also comprises:
Judge whether poll completes to the JVM in described JVM cluster, if do not had, continue the next JVM in described JVM cluster to monitor, until the JVM poll in described JVM cluster completes.
9. a JVM energy consumption control apparatus, is characterized in that, at least comprises internal memory garbage monitoring unit, virtual memory management unit, and processing unit, wherein,
Internal memory garbage monitoring unit, for monitoring the internal memory garbage reclamation situation of JVM cluster JVM, and sends to virtual memory management unit by JVM memory usage information;
Virtual memory management unit, for according to the JVM memory usage information receiving, in the time that self can process, mobile virtual internal memory, and upgrade virtual memory mapping table; In the time that self can not process, notifier processes unit; According to virtual memory mapping table, the physical memory mapping table of the feedback information management from processing unit self storage;
Processing unit, for receiving the notice from virtual memory management unit, controls the state variation of physical memory, comprises the state control between dormant state and initiate mode, and information after processing is fed back to virtual memory management unit.
10. JVM energy consumption control apparatus according to claim 9, is characterized in that,
Described internal memory garbage monitoring unit, specifically for the time interval T according to setting in advance, obtain JVM internal memory service condition corresponding to virtual machine ID of all JVM in JVM cluster, all virtual machine ID are put into queue Q, the value of queue Q squadron header element is assigned to variable v; Carried out minor GC judging the JVM that variable v is corresponding, and had object to enter old generation from the Cenozoic, obtain old for internal memory usage ratio r, current residual space size S; In the time that current residual space size S is less than the idle permission of old district internal memory threshold value V, send the first notice to described virtual memory management unit; Do not carry out minor GC judging the JVM that variable v is corresponding, and JVM corresponding to variable v carried out overall GC, mobile internal memory rubbish fragment, sends third notice to described virtual memory management unit;
Described virtual memory management unit, specifically for receiving the first notice from internal memory garbage monitoring unit, judging self can solve by virtual internal memory, mobile virtual internal memory, and upgrade virtual memory mapping table; Can not solve by virtual internal memory if judge self, send the second notice to described processing unit; Receive the third notice from internal memory garbage monitoring unit, judge self and can close physical memory piece by mobile virtual internal memory, mobile virtual internal memory upgrade virtual memory mapping table; Having judged physical memory piece can close, and sends four-way know to described processing unit;
Described processing unit, specifically for receiving the second notice from virtual memory management unit, is converted to initiate mode by the state of the physical memory piece in dormant state, and notifies described virtual memory management unit to upgrade physical memory mapping table; Receive from the four-way of described virtual memory management unit and know, idle memory block is converted to dormant state from initiate mode, and notify described virtual memory management unit to upgrade 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 true CN103870315A (en) 2014-06-18
CN103870315B 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)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766123A (en) * 2017-10-11 2018-03-06 郑州云海信息技术有限公司 A kind of JVM tunings method
CN108255582A (en) * 2018-01-16 2018-07-06 携程旅游信息技术(上海)有限公司 Method, system, equipment and the storage medium of java virtual machine garbage reclamations
CN109658541A (en) * 2017-10-11 2019-04-19 株洲中车时代电气股份有限公司 A kind of locomotive free time energy consumption monitoring method and device
CN109844716A (en) * 2016-10-20 2019-06-04 华为技术有限公司 Using the management-control method and management and control devices of starting
CN110291508A (en) * 2017-02-01 2019-09-27 微软技术许可有限责任公司 Garbage collector
CN113778740A (en) * 2021-11-10 2021-12-10 中航金网(北京)电子商务有限公司 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 (6)

* 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
US20110296132A1 (en) * 2010-05-31 2011-12-01 International Business Machines Corporation Garbage collection in an in-memory replication system
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

Patent Citations (6)

* 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
US20110296132A1 (en) * 2010-05-31 2011-12-01 International Business Machines Corporation Garbage collection in an in-memory replication system
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

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109844716A (en) * 2016-10-20 2019-06-04 华为技术有限公司 Using the management-control method and management and control devices of starting
CN109844716B (en) * 2016-10-20 2021-05-07 华为技术有限公司 Application starting control method and control equipment
US11474831B2 (en) 2016-10-20 2022-10-18 Huawei Technologies Co., Ltd. Application startup control method and control device
CN110291508A (en) * 2017-02-01 2019-09-27 微软技术许可有限责任公司 Garbage collector
CN107766123A (en) * 2017-10-11 2018-03-06 郑州云海信息技术有限公司 A kind of JVM tunings method
CN109658541A (en) * 2017-10-11 2019-04-19 株洲中车时代电气股份有限公司 A kind of locomotive free time energy consumption monitoring method and device
CN107766123B (en) * 2017-10-11 2020-10-27 苏州浪潮智能科技有限公司 JVM (JVM) tuning method
CN109658541B (en) * 2017-10-11 2021-11-12 株洲中车时代电气股份有限公司 Method and device for monitoring idle energy consumption of locomotive
CN108255582A (en) * 2018-01-16 2018-07-06 携程旅游信息技术(上海)有限公司 Method, system, equipment and the storage medium of java virtual machine garbage reclamations
CN108255582B (en) * 2018-01-16 2021-02-02 携程旅游信息技术(上海)有限公司 Method, system, equipment and storage medium for garbage recovery of java virtual machine
CN113778740A (en) * 2021-11-10 2021-12-10 中航金网(北京)电子商务有限公司 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

Also Published As

Publication number Publication date
CN103870315B (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN103870315A (en) JVM energy consumption control method and device
CN102868763B (en) The dynamic adjusting method that under a kind of cloud computing environment, virtual web application cluster is energy-conservation
Marotta et al. A simulated annealing based approach for power efficient virtual machines consolidation
CN103345298A (en) Data center energy saving system and method based on virtual IT resource distribution technology
US20090300614A1 (en) Virtual-machine control system and virtual-machine moving method
CN105868004B (en) Scheduling method and scheduling device of service system based on cloud computing
CN100407104C (en) Power source management method of embedded equipment under operation system cooperation and its system
CN101515161A (en) Centralized energy management method and system
CA2799985A1 (en) Leveraging smart-meters for initiating application migration across clouds for performance and power-expenditure trade-offs
CN102426475A (en) Energy saving method, energy saving management server and system under desktop virtual environment
CN102385554A (en) Method for optimizing duplicated data deletion system
Cao et al. Energy efficient allocation of virtual machines in cloud computing environments based on demand forecast
CN103644628A (en) Energy-saving method and device of air conditioner
CN108684075B (en) Processing resource allocation method under centralized base station architecture
CN103179048A (en) Method and system for changing main machine quality of service (QoS) strategies of cloud data center
CN105704785A (en) Network searching method, device and mobile terminal
CN104932281A (en) Household micro-power-grid energy-using system and realization method for intelligent electricity consumption interaction thereof
CN103645956A (en) Intelligent cluster load management method
CN103076867A (en) Cloud terminal processing method and system with function of identifying action of power key
CN102208986A (en) Cluster power consumption distribution and control method
CN103488538A (en) Application extension device and application extension method in cloud computing system
CN113573340A (en) Control method, device, medium and electronic equipment for base station cell
Zhang et al. CloudGC: Recycling idle virtual machines in the cloud
CN106201658A (en) A kind of migration virtual machine destination host multiple-objection optimization system of selection
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