Node.js is good for solving problems I don’t have
xquerywebappdev.wordpress.com
xquerywebappdev.wordpress.com
"The content server should not need to do hardly any IO. Why would an HTML content server need to write to the filesystem?"
This just shows a blatant lack of knowledge about what constitues IO. FYI, network is IO, writing to console is IO, logging is IO. The point of an evented system like node (and others based around the 'select' or 'epoll' type calls is that you can use one thread to do other things when you are waiting for the kernel to tell you your socket is ready.
Yes, I too get frustrated when 'front-end' people think they are systems engineers or super server coders, but that doesn't mean I am going to write a blog post that goes nowhere about it and completely misses the point of an evented system like this.
IMO the main problem that event loop systems were designed to solve was the "I have a ton of people connected concurrently but the majority of the time these connections are idle". Think if you were building a chat application. Your users are connected to your service constantly (they want to get messages as soon as they arrive), but most of the time they AREN'T receiving or sending data. If you had a thread for every connected client your server would melt due to the ram overhead, even though most threads aren't doing any work 99% of the time. In an event-loop based system, you don't have this issue because everything gets handled by one thread.
The author self-identifies their problem as: "The problem I have is processing a lot of data quickly"
Clearly, then, don't use node. But why write a blog post about not using something? A post involving a lesson learned ("I tried using node for processing a lot of data quickly, and it was terrible!") would have been more valuable.
I fully offer up the idea that I may have missed the point.
http://en.wikipedia.org/wiki/MarkLogic
I guess they're tyring "to fully utilize the potential of the internet".
I could care less about Mark Logic. I do care about what the article says, and I agree with it.
This is not true, and it's probably why the author seems confused. Node was not primarily designed to be a web server, nor is it particularly good at that. It is much better as a server that keeps sockets open, like for a chat application.
All the references to threads are probably the most difficult to understand for me. Node is single threaded and one can't spawn a new one. The author seem to be using it as some sort of magical artefact.. it's beyond comprehension.
Node makes it possible to do completely new things that would be difficult to do otherwise.
I take exception to this statement: "Node enthusiasts are front-end coders not wanting to do server coding." The number of engineers who only do server-side programming these days are few and far between. I haven't worked a job in the last 4 years where no one touched the frontend at some point or vice-versa. Sure, we usually have niches where we do the majority of our work, either front or backend. But at no point are they exclusive.
Node has been a blessing for me, as a frontend engineer, because I can finally code servers in the same mindset as I write client-side javascript. We (frontend folks) live in an asynchronous world. We eat parallel requests, xhr, and async callbacks all day. It turns out that when you apply those same concepts to the server, it opens up a whole new world of possibilities.
You'd be surprised how many people take the wrong answer, then. I've seen tons of posts touting Node from people with needs and problems that would be better served by other technologies.
"""Node makes it possible to do completely new things that would be difficult to do otherwise."""
Really? Like what? Besides running server side js (something that Netscape did back in the mid-nineties), Node offers nothing that one of the tons of evented servers/libs around could not previously handle. .
I personally like the Mongrel2 approach --combined with some non-blocking framework you got all the Node goodness, plus traditional server goodness, plus messaging, plus language agnosticity.
That was precisely the author's point. You'd rather stick with what you know then bother to deal with traditional server side techniques.
I use node for new cutting edge things which Django and Python can handle, but not as easily as node.
Like what?
Once you reach into realms where the label "massive" comes into play the importance of per-host performance is usually dwarfed by attributes like robustness and maturity.
JavaScript works well for Node because it is a language that has evolved to be asynchronous. Not because some front-end web monkey n00bz know JavaScript. Although that is certainly a plus.
Node.JS shines when you need to write network applications. It was advertised for this purpose by its creator. That is its stated goal.
Traditional server-side solutions SUCK at this. Try writing a non-blocking server-side WebSocket server in PHP and distribute the load across all of the cores. Yeah. Exactly.
Don't get me wrong, I love PHP. But for every job, a proper tool.
Node.JS takes care of the network server and hands off the work to PHP via FastCGI. That's how it should be. Node.JS solves real problems right now. If it isn't doing that, you're trying to hammer in a nail with a screwdriver. Stop it.
Wouldn't the traditional way to do it server-side be to just write it in C/C++ or Java with a thread pool? Or if you prefer the evented model, Python+Twisted isn't old enough to really be traditional, but is pretty widespread; and some Java server-side apps have been moving to an async model as well.
I was a bit vague. What I should have said was that dynamic language solutions are bad at it. Certainly you can pull out C/C++, Java, Erlang, etc. but at that point, you need to compile and recompile when you change your code. You are dealing with dependencies, libraries, binary compatibility, and the usual complexities that come with compiled languages.
> Or if you prefer the evented model, Python+Twisted
Well, Node.JS isn't the only game in town, certainly. Competition is a good thing.
Node.js works for me.
I don't think much else needs to be said.
So, Node solves problems we've already solved, only now using the second most poorly designed common production language available today (first place is reserved for PHP).
Nobody knowledgeable has said that async coding is novel. What matters is that node.js is a simple(r) and effective means of writing asynchronous applications.
It seems that the author needs something like super performant Hadoop++. Node doesn't address these problems.
"Node enthusiasts are front-end coders not wanting to do server coding"
I think he missed the point there. Using Javascript as a server side language, node has bridged a gap so many web programmers have been crossing. With node and mongodb, JSON is a language native to the entire webstack -- which is a very powerful idea. We are able to sync datastructures across server and client now.
This rant sounds very similar to "NoSQL DBs will never reach the competence and performance of the RDBMS".
Honest question here -- outside of not calling input and output transforms to or from JSON and native array/list/whatever, what is the new ability and the powerful idea? Aren't the two transforms pretty insignificant in practice?
I guess what mikescar finds attractive is the illusion that things are "integrated" and talking to each other in a format that doesn't look like one (it seems to be part of the programming language).
JavaScript as a server-side langauge is not a good thing; JavaScript is not a good systems language. We've already had an era of a poor systems language (PHP) being predominant in the web application space, and the conclusion was that there are better languages which can more effectively represent both general systems tasks, and specialized web tasks.
NoSQL databases will never be relational DBs because they explicitly eschew the relational algebra that powers the latter. Similarly, Node isn't a serious server-side solution explicitly because of its reliance on JavaScript.
Finally, I should point out that JSON isn't a subset of JavaScript. This means that you can't exec it as JavaScript in all cases, and even if you could, exec/eval is massively dangerous and should be avoided. This means that you're parsing JSON, which means that you no longer have an advantage over other languages -- Perl, Python, and Ruby all have very strong JSON support. (Python even has it in its standard library now.)
Why isn't Javascript a good server-side language?
"JSON is a subset of the object literal notation of JavaScript. Since JSON is a subset of JavaScript, it can be used in the language with no muss or fuss." http://www.json.org/js.html
Also see my other reply.
- JSON is a strict subset of Javascript syntax. You can always eval() a JSON string to convert it (not that you should). Many browsers support native JSON parsing now, so it's also very fast. I'm not sure what the downside is there.
JSON isn't a strict subset of JS. Moreover, no, you should never eval() things which are untrusted. Do you really trust everything the browser tells you? No? Then why trust JSON?
I'm not anti-JSON, I'm anti-JS. Browsers don't support other languages (except for VB, which bites, and Fx nightly support for Python, which I wish would become more widespread) so there's no choice in a browser. On the server side, though, you have a chance to use real languages, so you really should.
Oh, and also, you do know that XML-RPC, bless its ill-specified heart, is still around, right? There's a whole world of enterprise that isn't prepared to accept JSON-RPC.
Anyway, what do you count as a "real language"? I assume you mean Java. Which is...fine. But Java is not the answer for everyone.
Well, performance wise NoSQL DBs are faster. In anybody doubting that?
As for the competence part, well SQL DBs (by which I don't mean MySQL) are based on a little something called Relational Algebra. Which is math. Which is a (formally) proven and coherent set of methods for data representation and querying.
NoSQL DBs are just ad hoc solutions.
Not the same thing.
Then don't eat them.