Live data from Hacker News

Launching NginScript

nginx.com

61–70 of 131 posts

Re: Launching NginScript

#61

It's sad to see lua get slowly replaced by javascript.

I think is is sad to see anything replaced by Javascript. Unpopular opinion I guess. So many better choices out there.

> So many better choices out there.

For now. I get the feeling that soon enough a lot of them will start dying out. Trying to "sell" some language other than JS in a mostly-JS shop is already an impossible battle. Popularity is used as a counter-argument for everything.

Re: Launching NginScript

#62

I can't help but think this is a bad idea. Jamming more stuff into what is a great tool puts nginx on a slow path to a bloaty death. Am I incorrect in assuming that you could implement your entire server-side js app now as an nginScript module? Do people think that is a good thing? Not to mention that putting more interpreters and more end-user code into a system that has access to your service's private key might no…

The purpose is to give the power of LUA scripting (via OpenResty, used by companies like Cloudflare) in the hands of more people, since Lua is a small community (even tho, it's great, easy to learn and fast). Thus, adopting JS is the solution for them.

Disclaimer: we built one of the biggest Lua+Nginx project [1]

[1] https://github.com/Mashape/kong

Re: Launching NginScript

#63
post #3

Earlier quoted context omitted.

I'm not sure if this is great idea. Use of reverse proxies has lots of benefits. You can manage load balancing, SSL Termination, serving static content (much faster), caching, compression, centralized logging, and using different applications on the same ur space (foo.com/app1, foo.com/app2). They also have the added benefit of another layer of security (look for and prevent various HTTP exploits and prevent them fro…

I use nginx at Neocities to serve all our static sites, and as a proxy for our front site. I like nginx, but it has way too much of a sacred cow treatment by the dev community. It has plenty of problems, the configuration is a psuedo-language that doesn't always make the right choices and is difficult to heavily customize, and I've gotten to it be -very- unstable under certain circumstances, including really bread-an…

> Making nginx do custom things that you'll probably need to do in a serious environment (example: dynamically programmable SSL SNI) requires craxy mods and hacks

> you get a full, turing complete programming language to completely control the flow of your data

Did you try nginx's lua support ? Because it doesn't seem to be that experimental and has its fair share of documentation already, on top of being much more performant than Javascript:

https://blog.cloudflare.com/tag/lua/

http://openresty.org/

Re: Launching NginScript

#64
I think Nginx is open source crippleware. All the goddies are in the closed Nginxplus. Http2, load balancing with monitoring with application health checks. Do you get the source code of the closed features?

Nginx already has LUA scripting support.

Re: Launching NginScript

#66
post #17

Earlier quoted context omitted.

Last I checked Javascript implementations were slower than LuaJIT. Cost of implementing Lua tables, meta-tables, co-routines, etc. in Javascript will be rather high. Anywhere between 2-50x. If native Lua engine is removed, you can just forget about it then. So what you're saying doesn't make any sense for anything remotely performance sensitive.

lua compiled to asm.js is 64% of the speed of lua native https://kripken.github.io/lua.vm.js/lua.vm.js.html

So that might be good enough in the browser but on the server where an optimized Lua engine exists, why?

Re: Launching NginScript

#68

We run a separate virtual machine for each request, so there’s no need for garbage collection I'm curious to see the impact of this strategy on performance.

I wondered about this sentence. If you would apply scripting functionality to serve long-running websocket or HTTP/2 connections I'm sure garbage collection would be necessary. However if the scripts are really per request and not per connection then it could work - but the capabilites would be much more limited then what you can do in other scripted-webserver-environments (e.g. node).

Re: Launching NginScript

#69
post #61

Earlier quoted context omitted.

I think is is sad to see anything replaced by Javascript. Unpopular opinion I guess. So many better choices out there.

> So many better choices out there. For now. I get the feeling that soon enough a lot of them will start dying out. Trying to "sell" some language other than JS in a mostly-JS shop is already an impossible battle. Popularity is used as a counter-argument for everything.

I was just thinking that the Javascript community saw that the Ruby community were both snobs and well respected, assumed a causal link, and thought they just needed to be snobs for people to respect Javascript.

Re: Launching NginScript

#70
post #43

Earlier quoted context omitted.

Yeah I've been skeptical of nginx's Lua support in the past. I guess I discounted it because it was a relatively unknown feature and Lua is obviously not nearly as popular as JavaScript. I don't know of any production service written exclusively in Lua, though I'm sure there are some. So yes while this is just a continuation of a bad idea, it's a rather substantial continuation. I fear that a lot more people will mak…

AFIAK, CloudFlare is entirely just Nginx+Lua scripts.

That is not fully true.

It became a lot more true during 2013, but CloudFlare had already been operating for a few years then. A lot of fairly simple code was retired to the profit of Lua code, which is way easier to maintain.

There are still important modules written in C and compiled with Nginx. There are also proprietary extensions of the ngx_lua api to manipulate internal some internal aspects of Nginx within the scripts.

source: I wrote a good chunk of both iterations.

Post reply on HN