Discuss the design of parallel and incremental jmap histo.(Internet mail)
linzang(臧琳)
linzang at tencent.com
Mon Dec 16 01:38:23 UTC 2019
Dear Chris,
>> why jmap is getting stuck or "killed by timer" as you mention below. Shouldn't this be considered a bug and addressed directly.
This “timer” is usually another process, my experience is HDFS and ZKFC, the ZKFC pings it’s NameNode periodically, and when the NameNode’s heap is large (~180GB in my case), the heap iteration by jmap can cause the process stuck, so ZFKC can not get response from NameNode, so the NameNode got killed.
>> How useful are intermediate results? How often can users come to reasonable conclusions about heap usage when the data is incomplete.
From my experience, I usually use jmap -histo to get the information about the distribution of objects, and I found usually the object distribution of part of the heap is similar about the distribution of the whole heap. I agree that this is not correct for all cases, but since jmap -histo give results only when it’s exit normally at present, and I think maybe info of partial heap is better than nothing, especially for memory leak analysis.
>> Is there even an indication given of how much of the heap is accounted for in the output?
Yes, the incremental dump information shows the number of the objects and the totally bytes have been iterated.
Thanks!
BRs,
Lin
From: Chris Plummer <chris.plummer at oracle.com>
Date: Saturday, December 14, 2019 at 2:46 AM
To: "linzang(臧琳)" <linzang at tencent.com>, "serviceability-dev at openjdk.java.net" <serviceability-dev at openjdk.java.net>
Subject: Re: Discuss the design of parallel and incremental jmap histo.(Internet mail)
Hi Lin,
I have a question regarding the need for incremental support. The CSR states:
Problem: Now, the "JMap -histo" tool can not dump intermediate result, which is useful if the heap is large and dumping the whole heap can be stuck.
Two questions. The first is why jmap is getting stuck or "killed by timer" as you mention below. Shouldn't this be considered a bug and addressed directly. Second question is how useful are intermediate results? How often can users come to reasonable conclusions about heap usage when the data is incomplete. Is there even an indication given of how much of the heap is accounted for in the output?
thanks,
Chris
On 12/12/19 10:22 PM, linzang(臧琳) wrote:
Dear All,
I want to re-activate the thread of discussion about the implementation of parallel and incremental “Jmap -histo”.
The target of these changes is to solve the problems that “jmap -histo” may “ timeout or killed by timer” when heap is large. And the result of “jmap -histo” is “one or nothing”, which means if it gets killed before exit, user gets no information about the heap.
The “incremental” means that jmap -histo dumps the intermediate results when it is iterating the heap, so if it is interrupted, user can get some meaningful information.
The “parallel” targets to help speed up the heap iteration with multi-threading.
Originally I have implemented the “incremental dump” that dump the intermediate data into a separate file like <IncrementalHisto.dump>, and the final result will be saved to another file <HistoResult.dump>. so when jmap -histo get interrupted, user can get information from <IncrementalHisto.dump>, and if jmap -histo works fine, the final result would be in <HistoResult.dump>.
And the parallel dump will have multiple thread working on heap iteration, each thread generates intermediate data timely.
The main reason of using separate file for incremental dump is due to the consideration of parallel incremental dump implementation, so that every heap-iteration thread could dump its own data in separate file, to avoid using file lock.
However, it seems that the original design might confuse user by having two or more result files (intermediated result and final result). So I want to ask your help to discuss it:
1. For incremental dump without parallel, Intermediate result and the final result are dumped to the same file:
In this case, the intermediate data are generated in the middle of heap iteration, they are written to file <HistoResult.dump> at the same time. And if jmap -histo exits normally, the final result will be also dump to <HistoResult.dump>, then all intermediate data are flushed.
1. For parallel dump without incremental:
Every thread generates its own thread-local dump buffer, and all thread local dump are merged and write to the <HistoResult.dump> file at the end.
There is no incremental support, so the result is “one or nothing”.
1. For parallel + incremental dump, I think it’s a little complicated because of intermediate data processing:
* Every thread has its own thread-local intermediate data buffer, and all the thread-local buffers will be written to <HistoResult.dump> file while holding file lock. So there is only one data file generated, and if jmap -histo is interrupted, the intermediated data are save in the same file.
The problem is that the file write lock can be heavy, which may cause parallel heap dump slow.
* Every thread has its own thread-local intermediate data buffer, and every thread save its result in an temp file named <IntermediatedResult_[tid].dump>.
So there is no file lock. The parallel can be fast. But the problem is that there will be multiple files generated to save the thread-local intermediate results. And this might confuse the user.
* Every thread has its own thread-local intermediate data buffer, and another “data-merging-thread” will be generated.
The parallel threads write data to its thread local buffer, and enqueue the buffer when data reach some threshold. The “data-merging-thread” consumes the queue, merge the data from different thread, save the merged data to the result file.
In this case, there is only one <HistoResult.dump> file generated. And there is no file lock needed, but there is queue lock, and a separate “merging thread” impl. Do you think this is a reasonable solution?
So may I ask your suggestion ?
Details of previous discussion can be found at https://mail.openjdk.java.net/pipermail/serviceability-dev/2019-June/028276.html
Thanks!
BRs,
Lin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20191216/41e13508/attachment-0001.htm>
More information about the serviceability-dev
mailing list