Jolokia string allocation and streaming json

classic Classic list List threaded Threaded
1 message Options
gnufied gnufied
Reply | Threaded
Open this post in threaded view

Jolokia string allocation and streaming json

Hey guys,

I was trying to use Jolokia with a cassandra server and noticed that polling Jolokia http endpoint every 1 minute causes 3-4 young GCs lasting approx. 40ms each.

I am using Jolokia JVM agent and my team sort of agreed that - these GCs might be problematic for production use.

After this I had a look at Jolokia source code and found that, it constructs json strings where it can potentially also use streaming json via JSONStreamAware interface. I modified the source code to use JSONStreamAware wherever possible and found significant saving in string allocation.

There are downsides however:

1. Because JSON responses are streaming, we can't specify Content-Length in http responses.
2. Having streaming json might not be desirable for many clients. I was thinking, if I have to send this upstream as a patch, I should make this configurable.

What are your thoughts on this? I am also having somewhat difficult time getting jolokia test suite to successfully run because it seems to be having timing issues( correct me if I am wrong here).