I'm a new to Nginx.
What i want to do with Nginx is Traffic load balancing. To do it, i configured nginx.conf like below
udp udp
A <--> Nginx <--> Backend 1
<--> Backend 2
user nginx;
worker_processes 4;
worker_rlimit_nofile 30000;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
stream {
upstream udp_upstreams {
server 1:1:1:1:9997 fail_timeout=60s;
server 1:1:1:2:9997 fail_timeout=60s;
}
server {
listen 9000 udp;
proxy_pass udp_upstreams;
proxy_timeout 3s;
proxy_responses 1;
error_log /var/log/nginx/udp.log;
}
}
events {
worker_connections 10240;
}
when i run nginx, nginx prints a lot of below message.
2016/04/27 04:50:36 [alert] 3137#3137: *446352 10240 worker_connections are not enough while connecting to upstream, udp client: 3.3.3.3, server: 0.0.0.0:9000, upstream: "1.1.1.2:9997", bytes from/to client:0/0, bytes from/to upstream:0/0
2016/04/27 04:50:36 [alert] 3136#3136: *446353 10240 worker_connections are not enough while connecting to upstream, udp client: 3.3.3.3, server: 0.0.0.0:9000, upstream: "1.1.1.1:9997", bytes from/to client:0/0, bytes from/to upstream:0/0
How do i configure nginx.conf to solve it? I have already set the work_connections value to 40000. But it was useless.
Thanks in advance.
I just ran into the same problem and found a solution after I stopped wild googling and started to read the nginx documentation. ^_^;
The parameter 'proxy_responses' tells nginx to wait for x responses to the request. I my case, log forwarding, there is non. So nginx waits for and failes the server.
Solution:
proxy_responses 0
Docs: http://nginx.org/en/docs/stream/ngx_stream_proxy_module.html#proxy_responses
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With