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

Update amp #5170

Merged
merged 3 commits into from
Oct 23, 2019
Merged

Update amp #5170

merged 3 commits into from
Oct 23, 2019

Conversation

joanhey
Copy link
Contributor

@joanhey joanhey commented Oct 21, 2019

Update:

  • PHP v7.3.
  • Amp LIbs
  • Libuv instead of libev
  • the code

Ping @kelunik to review

Copy link
Contributor

@kelunik kelunik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

frameworks/PHP/amp/server.php Show resolved Hide resolved

Amp\Loop::run(function () {
$sockets = yield [
Cluster::listen("0.0.0.0:8080"),
Cluster::listen("[::]:8080"),
Cluster::listen('0.0.0.0:8080')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably pass a customized BindContext and increase the default backlog size.

https://github.com/amphp/socket/blob/abc18f1786363ceee2555ffd7fe87e4eead2ce24/src/BindContext.php#L12

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 128 is very low for a server.
But I don't know enough Amp.
Please could you help with that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. All you need to do is create an instance of (new Amp\Socket\BindContext)->withBacklog($size) as second parameter.

Copy link
Contributor Author

@joanhey joanhey Oct 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added socket bind context with backlog(102400) as the stream_socket_server use 2 sockets.
And with reuseport and tcpnodelay.

But I miss an option to set keepalive in the BindContext class.
Where could we set the keepalive ??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joanhey I stumbled upon that yesterday, too, so I just opened amphp/socket#67.

Copy link
Contributor Author

@joanhey joanhey Oct 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without keepalive, never will be fast, as each request from the same client need to open a new tcp connection. It's ready in the amp/http/server

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we're talking about different keep alives. HTTP/1.1 keep alive / connection reuse is automatically enabled.

The thing I just opened is about Tcp keep alive and only affects idle connections.

Bigger backlog, reuseport and tcpnodelay
@NateBrady23 NateBrady23 merged commit 0d05af1 into TechEmpower:master Oct 23, 2019
@joanhey joanhey deleted the amp branch October 23, 2019 15:52
tomciopp pushed a commit to tomciopp/FrameworkBenchmarks that referenced this pull request Oct 21, 2020
* Update amp

* Update connection limit

* Add socket bind context
Bigger backlog, reuseport and tcpnodelay
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.

3 participants