HAProxy + NodeJS + Rails 설정을 사용하여 파일 업로드 목적으로 NodeJS 서버를 사용합니다.HAProxy + NodeJS가 TCP 재전송으로 인해 연결되지 않음
문제는 내가 haproxy를 통해 nodejs로 업로드하고 손실 된 패킷 때문에 "TCP (Fast) Retransmission"이 발생하면 클라이언트의 TX 속도가 약 5-10으로 0으로 떨어집니다 TCP Retransmissions로 넘쳐납니다.
NodeJS에 직접 업로드하면 (TCP 재전송도 발생하지만 수십 번의 재전송 시도로 인해 멈추지 않습니다.) 이는 발생하지 않습니다.
내 테스트 설정은 단일 파일 입력 필드가있는 간단한 HTML4 FORM (POST 메서드)입니다. NodeJS 서버는 들어오는 데이터 만 읽고 다른 작업은 수행하지 않습니다.
여러 대의 컴퓨터, 네트워크, 브라우저에서 항상 동일한 문제를 테스트했습니다. 읽기에 대한
global
log 127.0.0.1 local1 debug
maxconn 4096 # Total Max Connections. This is dependent on ulimit
nbproc 2
defaults
log global
mode http
option httplog
option tcplog
frontend http-in
bind *:80
timeout client 6000
acl is_websocket path_beg /node/
use_backend node_backend if is_websocket
default_backend app_backend
# Rails Server (via nginx+passenger)
backend app_backend
option httpclose
option forwardfor
timeout server 30000
timeout connect 4000
server app1 127.0.0.1:3000
# node.js
backend node_backend
reqrep ^([^\ ]*)\ /node/(.*) \1\ /\2
option httpclose
option forwardfor
timeout queue 5000
timeout server 6000
timeout connect 5000
server node1 127.0.0.1:3200 weight 1 maxconn 4096
감사 :
.....
TCP 1506 [TCP segment of a reassembled PDU]
>> everything is uploading fine until:
TCP 1506 [TCP Fast Retransmission] [TCP segment of a reassembled PDU]
TCP 66 [TCP Dup ACK 7392#1] 63265 > http [ACK] Seq=4844161 Ack=1 Win=524280 Len=0 TSval=657047088 TSecr=79373730
TCP 1506 [TCP Retransmission] [TCP segment of a reassembled PDU]
>> the last message is repeated about 50 times for >>5-10 secs<< (TX drops to 0 on client, RX drops to 0 on server)
TCP 1506 [TCP segment of a reassembled PDU]
>> upload continues until the next TCP Fast Retransmission and the same thing happens again
haproxy.conf (haproxy v1.4.18 안정)은 다음과 같다 : 파일을 업로드하는 동안
다음은 클라이언트에서 TCP 트래픽 덤프입니다! :)
Simon