Http response time very slow

J. Mi jmi258 at gmail.com
Wed Sep 23 18:46:21 EDT 2009


Hi all,

I still have a performance issue with my HttpClient. My HttpClient (similar
to snoop example) needs to concurrently send multiple requests to some
online servers and then wait for all responses come back and then merge
them.

So I provided an answer as LinkedBlockingQueue in my response handler. When
messageReceived got invoked via an event, it offers the response in answer.
I also provided a getContent() method in my response handler for my
HttpClient to use to retrieve response of each request.
In getContent(), it uses answer.poll(TIME_OUT, TimeUnit.MILLISECONDS) to get
the response offered in messageReceived().

I created a simulator, a servlet, as an online server. I purposely delay 200
ms in the servlet before returning response. However, it appeared that
TIME_OUT in getContent() needed to be pretty long, like 600 ms (or sometimes
1 sec) before getting the response offered by messageReceived().

Anyone has any idea why it takes so long for messageReceived() being
triggered. The Tomcat server is sitting in the same machine where I run my
HttpClient. Well, actually Tomcat server is running in my Windows and the
HttpClient is running in my VMware in the same machine. It shouldn't be any
network impact.

Is there anything I can do to have messageReceived() invoked reasonably
prompt after channel sends a request to the servlet? This seems to be the
bottleneck.
This scenario can be just simplified as a simple request to a local server
to retrieve a simple, but 200ms-delayed, response. I wish my messageReceived
can be triggered within a second.

Thanks for your help,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-dev/attachments/20090923/abd71386/attachment.html 


More information about the netty-dev mailing list