JDK 12 正式收錄了我們的 Patch
國慶假期歸來就收到喜訊,之前給社群提交的patch( OA==&mid=2650887295&idx=1&sn=09fc96e6a6b4fc3cf9ebc7d7ada0bc9f&chksm=f32f60c0c458e9d60d4677816c0943bcd1a1a51bcb6b0179f5483cbd609103f803f3c95e119e&scene=21#wechat_redirect" target="_blank" rel="nofollow,noindex">PerfMa給OpenJDK社群提交的第一個Patch )已經正式收錄到JDK12了(點選“閱讀原文”,可檢視詳情),非常感謝社群的小夥伴的積極配合,從提交issue開始到正式修復並打入JDK12耗時才10天的時間,這個效率已經挺讚了,測試用例還是社群小夥伴給寫的,PerfMa會和社群不斷保持聯絡,貢獻出我們的一份力量,服務好Java小夥伴們。
另外第二個Patch( 假笨說-Metaspace使用很少就觸發了Full GC?(第二個社群Patch) )考慮到會修改一些語義,和之前的一些GC日誌表達上會不一致,和我之前的考慮有些類似,因此可能不太會考慮我的提議,雖然他們也認同我的考慮,下面是社群給的回覆:
FWIW, I agree this is confusing, and personally would prefer the committed size be printed as you suggests, but I guess this may break a lot of tooling. Note that the gap between committed and used can be quite large in the following pathological scenarios: a) lots of class loaders which do not load many classes and stop loading classes at an inconvenient time: when having been handed a larger memory chunk after having used up four small chunks - which the JVM takes as proof that this classloader is here to stay and therefore may just as well get a large chunk to gnaw on. This leads to fragmentation and there is no easy way to avoid it. We can play around with chunk sizes and allocation strategies but there will always be pathological scenarios since the JVM needs to guess and may guess wrongly. b) when class loaders died and their memory chunks are returned to the internal metaspace freelists. They are not always uncommitted immediately; in fact they never may be uncommitted. They will be reused when other classloaders load classes, which may never happen. Note: to analyze these situations better we (SAP) added a new command to jcmd, "VM.metaspace". Among other things, the command outputs a "Waste" section, which details both (a) and (b) and some minor other waste scenarios. That command is now upstream in stock OpenJDK, so it should be available in jdk11. Thanks, Thomas
相關連結
假笨說-Metaspace使用很少就觸發了Full GC?(第二個社群Patch)
歡迎各位關注個人微信公眾號,主要圍繞JVM寫一系列的原理性,效能調優的文章,也可以關注我們公司的公眾號