Discuss the design of parallel and incremental jmap histo.
linzang(臧琳)
linzang at tencent.com
Tue Dec 17 02:57:08 UTC 2019
Dear Chris,
I think I can first make the patch of parallel jmap. it seems to me that if parallel is fast enough, there is no need for incremental. So l will not work on it until I found new cases that show it is necessary, then we can discuss it again.
Thanks!
BRs,
Lin
On Dec 17, 2019, at 3:09 AM, Chris Plummer <chris.plummer at oracle.com<mailto:chris.plummer at oracle.com>> wrote:
On 12/15/19 5:38 PM, linzang(臧琳) wrote:
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.
This is the first I've heard mentioned of any of these. I assume NameNode is the process you are getting the heap dump from, and while dumping the heap it can't respond to ZKFC? That still sounds like something to me that should be addressed directly, and not worked around with the incremental solution. The parallel solution is ok because it also has a performance benefit, so if as a side affect it helps prevent the timeout issue, then that's ok.
>> 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.
Ok, but I still think avoiding the need for incremental dumps would be a better approach.
thanks,
Chris
>> 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<mailto:chris.plummer at oracle.com>>
*Date: *Saturday, December 14, 2019 at 2:46 AM
*To: *"linzang(臧琳)" <linzang at tencent.com<mailto:linzang at tencent.com>>, "serviceability-dev at openjdk.java.net<mailto:serviceability-dev at openjdk.java.net>" <serviceability-dev at openjdk.java.net<mailto: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.
2. 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”.
3. For parallel + incremental dump, I think it’s a little
complicated because of intermediate data processing:
1. 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.
2. 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.
3. 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/20191217/dc9918e3/attachment-0001.htm>
More information about the serviceability-dev
mailing list