Njs: Feature comparison with ngx_lua/OpenResty?

Created on 7 Jun 2019  路  1Comment  路  Source: nginx/njs

Hi,

I stumbled upon this project recently, and didn't see any mention in the presentation or elsewhere about how this compares to the ngx_lua module and OpenResty. A comparison with Perl is made, but not with Lua, which I don't think has the same drawbacks.

Language differences aside, why should I use njs over ngx_lua?

Thanks, and apologies if this isn't the right place for this discussion.

answered question

Most helpful comment

Hi @imiric,

Language differences aside, why should I use njs over ngx_lua?

While OpenResty is mature and a great tool to use, we decided to implement our own scripting for nginx for several reason.

1) njs is tailored to be executed inside nginx (fast VM creation/destroying), lua may have GC issues under heavy load.
2) lua adds a lot of ad-hoc features (directives, lua methods), njs strives for simplicity using powerful native nginx primitives (variables, subrequests).
3) njs is a pure nginx module, OpenResty is a set of patches which sometime abuses original nginx design.
4) we need our own scripting for nginx-plus (paid version) features.

While we already use njs for production it is still in early phase and lacks many features which OpenResty has. BTW we do not plan to implement everything lua/openresty has because the design philosophy is different.

>All comments

Hi @imiric,

Language differences aside, why should I use njs over ngx_lua?

While OpenResty is mature and a great tool to use, we decided to implement our own scripting for nginx for several reason.

1) njs is tailored to be executed inside nginx (fast VM creation/destroying), lua may have GC issues under heavy load.
2) lua adds a lot of ad-hoc features (directives, lua methods), njs strives for simplicity using powerful native nginx primitives (variables, subrequests).
3) njs is a pure nginx module, OpenResty is a set of patches which sometime abuses original nginx design.
4) we need our own scripting for nginx-plus (paid version) features.

While we already use njs for production it is still in early phase and lacks many features which OpenResty has. BTW we do not plan to implement everything lua/openresty has because the design philosophy is different.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

drsm picture drsm  路  3Comments

drsm picture drsm  路  4Comments

porunov picture porunov  路  4Comments

yvmarques picture yvmarques  路  3Comments

an0ma1ia picture an0ma1ia  路  4Comments