gnet icon indicating copy to clipboard operation
gnet copied to clipboard

opt: improve the performance of sending data

Open limpo1989 opened this issue 9 months ago • 3 comments

When data reading occurs, there is a high probability of data writeback generated in the OnTraffic. At this time, it is not necessary to wait for the registration write event callback to immediately perform the write operation, which can improve the performance of sending data.

benchmark use https://github.com/gnet-io/gnet-benchmarks

BEFORE

Using interface lo to connect to [127.0.0.1]:7002
Ramped up to 500 connections.
Total data sent:     35112.2 MiB (36817855642 bytes)
Total data received: 14540.8 MiB (15247174323 bytes)
Bandwidth per channel: 13883.816⇅ Mbps (1735477.0 kBps)
Aggregate bandwidth: 4065.857↓, 9817.959↑ Mbps
Packet rate estimate: 372404.8↓, 858515.8↑ (12↓, 41↑ TCP MSS/op)
Test duration: 30.0004 s.

AFTER

Using interface lo to connect to [127.0.0.1]:7002
Ramped up to 500 connections.
Total data sent:     41217.8 MiB (43220020514 bytes)
Total data received: 27600.4 MiB (28941133491 bytes)
Bandwidth per channel: 19242.419⇅ Mbps (2405302.3 kBps)
Aggregate bandwidth: 7717.413↓, 11525.006↑ Mbps
Packet rate estimate: 706735.2↓, 999879.1↑ (12↓, 38↑ TCP MSS/op)
Test duration: 30.0009 s.

RESULT

before: Aggregate bandwidth: 4065.857↓, 9817.959↑ Mbps
after:
Aggregate bandwidth: 7717.413↓, 11525.006↑ Mbps

limpo1989 avatar May 23 '24 13:05 limpo1989