12 ms·
NGINX open sources TCP load balancing
- phildougherty 12y agoThis is great. Perfect for when one doesn't want to deal with running a poorly supported 3rd party module in nginx. Prior to this the only other easy option was Haproxy. I'm happy.
- virtualSatai 12y agoI got a 502 when visiting this url, I think it's just irony bmiling at me: http://i.imgur.com/q3n8PpZ.png http://i.imgur.com/q3n8PpZ.png
- jimjag 12y agoSame here... heh heh heh
- bennylope 12y agoNot sure what's so ironic about this. That's the Mercurial server that's not responding.
- mattdeboard 12y agoYes, the Mercurial server being mercurial isn't ironic, it's coincidental
- 6chars 12y agoIt would be ironic if the Mercurial server were saturnine though.
- deleted 12y ago[deleted]
- andrewpe 12y agohttps://imgur.com/psXLq6Y.png https://imgur.com/psXLq6Y.png
- citrin_ru 12y agoIt seems to be mercurial server (used only be a few developers usually) is not ready to handle slashdot effect.
- fasteo 12y ago... and this is how I discovered the nice Waterfox browser [1] [1] https://www.waterfoxproject.org/ https://www.waterfoxproject.org/
- andrewpe 12y agoPerfect timing, at least for my company.
- takeda 12y agoSlightly disappointing though, it looks like it is just TCP and no health check.
- ninjazee124 12y ago502, how ironic.
- IMTDb 12y agoDoes that mean that I can now put NGINX in front of a cluster of TCP (non HTTP) servers and get NGINX to cleverly load balance the incoming requests to the individual nodes ?
- mryan 12y agoThat's correct. It's configured in much the same way as HTTP proxying, with a few different load balancing methods (least connections, consistent hashing).
- jfroma 12y ago> load balance the incoming requests to the individual nodes Correct me if I am wrong but I think this is actually incorrect, because there is no concept of "request" at the tcp level. If I understand correctly it will rather load balance "connections".
- toomuchtodo 12y agoCan someone explain how this is superior to HAproxy?
- fernandotakai 12y agofrom what i understand, this could be used for anything tcp related (here[0] they said it could be used to proxy mysql, ldap, rtmp and they use pop3 as an example). i thought haproxy was used basically to proxy http stuff, not general tcp. [0] http://nginx.com/resources/admin-guide/tcp-load-balancing/ http://nginx.com/resources/admin-guide/tcp-load-balancing/
- phildougherty 12y agoYou can do tcp loadbalancing with haproxy, you can't do udp though.
- deleted 12y ago[deleted]
- MichaelGG 12y agoWindows Network Load Balancing does.
- jsmthrowaway 12y agoEr, LVS, Netscaler, F5, Pen? People have been balancing DNS for ages to avoid the problems inherent to round robin, and UDP is the ideal scenario for DSR. HAproxy is unique in not supporting it, not the norm.
- dedward 12y agoudp is trivial to load balance.... plenty support it.
- wtarreau 12y agoLoadbalancing UDP is trivial but totally useless without protocol awareness. Loadbalancing UDP properly is much less trivial because most UDP-based protocols need to be handled properly and rewritten since they carry IP addresses, ports, and even expect reverse connections (eg: tftp). In fact the only two UDP-based protocols that you can load-balance without doing anything are syslog and DNS. Both of them are useless as they are properly dealt with by the sender.
- mryan 12y agoThe NGINX Plus docs on TCP Load Balancing: http://nginx.com/resources/admin-guide/tcp-load-balancing/ http://nginx.com/resources/admin-guide/tcp-load-balancing/ Something to read while we wait for the announcement page to come back up :-)
- shawabawa3 12y agoJust FYI it's not an announcement page, it's a link to the source code commit (probably explains why the page is down - isn't expected to have high traffic)
- fasteo 12y agoMany installations would go from haproxy->nginx to nginx->nginx. Having to support a single product will make many devops happy. In the same tense, haproxy is adding Lua support[1], which has been available in nginx - using openresty[2] - since 2011, and nginx core is doing the same with Javascript[2]. Interesting times aroung haproxy and nginx. [1] http://blog.haproxy.com/2015/03/12/haproxy-1-6-dev1-and-lua/ http://blog.haproxy.com/2015/03/12/haproxy-1-6-dev1-and-lua/ [2] http://www.openresty.org http://www.openresty.org [3] http://www.infoworld.com/article/2838008/javascript/nginx-has-big-plans-for-javascript.html http://www.infoworld.com/article/2838008/javascript/nginx-ha...
- amenod 12y agoNot sure about that... HAproxy is a proven technology (very reliable and a joy to use at that) in this field while Nginx is a newcomer and needs to establish its credibility first. I personally wouldn't use such technology for load balancer until it is properly battle-tested. Also, I can't see much of an advantage over (proven) HAproxy - am I missing something? As for supporting a single product, I don't see the point of that. Using Nginx for load balancing will probably be much different than using Nginx as a web server, so the learning curve is similar. Not that I don't welcome competition, I just don't see a real need in this space. EDIT: btw, the Lua thing was an April Fool's joke... EDIT 2: no it wasn't, my mistake. I was surprised by this so I checked the page and jumped a gun when I saw "April 1st" on http://www.haproxy.org/news.html http://www.haproxy.org/news.html. Sorry about that...
- phildougherty 12y agoNginx has supported http loadbalancing basically forever using the upstream directive along with proxy_pass. It supports leastconn, round-robin, and ip-hash (sticky). It is far from unproven. I have personally used it successfully in some huge projects. This new announcement simply makes the existing functionality work with tcp backends.
- shuzchen 12y agoFor anyone already using nginx in their stack, I don't think these things (being a newcomer, or needing credibility) are a very big concern. Some people are already used to using nginx as a load balancer for HTTP traffic (this new feature adds load balancing for any TCP traffic) so those users won't have much gap to cover. Also this feature was in the nginx+ version, which presumably means it has already been battle-tested by their enterprise customers.
- simonplus 12y agohttp://trac.nginx.org/nginx/changeset/61d7ae76647d/nginx http://trac.nginx.org/nginx/changeset/61d7ae76647d/nginx
- warpech 12y agoThe blog post tells more and has some nice diagrams: http://nginx.com/blog/nginx-plus-r6-released/ http://nginx.com/blog/nginx-plus-r6-released/
- cbsmith 12y agoI didn't see anything about proxy protocol support, which is kind of nice with TCP load balancing... http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt
- jfroma 12y agoYes this is important if you want to load balance http traffic at the TCP level and have the remote address in the back end app. Nginx already support decoding the proxy protocol but I wonder if with this new feature you can encode the remote address with proxy protocol.
- jzelinskie 12y agoI agree. nginx already supports forwarding from proxy protocol[0] via the http_realip module; time to go full circle. [0]: http://nginx.org/en/docs/http/ngx_http_realip_module.html http://nginx.org/en/docs/http/ngx_http_realip_module.html
- cbsmith 12y agoI've had problems getting that module to work properly with AWS ELB (though I'd kind of assumed the problem was with ELB), so I'm not sure how solid the support is even for that. It'd be nice to test it against nginx itself as a baseline.
- jzelinskie 12y agoWe use proxy protocol ELB -> nginx in production at CoreOS for Quay.io, but we use the Tengine 2.1.0 fork of nginx for some other patches. http://tengine.taobao.org/ http://tengine.taobao.org/
- MichaelGG 12y agoMaybe they'll bring in the health checks for HTTP balancing, next :).
- smwht 12y agoIf you don't mind building your own package, this has worked well for us: https://github.com/yaoweibin/nginx_upstream_check_module https://github.com/yaoweibin/nginx_upstream_check_module Though I agree it'd be nice to have the functionality integrated.
- CrLf 12y agoIt already supports it: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#health_check http://nginx.org/en/docs/http/ngx_http_upstream_module.html#... Or you're referring to something else?
- MichaelGG 12y ago" This directive is available as part of our commercial subscription. "
- oimaz 12y agocan this loadbalance redis and memcache?
- phildougherty 12y agoYes it could. You would either need to have redis slave replication setup and then only load balance your read-replicas, or else you would need to use sticky sessions to always send requests back to the right node.. I'm not sure if sticky sessions is possible with TCP loadbalancing in nginx but I assume it is.
- elementai 12y agoDon't know for NGinx yet, but one can balance with HAProxy, e.g. create 2 backends for read/write respectively. http://blog.haproxy.com/2014/01/02/haproxy-advanced-redis-health-check/ http://blog.haproxy.com/2014/01/02/haproxy-advanced-redis-he...
- smwht 12y agoAnyone know if the nginx TCP load balancing supports the PROXY protocol? Doesn't appear to, which is unfortunate.
- sarahnovotny 12y agoIt doesn't at this stage. That is in the plan, but there are other features we'd like to implement first.
- smwht 12y agoThanks. For reference, the use case is to distribute SSL negotiation without losing access to client IP addresses.
- adrenalinup 12y agoWhy would somebody need a TCP load balancer in a web server ? Is there a use-case where the TCP load balancer being with the web-server made a lot of sense ? Integrating too many features into a single software can be risky as it may compromise simplicity and the UNIX way, 1 tool for 1 job..
- hbz 12y agohttp://en.wikipedia.org/wiki/WebSocket http://en.wikipedia.org/wiki/WebSocket are a completely legitimate use.
- wtarreau 12y agoWebSocket works over HTTP, not TCP. A properly implemented HTTP stack will have no problem passing WebSocket to the next server. Some non-compliant HTTP stack still experience trouble with it though.
- hbz 12y agoTechnically incorrect. WebSockets handshake over HTTP and then "work" over TCP. I'm actually curious which HTTP stacks are non compliant and what you mean by that. As to my original comment, you can probably get by without having full TCP load balancing.
- mtourne 12y agoMaybe if you use Nginx to replace some of your load balancer appliances to reverse proxy all your traffic, but you are unable to do SSL termination on that box.
- weitzj 12y agoI guess when further people adopt HTTP2, where each user will have only one tcp connection to transfer your files, you have to figure out load balancing to stick to your connection.
- novaleaf 12y agodoes this include the dynamic reconfiguration feature? http://nginx.com/resources/admin-guide/tcp-load-balancing/#upstream_conf http://nginx.com/resources/admin-guide/tcp-load-balancing/#u...
- justizin 12y agoGreat to see functionality migrating from Plus to FOSS!
- based2 12y agohttps://www.varnish-cache.org/trac/wiki/LoadBalancing https://www.varnish-cache.org/trac/wiki/LoadBalancing
- fideloper 12y agoThat's neat! HAProxy has been able to do SSL termination OR pass-thru. It's ability to do TCP load balancing allows it to do ssl pass-thru, where SSL connections are "passed through" to other servers (so the web nodes would de-encrypt the SSL connection, rather than the load balancer). This is a good use case for some where they prefer or require data to be encrypted up to the last minute (although it's not the only way to do it). TCP load balancing is neat for doing things like load balancing MySQL connections, which aren't HTTP (although that's not necessarily recommended according to some things I've read). I believe, but can't find the sources, that Nginx can be as efficient a load balancer as HAProxy. I know I for one would prefer to use Nginx over HAProxy to keep my stack simpler (same technologies throughout), although HAProxy may have more advanced balancing algorithms and some more power around it's tcp socket "API" for adding/removing nodes dynamically. (I think Nginx Plus can already do some of that). Would love to hear the opinions of those with more experience/knowledge on the differences between the two!
- ibakirov 12y agoYes you right, both are good enough and everyone want to simplify his backend schemas... I want to note big difference between haproxy and nginx, first of all "nginx is webserver" (nginx HTTP server) and then proxy/loadbalancer(may be used) whereas haproxy is pure loadbalancer. Enterprise bare metal and hardware appliances for proxy/loadbalance built on top of haproxy nginx is wide spread because of usage as good minimalistic web server
- emcrazyone 12y agohuh, I thought all of NGINX was open source and so I'm confused by the title "NGINX open sources TCP load balancing." Just a bad title or am I missing something?
- jffry 12y agoA bit under two years ago, NGINX announced NGINX+ [1], with an open source "core" and paid-for extras [2] [1]: https://news.ycombinator.com/item?id=6255592 https://news.ycombinator.com/item?id=6255592 [2]: http://nginx.com/products/feature-matrix/ http://nginx.com/products/feature-matrix/
- chubs 12y agoReading through the code, it's extremely tidy. Very confidence inspiring :)
- DonnyV 12y agoNot really sure how they can call this project open source anymore. Every new feature is now tied to there subscription service. You better off with haproxy.
- dschiptsov 12y agoThis is, perhaps, a canonical example of how management's attempt to monetize an open source project will cause sub-optimal results both in code quality and profits. New features should be developed and tested in an open version, so the feedback, testing, patches and even unexpected new improvements from high skilled enthusiasts would be incorporated much more quickly than any closed team with QA (look at the Linux kernel). We have seen too many examples of "acquiring" open source projects to monetize on its user base (how I hate that idiotic MBA slang) which then became stagnant - from MySQL to Xen, you name it. I wonder what mr. Sysoev is writing these days?)
- jospoortvliet 12y agoI agree with you, but knowing a little how hard it is to stay smart about this as an open source company, I understand why it went wrong. The Open Source Way is surprisingly hard to understand and the pressure from Sales turns the focus on short term gains.
- IgorPartola 12y agoNot that I don't want me some more nginx features, but how will this work exactly? Are you suggesting these features, once developed, become closed source? Honestly, I am not sure how nginx could be profitable long term. It is so good, that you don't need paid support or whatever the Plus version offers.
- gizzlon 12y agoGuess it would work more like Fedora -> Redhat Enterprise Linux. You might be right about the profits, I have no idea.. The "open core" model is horrible IMO. It pits the open source version and the commercial version againts each other. What happens when someone would like to contribute features already planned for the commercial version.. ?
- dschiptsov 12y agoRedhat has really clever model, btw. Once, in times of RHEL3 and 4 they have tried to maintain zillion patches against vanilla kernel to be "Enterprise Linux", you know, so you could run Oracle cheap (a hot topic in that time). Then they have realized, that it is much smarter to give the patches to the mainstream, so everyone will benefit. Fedora became a test-bed for a new technologies, to amortize the too rapid changes (systemd and other crap, you know), so they could provide stable and compatible RHEL versions for existing customers. And Redhat is a service, not the code company.
- ibakirov 12y agohaproxy is good enough with it's: - full stats rather os nginx stab_status (full stats only in nginx plus) - much load balancing mechanism support than os nginx (full support needs nginx plus, e.g: for sticky sessions) for me, in the first place haproxy and then nginx I good welcome opensourcing parts of nginx, take that way