9 ms·
Nginx Unit
- foota 9y agoThis would take the place of something like tomcat or uwsgi, right?
- willvarfar 9y agoJava is a notable omission on the diagram on their landing page...
- richdougherty 9y agoUnder Features / Multi-language support: > Full support for Go, PHP, and Python; Java and Node.JS support coming soon
- seanp2k2 9y agoNo Ruby support :<
- shawabawa3 9y agoAlso "coming soon" according to their github page
- etatoby 9y agoThe day I can toss Tomcat to the bin and replace it with something written in C that allows zero-downtime restarts will be a fine day indeed.
- reificator 9y agoThe concept of XUnit is so ingrained in my head that I assumed it was a unit testing framework for NGINX. The rest of the headline cleared it up of course, but I was curious for a minute how that would look. EDIT: When discussing a new product, I would think the name is a fair point of discussion. Furthermore after this thread's title changed, it now requires a clickthrough to dispel similar misunderstandings.
- wpietri 9y agoYeah, given the title, I thought it was about a unit testing framework for Nginx. Kinda like ServerSpec, but more specific: http://serverspec.org/ http://serverspec.org/
- baybal2 9y agoLooks to be a good candidate to replace omnipresent nginx based API routers
- thanksgiving 9y agoI 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?
- tokenizerrr 9y agoAnsible? Puppet? A five line bash script?
- noway421 9y agorsync && ssh target -t 'cd ~/app/; ...' and it's a one-liner.
- baybal2 9y agoHere will go their REST config api to force reloads. BTW, it is a good idea to always do API versioning on production runs. That will eliminate the possibility that different API versions (files stuck in the cache, or simply people who kept browser open for a long time) use the same endpoint
- thanksgiving 9y agoYes, I have a baseurl/v0/... in the naming scheme for now. (:
- drcongo 9y agoUse a webserver that proxies requests to a wsgi server. We tend to put Caddy in front of Gunicorn which works really well. Also, look into running Gunicorn under supervisord.
- amouat 9y agoAlso note github repo at https://github.com/nginx/unit https://github.com/nginx/unit
- cormacrelf 9y agoIf 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
- icebraining 9y agoThere's also a blog post introducing the project: https://www.nginx.com/blog/introducing-nginx-application-platform/ https://www.nginx.com/blog/introducing-nginx-application-pla...
- Antwan 9y agoAny report of the perf (VS uWSGI for example) ?
- svennek 9y agoSo 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...)
- fgjjgutjvnu 9y agoI recently tried to deploy a python flask application, and it was quite a mess. It relied on some services I had never heard of, and the documentation was a mess (not the documentation of Flask but of how to deploy it properly). If Nginx Unit could host flask applications, it would be great news.
- hathym 9y agohow does it compare to openresty/luajit ?
- noway421 9y agoAFAIK nginx unit would still require to have an nginx in front, so they are in different weight category with openresty. It looks like it's more of a replacement to good old NGINX+Apache set up where there would be mod_php, mod_cgi, mod_perl and .htaccess on backend to serve the app.
- mmahemoff 9y agoConfusing description. After seeing the Github README (https://github.com/nginx/unit#integration-with-nginx 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 9y agoIt'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.
- FooBarWidget 9y agoYou seem to be very experienced in this area. Can you explain a bit about why you think an "app server with microservice orchestration" is needed?
- flachsechs 9y agobecause you can work with individual microservices across clusters without a ton of overhead (or use a monolithic app server), aiding in deployment, rollback, debugging, development.
- dithering 9y agoSo in what circumstances would you need the polyglot bit? (I guess I'm assuming a container/VM architecture here).
- 9y ago
- yeukhon 9y agoIt is in beta, but I hope this won't become a commerical-only product.
- unkown-unknowns 9y agohttps://github.com/nginx/unit https://github.com/nginx/unit It's open source at the moment at least and I think it's reasonable to expect at least that the parts that are open source today will remain so in the future. Certainly they could have a commercial version with extra features like they do with Nginx, but as long as they have a useful version of this Nginx Unit available open source I will be happy to use it.
- argsno 9y agoSo, it's an application server?
- skrebbel 9y agoThis 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/ http://mongrel2.org/
- coldtea 9y agoMongrel2 was indeed a nice idea on paper. It never had much momentum though -- but what it lost and killed it was Zed's interest.
- agnivade 9y agoWait, zeromq lost momentum ? When did that happen ?
- FooBarWidget 9y agoWhen was the last time you heard something about it?
- RantyDave 9y agoI'm using it for a project now. It's a bit weird, but it does work. Cool thing: you can slot a file descriptor into the zmq provided poll ... point is that you can poll on both zmq and sockets in the one loop. Pro Tip: Use 'cbor' for serialising.
- sevensor 9y ago> you can poll on both zmq and sockets in the one loop Which is magnificent. The ZMQ poller is tons of fun. (Although I think this doesn't work on Windows.)
- shoover 9y agoThanks for the tip. In which language(s) do you use CBOR? I want to like it, but the various C APIs look a bit cumbersome and lacking docs.
- chatmasta 9y agoI'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-platform/ https://www.nginx.com/blog/introducing-nginx-application-pla... [1] https://www.nginx.com/products/ https://www.nginx.com/products/
- coldtea 9y ago>What makes this better than, for example, using docker-compose? Not having to use docker would be a huge plus for me.
- justonepost 9y agoyes, infinitely more lightweight. but docker compose and friends are cool
- pilif 9y ago> 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.
- korzun 9y agoTechnically, you can expose the Unit API within an internal network.
- zeckalpha 9y agoWhy that still might not be a good idea: https://research.google.com/pubs/pub43231.html https://research.google.com/pubs/pub43231.html
- korzun 9y agoThanks for linking that. Typically, if you know what you are doing, a setup of this nature would be segmented out from the rest of internal network. I did compliance work for a lot of start-ups and never came across a company that understood this concept. The majority thinks that their wireless router is already doing this via the Guest account.
- vertex-four 9y agoTechnically, NOT RECOMMENDED is the same as SHOULD NOT in RFC2119 - i.e. "the full implications should be understood and the case carefully weighed before implementing any behavior described with this label". Not that this document uses those definitions, but.
- uvtc 9y ago> 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" For the same reason they say, "non-trivial" when they really mean "nearly impossibly difficult". :)
- eeZah7Ux 9y ago[honest question, not being negative] what real use-case is not already being addressed by existing technologies?
- TeMPOraL 9y agoFor almost every new product you see, the answer is: none. It's not about making something impossible possible. It's about improving possible things in some dimension - like speed, safety, flexibility, or - in this case - standardization and integration with already used tool.
- Walkman 9y agoGreat answer! I wondered about this myself for a moment :)
- coldtea 9y agoHonest question, not being snarky: when did the existence of other products handling the same use-cases ever stopped people from creating another? For one, it's not just "handling a use-case" it's also _how_ you handle it. And within what ecosystem you handle it. And what kind of support etc you offer with it. Etc...
- smegel 9y ago> Full support for Go, PHP, and Python; Does it do WSGI then? Did they write the equivalent of mod_wsgi?
- anentropic 9y agoyes, from docs it appears the Python app type in Unit provides a WSGI host
- bluetech 9y agoI'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 9y agolol.. 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 :)
- falsedan 9y agoGreat story bro
- andruby 9y agoAny pointers for those interested in the story who have no clue?
- omegavesko 9y agoWhat does "en-masse configuration" even mean?
- falsedan 9y agoThat they deployed a broken config file & forcefully stop-started nginx instead of reloading it (and bypassing nginx's built-in protection: it will test a config and refuse to load it if it's broken on reload. on restart it's stuck with whatever busted config you give it).
- etatoby 9y agoSo they deployed a bad config file to all nodes and restarted the service, which then failed to start. How is this specific to Nginx? This same mistake is possible with any other software ever written.
- marktam264 9y agoIs this like AWS Lambda you could put in your own cloud?
- falsedan 9y ago> Is this like AWS Lambda No > you could put in your own cloud? Yes
- noway421 9y agoThis type of question is indication that NGINX Inc. salesmen did fail horribly to conceive of what the product actually is in layman engineering terms. Too much buzzword compliance.
- donatj 9y agoYup. I came to the comments specifically to try to figure out what the heck this thing does. The page itself never gets to the point of "Here's what it does".
- wiradikusuma 9y agoThe 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/ http://nunit.org/
- atemerev 9y agoSo, Nginx follows exactly the way of Apache HTTP: remember mod_php, mod_perl etc?
- icebraining 9y agoThis is not Nginx, it's a separate project developed by the same company. You could put any frontend proxy in front of it.
- oelmekki 9y agoI 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 https://github.com/hipache/hipache
- wut42 9y agoDynamic upstreams are available in nginx, but only in the enterprise/paid offering.
- justonepost 9y agoit's like swarm - https://docs.docker.com/engine/swarm/#feature-highlights https://docs.docker.com/engine/swarm/#feature-highlights but much more lightweight.
- anentropic 9y agoand nothing to do with docker containers in fact nothing like it really AFAICT
- pas 9y agoKong would be ideal in front of dokku: https://getkong.org https://getkong.org It works with postgres or cassandra (and eventually scylladb https://github.com/Mashape/kong/issues/754 https://github.com/Mashape/kong/issues/754 ). Also, nginx is pretty good at restarts, even with thousands of files and vhosts.
- LaGrange 9y agoRe the Go thing: they give you a go package: https://github.com/nginx/unit/tree/master/src/go/unit https://github.com/nginx/unit/tree/master/src/go/unit. Note that it's actually CGo (which is not Go), and it uses a non-standard build process to install it: http://unit.nginx.org/docs-installation.html#source-code http://unit.nginx.org/docs-installation.html#source-code. I don't like it at all :( I usually put plain nginx in front of my app, to handle static files and simple load-balancing, but this seems to be oriented towards handling issues best handled elsewhere.
- mattacular 9y agoI didn't see this mentioned but is there any way to upgrade the versions of the modules such as Go and PHP indepedendently of the core Unit package?
- devj 9y agoHow is it different from Envoy?
- daddykotex 9y agoI came to ask the same question. The landing page is terrible it says pretty much nothing.
- daddykotex 9y agoIt seems like it is quite different, you actually change your code to listen with NGINX unit. https://unit.nginx.org/docs-installation.html https://unit.nginx.org/docs-installation.html
- tr1ckst3r 9y agothis is an Envoy competitor. If my reading is right, they want to jump on the Istio bandwagon (https://istio.io/docs/concepts/what-is-istio/overview.html https://istio.io/docs/concepts/what-is-istio/overview.html) as another data plane option.
- AsyncAwait 9y agoSo is still standalone or do you still need to run this behind the regular Nginx, like you would a language-specific application server?
- jchw 9y agoSounds like uWSGI based on the description. I wonder how it'll play along with certain environments like Kubernetes.
- fermigier 9y agoSame. 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.
- bpicolo 9y agoYep. Somewhat tricky when you have 896 runtime options. That said, have been happy running uwsgi in production for a lot of python (and php) services. Yelp.com runs behind uwsgi, and effectively all of the python services behind it do as well. Some use more uncommon features like gevent support.
- kogepathic 9y ago> 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!). uWSGI definitely needs more concise tutorials on how to accomplish some tasks (e.g. creating Hello World with python and uWSGI, or how the uWSGI emperor works). However I disagree with "lacking severely in the department of documentation" Sure, it's not as easy as some other projects to dive into (e.g. Django) but IMHO the documentation is not lacking, it's just not forthcoming. If you sit down and read through the uWSGI documentation, you'll discover a lot of very useful functionality and a reasonable description of how to utilise it. What's lacking is the tl;dr way to bash something out quick and dirty.
- pas 9y agohttps://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.h... it seems very quick and straight to the point (yet complete, it even starts with apt-get) https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html - has config snippets too Or maybe you mean detailed step by step instructions, a'la howtoforge?
- phillippschmedt 9y agoCould 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?
- msimpson 9y agoNGINX allows you to proxy a back-end applications giving you the ability to load balance, handle upstream failures with custom maintenance pages, employ server blocks (virtual hosts), and much more. However, you always need to do the leg work to get your specific application language up and running. This new unit system makes that job easier as you would no longer need to employ separate middleware, like PHP-FPM for PHP applications, or use a separate init system like systemd to run Go or Node applications. Now NGINX would assume those responsibilities and provide you with a consistent interface. Here you can see the configuration of workers and user/group permissions for a Go application: http://unit.nginx.org/docs-configuration.html#go-application http://unit.nginx.org/docs-configuration.html#go-application
- Xoros 9y agoI'm sorry but I'm not sure I get it. Is it like the apache mod_php for php for example ? Thanks in advance for your answer
- falcolas 9y agoThat's how my reading of it goes. You provide an "endpoint" for the library to call, configure the Unit framework, and their Manager connects the nginx frontend to that Unit framework. No real idea if it does so using fcgi or some other socket-based proxying, or if the unit is spun up as a separate process and handed the raw socket and some shared memory after the headers are parsed (closer to how mod_php works).
- msimpson 9y agoYes, you can generally think of it as a replacement for mod_php as Unit would parse requests from NGINX, pass them along to the PHP parser, then return the responses back to NGINX. That's the same job mod_php does for Apache and what PHP-FPM (essentially) does for servers like NGINX. You can see the PHP configuration here: http://unit.nginx.org/docs-configuration.html#php-application http://unit.nginx.org/docs-configuration.html#php-applicatio... And here's the configuration needed to integrate Unit with NGINX: http://unit.nginx.org/docs-integration-with-nginx.html http://unit.nginx.org/docs-integration-with-nginx.html
- noway421 9y agoAny use for that on small scale (of 1 instance)? If you'd need to run nginx in front of it anyway, does it provide any use in case where you'd normally use php-fpm and some proxy_pass?
- detaro 9y agoInteresting for me since I run not just php. Depending on what you do, maybe the API is useful for you.
- taf2 9y agoIs this similar to openresty ? Instead of Lua - python, go and php? Or something different?
- bovermyer 9y agoNo, this is a replacement for things like php-fpm, gunicorn, etc. The REST API part of it is for updating its configuration over HTTP.
- jonotime 9y agoInteresting. 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/ https://traefik.io/
- metalliqaz 9y agoSo in my Flask app this would replace gunicorn?
- bovermyer 9y agoYes.
- bovermyer 9y agoMore useful: http://unit.nginx.org/docs-nginx-unit.html http://unit.nginx.org/docs-nginx-unit.html
- ishtu 9y agoI am surprised noone mentioned Kong [1] yet. It seems to implement most of stuff promised by Unit and it was around for a few years. [1] https://getkong.org/ https://getkong.org/
- base698 9y agoThe last I saw Kong didn't support microcache, which is one of the best nginx features IMHO.
- LeonidBugaev 9y agoNot sure how it is related. Unit is an app server, it runs app processes and manages them, handles graceful restarts and etc. Kong is just an API gateway: you run your own infrastructure as usually and put a gateway on top of it.
- ishtu 9y ago>Build the foundation of your service mesh. Not directly related as Unit seems to be advertised as app server primarily, but you can see quoted text on main page.
- agentgt 9y agoI'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).
- user5994461 9y agoCGI for PHP/Python. AJP/mod_jk for Java.
- LeicaLatte 9y agoLooks fantastic! Will be trying this over the weekend.
- scadge 9y agoIs it an alternative to Docker Compose in some sense?
- jimjag 9y agoI 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.
- anonacct37 9y agoI 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.
- korzun 9y agoI 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.
- zzzcpan 9y agoBecause people have a hard time figuring out what it is. Could you explain what it is? What benefits does it have to make it worth exploring? To me it looks like a rather invasive but flexible and dynamically configurable inetd. But it forces you to use its own libraries to receive http requests.
- derefr 9y agoIt's a lot like OpenResty (https://openresty.org/en/ https://openresty.org/en/), which is Nginx with a Lua interpreter embedded and bridged to its request-response cycle (the OpenResty page explains the point of that pretty well); but instead of Lua, Unit has a bunch of other language runtimes embedded.
- 9y ago
- bkeroack 9y agoIt'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.
- doozy 9y agoIt'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.
- deleted 9y ago[deleted]
- scott_karana 9y agoDoes 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. ;-)
- vertex-four 9y agoGo I/O is async by default, I figured, so... It could be that nginx is more efficient at static file serving, but that'd be down to being specifically designed and optimised for it rather than some "sync vs async" thing.
- ekimekim 9y agoMinor quibble, in the context of serving static files (ie. from disk), go doesn't use async I/O, the file I/O blocks the thread until it's complete. But since go's scheduler is M:N this doesn't lock up the whole program, so your point stands.
- neo_blackcap 9y agoSo does it use fastcgi to rule them all?
- lngnmn 9y agoOh, they wrote their own uwsgi, based on what presumably started as nginx2. That's cool. I hope they would avoid the Second System syndrome..
- mempko 9y agoBut can I use Perl 6?
- ultimoo 9y agoFor Go, does anyone have opinions on how is this is advantageous than using the in-built HTTP server (net.Listen() from net/http) that can fronted by a regular nginx/proxy_pass?
- pkstn 9y agoWhat 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?
- elcapitan 9y agoSeems to be a standardized replacement for language specific app servers like fpm for php. I guess that makes it a little easier to deploy stuff, although recently with docker containers, that hasn't been such a big deal anymore. You can just take an off the shelf fpm container and deploy that.
- rthomas6 9y agoSeems like a simple C app would take much less resources than a docker container and have a lot lower latency, though. How much computing power would you need for each, given the same number of users?
- Waterluvian 9y agoI 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.
- adventist 9y agoYeah I had a hard time finding out what this site did.
- dogweather 9y agoLol, yep: > NGINX Unit is a new, lightweight, open source application server built to meet the demands of today’s dynamic and distributed applications. That means everything and nothing. They wasted their intro sentence on it. They probably don't have a very good idea of what it is either.
- jjeaff 9y agoWhile it is a fluffy marketing sentence, it seems clear to me. It's an application server. Then the next section explains that you can run different kinds of applications and even different versions of the base software like different versions of PHP or python all in the same server.
- zmix 9y agoI can't say more than: Mee too!
- gkya 9y agoIt seems to me that software producers often advertise to managers rather than programmers, and that's why this style caught on.
- snambi 9y agoAgree, this is marketing material for bean counters.
- usr1106 9y ago
- moklick 9y agoNginx Unit > G Unit
- dogweather 9y ago> Run multiple applications written in different languages on the same server Amazing progress! Someone introduce them to CGI.