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

perf(jetsocat,dgw): rework flow control algorithm #977

Merged
merged 3 commits into from
Aug 15, 2024
Merged

Conversation

CBenoit
Copy link
Member

@CBenoit CBenoit commented Aug 15, 2024

Replace the old naive flow control algorithm.
The new algorithm is much more fair, and considerably reduce the number of WindowAdjust messages exchanged.
The idea is to send WindowAdjust messages only when the scheduler is idle, and focus on handling active connections as fast as possible without sending any WindowAdjust message when it is busy.

Before this patch, single connection:

0.0000-15.5887 sec 34.4 GBytes 18.9 Gbits/sec

After this patch + maximum message size of 4 kB, single connection:

0.0000-10.0490 sec 23.0 GBytes 19.7 Gbits/sec

Improvement of 4.2%.

This patch + maximum message size of 16 kB, single connection:

0.0000-10.0393 sec 30.6 GBytes 26.2 Gbits/sec

Improvement of 38.6%.

Before this patch, 10 parallel connections:

[ ID] Interval Transfer Bandwidth
[ 3] 0.0000-20.0677 sec 555 MBytes 232 Mbits/sec
[ 9] 0.0000-20.0704 sec 3.89 GBytes 1.67 Gbits/sec
[ 2] 0.0000-20.0703 sec 3.62 GBytes 1.55 Gbits/sec
[ 4] 0.0000-20.0693 sec 3.91 GBytes 1.67 Gbits/sec
[ 10] 0.0000-20.0659 sec 3.43 GBytes 1.47 Gbits/sec
[ 5] 0.0000-20.0651 sec 2.73 GBytes 1.17 Gbits/sec
[ 8] 0.0000-20.0704 sec 3.83 GBytes 1.64 Gbits/sec
[ 7] 0.0000-20.0692 sec 3.37 GBytes 1.44 Gbits/sec
[ 1] 0.0000-20.0692 sec 3.61 GBytes 1.54 Gbits/sec
[ 6] 0.0000-20.2801 sec 455 MBytes 188 Mbits/sec
[SUM] 0.0000-20.2810 sec 29.4 GBytes 12.4 Gbits/sec

Notice how some connections are considerably slower.

After this patch + maximum message size of 4 kB, 10 parallel connections:

[ 8] 0.0000-10.3368 sec 1.88 GBytes 1.56 Gbits/sec
[ 10] 0.0000-10.3377 sec 1.87 GBytes 1.55 Gbits/sec
[ 1] 0.0000-10.3642 sec 1.87 GBytes 1.55 Gbits/sec
[ 5] 0.0000-10.3640 sec 1.86 GBytes 1.54 Gbits/sec
[ 2] 0.0000-10.3640 sec 1.85 GBytes 1.54 Gbits/sec
[ 4] 0.0000-10.3650 sec 1.85 GBytes 1.54 Gbits/sec
[ 3] 0.0000-10.3641 sec 1.85 GBytes 1.54 Gbits/sec
[ 9] 0.0000-10.3646 sec 1.90 GBytes 1.58 Gbits/sec
[ 6] 0.0000-10.3652 sec 1.85 GBytes 1.54 Gbits/sec
[ 7] 0.0000-10.3800 sec 1.87 GBytes 1.55 Gbits/sec
[SUM] 0.0000-10.3812 sec 18.7 GBytes 15.4 Gbits/sec

Improvement of 24.1%.
Also notice how all connections are transferring roughly the same amount of bytes.

Issue: DGW-202

Replace the old naive flow control algorithm.
The new algorithm is much more fair, and considerably reduce the
number of WindowAdjust messages exchanged.
The idea is to send WindowAdjust messages only when the scheduler is
idle, and focus on handling active connections as fast as possible
without sending any WindowAdjust message when it is busy.

Before this patch, single connection:

> 0.0000-15.5887 sec  34.4 GBytes  18.9 Gbits/sec

After this patch + maximum message size of 4 kB, single connection:

> 0.0000-10.0490 sec  23.0 GBytes  19.7 Gbits/sec

Improvement of 4.2%.

This patch + maximum message size of 16 kB, single connection:

> 0.0000-10.0393 sec  30.6 GBytes  26.2 Gbits/sec

Improvement of 38.6%.

Before this patch, 10 parallel connections:

> [ ID] Interval       Transfer     Bandwidth
> [  3] 0.0000-20.0677 sec   555 MBytes   232 Mbits/sec
> [  9] 0.0000-20.0704 sec  3.89 GBytes  1.67 Gbits/sec
> [  2] 0.0000-20.0703 sec  3.62 GBytes  1.55 Gbits/sec
> [  4] 0.0000-20.0693 sec  3.91 GBytes  1.67 Gbits/sec
> [ 10] 0.0000-20.0659 sec  3.43 GBytes  1.47 Gbits/sec
> [  5] 0.0000-20.0651 sec  2.73 GBytes  1.17 Gbits/sec
> [  8] 0.0000-20.0704 sec  3.83 GBytes  1.64 Gbits/sec
> [  7] 0.0000-20.0692 sec  3.37 GBytes  1.44 Gbits/sec
> [  1] 0.0000-20.0692 sec  3.61 GBytes  1.54 Gbits/sec
> [  6] 0.0000-20.2801 sec   455 MBytes   188 Mbits/sec
> [SUM] 0.0000-20.2810 sec  29.4 GBytes  12.4 Gbits/sec

Notice how some connections are considerably slower.

After this patch + maximum message size of 4 kB, 10 parallel connections:

> [  8] 0.0000-10.3368 sec  1.88 GBytes  1.56 Gbits/sec
> [ 10] 0.0000-10.3377 sec  1.87 GBytes  1.55 Gbits/sec
> [  1] 0.0000-10.3642 sec  1.87 GBytes  1.55 Gbits/sec
> [  5] 0.0000-10.3640 sec  1.86 GBytes  1.54 Gbits/sec
> [  2] 0.0000-10.3640 sec  1.85 GBytes  1.54 Gbits/sec
> [  4] 0.0000-10.3650 sec  1.85 GBytes  1.54 Gbits/sec
> [  3] 0.0000-10.3641 sec  1.85 GBytes  1.54 Gbits/sec
> [  9] 0.0000-10.3646 sec  1.90 GBytes  1.58 Gbits/sec
> [  6] 0.0000-10.3652 sec  1.85 GBytes  1.54 Gbits/sec
> [  7] 0.0000-10.3800 sec  1.87 GBytes  1.55 Gbits/sec
> [SUM] 0.0000-10.3812 sec  18.7 GBytes  15.4 Gbits/sec

Improvement of 24.1%.
Also notice how all connections are transferring roughly the same amount
of bytes.
@CBenoit CBenoit enabled auto-merge (squash) August 15, 2024 07:19
@CBenoit CBenoit disabled auto-merge August 15, 2024 07:30
@CBenoit CBenoit enabled auto-merge (squash) August 15, 2024 07:30
@pacmancoder pacmancoder self-requested a review August 15, 2024 09:21
Copy link
Contributor

@pacmancoder pacmancoder left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@CBenoit CBenoit merged commit 6b77a99 into master Aug 15, 2024
25 checks passed
@CBenoit CBenoit deleted the perf/jmux-proxy-5 branch August 15, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants