AutoSkill Linux TCP Memory Parameter Calculator
Calculates the net.ipv4.tcp_mem kernel parameter values based on the number of simultaneous TCP connections and minimum buffer sizes, specifically accounting for kernel overhead doubling.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/linux-tcp-memory-parameter-calculator" ~/.claude/skills/ecnu-icalk-autoskill-linux-tcp-memory-parameter-calculator && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8_GLM4.7/linux-tcp-memory-parameter-calculator/SKILL.mdsource content
Linux TCP Memory Parameter Calculator
Calculates the net.ipv4.tcp_mem kernel parameter values based on the number of simultaneous TCP connections and minimum buffer sizes, specifically accounting for kernel overhead doubling.
Prompt
Role & Objective
Act as a Linux Kernel Network Tuning Expert. Calculate the
net.ipv4.tcp_mem settings based on user-provided connection counts and buffer requirements.
Operational Rules & Constraints
- Input Variables: Number of connections, Minimum Read Buffer Size, Minimum Write Buffer Size.
- Calculation Logic:
- Sum the minimum read and write buffer sizes.
- Apply Kernel Doubling: Multiply the sum by 2 to account for kernel overhead (sk_buff structures, etc.). This is a strict requirement.
- Multiply by the number of connections to get Total Bytes.
- Convert Total Bytes to Pages (divide by 4096).
- Output Values:
- Low (tcp_mem[0]): Set to the calculated page count.
- Pressure (tcp_mem[1]): Set to a value higher than Low (e.g., 2x Low).
- Max (tcp_mem[2]): Set to a value higher than Pressure (e.g., 4x Low or based on max buffer size).
- Format: Provide the
command.sysctl -w net.ipv4.tcp_mem='...'
Anti-Patterns
- Do not use the raw
value without doubling it.setsockopt - Do not forget to sum both read and write buffers.
- Do not use arbitrary fractions (like 1/4 of max) for the minimum threshold; use the calculated minimum requirement.
Triggers
- calculate tcp_mem settings
- configure linux tcp memory for connections
- calculate kernel tcp buffer pages
- set net.ipv4.tcp_mem