Retaj inĝenieroj ofte renkontas situaciojn kie TCP-fenestro aŭ aplikiĝefikeco estas kulpigita sur retinfrastrukturo. Post rezultado de ampleksaj pakaĵasimiladoj, tcpdumps, kaj sendostacia analizo, la vera proplempunkto ofte estas malkovrita: elĉerpita NIC (Network Interface Card) aŭ Os-nivelaj bufroj sur la kliento aŭ servilsistemoj.
Tiu artikolo disponigas kaj heredaĵon (ĉirkaŭ 2009) kaj nunan (2025-2026) bufrokonfiguraciojn por Linukso, Fenestroj, kaj makOS, kune kun diagnozaj teknikoj por identigi bufrodeprenon antaŭ ol ĝi iĝas kritika temo.
TCP uzas fluokontrolmekanismon kie la ricevilo reklamas "fenestrograndecon" indikante kiom multe da datenoj ĝi povas akcepti. Kiam sistembufroj plenigas supren, tiu fenestro ŝrumpas al nul, devigante la sendinton atendi. Tio prezentiĝas kiel retproblemo sed estas fakte mastro-resurstemo.
# 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
| Parametro | Legacy Value (2009) | Priskribo Priskribo |
|---|---|---|
| reto.core.rmem defaŭlto | 124928 (122KB) | Defaŭlto ricevas socketan bufrograndecon |
| Neta.core.rmem max | 131071 (128KB) | Maksimumo ricevas socketan bufrograndecon |
| Netaturo.wmem defaŭlto | 124928 (122KB) | Defaŭlto sendas torakan bufrograndecon |
| La reto.wself max | 131071 (128KB) | Maksimuma sendi torakan bufrograndecon |
| reto.ipv4.tcp r mem | 4096 87380 174760 | TCP ricevas bufron: min, defaŭlto, maks (en bajtoj) |
| reto.ipv4.tcp w mem | 4096 16384 131072 | TCP sendas bufron: min, defaŭlto, maks (en bajtoj) |
| reto.ipv4.tcp mem | 196608 262144 393216 | TCP memorpaĝoj: malalta, premo, alta |
| Net.netdev max backlog | 1000 | Maksimumaj pakaĵetoj en enigo atendovico |
| Neta.core.opt mem max | 10240 (10KB) | Maksimuma ancila bufrograndeco per socket |
| Parameter | Nuna Rekomendita Valoro | 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 ricevas bufron: min, defaŭlto, maks (128MB maks) |
| net.ipv4.tcp_wmem | 4096 65536 1342177 | TCP sendas bufron: min, defaŭlto, maks (128MB max) |
| net.ipv4.tcp_mem | 8388608 12582912 16777216 | TCP memorpaĝoj: malalta, premo, alta (64GB-sistemo) |
| net.core.netdev_max_backlog | 250000 | Maksimumaj pakaĵetoj en enirvico (10GbE +) |
| net.core.optmem_max | 65536 (64KB) | Maximum ancillary buffer size per socket |
| reto.ipv4.tcp congestion control | bbr | Uzu BBR-ŝtopiĝkontrolon (la algoritmo de Google) |
| reto.ipv4.tcp window scaling | 1 1 1 1 | Endabla TCP fenestro skalanta (RFC 1323) |
| reto.ipv4.tcp timestamps | 1 | Enable TCP tempstampoj por pli bona RTT-takso |
| reto.ipv4.tcp sack | 1 | Enable Selective Acsciledgment |
| reto.ipv4.tcp no metrics save | 1 | Disigebla kaĉado de TCP-metrikoj |
Aldonu tiujn agordojn al /etc/sysctl.conf aŭ krei novan dosieron /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) | Situo |
|---|---|---|
| TcpWindows | 65535 (64KB) | Registro: HKLMSystem \CurrentControlSet-Services\Tcpip\Parameters |
| Tcp1323 Opts | 0 (disable) | Fenestra skarpo handikapita defaŭlte |
| Defaŭlta ReceiveWindow | 8192 (8KB) | Defaŭlto ricevas fenestron |
| Defaŭltaj plendoj | 8192 (8KB) | Defaŭlo sendas fenestron |
| GlobalMaxTcpWindowSize | 65535 (64KB) | Maksimuma TCP-fenestrograndeco |
| TcpNumConnections | 16777214 | Maksimuma TCP-ligoj |
Modernaj fenestroj uzas la Vidu ankaŭ: Windows Auto-Tuning trajto, kiu dinamike adaptas ricevas bufrojn bazitajn sur retkondiĉoj.
| Trajto | Nuna Rekomendita Setting | Description |
|---|---|---|
| Auto-Tuning Level | normala (aŭ tre eksperimenta por 10GbE +) | Dinamiko ricevas fenestron |
| Ricevi-Side Scaling (RSS) | ebligis | Distribute-retpretigo trans CPUoj |
| Chimney Offload | aŭtomata (aŭ handikapita sur modernaj NICoj) | TCP malŝarĝo al NIC-hardvaro |
| NetDMA | handikapita handikapulo | Rekta Memoro Aliro (malprecedigita) |
| TCP Global Parameters | Vidu komandojn sub | Sistemo-kovranta TCP-valoroj |
| Kontentigo Provizanto | CUBIC (aŭ NewReno-lanugo) | TCP-ŝtopiĝo-kontrolo-algoritmo |
# 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 |
|---|---|---|
| kerno.ipc.maxsockbuf | 262144 (256KB) | Maksimuma toraka bufrograndeco |
| reto.inet.tcp.sendspace | 32768 (32KB) | Defaŭlta TCP sendas bufron |
| reto.inet.tcp.recvspace | 32768 (32KB) | Defaŭlta TCP ricevas bufron |
| reto.inet.tcp.autorcvbufmax | 131072 (128KB) | Maksimuma aŭtogordita ricevas bufron |
| reto.inet.tcp.autosndbufmax | 131072 (128KB) | Maksimuma aŭtogordita sendas bufron |
| reto.inet.tcp.rfc1323 | 0 (disabled) | TCP fenestro skalanta |
| 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 (enirebla) | Enable TCP fenestro skalanta |
| reto.inet.tcp.sack | 1 (enabled) | Enable Selective Acknowledgment |
| reto.inet.tcp.msdflt | 1440 | Defaŭlta TCP Maksimuma Segment Size |
| reto.inet.tcp.delayed ack | 3 3 3 3 | Dependita ACK-konduto |
# 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 <Kreante LaunchDaemon por Persistent Settings
# 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 Averto: MacOS Ventura (13) kaj poste havas System Integrity Protection (SIP) restriktojn. Kelkaj kernparametroj ne povas esti modifitaj eĉ kun sekso. Testvaloroj en via specifa medio.
# 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'
Vidu tiujn indikilojn de bufrotemoj:
# 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
Por determini optimumajn bufrograndecojn por via reto, kalkuli la Bandwidth-Delay Produkton:
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.
| Workload Type | Rekomendita Buffer Size | Ŝlosilo Parametroj |
|---|---|---|
| Web Server (Low Latency) | 4-16 MB | Pli malaltaj bufroj, pli da ligoj, rapida respondo |
| Datuma Servilo | 16-32 MB | Moderaj bufroj, kongruaj traputitaj |
| Translokigo / Backup | 64-128 MB | Maksimumaj bufroj, alta trametita prioritato |
| Video Streaming | 32-64 | Grandaj bufroj, kohera liveraĵkurzo |
| HPC / Data Center | 128-256 MB | Maksimumaj bufroj, specialigita obstrukciĝkontrolo |
| Sendita / Mobile | 2-8 MB | Konservativulbufroj, varia latenteco pritraktanta |
Buffer-degaso estas ofta radikkialo de spektaklotemoj kiuj ŝajnas esti ret-rilataj. Komprenante la evoluon de bufrosizing de 2009's 128KB-limoj ĝis 128MB kapabloj, retinĝenieroj povas rapide identigi kaj solvi tiujn temojn.
Ŝlosiloj:
Memoro: "retoproblemo" rivelita per pakaĵanalizo por montri TCP nul fenestrojn estas fakte mastro sistemresursproblemo. Kun bonorda bufro agordado, vi povas elimini tiujn falsajn diagnozojn kaj realigi optimuman efikecon.
Lasta Ĝisdatigita: februaro 2, 2026
Aŭtoro: Baud9600 Technical Team