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

Confirm if HTTP connection uses Keep-Alive #34

Closed
erickpintor opened this issue Jun 24, 2016 · 5 comments
Closed

Confirm if HTTP connection uses Keep-Alive #34

erickpintor opened this issue Jun 24, 2016 · 5 comments

Comments

@erickpintor
Copy link
Contributor

To improve performance, FaunaDB allows http keep-alive connections. The should drivers issue requests with keep-alive header on.

The idle timeout for http connections is 5 seconds on the server, we should set it to a bit less on the client. 4 seconds should be fine.

@mtnbarreto
Copy link
Contributor

From my understanding by default NSURLSession uses HTTP keep alive so not need to negotiate TCP stuff for each request.
Anyway i would like to check it.

Okay about the idle timeout.

@mtnbarreto mtnbarreto added the done label Jul 5, 2016
@mtnbarreto
Copy link
Contributor

mtnbarreto commented Jul 5, 2016

It seems the client is not sending any Connection: close header so the connection should keep alive.

@erickpintor
Copy link
Contributor Author

There is still an open question related to this: does swift keep a connection pool? If yes, we'll have to set it's idle timeout.

@erickpintor erickpintor reopened this Jul 5, 2016
@mtnbarreto
Copy link
Contributor

mtnbarreto commented Jul 5, 2016

Apparently NSURLSession does't have such configuration. I'm almost sure it use a connection pool and in fact it support HTTP pipeline but probably it makes the decision about when close idle connections based on networking activity and trying to be as efficient as possible with the resources.

@erickpintor Here you have the NSURLSession configuration properties https://developer.apple.com/reference/foundation/nsurlsessionconfiguration. Maybe we should set up HTTPMaximumConnectionsPerHost.

Let me know your thoughts and the direction we should take on this.

@erickpintor
Copy link
Contributor Author

From the docs.

... depending on your connection to the Internet, a session may use a lower limit than the one you specify. The default value is 6 in OS X, or 4 in iOS.

It doesn't seems wise to change it.

Considering that amount of concurrent connections, and the lack of configuration around idleness, I think is unlikely that it'll happen on normal devices.

We can close this for now.

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

No branches or pull requests

2 participants