[ 
https://issues.apache.org/jira/browse/THRIFT-970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925482#action_12925482
 ] 

Bryan Duxbury commented on THRIFT-970:
--------------------------------------

I'm a little concerned about having two different HTTP-client-related classes 
in Thrift. On the one hand, it seems like THttpClient isn't all that 
responsible. On the other hand, it seems like your new THttpTransport won't 
cache connections at all, which could have significant performance implications.

Couldn't we instead find some way to make THttpClient do what we want it to and 
let he pooling/caching be configurable?

Also, it appears that just closing the input stream you get from 
HttpUrlConnection *never* closes the underlying socket, but there's another 
method called disconnect() that *will* close the underlying socket if the 
connection is idle. Maybe we just need to change THttpClient to call that 
method.

> Under heavy load, THttpClient may fail with "too many open files"
> -----------------------------------------------------------------
>
>                 Key: THRIFT-970
>                 URL: https://issues.apache.org/jira/browse/THRIFT-970
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Library
>    Affects Versions: 0.2, 0.3, 0.4, 0.5
>         Environment: All
>            Reporter: Mathias Herberts
>         Attachments: THRIFT-970-1
>
>
> THttpClient uses URL.openConnection which returns a HttpUrlConnection 
> instance for each message transmission.
> HttpUrlConnection supposedly pools connections to the server. While stress 
> testing an application, we've noticed that after several thousands requests, 
> THttpClient would fail with a "Too many open files" error thrown in 
> java.net.Socket.createImpl called from THttpClient.flush.
> As the underlying connection to the server is internally handled by 
> HttpUrlConnection and the JVM, there is unfortunately not much that can be 
> done to remedy this problem while still using HttpUrlConnection.
> I propose a new implementation of THttpClient which uses Apache HttpClient 
> from Http Components instead of HttpUrlConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to