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

Change default socket backlog size to 511 #242

Merged
merged 1 commit into from
Aug 1, 2020
Merged

Conversation

clue
Copy link
Member

@clue clue commented Jul 31, 2020

The backlog parameter used to default to just 32 as of PHP 5.3.3 and
used to be hard coded to 4 in earlier PHP versions.

The new default of 511 was evaluated to be a reasonable value for
event-driven applications that can cope with many concurrent connections
on a variety of platforms. In particular, this solves common ECONNRESET
(connection reset by peer) errors when running benchmarks with higher
concurrency. For more specific requirements, the backlog parameter can
be given explicitly to override this default.

See php/php-src@5b277c4
Refs reactphp/http#354 and others

The `backlog` parameter used to default to just 32 as of PHP 5.3.3 and
used to be hard coded to 4 in earlier PHP versions.

The new default of 511 was evaluated to be a reasonable value for
event-driven applications that can cope with many concurrent connections
on a variety of platforms. In particular, this solves common ECONNRESET
(connection reset by peer) errors when running benchmarks with higher
concurrency. For more specific requirements, the `backlog` parameter can
be given explicitly to override this default.

See php/php-src@5b277c4
@clue clue added this to the v1.6.0 milestone Jul 31, 2020
@kelunik
Copy link
Contributor

kelunik commented Aug 1, 2020

@clue Care to shed some light why you chose 511 instead of 512?

@clue
Copy link
Member Author

clue commented Aug 1, 2020

@acasademont 511 is not only used in Node.js and PHP-FPM, but also in Nginx, Apache, Redis, etc... I'd say 511 was determined to be a safe limit on most OSes (except FreeBSD where it's -1). The backlog limit default in PHP was committed 5 years ago by an user, I don't think there was much discussion about it (the limit default itself) before or after adding a backlog stream context option?

Originally posted by @CharlotteDunois in reactphp/http#354 (comment)

@kelunik
Copy link
Contributor

kelunik commented Aug 1, 2020

Thanks!

@jsor jsor merged commit acdcab8 into reactphp:master Aug 1, 2020
@clue clue deleted the backlog branch August 1, 2020 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants