Join GitHub today
Implement streaming json responses #243
This pull request implements streaming json responses. Which user can configure via jolokia properties file.
Using streaming json I saw a drop by 39 times - in allocation sizes while an external python script performed 10 identical collections on the url. I did this numerous times and while numbers vary somewhat, it still holds true that using streaming json results in less allocations.
Thans a lot, and sorry for the delay. 'was skiing in the Alpes for a week ;)
I will have a look at it, and will include it in the one way or other. Could be that it will be added to Jolokia 2.0, but let me have a look first. This might take until the end of the week, though ....
Cheers. thanks for having a look. My motivation is to use this agent with cassandra cluster which uses ParNew GC and hence can result in stop-the-world gc pauses on young gc collection. I have profiled extensively with cassandra server and these changes have made young GC collections almost disappear.
The reason, we see less allocations is, there is lot of wasteful string creation when serializing full json strings. for example, when
This code removes lot of these redundant allocations. I haven't looked too closely at other endpoints (such as when ran within a container or proxy mode), since my own usecase uses jvm agent mode prominently. But I am happy to look. Also, do you think, it should be configured on per-request basis too?
was finally able to have a look, thanks a lot for the PR.
I wonder what would be the drawback to exclusively use streaming (and get rid of the old code). If streaming is always superior, we could get rid of the extra option and make that the default and only behaviour.
Do you see any problems in always using streaming ?
At Yelp - we have been running modified version of Jolokia (with this patch enabled) on hundreds of machines and so far we haven't seen a problem.
My initial worry was - what if a particular HTTP client couldn't deal with chunked encoding and this patch broke some of the tooling we have. But after good amount of testing, I haven't seen any regressions.
May 19, 2016
1 check passed
added a commit
this pull request
May 19, 2016
referenced this pull request
Sep 8, 2016
@gnufied Hi ;-) Sorry for pinging you again, but I have a question about your contribution https://github.com/rhuss/jolokia/blob/master/agent/core/src/main/java/org/jolokia/util/ChunkedWriter.java . It looks like that it takes over some parts or is derived directly from java.nio.StreamEncoder .
If you can confirm this, we have to replace this as
Thanks, and sorry for bugging you again. Don't get me wrong, your contribution is very valuable but we need to get this sorted out. It would be awesome if you could reply soon.
@rhuss I can confirm that bits of
I can revisit deriving from