System Buffer Tuning - TCP and Network Performance Optimization
시스템 버퍼 튜닝 : "네트워크 문제" 뒤에 숨겨진 Culprit
회사연혁
네트워크 엔지니어는 TCP 창링 또는 애플리케이션 성능이 네트워크 인프라에 비난되는 상황을 자주 발생합니다. 광대한 패킷 캡처, tcpdumps 및 네트워크 분석 수행 후, true Bottleneck은 종종 발견됩니다. NIC (Network Interface Card) 또는 OS-level 버퍼는 클라이언트 또는 서버 시스템에 있습니다.
이 문서는 Linux, Windows 및 macOS용 레거시 (circa 2009) 및 현재 (2025-2026) 버퍼 구성을 제공하여 중요한 문제이기 전에 버퍼 배기를 식별하는 진단 기법을 제공합니다.
버퍼 배출의 일반적인 증상
- TCP Zero Window 이벤트 패킷 캡처
- 낮은 네트워크 지연에도 불구하고 높은 전송률
- Application throughput는 유효한 대역폭의 밑에 두드러지게 했습니다
- 하중의 밑에 성과 degradation는 짐이 감소할 때 개량합니다
- 유사한 하드웨어 구성의 Inconsistent 성능
- 소켓 오류 또는 "사용 가능한 자원" 메시지
문제 이해
TCP 창 확장 메커니즘
TCP는 수신기가 얼마나 많은 데이터를 수용 할 수 있는지 나타내는 "window size"를 광고하는 유량 제어 메커니즘을 사용합니다. 시스템 버퍼가 채울 때, 이 창은 0에 수축하고, sender를 기다립니다. 이것은 네트워크 문제로 나타나지만 실제로 호스트 리소스 문제입니다.
버퍼 매트
- 소켓 버퍼 (SO SNDBUF/SO RCVBUF): Per-socket는 완충기를 보내고
- TCP 창 완충기: 최대 TCP 창 크기
- 네트워크 장치 완충기: NIC 링 버퍼는 패킷 채우기
- 체계 넓은 기억: 네트워킹을 위해 할당되는 전반적인 기억
진단 명령
Linux 진단
# 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"
Windows 진단
# 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"
macOS 진단
# 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
Linux 버퍼 튜닝
레거시 리눅스 설정 (Circa 2009)
| 제품 설명 | 유산 가치 (2009) | 이름 * |
|---|---|---|
| 네트워크 | 124928 (122KB) | 과태는 소켓 완충기 크기를 받습니다 |
| 그물.core.rmem max | 131071 (128KB) | 최대 수신 소켓 버퍼 크기 |
| 네트워크 | 124928 (122KB) | 과태는 소켓 완충기 크기를 보냅니다 |
| 네트워크 | 131071 (128KB) | 최대는 소켓 완충기 크기를 보냅니다 |
| 다운로드 | 4096 87380 174760년 | TCP 수신 버퍼 : 최소, 기본, 최대 (바이트에서) |
| 다운로드 | 4096 16384 131072년 | TCP는 완충기를 보냅니다: 분, 과태, 최대 ( 바이트에서) |
| 다운로드 | 전화 번호 : +86 592 512 298 | TCP 메모리 페이지: 낮은, 압력, 높은 |
| net.core.netdev max backlog에 대 한 | 1000년 | 입력 큐에 최대 패킷 |
| net.core.optmem max의 | 10240 (10KB) | 소켓 당 최대 ancillary 완충기 크기 |
현재 리눅스 설정 (2025-2026)
| Parameter | 현재 추천 값 | 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는 완충기를 받습니다: 분, 과태, 최대 (최대 128MB) |
| net.ipv4.tcp_wmem | 4096 65536 134217728년 | TCP는 완충기를 보냅니다: 분, 과태, 최대 (128MB 최대) |
| net.ipv4.tcp_mem | 전화 번호 : +86 592 512 8777 | TCP 메모리 페이지: 저, 압력, 높은 (64GB 시스템) |
| net.core.netdev_max_backlog | 250000의 | 입력 큐에 최대 패킷 (10GbE+) |
| net.core.optmem_max | 65536 (64KB) | Maximum ancillary buffer size per socket |
| net.ipv4.tcp congestion 제어 | 뚱 베어 | BBR 혼잡 제어 사용 (Google의 알고리즘) |
| net.ipv4.tcp window scaling의 경우 | 1명 1명 | TCP 창 스케일링 활성화 (RFC 1323) |
| net.ipv4.tcp timestamps의 경우 | 1 | 더 나은 RTT 추정을위한 TCP 타임스탬프 활성화 |
| 다운로드 | 1 | Enable 선택적인 Acknowledgment |
| net.ipv4.tcp no metrics save는 | 1 | TCP 메트릭스의 비활성화 |
Linux 구성 Application
이 설정 추가 /etc/sysctl.conf 또는 새 파일을 만들 /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
NIC 링 버퍼 튜닝
# 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
- 연결 기억: 각 연결은 rmem max + wmem max (128MB 완충기를 가진 256MB)까지 사용할 수 있습니다
- 총 체계 충격: 1,000개의 연결 × 256MB = 256GB 잠재적인 사용법
- 안전한 방출: 최대 동시 연결 × 256MB는 시스템 RAM의 50 %를 초과하지 않아야합니다.
- 예: 64GB 서버는 최대 연결을 128MB 버퍼와 ~125 동시 높은 처리 연결을 제한해야 합니다.
- <16GB RAM: 최대 16-32MB에 버퍼를 감소시키고 tcp mem 비율로 조정하십시오
Windows 버퍼 조정
레거시 Windows 설정 (Circa 2009 - Windows Vista/7/Server 2008)
| Parameter | Legacy Value (2009) | - 연혁 |
|---|---|---|
| TcpWindow 크기 | 65535 (64KB) | 등록: HKLM\System\CurrentControlSet\Services\Tcpip\Parameters |
| Tcp1323광택 | 0 (사용 가능) | 창은 기본적으로 비활성화 |
| 기본값ReceiveWindow | 8192 (8KB) | 기본 수신 창 |
| 기본값SendWindow | 8192 (8KB) | 기본값은 창을 보냅니다 |
| GlobalMaxTcpWindow 크기 | 65535 (64KB) | 최대 TCP 창 크기 |
| TcpNum연결 | 16777214'실제 이름입 16777214니다. | 최대 TCP 연결 |
현재 Windows 설정 (Windows 10/11/Server 2019-2025)
현대 Windows 사용 Window Auto-Tuning 받기 역학적으로 네트워크 조건을 기반으로 버퍼를받습니다.
| 제품 정보 | 현재 권장 설정 | Description |
|---|---|---|
| Auto-Tuning 수준 | 정상 (10GbE+를 위한 높게 실험) | 동적 수신 창 조정 |
| 수신 측 확장 (RSS) | 지원하다 | CPU를 통한 분산 네트워크 처리 |
| Chimney 오프로드 | 자동 (또는 현대 NICs에 비활성화) | TCP offload로 NIC 하드웨어 |
| 다운로드 | 지원하다 | 직접 메모리 액세스 (deprecated) |
| TCP 글로벌 매개 변수 | 아래 명령어 보기 | 시스템 전체 TCP 설정 |
| Congestion 공급자 | CUBIC (또는 NewReno fallback) | TCP 혼잡 제어 알고리즘 |
Windows 구성 명령
# 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
고급 NIC 버퍼 설정 (장치 관리자 또는 PowerShell을 통해)
# 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
레지스트리 Tweaks (Advanced - Caution 사용)
# 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)
macOS 버퍼 조정
레거시 macOS 설정 (Circa 2009 - Mac OS X 10.5/10.6)
| Parameter | Legacy Value (2009) | Description |
|---|---|---|
| kern.ipc.maxsockbuf의 | 262144 (256KB) | 최대 소켓 버퍼 크기 |
| 네트워크 | 32768 (32KB) | 기본 TCP는 버퍼를 보냅니다 |
| 네트워크 | 32768 (32KB) | 기본 TCP 수신 버퍼 |
| 그물.inet.tcp.autorcvbufmax | 131072 (128KB) | 최대 자동 tuned 수신 버퍼 |
| 그물.inet.tcp.autosndbufmax | 131072 (128KB) | 최대 자동 조정은 완충기를 보냅니다 |
| 네트워크 | 0 (disabled) | TCP 창 스케일링 |
현재 macOS 설정 (macOS 12-15 Monterey를 Sequoia로)
| 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 (사용 가능) | TCP 창 확장 가능 |
| 네트워크 | 1 (enabled) | Enable Selective Acknowledgment |
| 네트워크 | 1440년 | 기본 TCP 최대 세그먼트 크기 |
| 네트워크 | 3개 | 지연 ACK 동작 |
macOS 구성
# 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 <Persistent Settings에 대한 LaunchDaemon 만들기
# 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 경고: macOS Ventura (13) 이상에는 System Integrity Protection (SIP) 제한이 있습니다. 일부 커널 매개 변수는 sudo에도 modifiable 할 수 없습니다. 특정 환경에서 설정 테스트.
성능 테스트 및 검증
테스트 버퍼 성능을위한 도구
iperf3 - 네트워크 성능 테스트
# 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
tcpdump - 캡처 TCP 창 크기
# 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'
Wireshark 분석
버퍼 문제의 이러한 지표를 찾습니다 :
- TCP Zero 윈도우 메시지
- TCP 창 업데이트 패킷
- TCP 창 전체 알림
- 낮은 RTT를 가진 높은 retransmission 비율
시스템 모니터링
# 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
대역폭 지연 제품 (BDP) 계산
네트워크의 최적의 버퍼 크기를 결정하려면 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-Specific 권장 사항
| Workload 유형 | 관련 버퍼 크기 | 핵심 모수 |
|---|---|---|
| 웹 서버 (낮은 대기 시간) | 4-16 메가바이트 | 더 낮은 완충기, 더 많은 연결, 빠른 응답 |
| 데이터베이스 서버 | 16-32 메가바이트 | Moderate 버퍼, 일관된 처리량 |
| 파일 전송 / 백업 | 64 비트 | 최대 버퍼, 높은 처리량 우선권 |
| 동영상 스트리밍 | 32-64 메가바이트 | 큰 완충기, 일관된 납품 비율 |
| HPC / 데이터 센터 | 128-256 메가바이트 | 최대 버퍼, 특수 혼잡 제어 |
| 무선/모바일 | 2-8 메가바이트 | Conservative 완충기, 변하기 쉬운 latency 취급 |
일반적인 실수 및 Pitfalls
피하기 위해 실수
- 더 많은 것: 과도하게 큰 완충기는 완충기를 일으키는 원인이 될 수 있습니다, 늦게 증가
- 메모리 제약을 무시: 연결 조사에 의해 곱한 큰 완충기; 10,000의 연결과 128MB 완충기를 가진 서버는 렘의 1.25TB를 필요로 합니다
- 이유없이 자동 조정을 해제 : 현대 OS 자동 조정은 보통 정체되는 조정 보다는 더 낫습니다
- 변화 후에 시험하지 않기: 항상 실제 작업 부하와 성능 향상을 검증
- NIC 버퍼를 잊어 : 반지 완충기 배기는 소켓 완충기의 자주적으로 일어날 수 있습니다
- Inconsistent 설정: 클라이언트와 서버는 호환이 되는 완충기 윤곽이 있어야 합니다
- 혼잡 통제를 무시: BBR 및 CUBIC는 이전 알고리즘보다 훨씬 낫습니다.
문제 해결 작업 흐름
- 기본 설정: iperf3 또는 유사한 도구로 현재 성능 측정
- 캡처 패킷: TCP 창 동작을 식별하기 위해 tcpdump/Wireshark 사용
- 시스템 통계 확인: 하락, 완충기 배기, 재전송을 위해 보기
- BDP 계산: Determine theoretically 최적의 버퍼 크기
- incremental 변경 적용: 한 번에 모든 것을 변경하지 마십시오.
- 시험과 유효성: 실제 성능 개선
- 시간을 감시하십시오: 설정은 다양 한 부하의 밑에 최적 유지
참고 및 더 읽기
- RFC 1323 - 고성능 TCP 확장(Window Scaling)
- RFC 2018 - TCP 선택적인 Acknowledgment 선택권
- RFC 6928 - TCP의 초기 창을 증가
- RFC 8312 - CUBIC 혼잡 통제 알고리즘
- BBR 혼잡 제어 (Google) - https://research.google/pubs/pub45646/
- 리눅스 커널 문서 - 네트워킹/IP-sysctl.txt
- Windows TCP/IP 성능 조정 가이드 (Microsoft)
- ESnet 네트워크 조정 가이드 - https://fasterdata.es.net/
관련 기사
Buffer 배기는 네트워크 관련이 있는 성능 문제의 일반적인 루트 원인입니다. 2009의 128KB 제한에서 버퍼의 진화를 이해함으로써 오늘날의 128MB 기능에 네트워크 엔지니어가 신속하게 식별하고 이러한 문제를 해결 할 수 있습니다.
중요한 테이크아웃:
- 현대 시스템은 레거시보다 훨씬 더 큰 버퍼가 필요합니다 (2009) 구성
- 항상 특정 네트워크 조건에 대한 BDP를 계산합니다.
- 사용 가능한 경우 OS 자동 조정 기능 (Windows, 현대 리눅스)
- 검증된 변경을 위한 모니터 및 테스트
- tuning 때 workload-specific 필요조건을 고려하십시오
기억: 패킷 분석에 의해 공개된 "network problem"는 TCP 0 창이 실제로 호스트 시스템 리소스 문제입니다. 적절한 버퍼 튜닝을 통해 이러한 거짓 진단을 제거하고 최적의 성능을 얻을 수 있습니다.
최근 업데이트: 2월 2, 2026
저자: Baud9600 기술 팀