UDP load balancing - 1 new socket for each incoming packet?
Gwenole Gendrot
gwenoleg at alinket.com
Thu Sep 1 06:58:50 UTC 2016
Hi,
I've been using nginx 1.11.3 to test the UDP load balancing feature,
using a "basic" configuration.
The functionality is working out of the box, but a new socket will be
created by the proxy for each packet sent from a client (to the same
connection). This leads to resource exhaustion under heavy load (even
with only 1 client / 1 server).
My question: is it the intended behaviour to open a new socket for each
incoming packet?
- if no => is this a bug? some misconfiguration from my part (either in
nginx or Linux)? has anyone observed this behaviour?
- if yes => is reusing the socket for the same connection a missing
feature / future improvement?
Tx!
Gwn
P.S.: my current workaround is to set the proxy timeout to a very low
value and increase the maximum number of concurrent connections & opened
files/sockets.
P.P.S: Logs were empty of warnings & errors. My coonfiguration (nothing
fancy, pretty much all the system & SW are from a fresh install) as
attachment.
BR,
Gwenole Gendrot
156 1835 3270
-------------- next part --------------
$ uname -a
Linux AiDMS 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$
$ nginx -v
nginx version: nginx/1.11.3
$
$ cat /etc/nginx/streams-available/udp_balancing_test.conf
stream {
upstream udp_cluster {
# hash $remote_addr consistent;
hash $remote_addr;
server 127.0.0.1:17000;
server 127.0.0.1:17001;
server 127.0.0.1:17002;
server 127.0.0.1:17003;
}
server {
# listen 0.0.0.0:16583 udp reuseport;
listen 0.0.0.0:16583 udp;
#UDP traffic will be proxied to the "udp_cluster" upstream group
proxy_pass udp_cluster;
# proxy_buffer_size 1024k;
proxy_timeout 5s;
}
}
$
$ cat /etc/nginx/nginx.conf
user nginx;
# worker_processes 1;
worker_processes auto;
error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 8192;
# use epoll;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
# remove default http configuration
#include /etc/nginx/conf.d/*.conf;
}
include streams-enabled/*.conf;
More information about the nginx
mailing list