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

Feature: TCP Fast Open implementaion. #356

Merged
merged 2 commits into from Jun 10, 2015
Merged

Feature: TCP Fast Open implementaion. #356

merged 2 commits into from Jun 10, 2015

Conversation

cubicdaiya
Copy link
Contributor

Introduced tcp-fastopen as the new directive. It takes 1 argument for the maximum queue length.
By default, the value of tcp-fastopen is zero (In this case, TCP Fast Open is disabled). Because TCP Fast Open is not always available.

Sample configuration

tcp-fastopen: 4096

Introduced tcp-fastopen as the new directive.
It takes 1 argument for the maximum queue length.
@kazuho
Copy link
Member

kazuho commented Jun 10, 2015

Thank you for the PR! Looks like a nice addition.

One little question: is there any reason not to have the feature turned on by default? If not, how about setting the default (in main) to 4,096 (instead of 0) if TCP_FASTOPEN is defined?

@cubicdaiya
Copy link
Contributor Author

One little question: is there any reason not to have the feature turned on by default?

No. I think it is also turned on by default.

If not, how about setting the default (in main) to 4,096 (instead of 0) if TCP_FASTOPEN is defined?

👍

@cubicdaiya
Copy link
Contributor Author

@kazuho Changed the default value and behavior. How about this?

@kazuho kazuho merged commit 79fbb56 into h2o:master Jun 10, 2015
@kazuho
Copy link
Member

kazuho commented Jun 10, 2015

Thank you for the changes! Merged to master with safeguards for platforms other than Linux added.

@2vek
Copy link

2vek commented Jun 18, 2015

I have a openvz virtual server, with very old kernel.

$ uname -r
2.6.32-042stab106.4

h2o refuses to start example config given in source code.

$  h2o -v
h2o version 1.3.0

$  h2o -c examples/h2o/h2o.conf 
failed to set TCP_FASTOPEN:Protocol not available
[examples/h2o/h2o.conf:3] failed to listen to port ANY:8080: Protocol not available

Most VPS providers don't update kernel often to boast their uptime.
Since, this is new kernel feature. I think h2o should just not use this feature if kernal don't support it, instead of refusing to start until tcp-fastopen: 0 added to config

@centminmod
Copy link

yeah OpenVZ VPS would have restrictions.. you can easily check if server environment is OpenVZ based by checking if this file exists /proc/user_beancounters and use that to determine if TCP Fast Open should be enabled or not

@kazuho
Copy link
Member

kazuho commented Jun 18, 2015

@2vek Oh that's bad.

Until we fix the issue, I think setting tcp-fastopen: 0 in your configuration file would be a workaround. Woold you mind trying?

see also: https://h2o.examp1e.net/configure/base_directives.html#tcp-fastopen

@cubicdaiya
Copy link
Contributor Author

Oh, sorry. The consideration seems to be not enough.

@kazuho
Copy link
Member

kazuho commented Jun 18, 2015

@cubicdaiya It's not your fault. I suggested turning this knob on by default.

IMO it might be better to report an warning and continue (instead of reporting an error and exitting) when setting TCP_FASTOPEN fails.

@kazuho
Copy link
Member

kazuho commented Jun 19, 2015

@2vek @centminmod I anticipate that the issue has been fixed with the merger of the pull-req above. Please open a new issue if you still have issues.

Thank you for your help.

@2vek
Copy link

2vek commented Jun 19, 2015

👍 It is better now, just tested

$  ./h2o -v 
h2o version 1.3.1
$  ./h2o -c examples/h2o/h2o.conf 
[warning] failed to set TCP_FASTOPEN:Protocol not available
[warning] failed to set TCP_FASTOPEN:Protocol not available
[warning] failed to set TCP_FASTOPEN:Protocol not available
[warning] failed to set TCP_FASTOPEN:Protocol not available
[INFO] raised RLIMIT_NOFILE to 65536
h2o server (pid:30888) is ready to serve requests
fetch-ocsp-response (using OpenSSL 1.0.1k 8 Jan 2015)
fetch-ocsp-response (using OpenSSL 1.0.1k 8 Jan 2015)
fetch-ocsp-response (using OpenSSL 1.0.1k 8 Jan 2015)
fetch-ocsp-response (using OpenSSL 1.0.1k 8 Jan 2015)
failed to extract ocsp URI from examples/h2o/server.crt
[OCSP Stapling] disabled for certificate file:examples/h2o/server.crt
failed to extract ocsp URI from examples/h2o/alternate.crt
[OCSP Stapling] disabled for certificate file:examples/h2o/alternate.crt
failed to extract ocsp URI from examples/h2o/server.crt
[OCSP Stapling] disabled for certificate file:examples/h2o/server.crt
failed to extract ocsp URI from examples/h2o/alternate.crt
[OCSP Stapling] disabled for certificate file:examples/h2o/alternate.crt

Thanks.

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

Successfully merging this pull request may close these issues.

None yet

4 participants