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

Improve performance of TCP socket reads #2212

Merged
merged 7 commits into from
Jan 18, 2021

Conversation

mpilquist
Copy link
Member

@mpilquist mpilquist commented Jan 16, 2021

  • Initializes the socket read buffer to 8192 bytes instead of 0
  • Uses allocateDirect
  • Stores read buffer in a private var instead of a Ref

@djspiewak
Copy link
Member

djspiewak commented Jan 16, 2021

Almost no difference.

Before

Throughput

Ramped up to 500 connections.
Total data sent:     16886.5 MiB (17706826192 bytes)
Total data received: 16885.3 MiB (17705547200 bytes)
Bandwidth per channel: 18.886⇅ Mbps (2360.8 kBps)
Aggregate bandwidth: 4721.438↓, 4721.779↑ Mbps
Packet rate estimate: 437386.1↓, 437942.3↑ (6↓, 8↑ TCP MSS/op)

Requests per Second

200 clients, running 128 bytes, 30 sec.

Speed: 77217 request/sec, 77213 response/sec
Requests: 2316522
Responses: 2316394

After

Throughput

Ramped up to 500 connections.
Total data sent:     17368.3 MiB (18212022044 bytes)
Total data received: 17370.2 MiB (18213932796 bytes)
Bandwidth per channel: 19.424⇅ Mbps (2428.0 kBps)
Aggregate bandwidth: 4856.241↓, 4855.732↑ Mbps
Packet rate estimate: 448966.6↓, 451067.4↑ (6↓, 8↑ TCP MSS/op)

Requests per Second

200 clients, running 128 bytes, 30 sec.

Speed: 78482 request/sec, 78478 response/sec
Requests: 2354488
Responses: 2354342

io/src/main/scala/fs2/io/net/Socket.scala Outdated Show resolved Hide resolved
io/src/main/scala/fs2/io/net/Socket.scala Outdated Show resolved Hide resolved
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