强碱是什么| 子宫肥大有什么危害| 京东公司全称是什么| 检查hpv需要注意什么提前注意什么| 肌张力高有什么症状| 榴莲为什么那么贵| 排山倒海是什么意思| 诚五行属什么| 为什么不要看电焊火花| 子宫什么样子图片| 什么牌子手机好| 为什么有的人怎么吃都不胖| 男人射的快是什么原因| 什么时间是排卵期| 猪儿虫是什么意思| 枕芯用什么填充物好| 塑料袋属于什么垃圾| 毛拉是什么意思| 木耳炒什么| 决明子泡水喝有什么好处| 鸡蛋与什么食物相克| 慢性胃炎用什么药效果最好| 曲苑杂坛为什么停播| 什么人不能吃石斛| 鼻子闻不到味道是什么原因| 人格是什么| 脸颊两侧长斑是什么原因怎么调理| 猪胰子是什么东西| 唐三彩是什么意思| 为什么会长针眼| 特别的意思是什么| 什么叫安置房| 吃一个海参相当于吃了什么| 血压高什么原因引起的| 眼睛干涩模糊用什么眼药水| 闻鸡起舞是什么生肖| 长期服用优甲乐有什么副作用| 属龙和什么属相最配| 即使什么也什么造句| 2007年属猪五行属什么| 月经发黑是什么原因| 百合有什么功效和作用| 荔枝什么品种最贵| 整装待发是什么意思| 心率90左右意味着什么| 验孕棒ct分别代表什么| 节度使是什么意思| 普洱在云南什么位置| www是什么| 医保是什么| 白蜡金是什么金| 生灵涂炭是什么意思| 马弁是什么意思| 大圣归来2什么时候上映| 毛遂自荐什么意思| 问羊知马是什么生肖| 为什么家里会有蚂蚁| 吃苹果有什么好处和功效| 香蕉补什么| 控销药品什么意思| 促甲状腺激素偏低是什么意思| 出海是什么意思| 何方珠宝是什么档次| 美好的近义词是什么| 月经期间喝酒有什么危害| 什么时候做四维| 叫花子是什么意思| 足三里在什么位置| ojbk什么意思| 士大夫什么意思| 尿潜血阴性什么意思| 股癣用什么药膏| 抬旗是什么意思| 月和什么有关| 巫山云雨是什么意思| 终结者是什么意思| 滑胎是什么意思| 94年的属什么| 渣渣辉什么意思| 为什么会得面瘫| 花木兰属什么生肖| 灵官爷是什么神| 肚脐周围痛是什么原因| 泰山石敢当什么意思| 什么是肾功能不全| 讥讽的笑是什么笑| 灯红酒绿是什么意思| 玙字五行属什么| 阿咖酚散是什么药| 乌鸡白凤丸适合什么人吃| 破伤风感染后会出现什么症状| 得了肠息肉有什么症状| 咳嗽能吃什么水果| 650是什么意思| 什么药吃了会产生幻觉| 伪善是什么意思| 食客是什么意思| 梦见什么是受孕成功了| 主导是什么意思| 子午流注是什么意思| 恢复伤口吃什么好得快| 蜜袋鼯吃什么| 急性寻麻疹用什么药| 悦字属于五行属什么| 检出限是什么意思| mi医学上是什么意思| 什么东西化痰效果最好最快| 沙发是什么发质| 小孩手上脱皮是什么原因| 湿疹用什么| 仙居杨梅什么时候上市| 磨平了棱角是什么意思| 鱼腥草有什么用处| 右侧胸膜增厚是什么意思| mi医学上是什么意思| 法令纹上有痣代表什么| 什么人容易得眩晕症| 疏朗是什么意思| 小孩出汗多是什么原因造成的| 脚底出汗是什么原因女| 嘉庆叫什么名字| titus手表属于什么档次| 总想睡觉是什么原因| 反流性食管炎挂什么科| 单个室早是什么意思| 玉五行属什么| 七月22号是什么星座| 血糖高适合喝什么酒| 7月20号是什么星座| 山麻雀吃什么| 母胎solo是什么意思| 冲喜是什么意思| 苯丙氨酸是什么| 屁股痛挂什么科| 西夏是现在的什么地方| 梦见把狗打死了是什么意思| 心脏下边是什么器官| 橘猫是什么品种| 金丝檀木是什么木| 黑豆不能和什么一起吃| 天麻主治什么病| 奶嚼口是什么| 李子和什么不能一起吃| 肝脓肿是什么病严重吗| 12月14号是什么星座| aa是什么病| 低盐饮食有利于预防什么疾病| z是什么品牌| 宽慰是什么意思| 性格内向的人适合做什么工作| m0是什么意思| 异想天开什么意思| 半衰期什么意思| 董卓字什么| 天子是什么生肖| 扁平疣是什么原因长出来的| 葫芦五行属什么| 异地办理临时身份证需要什么材料| 靖康耻指的是什么历史事件| 吃什么东西对心脏好| 手脚热吃什么药效果好| 霜降是什么意思| 七里香是什么| 什么是菊粉| 容易出汗什么原因| 想吃咸的是身体缺什么| 呜呼哀哉什么意思| 农历12月26日是什么星座| 黄精有什么作用| 阳虚什么症状| 心气不足是什么意思| 两个大于号是什么车| 三合局是什么意思| 1951属什么生肖| 梦见头上长虱子是什么意思| 柿子与什么食物相克| 有氧运动什么意思| 水瓶座男生喜欢什么样的女生| 缺钾是什么原因引起| 自来水是什么水| 什么是电子邮件地址| 手为什么会发麻| 啪啪是什么意思| 痔疮用什么药膏| 梦见灵堂是什么预兆| 经常拉肚子是什么原因引起的| 听什么音乐容易入睡| 做b超可以检查出什么| 虎鲸为什么对人类友好| 11月14号是什么星座| 脱发看什么科| 子宫内膜不典型增生是什么意思| 人工牛黄是什么| 1972年属鼠的是什么命| 头骨凹陷是什么原因| 消炎药有什么| 企鹅吃什么| 肺间质纤维化是什么病| 睾丸突然疼痛什么原因| 偏头痛不能吃什么食物| 尿次数多是什么原因| 高汤是什么汤| 回肠荡气什么意思| 胃炎伴糜烂吃什么药效果好| 屁多还臭是什么原因| 下巴发黑是什么原因| 雨露均沾什么意思| cream什么意思| 栖字五行属什么| 你喜欢我什么| 乌纱帽是什么意思| 薪字五行属什么| 直辖市市长是什么级别| 老舍被誉为什么| 如果怀孕了会有什么预兆| 来姨妈喝什么汤好| 打飞机是什么| 地贫和贫血有什么区别| 容易出汗是什么问题| konka是什么牌子| 女朋友过生日送什么最好| 吃饭恶心是什么原因| 拉肚子吃什么食物比较好| 烧心吃什么马上能缓解| 蒂芙尼算什么档次| 元宵节干什么| 马蹄是什么| 祭日是什么意思| 脸颊红是什么原因| 属狗的什么命| 血沉是查什么病的| 长方脸适合什么样的发型| 什么叫心肌桥| 晚上喝牛奶有什么好处和坏处| 7月份是什么季节| 舒筋健腰丸为什么这么贵| 咽喉炎吃什么药| 尿隐血是什么原因| 经期可以喝什么茶| 沙字五行属什么| 竹节棉是什么面料| 生姜什么时候种植最合适| 亭亭净植是什么意思| 靶向治疗是什么意思| 阁老相当于现在什么官| 肚子拉稀像水一样是什么情况| 维生素b2是什么颜色| pearl是什么意思| 嘴唇发紫发黑是什么原因| 眼角发白是什么原因| 荷花什么生肖| 乳粉是什么| 清谈是什么意思| 什么时候用顿号| copd是什么意思| 什么血型可以生出o型血| 手指僵硬暗示什么疾病| 途明是什么档次的包| 励志是什么意思| c是什么单位| 海参多少头是什么意思| 肌红蛋白偏低什么原因| 佯装是什么意思| 榴莲为什么贵| 百度

