top | item 15189949

Nginx Unit

680 points| tomd | 8 years ago |nginx.com | reply

232 comments

order
[+] Waterluvian|8 years ago|reply
I hate sites like this. Im probably stupid but I have no idea what precisely it is after reading that page. I just know that marketing team wants me to believe it's going to be my saviour.
[+] _pfxa|8 years ago|reply
It seems to me that software producers often advertise to managers rather than programmers, and that's why this style caught on.
[+] zmix|8 years ago|reply
I can't say more than: Mee too!
[+] snambi|8 years ago|reply
Agree, this is marketing material for bean counters.
[+] adventist|8 years ago|reply
Yeah I had a hard time finding out what this site did.
[+] skrebbel|8 years ago|reply
This looks pretty cool, and makes me sad that Mongrel2 never became popular. In short: Mongrel2 solves the same problem, but does it by letting your application handle requests and websocket connections over ZeroMQ instead of eg FastCGI.

I guess it lost momentum when ZeroMQ did. Anyone know why? Sounds like a dream solution in the current microservice hype.

http://mongrel2.org/

[+] mmahemoff|8 years ago|reply
Confusing description. After seeing the Github README (https://github.com/nginx/unit#integration-with-nginx), it looks to be Nginx's alternative to low-level, language-specific, app servers, e.g. PHP-FPM or Rack, with the benefit that a single Unit process can support multiple languages via its dynamic module architecture, similar to Nginx web server's dynamic modules.

It's still intended to run behind Nginx web server (or some other web server), much like you'd run something like PHP-FPM behind a web server.

[+] justonepost|8 years ago|reply
It's a polyglot app server with microservice orchestration. It's definitely needed.

Some things to look for, such as registration/discovery of services, intra-cluster load balancing (where it started, no doubt), identity propagation & authn/z

The biggest issue to my mind though is distributed transactions and logging/debug/development. My biggest stumbling blocks with this sort of thing.. stepping through code over microservices is such a PITA.

[+] pilif|8 years ago|reply
> It is not recommended to expose unsecure Unit API

why do people always use "not recommended" when they actually mean "do not ever do this or you'll end up the laughing stock in the tech press"

Exposing this otherwise awesome API to the public will amount to a free RCE for everybody. So not ever expose this to the public, not even behind some authentication.

It's very cool that by design it's only listening on a domain socket. Don't add a proxy in front of this.

[+] jimjag|8 years ago|reply
I am biased, but call me underwhelmed. It seems that with every "new" feature, nginx is copying Apache httpd, even now claiming to be the "swiss army knife" of web-servers. Embedded languages. Dynamic modules. Support of uWSGI. gracefull restarts. Thread pools... and yet people eat it up. Just goes to show what having corporate-backed marketing and PR can do.
[+] Prefinem|8 years ago|reply
When I started with apache, I thought it was great, but after moving to nginx, the speed and simplicity made me never look back. While these new features to nginx aren't new to the world, they are a nice welcome addition to a system that IMO is far superior to apache.
[+] korzun|8 years ago|reply
I don't understand why people want to write something off without even trying it.

This is not'nginx'. You can't sit and write this off because Apache did something similar ten years ago. The build in API alone is worth exploring.

[+] anonacct37|8 years ago|reply
I agree. Apache has great module support. I think their worst sin was that their debian package defaulted to a small number of workers and using a forking mpm leading people to believe apache was slow.

Their eventing/threaded mpm is basically nginx.

And now nignx is starting to gain the features of apache.

[+] b34r|8 years ago|reply
Performance is a feature.
[+] phillippschmedt|8 years ago|reply
Could anyone explain to me why I would want to use this? What exactly is the use case and benefits of it when I am for example running a go web application?
[+] bkeroack|8 years ago|reply
It's worth noting that it's rarely necessary or desirable to put an app server like nginx in front of Go HTTP server applications. The Go standard library http and TLS stack are production quality and rock solid. Putting something in front is mostly cargo culting from people more used to the worlds of PHP/Python/Ruby/etc.
[+] wyc|8 years ago|reply
Pushing back on this a bit...for example, securely exposing a JSON endpoint to the public internet requires extra machinery that applications like nginx bring for free. If you simply set the router to your handler, then you accept arbitrarily large request sizes, wide open for DoS attacks. You have to either manually add limits or pull in some library. nginx caps these by default. Want throttling or load balancing? Again, things that haproxy and nginx do well, but require more cruft in your application.
[+] sslalready|8 years ago|reply
I find it useful for filtering and caching. Things like redirecting traffic to /.well-known/acme-challenge/ to your certificate management host, providing an endpoint for machine status or filtering requests to dot-files. Or telling Nginx to cache responses and allow it to serve stale content when the backend server returns 4xx/5xx status codes during deploys or high load. Handling things like client certificate authentication in Nginx instead of doing it in every backend application is another thing I've found useful.
[+] doozy|8 years ago|reply
It's useful to put Varnish in front of the app server for caching and to serve static content from a separate process (and domain) running a light/tiny httpd server instead of Apache/Nginx

I don't use Go, but D (dlang), vibe.d, varnish and lighttpd are working real well for my latest venture.

[+] scott_karana|8 years ago|reply
Does the Go http library asynchronously serve static files, by default? Or is it going to block on any app requests?

Nginx is extremely fast for that case, which is typically the reason most people proxy languages through it. ;-)

