Reputation: 2493
I am trying to set up a load balancing solution which is able to load balance UDP traffic. In my case, I have several different servers which send UDP package to a load-balancer. Inside each UDP package body, there is a MSG-ID field. Ideally, I want to load-balance UDP traffic to a set of servers based on that MSG-ID. In other words, two UDP packages with same MSG-ID should be sent to the same server (because i want to assemble two UDP packages with same MSG-ID to form a complete package for further processing). But if it's not possible, then a solution based on source/sender IP might be sufficient.
Haproxy doesn't support UDP so I am checking nginx. But seems that only nginx-plus (not free solution) allows you to do load-balance based on ip_hash method?
I wish to know:
Thanks.
Upvotes: 2
Views: 2396
Reputation: 799
You would ordinarily use proxy_bind $remote_addr transparent; in your server {} context. Note that you need a (very) recent nginx with upstream / udp loadbalancing support for this to work.
Upvotes: 0
Reputation: 1582
nginx does support UDP load balancing in both open source nginx(since v1.19.13) and NGINX Plus. Read this post from nginx.com
And nginx provides UDP load-balance based on ip_hash out of box,check the docs
So I think the answer to question No.2 is yes.
Also mentioned in the docs here, nginx upstream module provide hash algorithm on a custom key, which in your case could be MSG-ID, but i don't know how you can get MSG-ID out from you UDP datagram and i guess it won't be easy. I tried to search for a while but got no luck. If you found a solution, hope you can share under this question.
Upvotes: 1