6 The Parallel Collector

The parallel collector (also referred to here as the throughput collector) is a generational collector similar to the serial collector. The primary difference between the serial and parallel collectors is that the parallel collector has multiple threads that are used to speed up garbage collection.

The parallel collector is enabled with the command-line option -XX:+UseParallelGC. By default, with this option, both minor and major collections are run in parallel to further reduce garbage collection overhead.

Number of Parallel Collector Garbage Collector Threads

On a machine with <N> hardware threads where <N> is greater than 8, the parallel collector uses a fixed fraction of <N> as the number of garbage collector threads.

The fraction is approximately 5/8 for large values of <N>. At values of <N> below 8, the number used is <N>. On selected platforms, the fraction drops to 5/16. The specific number of garbage collector threads can be adjusted with a command-line option (which is described later). On a host with one processor, the parallel collector will likely not perform as well as the serial collector because of the overhead required for parallel execution (for example, synchronization). However, when running applications with medium-sized to large-sized heaps, it generally outperforms the serial collector by a modest amount on computers with two processors, and usually performs significantly better than the serial collector when more than two processors are available.

The number of garbage collector threads can be controlled with the command-line option -XX:ParallelGCThreads=<N>. If you are tuning the heap with command-line options, then the size of the heap needed for good performance with the parallel collector is the same as needed with the serial collector. However, enabling the parallel collector should make the collection pauses shorter. Because multiple garbage collector threads are participating in a minor collection, some fragmentation is possible due to promotions from the young generation to the old generation during the collection. Each garbage collection thread involved in a minor collection reserves a part of the old generation for promotions and the division of the available space into these "promotion buffers" can cause a fragmentation effect. Reducing the number of garbage collector threads and increasing the size of the old generation will reduce this fragmentation effect.