[+] Ruud-v-A|8 years ago|reply
I love Warp for Haskell, but I would still be hesitant to expose it directly. It’s simply not used as much as Nginx or Apache. Less people have spent time trying to break it.
[+] stanleydrew|8 years ago|reply
Perhaps it's rarely necessary, but it is often desirable. For instance if you are serving any static content along with your application, nginx is quite handy and is probably better at compressing and caching.
[+] yumyumyumyumyum|8 years ago|reply
And yet this issue remains unsolved: https://github.com/golang/go/issues/16100

Your choice is force a timeout and kill streaming requests, but defend against slow client DOS, or support streaming requests and suffer from a trivial slow client DOS.

For this and other reasons I still recommend fronting golang with something more capable on this front.

[+] jchw|8 years ago|reply
Sounds like uWSGI based on the description. I wonder how it'll play along with certain environments like Kubernetes.
[+] fermigier|8 years ago|reply
Same. I really want to like (and use) uWSGI, for many reasons, but I find it's lacking severely in the department of documentation (searching "uwsgi" on Amazon gives zero hits!).

A properly edited book would be awesome. I would pay for it of course.

[+] dschep|8 years ago|reply
Whoa. How did I never notice that uWSGI grew up beyond just WSGI!
[+] yeswecatan|8 years ago|reply
More like a replacement for any wsgi server.
[+] oelmekki|8 years ago|reply
I initially thought it would allow to dynamically handle upstreams list (and other configuration) like hipache is doing [1], which would be awesome for dokku or other container management systems which rely on system nginx. But after seeing languages mentioned, I'm confused.

Is it supposed to replace language specific servers, like unicorn and puma for rails (but then, I'm confused about what such kind of support would be for Go, since the server is directly embedded in the program)? Does it embeds interpreter for interpreted languages, like mod_* did for apache?

[1] https://github.com/hipache/hipache

[+] chatmasta|8 years ago|reply
I'm having a hard time seeing what niche this fills. It seems to be both a process manager and TCP proxy. What am I missing here? What makes this better than, for example, using docker-compose?

I think a "how it works" or "design doc" would be really helpful.

That said, the source files do make for pleasant reading. The nginx team has always set a strong example for what good C programming looks like.

EDIT: Their blog post [0] makes this more clear... nginx unit is one of four parts in their new "nginx application platform" [1]

[0] https://www.nginx.com/blog/introducing-nginx-application-pla...

[1] https://www.nginx.com/products/

[+] coldtea|8 years ago|reply
>What makes this better than, for example, using docker-compose?

Not having to use docker would be a huge plus for me.

[+] pkstn|8 years ago|reply
What is this? I've tried to read blog post, product site, these comments and still having really hard time figuring out what is Unit and why?
[+] jonotime|8 years ago|reply
Interesting. I like the restartless configs idea. This is becoming more common these days with short lived microservices. This week I just switched my load balancer setup from HAProxy to Traefik - very nice API based setup. https://traefik.io/
[+] amouat|8 years ago|reply
Also note github repo at https://github.com/nginx/unit
[+] cormacrelf|8 years ago|reply
If you're unfamiliar, look at this instead.

The homepage on Nginx.com is basically

> Join this webinar to learn

> - What NGINX Unit does that has not been available before

[+] bluetech|8 years ago|reply
I'm happy to see this. nginx itself is excellent software, I'll be happy to use similar tech for the application server as well (instead of uwsgi).

There are a couple of options I'd like to see added to the Python configuration though before I could try it:

- Ability to point it at a virtualenv.

- Ability to set environment variables for the application.

[+] justonepost|8 years ago|reply
lol.. nginx en-masse configuration is a nightmare. i can point to a fortune 50 company that it's destroying for relying on it. I won't name names :)
[+] wiradikusuma|8 years ago|reply
The logo makes it as if it's read "N Unit", which is probably confusing as a popular unit testing with such name exists: http://nunit.org/
[+] metalliqaz|8 years ago|reply
So in my Flask app this would replace gunicorn?
[+] svennek|8 years ago|reply
So it looks like they basically rewrote uwsgi and slapped a rest api on top of it.. (as a big fan of uwsgi, that seems like a reasonable thing to do...)
[+] est|8 years ago|reply
badly need settings like restart works every X requests or harakiri after # seconds timeout.
[+] agentgt|8 years ago|reply
I'm still not sure I understand "Unit".

I can't speak for the other languages (PHP, Go, Python) but I have some reservations about it helping Java (as well as Erlang and other (J)VM languages) as FastCGI like stuff has been attempted for Java in the past with not very good success with the exception of Resin.

I guess it would be interesting though if they did a native Servlet 3.0+ implementation like Resin but I doubt that is is what will happen. Regardless Netty, Undertow and even Jetty have caught up speed wise to Resin (well at least according to techempower).

[+] baybal2|8 years ago|reply
Looks to be a good candidate to replace omnipresent nginx based API routers
[+] thanksgiving|8 years ago|reply
I have a small flask application which basically is a rest get post API server. I'm struggling to make deployment easy. With PHP, i just push to the application server and rsync that folder into var www html for Apache httpd but what would I do for flask python 3?