Hacker News new | ask | show | jobs
by klibertp 3418 days ago
I disagree. I worked with both Nginx and Cowboy for quite some time, and I don't think that Cowboy is harder to "configure, update and manage." I had opposite impression.

I like Nginx very much, by the way - I was very happy when I switched from Apache to Nginx and I never looked back. Nginx is still my default choice for serving static files, as a frontend for Python (and similar) applications, as a (reverse) proxy, etc. However, I don't feel the need for it when working with Erlang or Elixir, exactly because of Cowboy.

Cowboy is not as fast, but it still is quite performant, even for static files handling. I don't have the numbers, and I can't seem to find a relevant comparison (there's one against Node.js and Tornadoweb here: http://www.ostinelli.net/a-comparison-between-misultin-mochi...) right now, unfortunately.

However, upgrading and management of Cowboy are either on the same level as Nginx or simpler. The upgrade process has two steps: change version in mixfile and re-fetch deps, done. I know that it's one step more than plain apt-get, but it's not that complicated, either.

As for management, Cowboy has an advantage that you can configure it in a Turing complete language (with clear semantics - recall if or allow/deny semantics in Nginx config), not only by initial configuration but also by writing handlers, where you can do arbitrary processing. It's also runtime configurable and hot-swappable (you can reload Nginx config, you can't (AFAIK) replace the currently running nginx with newer version "in place", you need to restart it).

On the other hand, Cowboy has much less built-in functionalities, which is why I said it's not good for example for being a plain proxy - you'd need to write your own handler module for that, while in Nginx it's a one proxy_pass directive and it will be faster to boot. However, when you have an Elixir app and you want to just serve some static assets in addition to the app itself I think it's completely fine to rely on Cowboy for this.

Of course, the advantage of Turing-complete language disappears if you use OpenResty. It allows you to write your app inside Nginx in Lua. I used it in a few cases and it was quite pleasant experience, however, then the Elixir backend becomes unnecessary...

So, to summarize: I think that you don't need Nginx if you use Erlang/Elixir for your backend and that you gain almost nothing if you do include it.