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.<p>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?<p>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 not be terribly wise.<p>I'm sure many people will tell me I'm wrong, and I guess I can see some benefit to simplifying configuration and perhaps deployment.<p>But there's a reason we've mostly moved away from deploying embedded PHP applications inside of mod_php.
I wonder why they didn't use Duktape[1]. It seems like the obvious choice for this kind of effort (e.g., if the 2 main Lua implementations have any counterpart in JS, it's probably Duktape).<p>It's possible that Duktape was still too early in its development to use when Nginx started this project, but even then it seems like they could have collaborated and saved a lot of man hours.<p>I wonder if there a good reason why Nginx didn't use Duktape, or could this be a case of NiH where some Nginx dev got excited about the opportunity to build a new superfast JavaScript implementation just for Nginx? Surely it would have been less work to integrate the two event loops and use Duktape's (well-documented) API to build whatever features they wanted?<p>That said, although I've built significant async programs in other languages, I've never done anything in C on this scale, so take my words with a grain of salt.<p>1. <a href="http://duktape.org/" rel="nofollow">http://duktape.org/</a>
This seems like massive overkill. Instead of adding a limited domain-specific language which is tuned to nginx's requirements, they've added the behemoth that is JavaScript, along with all its flaws. A turing-complete behemoth, at that.
This is a welcome improvement to me. I've spent many an hour trying to figure out how to put some logic in nginx but it was never very intuitive to me. I think a reverse proxy + ssl termination + web cache should be considered part of a normal web stack and developers should be proficient to use the full stack when they develop and implement sites. Rather than trying to do everything on the app server, once I started utilizing nginx my app design changed somewhat and of course the response times dropped and the app server load was reduced. I'm hoping nginscript just makes it all easier to do.
A web server with a JavaScript engine. What could ever go wrong?<p>My eyes start to bleed when I imagine what some cowboys will implement on top of that.
The post ends with "We look forward to your feedback as you try out nginScript [...]" but it doesn't mention where we can test it out. Does anybody know more about that?
<i>We run a separate virtual machine for each request, so there’s no need for garbage collection</i><p>I'm curious to see the impact of this strategy on performance.
I think a countdown for a new 'in vogue' webserver just started.<p>This is something I would've expected from a "Show HN: Embedded JS in Nginx" post, meaning it has potential to be a project done just to see what can be done, that everyone could say "Hey, that's cool" and then never use, because it's a terrible idea.<p>Instead, it's presented as a reasonable way of moving forward, when they could've pushed for their own much more reasonable alternative. They've done more work for a worse idea, effectively out-competing their own feature with a much more popular but crappy alternative.
Adding Javascript support to high-performance reliable web server does not seem rational from the engineering point of view.<p>I'd rather added support for the safe subset of some statically-typed, high performance language compiled to LLVM. This language must be without asyncronous GC, so its memory use will be predicatable under high load.<p>Javascript on server side is so vogue-ish. Vogue will change soon but uglyness of architectural decision will stay with Nginx forever.
I think it's a good addition. We have been using varnish on high traffic servers and one of the reasons was that it had "vcl", a javascript-like language to define request handling logic. (With a lot smaller feature set and more domain specific. But powerful enough). Having javascript on nginx would provide a lot of config options for people familiar with it. I believe nginx already has Lua support so not a big deal anyway.
Yeah, I am a known Apache fanboy, and so I'm sure that what I say will be discounted. But, imo, this just shows what happens when an open source project becomes the sales initiative of an Open Core model company. Instead of the design and future being under the control and guidance of the community, it is instead in the hands of the VCs and whatever "promises" future revenue growth. Believe me, I know; I used to work at Covalent which was billed as the "Red Hat of the Apache web server" so I know how hard it is to resist the push of VCs and those nasty quarterly numbers. And Covalent wasn't the only Apache shop around, unlike nginx.com today.<p>The combination of FUD and marketing $$$ is being used to "encourage" more people to migrate (or use) nginx, as an "open source" alternative, when it's obvious that "open source" is being used mostly for the PR aspect and not so much for the community-focus and community-led aspects which is really core to "true" Open Source.
I can understand the appeal, marketing Javascript to CIO/CTO is much easier than marketing Lua today.<p>(Which obviously is sad as in my humble opionion for various reasons Lua is the better embedded language. I hoped it could become a widely adopted standard, we had great success with Lua in Redis in the past).
For anyone interested, it looks like it's available as a module on <a href="http://hg.nginx.org/njs/" rel="nofollow">http://hg.nginx.org/njs/</a>
I've recently been leaning towards not using web servers like nginx or apache at all. There are non-blocking server platforms like node.js or vert.x that let you code your web server instead of configure it. I find that ou frequently hit a wall of opaque redirect rules that become unmaintainable for any complex project. Having your server written in testable code makes it more predictable. It looks like nginx is trying to meet in the middle.
I think that most people missed the point here.<p>The basic idea is a DSL that "happens" to have the same syntax than Javascript. I guess that this VM has a lot of optimisations related to its purpose toward nginx (.e.g. no GC overhead, since each JS context is supposed to be short lived and tied to a unique request).
so it's mod_perl, but javascript and nginx instead of apache and perl. seems like they've ignored history here, as mod_perl turned out to be a bad thing in the end, people messing with bits they really shouldn't leading to massive amounts of unmaintained legacy spaghetti code messing with all parts of apache.<p>bearing in mind mod_perl's original use was not for writing applications, it was for messing with apache, for doing the things you can't easily do in the config. but where there's a way, abuse will follow, and before you know it whole apps will be written with this<p>ah well, those who don't learn from history are doomed to repeat it.<p>so, while it may seem like a good idea now, you can bet in 5-10 years it will no longer look so clever
I wonder if they'll have an "'nginscript' is evil" section in their wiki, like their "'if' is evil" one...
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?<p>Nginx already has LUA scripting support.
HN and it's predictable level of antipathy is a constant disappointment. Hating is the norm, do better. Put more thought into your opinions.<p>Personal feelings of Javascript aside (not my favorite either!), I think this is a great business move (adoption, excitement, blog-o-sphere marketing, even if some users shoot themselves in the foot), and I think it opens up exciting possibilities, including creating Nginx+ features fo'free.