Arrangement of Generations in Parallel Collectors

The arrangement of the generations is different in the parallel collector.

That arrangement is shown in Figure 6-1:

Figure 6-1 Arrangement of Generations in the Parallel Collector

Description of Figure 6-1 follows
Description of "Figure 6-1 Arrangement of Generations in the Parallel Collector"

Parallel Collector Ergonomics

When the parallel collector is selected by using -XX:+UseParallelGC, it enables a method of automatic tuning that allows you to specify behaviors instead of generation sizes and other low-level tuning details.

Options to Specify Parallel Collector Behaviors

You can specify maximum garbage collection pause time, throughput, and footprint (heap size).

  • Maximum garbage collection pause time: The maximum pause time goal is specified with the command-line option -XX:MaxGCPauseMillis=<N>. This is interpreted as a hint that pause times of <N> milliseconds or less are desired; by default, no maximum pause- time goal. If a pause-time goal is specified, the heap size and other parameters related to garbage collection are adjusted in an attempt to keep garbage collection pauses shorter than the specified value; however, the desired pause-time goal may not always be met. These adjustments may cause the garbage collector to reduce the overall throughput of the application.

  • Throughput: The throughput goal is measured in terms of the time spent doing garbage collection versus the time spent outside of garbage collection, referred to as application time. The goal is specified by the command-line option -XX:GCTimeRatio=<N>, which sets the ratio of garbage collection time to application time to 1 / (1 + <N>).

    For example, -XX:GCTimeRatio=19 sets a goal of 1/20 or 5% of the total time in garbage collection. The default value is 99, resulting in a goal of 1% of the time in garbage collection.

  • Footprint: The maximum heap footprint is specified using the option -Xmx<N>. In addition, the collector has an implicit goal of minimizing the size of the heap as long as the other goals are being met.

Priority of Parallel Collector Goals

The goals are maximum pause-time goal, throughput goal, and minimum footprint goal, and goals are addressed in that order:

The maximum pause-time goal is met first. Only after it's met is the throughput goal addressed. Similarly, only after the first two goals have been met is the footprint goal considered.

Parallel Collector Generation Size Adjustments

Statistics such as average pause time kept by the collector are updated at the end of each collection.

The tests to determine if the goals have been met are then made and any needed adjustments to the size of a generation is made. The exception is that explicit garbage collections, for example, calls to System.gc()are ignored in terms of keeping statistics and making adjustments to the sizes of generations.

