Os enxeñeiros de redes adoitan atopar situacións nas que o rendemento das ventás TCP ou o rendemento das aplicacións é culpado da infraestrutura de rede. Despois de realizar extensas capturas de paquetes, tcpdumps e análise de rede, a miúdo descóbrese o verdadeiro pescozo de botella: NIC esgotado (Network Interface Card) ou tampóns a nivel de OS nos sistemas cliente ou servidor.
Este artigo proporciona tanto o legado (circa 2009) como as actuais configuracións de tampón (2025-2026) para Linux, Windows e macOS, xunto con técnicas de diagnóstico para identificar o esgotamento do tampón antes de que se converta nun problema crítico.
A TCP utiliza un mecanismo de control de fluxo onde o receptor anuncia un "tamaño de xanelas" indicando cantos datos pode aceptar. Cando os tampóns do sistema se enchen, esta xanela redúcese a cero, obrigando ao remitente a agardar. Isto é un problema de rede, pero en realidade é un problema de recursos.
# 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
| Parámetro | Legado valor (2009) | Descrición |
|---|---|---|
| net.core.rmem default | 124928 (122KB) | Por defecto recibe o tamaño do tampón |
| net.core.rmem max | 131071 (128KB) | Tamaño máximo do tampón |
| net.core.wmem default | 124928 (122KB) | Por defecto envía o tamaño do tampón |
| net.core.wmem max | 131071 (128KB) | Tamaño máximo do tampón de socket |
| net.ipv4.tcp rmem | 4096 87380 174760 | TCP recibe buffer: min, default, max (en bytes) |
| net.ipv4.tcp wmem | 4096 16384 131072 | TCP envía buffer: min, default, max (en bytes) |
| net.ipv4.tcp mem | 196608 262144 393216 | Páxina de memoria TCP: baixa, presión, alta |
| net.core.netdev max backlog | 1000 | Paquetes máximos en cola de entrada |
| net.core.optmem max | 10240 (10KB) | Tamaño máximo do tampón auxiliar por socket |
| Parameter | Valor actual recomendado | 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 recibe tampón: min, default, max (128MB max) |
| net.ipv4.tcp_wmem | 4096 65536 134217728 | TCP envía tampón: min, default, max (128MB max) |
| net.ipv4.tcp_mem | 8388608 12582912 16777216 | Páxinas de memoria TCP: baixa, presión, alta (64GB) |
| net.core.netdev_max_backlog | 250000 | Paquetes máximos en cola de entrada (10GbE+) |
| net.core.optmem_max | 65536 (64KB) | Maximum ancillary buffer size per socket |
| net.ipv4.tcp congestion control | Bbrb | Control de conxestión BBR (algoritmo de Google) |
| net.ipv4.tcp window scaling | 1 | Escalada de ventás TCP (RFC 1323) |
| net.ipv4.tcp timestamps | 1 | Activar axustes de tempo TCP para unha mellor estimación de RTT |
| net.ipv4.tcp sack | 1 | Permitir recoñecemento selectivo |
| net.ipv4.tcp no metrics save | 1 | Caching disíble de métricas TCP |
Engadir esta configuración para /etc/sysctl.conf Crea un novo ficheiro /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) | Localización |
|---|---|---|
| TcpWindowsize | 65535 (64KB) | Rexistro: HKLM\System\CurrentControlSet\Services |
| Tcp1323Opts | 0 (desaprobado) | Baixar Windows por defecto |
| Windows por defecto | 8192 (8KB) | Por defecto recibe unha fiestra |
| default windows | 8192 (8KB) | Por defecto enviar fiestra |
| GlobalMaxTcpWindowsize | 65535 (64KB) | Tamaño máximo da fiestra TCP |
| TcpNumConnections | 16777214 | Máximo TCP |
Windows utiliza o Baixar Window Auto-Tuning característica, que se axusta dinámicamente reciben tampóns baseados en condicións de rede.
| Característica | Actualidad Recomendada | Description |
|---|---|---|
| Auto-Tuning nivel | Normal (ou altamente experimental para 10GbE) | Ajuste fiestra dinámica |
| Escalada de lado (RSS) | Activado | Distribución do procesamento de redes a través de CPUs |
| Chimney Offload | automático (ou desactivado en NIC) | Descarga TCP para hardware NIC |
| NetDMA | discapacitados | Acceso directo á memoria (deprecado) |
| Parametros globais TCP | Ver comandos abaixo | Configuración TCP de todo o sistema |
| Proveedor de conxestión | CUBIC (ou NewReno) | Algoritmo de control de conxestión TCP |
# 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 |
|---|---|---|
| kern.ipc.maxsockbuf | 262144 (256 KB) | Tamaño máximo do tampón |
| net.inet.tcp.sendspace | 32768 (32KB) | TCP por defecto envía buffer |
| net.inet.tcp.recvspace | 32768 (32KB) | TCP por defecto recibe buffer |
| net.inet.tcp.autorcvbufmax | 131072 (128KB) | Máximo auto atado recibe buffer |
| net.inet.tcp.autosndbufmax | 131072 (128KB) | Máximo de envío atado |
| net.inet.tcp.rfc1323 | 0 (disabled) | fiestra TCP escalando |
| 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 (incluído) | Activar a escala de fiestra TCP |
| net.inet.tcp.sack | 1 (enabled) | Enable Selective Acknowledgment |
| net.inet.tcp.msdflt | 1440 | TCP Tamaño máximo do segmento |
| net.inet.tcp.delayed ack | 3 | Atraso do comportamento |
# 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 <Creación dun LaunchDaemon para configuracións persistentes
# 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 Aviso: MacOS Ventura (13) e máis tarde con restricións de protección de integridade do sistema (SIP). Algúns parámetros do kernel poden non ser modificables nin con sudo. Proba os axustes no teu entorno específico.
# 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'
Busca estes indicadores de problemas de tampón:
# 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
Para determinar os tamaños óptimos de tampón para a súa rede, calcula o produto Bandwidth-Delay:
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 tipo | Recomendado tamaño Buffer | Parametros clave |
|---|---|---|
| Web Server (baixa latencia) | 4-16 MB | Máis conexións, resposta rápida |
| Servidor de bases de datos | 16-32 MB | Os tampóns moderados, un rendemento consistente |
| Transferencia de ficheiros / Backup | 64-128 MB | Máximos tampóns, prioridade de alto rendemento |
| Video streaming | 32-64 MB | Amplos tampóns, taxa de entrega consistente |
| HPC / Centro de datos | 128-256 MB | Máximas tampóns, control especializado de conxestión |
| Wireless / Mobile | 2-8 MB | tampóns conservadores, manipulación de latencia variable |
O esgotamento de Buffer é unha causa común de problemas de rendemento que parecen estar relacionados coa rede. Ao comprender a evolución do tamaño do tampón desde os límites de 128 kB de 2009 ás capacidades actuais de 128MB, os enxeñeiros de redes poden identificar e resolver rapidamente estes problemas.
Key Takeaways:
Un "problema de rede" revelado pola análise de paquetes para mostrar xanelas TCP cero é en realidade un problema de recursos do sistema de servidor. Coa afinación tampón axeitada, pode eliminar estes falsos diagnósticos e conseguir un rendemento óptimo.
Última actualización: 2 de febreiro de 2026
Equipo técnico Baud9600