-
Notifications
You must be signed in to change notification settings - Fork 138
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
Investigate excessive socket connections #742
Comments
Copy/paste a skype conversation:
|
Using the following steps:
I'm able to create ESTABLISHED connections that should have been cleaned up by the heartbeat according to the above comment. These have all been hanging around for > 30 mins based on repro steps above:
|
I noticed that:
This was puzzling, and so I decided to get to the bottom of it. Here is the network capture when using curl: and here is the network capture when using android's httpclient: As it turns out, by default http1.1 clients will use persistent connections. This can be turned off by adding:
This has the effect of forcing the server to close the connection after sending a response. After adding the above, it behaved the same as the curl client. Btw I'm not suggesting that anybody do this, because then you will lose all of the benefits of persistent connections. I'm just writing this down as a piece to the puzzle in terms of figuring out why the connections are lingering. |
Good description of the problem: http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html Article on tcp keepalive with Go: http://felixge.de/2014/08/26/tcp-keepalive-with-golang.html |
I tried reducing the tcp keepalive time per this guide:
but it didn't seem to take the expected effect. This is on a CentOS7 box running in AWS. |
It did seem to reduce it to 20 minutes, which may be related to some internal minimum. |
I was able to reduce the time down to approximately 3 minutes with:
|
Is there a way to measure the additional work the TCP stack will have to do? Is that related to dropping connections that aren't actually lost? I guess I'm wondering why the default is so long. |
Basically it will cause more packets to be sent and increase overall network traffic. I think it's set to a high number by default because it's a relatively rare occurrence for a network cable to be unplugged, and the downside isn't that bad (an extra open socket for a while, which will eventually get reaped). Of course, in a mobile world, it's a more common occurrence. |
It's related to the "unplugged" scenario described in 2.3. Checking for dead peers of the TCP keepalive overview |
Added two articles to the couchbase-mobile-portal docs under "OS Level tuning", so I'm closing this ticket. |
Can you please provide a link to the articles? Thank you, I was looking under http://developer.couchbase.com/mobile/develop/guides/sync-gateway/index.html |
@couchbasebrian sure both articles are here: (this will eventually get pushed up to developer.couchbase.com) |
As reported in https://issues.couchbase.com/browse/CBSE-1722
The text was updated successfully, but these errors were encountered: