Skip to content

Configurable listen backlog - #263

Merged
jaspervdj merged 4 commits into
jaspervdj:masterfrom
ners:push-ltyrxumsqpnl
Oct 3, 2026
Merged

jaspervdj merged 4 commits into
jaspervdj:masterfrom
ners:push-ltyrxumsqpnl

Conversation

@ners

@ners ners commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

I built a small server using runServer and benchmarked it under concurrent load.
It had a severe throughput degradation at around 16 simultaneous clients.

I traced it down to the backlog setting that makeListenSocket hard-codes to 5. This setting forces the kernel to drop connections if there are already 5 pending in the queue. The client then goes into TCP retransmit instead of completing a handshake.

In my benchmark, bumping the backlog moderately improved performance for up to 16 clients, and doubled it past 16.

The added parameter to makeListenSocket made it take Int -> Int, which I assumed you would find objectionable. So, since this is a breaking change already, I took the liberty to migrate to the more descriptive HostName and PortNumber. 🙂

I also bumped the version and added changelog entries, and prepared the commits such that they don't need squashing before merging.

@jaspervdj jaspervdj left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks good to me, thanks!

Comment thread CHANGELOG Outdated
@jaspervdj
jaspervdj merged commit 52ec542 into jaspervdj:master Oct 3, 2026
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.

2 participants