Growing and shrinking the size of a generation is done by increments that are a fixed percentage of the size of the generation so that a generation steps up or down toward its desired size. Growing and shrinking are done at different rates. By default, a generation grows in increments of 20% and shrinks in increments of 5%. The percentage for growing is controlled by the command-line option -XX:YoungGenerationSizeIncrement=<Y> for the young generation and -XX:TenuredGenerationSizeIncrement=<T> for the old generation. The percentage by which a generation shrinks is adjusted by the command-line flag -XX:AdaptiveSizeDecrementScaleFactor=<D>. If the growth increment is X%, then the decrement for shrinking is X/D%.

If the collector decides to grow a generation at startup, then there's a supplemental percentage is added to the increment. This supplement decays with the number of collections and has no long-term effect. The intent of the supplement is to increase startup performance. There isn't supplement to the percentage for shrinking.

If the maximum pause-time goal isn't being met, then the size of only one generation is shrunk at a time. If the pause times of both generations are above the goal, then the size of the generation with the larger pause time is shrunk first.

If the throughput goal isn't being met, then the sizes of both generations are increased. Each is increased in proportion to its respective contribution to the total garbage collection time. For example, if the garbage collection time of the young generation is 25% of the total collection time and if a full increment of the young generation would be by 20%, then the young generation would be increased by 5%.

Parallel Collector Default Heap Size

Unless the initial and maximum heap sizes are specified on the command line, they're calculated based on the amount of memory on the machine. The default maximum heap size is one-fourth of the physical memory while the initial heap size is 1/64th of physical memory. The maximum amount of space allocated to the young generation is one third of the total heap size.

Specification of Parallel Collector Initial and Maximum Heap Sizes

You can specify the minimum and maximum heap sizes using the options -Xms (minimum heap size) and -Xmx (maximum heap size).

If you know how much heap your application needs to work well, then you can set -Xms and -Xmx to the same value. If you don't know, then the JVM will start by using the initial heap size and then growing the Java heap until it finds a balance between heap usage and performance.

Other parameters and options can affect these defaults. To verify your default values, use the -XX:+PrintFlagsFinal option and look for -XX:MaxHeapSize in the output. For example, on Linux you can run the following:

java -XX:+PrintFlagsFinal <GC options> -version | grep MaxHeapSize

Excessive Parallel Collector Time and OutOfMemoryError

The parallel collector throws an OutOfMemoryError if too much time is being spent in garbage collection (GC).

If more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, then an OutOfMemoryError, is thrown. This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small. If necessary, this feature can be disabled by adding the option -XX:-UseGCOverheadLimit to the command line.

Parallel Collector Measurements

The verbose garbage collector output from the parallel collector is essentially the same as that from the serial collector.

血栓有什么症状 头发打结是什么原因 5d电影是什么 锋芒的意思是什么 脉络膜裂囊肿是什么病
少字五行属什么 吃什么对甲状腺有好处 太阳筋疼是什么原因 小孩睡觉打呼噜是什么原因 精神心理科主要治疗什么疾病
离子四项是检查什么的 网状的蘑菇叫什么 荞麦长什么样子 黑咖啡什么时候喝 颈椎压迫神经手麻吃什么药
洗面奶什么好 山梨酸钾是什么东西 86属什么生肖 毒灵芝长什么样 数学专业学什么
腺肌症是什么意思tiangongnft.com 孩子多动缺什么sscsqa.com 四季春属于什么茶hcv9jop6ns9r.cn 三长两短是什么意思hcv8jop4ns5r.cn 月经来了不能吃什么东西hcv7jop9ns1r.cn
莫非的近义词是什么hcv8jop5ns9r.cn silk是什么意思hcv9jop3ns5r.cn 6月6日是什么星座hcv8jop6ns3r.cn 什么是五谷gangsutong.com 适合什么发型hcv8jop4ns2r.cn
嗜碱性粒细胞偏高是什么原因hcv8jop0ns6r.cn 脱氧核糖是什么hcv7jop5ns2r.cn 笑字五行属什么hcv9jop4ns4r.cn 20属什么hcv8jop8ns2r.cn 戴菊是什么jiuxinfghf.com
老人头发由白变黑是什么原因hcv9jop7ns4r.cn 大v什么意思shenchushe.com 喝中药为什么会拉肚子hcv9jop6ns4r.cn dm医学上是什么意思hcv7jop6ns1r.cn gm墨镜是什么牌子zhongyiyatai.com
百度