ok2c / httpcomponents-jackson

JSON message asynchronous producers and consumers for Apache HttpComponents 5.0 based on Jackson JSON library
https://ok2c.github.io/httpcomponents-jackson
Apache License 2.0
7 stars 6 forks source link

Blocking IO Threads #6

Closed anuragagarwal561994 closed 2 years ago

anuragagarwal561994 commented 3 years ago

@ok2c the json async processing works pretty well and I am able to achieve improvements in my cpu and memory.

I have one concern though which I am trying to debug. Since the handling of json processing is happening on io threads, for bigger response sizes I am seeing increased timeouts. In classic API otherwise the jackson processing would have been done by some other thread than the io thread.

I am suspecting that after migrating to the async APIs our io threads are getting chocked and resulting in these timeouts. For the API responses where the response sizes are small we are seeing improvements.

Running with 16 IOThreads on 16 core machine. Will try increasing the thread count.

ok2c commented 3 years ago

@anuragagarwal561994 I am not sure there should be any difference here betweein the classic and the async i/o model. Blocking connections can likewise get get choked unless one off-loads processing entirely to another thread. What I well know for a fact is that the async event-driven model is massively more complex and people tend to introduce all sorts of problems due to issues with their event handling code.

anuragagarwal561994 commented 3 years ago

So we are not fully doing async as of now. While calling http api, we add a latch in the callback and await till the response is given and then do the parsing in the classic model.

In the async model everything remains same, only difference is that we have started using the json async producer and consumer. Rest making a latch and let it countdown in the callback and awaiting for a response time remains same.

We record the start time before the call is made and record the end time after the json is parsed both in classic and async model, but yet we see the difference.

ok2c commented 3 years ago

@anuragagarwal561994 I am not sure how I can help.

ok2c commented 2 years ago

@anuragagarwal561994 Do you have any updates? Is this still an issue?

anuragagarwal561994 commented 2 years ago

@ok2c didn't get time to see this issue thereafter, you can close it for now. I will pick it up later and may be we can re-open this.