您的位置:首页 > 其它

Sun JVM 年轻代和老年代垃圾回收都需要暂停JVM

2016-05-09 09:58 375 查看
The Young Generation is where all new objects are allocated and aged. When the young generation fills up, this causes a minor garbage collection. Minor collections can be optimized assuming
a high object mortality rate. A young generation full of dead objects is collected very quickly. Some surviving objects are aged and eventually move to the old generation.
        --所有新的对象都会在年轻代中创建和标记年纪。当年轻代被填满,会引起minor garbage collection。它可以回收大部分垃圾,而且是非常快的收集,有些已经达到年纪的会被移动到老年代。

Stop the World Event - All minor garbage collections are "Stop the World" events. This means that all application threads are stopped until the operation completes. Minor garbage collections are always Stop
the World events.
        --所有的minor garbage collection是stop the world事件。这意味着所有的应用线程要停止直到收集操作完成。

The Old Generation is used to store long surviving objects. Typically, a threshold is set for young generation object and when that age is met, the object gets moved to the old generation. Eventually the old generation
needs to be collected. This event is called a major garbage collection.
        --老年代通常存储生命周期长的对象,通常是年轻代对象的年纪到了(在Hot spot 中默认设置是15),就会将对象移动到老年代。回收老年代的事件叫major garbage。

Major garbage collection are also Stop the World events. Often a major collection is much slower because it involves all live objects. So for Responsive applications, major garbage collections should be minimized. Also note, that the
length of the Stop the World event for a major garbage collection is affected by the kind of garbage collector that is used for the old generation space.
       --major garbage collection也是stop the world的事件,通常major collection非常慢,因为涉及到所有活的对象。所以对于应用的响应,major garbage collections应该少一点好。也要注意的是,对老年代的回收的major garbage collection是最长的一种垃圾回收机制。
        在正式环境下,我所负责的系统
       
minor garbage collection   0.05s-0.17s之间
        major garbage collection   1.2s-5.3s之间

The Permanent generation contains metadata required by the JVM to describe the classes and methods used in the application. The permanent generation is populated by the JVM at runtime based on classes in use by the
application. In addition, Java SE library classes and methods may be stored here.
Classes may get collected (unloaded) if the JVM finds they are no longer needed and space may be needed for other classes. The permanent generation is included in a full garbage collection.
         --永久代装的是JVM所需要的元数据,应用的类和方法。永久代是应用运行的基础。此外,java SE的lib也运行在里面。当类不被需要时,就会被回收,被full garbage回收。
http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: