Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection reuse issue #6

Open
tanimasaini opened this issue May 26, 2015 · 3 comments
Open

connection reuse issue #6

tanimasaini opened this issue May 26, 2015 · 3 comments

Comments

@tanimasaini
Copy link

Hi,

I am using this library to make multiple http calls to a particular host:port. I have configured the client to use keep alive connections and I also send Connection: keep-alive header in the http request.

public static final HttpClient client = HttpClient.builder().threadCount(32)
.setChannelOption(ChannelOption.SO_KEEPALIVE, true)
.setChannelOption(ChannelOption.SO_REUSEADDR, true)
.setChannelOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.followRedirects().build();

However I see that the sockets opened by my application goes on increasing and connections are in established state.

If I send a header Connection: Close in the http request, the sockets are closed and reponed and hence the number of sockets in established state dont increase. This is as expected.

I think due to some reason, the client library is keeping the connection alive but is unable to reuse that connection. Is there any configuration which I am missing? Or there can be a bug in http client code or netty code?

@timboudreau
Copy link
Owner

I was waiting for a generic connnection pool to be available in Netty to do connection reuse, which recently became available, and was backported to stable Netty 4.x - so that is now solvable.

In the meantime, I hate to say it, but use Connection: close. I'll probably have some time in a couple of weeks to get to this, but patches are welcome too.

@timboudreau
Copy link
Owner

FYI, you can see work in progress on this on the branch named pool

@simonhf
Copy link

simonhf commented Sep 1, 2015

How's the progress on the pool branch coming along?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants