Skip to content

bpftune doesn't seem to notice its' hit an external limit when attempting to increase TCP buffers #93

@wolfspyre

Description

@wolfspyre

first, want to say that BPFTune is super cool.

This is really good stuff. and I'm thankful for the efforts put forth at autotuning.
I think a good companion tool to this would leverage a sibling host, to help identify optimal interface settings wrt nic buffers, MTU, mss, etc... but that's a tangent of a different flavor.

I have observed a peculiar behavior with bpftune on my proxmox hosts that I suspect others may hit as well.

Ceph wants to schep lots of data around. and so bpftune is trying to increase the tcp buffer accordingly.
...but it seems unaware of the 2g limit to rmem_max and keeps hitting a wall attempting to increase rmem max beyond 2gb:

2024-10-07T18:41:48.055804-05:00 px-m-45 bpftune[2726]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput
2024-10-07T18:41:48.055927-05:00 px-m-45 bpftune[2726]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (67108864 134217728 2000000000) -> (67108864 134217728 2500000000)
2024-10-07T18:41:48.152832-05:00 px-m-45 bpftune[2726]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput
2024-10-07T18:41:48.152950-05:00 px-m-45 bpftune[2726]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (67108864 134217728 2000000000) -> (67108864 134217728 2500000000)
2024-10-07T18:41:48.216185-05:00 px-m-45 bpftune[2726]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput
2024-10-07T18:41:48.216286-05:00 px-m-45 bpftune[2726]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (67108864 134217728 2000000000) -> (67108864 134217728 2500000000)
2024-10-07T18:41:48.311124-05:00 px-m-45 bpftune[2726]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput
2024-10-07T18:41:48.311317-05:00 px-m-45 bpftune[2726]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (67108864 134217728 2000000000) -> (67108864 134217728 2500000000)
2024-10-07T18:41:48.480604-05:00 px-m-45 bpftune[2726]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput
2024-10-07T18:41:48.480783-05:00 px-m-45 bpftune[2726]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (67108864 134217728 2000000000) -> (67108864 134217728 2500000000)
2024-10-07T18:41:48.525093-05:00 px-m-45 bpftune[2726]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput
2024-10-07T18:41:48.525232-05:00 px-m-45 bpftune[2726]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (67108864 134217728 2000000000) -> (67108864 134217728 2500000000)
2024-10-07T18:41:48.620254-05:00 px-m-45 bpftune[2726]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput
2024-10-07T18:41:48.620394-05:00 px-m-45 bpftune[2726]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (67108864 134217728 2000000000) -> (67108864 134217728 2500000000)
2024-10-07T18:41:48.926975-05:00 px-m-45 bpftune[2726]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput
2024-10-07T18:41:48.927068-05:00 px-m-45 bpftune[2726]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (67108864 134217728 2000000000) -> (67108864 134217728 2500000000)
2024-10-07T18:41:48.978057-05:00 px-m-45 bpftune[2726]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput

This is 1 second of logs about this ;)

root@px-m-45:/var/log# uname -a
Linux px-m-45 6.8.12-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-2 (2024-09-05T10:03Z) x86_64 GNU/Linux
root@px-m-45:/var/log# sysctl net.ipv4.tcp_rmem
net.ipv4.tcp_rmem = 67108864	134217728	2000000000
sysctl -w net.ipv4.tcp_rmem="67108864 134217728 2000000000"
net.ipv4.tcp_rmem = 67108864 134217728 2000000000
root@px-m-45:/var/log# sysctl -w net.ipv4.tcp_rmem="67108864 134217728 2147483647"
net.ipv4.tcp_rmem = 67108864 134217728 2147483647
root@px-m-45:/var/log# sysctl -w net.ipv4.tcp_rmem="67108864 134217728 2147483648"
sysctl: setting key "net.ipv4.tcp_rmem": Invalid argument
root@px-m-45:/var/log#

This makes sense, as net.ipv4.rmem_max / net.ipv4.wmem_max cap at 2g-1

root@px-m-45:/var/log# sysctl -w net.core.rmem_max=2147483647
net.core.rmem_max = 2147483647
root@px-m-45:/var/log# sysctl -w net.core.rmem_max=2147483648
sysctl: setting key "net.core.rmem_max": Invalid argument

root@px-m-45:/var/log# sysctl -w net.core.wmem_max=2147483647
net.core.wmem_max = 2147483647
root@px-m-45:/var/log# sysctl -w net.core.wmem_max=2147483648
sysctl: setting key "net.core.wmem_max": Invalid argument

This link isn't REALLY relevant, except that it points out the 2g cap

So... I suppose I'd expect that bpftune would be aware that this is (seemingly?) a hard limit.. or identify that it's hitting some limitation, and perhaps intelligently trying to find a maximal value, rather than simply trying to increease by 25%?

thoughts?

again, thanks for making this... it's slick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions