Tinklo inžinieriai dažnai susiduria su tokiomis situacijomis, kai TCP užvedimas arba taikymas yra kaltas dėl tinklo infrastruktūros. @ info: whatsthis
Darbe pateikiama tiek senųjų (circa 2009), tiek dabartinių (2025- 2026) "Linux", "Windows" ir "MacOS" buferinių konfigūracijų informacija, taip pat diagnostikos priemonės, skirtos nustatyti, ar buferis išnaudojamas, prieš jam tampant kritine problema.
TCP naudoja srauto valdymo mechanizmą, kai imtuvas reklamuoja "lango dydį", nurodydamas, kiek duomenų jis gali priimti. @ info: whatsthis Kalbama apie tinklo problemą, bet iš tikrųjų tai yra priimančiosios šalies išteklių klausimas.
# Check current TCP buffer settings sysctl net.ipv4.tcp_rmem sysctl net.ipv4.tcp_wmem sysctl net.core.rmem_max sysctl net.core.wmem_max # Check NIC ring buffer sizes ethtool -g eth0 # Monitor socket buffer usage ss -tm # Check for TCP zero window events tcpdump -i any 'tcp[tcpflags] & tcp-push != 0' -vv # Check network statistics for buffer issues netstat -s | grep -i "buffer\|queue\|drop"
# Check TCP parameters
netsh interface tcp show global
# View network adapter buffer settings
Get-NetAdapterAdvancedProperty -Name "Ethernet" | Where-Object {$_.DisplayName -like "*buffer*"}
# Monitor TCP statistics
netstat -s -p tcp
# Check receive window auto-tuning
netsh interface tcp show global | findstr "Receive Window"
# Check current buffer settings sysctl kern.ipc.maxsockbuf sysctl net.inet.tcp.sendspace sysctl net.inet.tcp.recvspace # View network statistics netstat -s -p tcp # Monitor socket buffers netstat -an -p tcp
| Parametras | palikimo vertė (2009) | Aprašymas |
|---|---|---|
| net.core.rmem _ default | 124928 (122KB) | NAME OF TRANSLATORS |
| net.core.rmem _ max | (128KB) | Maksimalus priėmimo lizdo buferio dydis |
| net.core.wmem _ default | 124928 (122KB) | NAME OF TRANSLATORS |
| net.core.wmem _ max | 131071 (128KB) | Maksimalus siuntimo lizdo buferio dydis |
| net.ipv4.tcp _ rmem | 4096 87380 174760 | TCP gauna buferis: min, numatytoji, max (baitais) |
| net.ipv4.tcp _ wmem | 4096 16384 131072 | TCP siuntimo buferis: min, default, max (baitais) |
| net.ipv4.tcp _ mem | 196608 262144 393216 | TCP atminties puslapių: žemas, spaudimas, aukštas |
| net.core.netdev _ max _ backlog | 1000 | @ info: whatsthis |
| net.core.optmem _ max | 10240 (10KB) | Didžiausias papildomas buferio dydis vienam lizdui |
| Parameter | NAME OF TRANSLATORS | Description |
|---|---|---|
| net.core.rmem_default | 16777216 (16MB) | Default receive socket buffer size |
| net.core.rmem_max | 134217728 (128MB) | Maximum receive socket buffer size |
| net.core.wmem_default | 16777216 (16MB) | Default send socket buffer size |
| net.core.wmem_max | 134217728 (128MB) | Maximum send socket buffer size |
| net.ipv4.tcp_rmem | 4096 87380 134217728 | TCP gauna buferis: min, default, max (128MB max) |
| net.ipv4.tcp_wmem | 4096 65536 134217728 | TCP siuntimo buferis: min, default, max (128MB max) |
| net.ipv4.tcp_mem | 8388608 12582912 16777216 | TCP atminties puslapių: žemas, slėgis, aukštas (64GB sistema) |
| net.core.netdev_max_backlog | 250000 | Maksimalūs paketai įvesties eilėje (10GBE +) |
| net.core.optmem_max | 65536 (64KB) | Maximum ancillary buffer size per socket |
| net.ipv4.tcp _ shope _ control | bBr | Naudokite BBA perkrovos kontrolę ("Google" algoritmas) |
| net.ipv4.tcp _ window _ mastelis | 1 | Įjungti TCP langų mastelį (RFC 1323) |
| net.ipv4.tcp _ timestamps | 1 | Įjungti TCP laiko žymas geresniam RTT apskaičiavimui |
| net.ipv4.tcp _ sack | 1 | Įjungti pasirinktinį patvirtinimą |
| net.ipv4.tcp _ no _ metrics _ save | 1 | Naikinti TCP metriką |
Pridėti šiuos nustatymus į /etc/sysctl.conf arba sukurti naują failą /etc/sysctl.d/99-network-tuning.conf:
# Network Buffer Tuning for High-Performance Applications # Optimized for 10GbE+ networks with RTT up to 300ms # Core socket buffer settings net.core.rmem_default = 16777216 net.core.rmem_max = 134217728 net.core.wmem_default = 16777216 net.core.wmem_max = 134217728 # TCP buffer settings net.ipv4.tcp_rmem = 4096 87380 134217728 net.ipv4.tcp_wmem = 4096 65536 134217728 net.ipv4.tcp_mem = 8388608 12582912 16777216 # Device buffer settings net.core.netdev_max_backlog = 250000 net.core.netdev_budget = 50000 net.core.netdev_budget_usecs = 5000 net.core.optmem_max = 65536 # TCP optimizations net.ipv4.tcp_congestion_control = bbr net.ipv4.tcp_window_scaling = 1 net.ipv4.tcp_timestamps = 1 net.ipv4.tcp_sack = 1 net.ipv4.tcp_no_metrics_save = 1 net.ipv4.tcp_moderate_rcvbuf = 1 # Apply with: sysctl -p /etc/sysctl.d/99-network-tuning.conf
# Check current ring buffer sizes ethtool -g eth0 # Set maximum ring buffer sizes (adjust based on NIC capabilities) ethtool -G eth0 rx 4096 tx 4096 # Make persistent by adding to /etc/network/interfaces or systemd service
| Parameter | Legacy Value (2009) | Vieta |
|---|---|---|
| TcpWindowDydis | 65535 (64KB) | Registras: HKLM\ System\ ControltsControlSet\ Paslaugos\ Tcpip\ Parametrai |
| Tcp1323Opts | 0 (išjungtas) | NAME OF TRANSLATORS |
| Comment | 8192 (8KB) | NAME OF TRANSLATORS |
| Comment | 8192 (8KB) | NAME OF TRANSLATORS |
| GlobalMaxTcpWindowSize | 65535 (64KB) | Didžiausias TCP lango dydis |
| TcpNumConnections | 16777214 | Didžiausias TCP ryšys |
Modernus Windows naudoja Gaunamas langas Automatinis nustatymas funkcija, kuri dinamiškai koreguoja gauna buferius, remiantis tinklo sąlygomis.
| Savybė | NAME OF TRANSLATORS | Description |
|---|---|---|
| Automatinio derinimo lygis | normalus (arba labai eksperimentinis 10GbE +) | Dinaminis priėmimo lango reguliavimas |
| Gavimo pusės skalė (RSS) | įjungtas | Name |
| Comment | automatinis (arba išjungtas šiuolaikinėse NIC) | TCP perkėlimas į NIC aparatūrą |
| NetDMA | išjungtas | tiesioginė prieiga prie atminties (išjungta) |
| TCP pasauliniai parametrai | Žiūrėkite komandas žemiau | Sistemos pločio TCP nustatymai |
| Siūties tiekėjas | CUBIC (arba NewReno nugaros) | TCP perkrovos kontrolės algoritmas |
# Check current auto-tuning level netsh interface tcp show global # Enable auto-tuning (normal mode - default for most scenarios) netsh interface tcp set global autotuninglevel=normal # For high-bandwidth, high-latency networks (10GbE+, data center environments) netsh interface tcp set global autotuninglevel=experimental # For conservative tuning (if experimental causes issues) netsh interface tcp set global autotuninglevel=restricted # For very conservative tuning (not recommended for high-performance networks) netsh interface tcp set global autotuninglevel=highlyrestricted # Enable CUBIC congestion provider (Windows Server 2022/Windows 11+ only) netsh interface tcp set supplemental template=Internet congestionprovider=cubic # Note: Windows 10 and Server 2019 use Compound TCP or NewReno by default # CUBIC is not available on these older versions # Enable Receive-Side Scaling (RSS) netsh interface tcp set global rss=enabled # Set chimney offload (automatic is recommended) netsh interface tcp set global chimney=automatic # Disable NetDMA (recommended for modern systems) netsh interface tcp set global netdma=disabled # Enable Direct Cache Access (if supported) netsh interface tcp set global dca=enabled # Enable ECN (Explicit Congestion Notification) netsh interface tcp set global ecncapability=enabled # Set initial congestion window to 10 (RFC 6928) netsh interface tcp set global initialRto=3000
# View current adapter settings Get-NetAdapterAdvancedProperty -Name "Ethernet" # Increase receive buffers (adjust based on NIC) Set-NetAdapterAdvancedProperty -Name "Ethernet" -DisplayName "Receive Buffers" -DisplayValue 2048 # Increase transmit buffers Set-NetAdapterAdvancedProperty -Name "Ethernet" -DisplayName "Transmit Buffers" -DisplayValue 2048 # Enable Jumbo Frames (if network supports it) Set-NetAdapterAdvancedProperty -Name "Ethernet" -DisplayName "Jumbo Packet" -DisplayValue 9014 # Enable Large Send Offload (LSO) Set-NetAdapterAdvancedProperty -Name "Ethernet" -DisplayName "Large Send Offload V2 (IPv4)" -DisplayValue Enabled Set-NetAdapterAdvancedProperty -Name "Ethernet" -DisplayName "Large Send Offload V2 (IPv6)" -DisplayValue Enabled
# These settings are typically NOT needed on Windows 10/11 due to auto-tuning # Only modify if auto-tuning is disabled or problematic # Registry path: HKLM\System\CurrentControlSet\Services\Tcpip\Parameters # Maximum TCP window size (if auto-tuning disabled) # TcpWindowSize = 16777216 (16MB) - REG_DWORD # Enable window scaling (enabled by default on modern Windows) # Tcp1323Opts = 3 - REG_DWORD # Number of TCP Timed Wait Delay # TcpTimedWaitDelay = 30 - REG_DWORD (default 240)
| Parameter | Legacy Value (2009) | Description |
|---|---|---|
| Ipc.maxsockbuf | 262144 (256KB) | Didžiausias lizdo buferio dydis |
| net.inet.tcp.sendspace | 32768 (32KB) | NAME OF TRANSLATORS |
| net.inet.tcp.recvspace | 32768 (32KB) | NAME OF TRANSLATORS |
| net.inet.tcp.autoricVbufmax | 131072 (128KB) | Didžiausias automatiškai reguliuojamas priėmimo buferinis tirpalas |
| net.inet.tcp.autosndbufmax | 131072 (128KB) | Didžiausias automatiškai reguliuojamas siuntimo buferis |
| net.inet.tcp.rfc1323 | 0 (disabled) | TCP langų mastelis |
| Parameter | Current Recommended Value | Description |
|---|---|---|
| kern.ipc.maxsockbuf | 8388608 (8MB) | Maximum socket buffer size |
| net.inet.tcp.sendspace | 131072 (128KB) | Default TCP send buffer |
| net.inet.tcp.recvspace | 131072 (128KB) | Default TCP receive buffer |
| net.inet.tcp.autorcvbufmax | 16777216 (16MB) | Maximum auto-tuned receive buffer |
| net.inet.tcp.autosndbufmax | 16777216 (16MB) | Maximum auto-tuned send buffer |
| net.inet.tcp.rfc1323 | 1 (įjungta) | Įjungti TCP langų mastelį |
| net.inet.tcp.sack | 1 (enabled) | Enable Selective Acknowledgment |
| net.inet.tcp.mssdflt | 1440 | NAME OF TRANSLATORS |
| net.inet.tcp.laved _ ack | 3 | Vėluoja ACK elgesį |
# Check current settings sysctl kern.ipc.maxsockbuf sysctl net.inet.tcp.sendspace sysctl net.inet.tcp.recvspace sysctl net.inet.tcp.autorcvbufmax sysctl net.inet.tcp.autosndbufmax # Apply settings temporarily (until reboot) sudo sysctl -w kern.ipc.maxsockbuf=8388608 sudo sysctl -w net.inet.tcp.sendspace=131072 sudo sysctl -w net.inet.tcp.recvspace=131072 sudo sysctl -w net.inet.tcp.autorcvbufmax=16777216 sudo sysctl -w net.inet.tcp.autosndbufmax=16777216 sudo sysctl -w net.inet.tcp.rfc1323=1 sudo sysctl -w net.inet.tcp.sack=1 # Make settings persistent (create /etc/sysctl.conf) sudo tee /etc/sysctl.conf <Name
# Create /Library/LaunchDaemons/com.local.sysctl.plist sudo tee /Library/LaunchDaemons/com.local.sysctl.plist <EOF sudo chmod 644 /Library/LaunchDaemons/com.local.sysctl.plist sudo launchctl load /Library/LaunchDaemons/com.local.sysctl.plist Label com.local.sysctl ProgramArguments /usr/sbin/sysctl -w kern.ipc.maxsockbuf=8388608 RunAtLoad Įspėjimas: MacOS Ventura (13) ir vėliau turi sistemos vientisumo apsaugos (SIP) apribojimus. III PRIEDAS Testuoti nustatymus jūsų konkrečioje aplinkoje.
# Server side iperf3 -s # Client side - test TCP throughput iperf3 -c server_ip -t 60 -i 5 -w 16M # Test with multiple parallel streams iperf3 -c server_ip -P 10 -t 60 # Test UDP performance iperf3 -c server_ip -u -b 1000M -t 60
# Capture and display TCP window sizes tcpdump -i any -n 'tcp' -vv | grep -i window # Save capture for Wireshark analysis tcpdump -i any -w /tmp/capture.pcap 'tcp port 443'
Ieškoti šių buferinių klausimų rodiklių:
# Linux - Monitor network buffer statistics watch -n 1 'cat /proc/net/sockstat' watch -n 1 'ss -tm | grep -i mem' # Check for drops netstat -s | grep -i drop # Windows - Monitor TCP statistics netstat -e 1 # macOS - Monitor network statistics netstat -s -p tcp
NorÄ dami nustatyti optimalius taukšus savo tinklui, apskaičiuoti Bandwidth- Delay produktas:
BDP = Bandwidth (bits/sec) × RTT (seconds) Example for 10 Gigabit Ethernet with 50ms RTT: BDP = 10,000,000,000 × 0.050 = 500,000,000 bits = 62.5 MB Buffer Size = BDP × 2 (for bidirectional traffic and headroom) Buffer Size = 62.5 MB × 2 = 125 MB This is why modern settings recommend 128MB maximum buffers.
| Darbinės apkrovos tipas | Rekomenduojama buferis dydis | Raktų parametrai |
|---|---|---|
| Interneto serveris (mažas latentinis laikas) | 4- 16 MB | Blauzdos taukšai, daugiau jungčių, greitas atsakas |
| Duomenų bazės serveris | 16- 32 MB | Vidutinių buferiai, pastovus pralaidumas |
| Failų perdavimas / atsarginė kopija | 64- 128 MB | Maksimalūs taukšai, didelis našumas prioritetas |
| Vaizdo transliavimas | 32- 64 MB | Stambūs buferiai, nuoseklus pristatymo lygis |
| HPC / duomenų centras | 128- 256 MB | Maksimalūs taukšai, specializuota perkrovos kontrolė |
| Belaidis / mobilus | 2-8 MB | Konservantai, kintamo latentinio valdymo |
Buferio išnaudojimas yra bendra pagrindinė priežastis veiklos klausimais, kurie, atrodo, yra susiję su tinklu. Suprasdami buferio dydžio kitimą nuo 2009 m. 128KB ribos iki šiandieninių 128MB pajėgumų, tinklo inžinieriai gali greitai nustatyti ir išspręsti šias problemas.
Raktų paėmimas:
atminkite: A "tinklo problema" atskleidė paketo analizės parodyti TCP nulis langai iš tikrųjų priimančiosios sistemos išteklių problema. Gerai reguliuojant buferį, Jūs galite pašalinti šias klaidingas diagnozes ir pasiekti optimalų efektyvumą.
Atnaujinta: vasario 2, 2026
Autorius: Baud9600 Techninė komanda