News for hackers. Stuff that matters.
Re:After a year of using Node.js in production by tylerlh on Monday May 02, 2016 @06:26PM (#11616239)
The Netflix.com site and webapp runs on Node (and talks to a number of services written in mostly JVM based languages). While we encounter challenges just as we would with any other language -- it works for us and I would argue that it's a pretty big application.

There's always a multitude of ways to get something done, and it's up to you to decide what tool will do it best. Don't treat any one language as an end-all-be-all and you might find yourself much happier and more productive. Of course, YMMV.

Re:After a year of using Node.js in production by uptownJimmy on Monday May 02, 2016 @08:59PM (#11617067)
Speaking only for myself, a middle-weight .NET dev who was, not too long ago, working desperately to find my footing in all this:

1. I think the learning curve to doing good work with Node is really shallow at first, and then it quickly gets almost vertical.

2. I think that ALL of the other server-side language/framework combos (Ruby/Rails, Python/Django, C#/.NET, PHP/Symfony, etc.) make it significantly easier for a "merely-good" dev to make really good Web applications.

3. I think the kinds of devs that work at, say, Netflix are often the kinds of devs that can do amazing things with almost any dev stack, but that leads directly to my last point:

4. I think that most junior devs are making a tactical mistake with their growth, and with their careers, when they choose Node for their first forays into Web app development. The relative chaos and churn, and questionable suitability of Node for many-maybe-most use cases, make Node more trouble than it is worth for someone still struggling to make sense of the basics.

Re:After a year of using Node.js in production by kansface on Monday May 02, 2016 @10:53PM (#11617503)
> 2. I think that ALL of the other server-side language/framework combos (Ruby/Rails, Python/Django, C#/.NET, PHP/Symfony, etc.) make it significantly easier for a "merely-good" dev to make really good Web applications.

All of those frameworks are threaded/synchronous - they are maybe 10 times easier to use and potentially 100x slower (less concurrent) than Node. The ruby equivalent isn't rails, its eventmachine. Moving from django to twisted is probably just as hard as django to Node. 9/10s of the python ecosystem assume synchronous code so you end up with threads, processes, and callbacks.

Re:After a year of using Node.js in production by CJefferson on Tuesday May 03, 2016 @03:21AM (#11618589)
I haven't found the overhead of threaded frameworks to be anywhere close to that -- in practice it can be close to even, maybe 2x slower.

And a big advantage of threaded is that it is (obviously) easier to scale to multiple CPUs, and I don't have to worry about one connection taking more than a handful of milliseconds and jamming up my server.

Node is fine, but I feel many of the speed benefits come from V8 vs cpython, rather than threaded vs async

Re:After a year of using Node.js in production by forty on Tuesday May 03, 2016 @10:13AM (#11620833)
Surprisingly (to me at least) scaling single threaded code to multiple CPUs is actually very easy: just spawn the node process N times (using cluster, naught, pm2 or similar project) and that's it.
Re:After a year of using Node.js in production by ldehaan on Tuesday May 03, 2016 @04:02AM (#11618759)
seriously? rtfm. Node has supported multiple CPUs for Years, it's called cluster.
Re:After a year of using Node.js in production by anonyfox on Tuesday May 03, 2016 @02:16AM (#11618331)
Elixir/Phoenix, Go/, Rust/ ... should all outperform node.js easily, plus they're actually parallel and not just concurrent AND are much more solid languages to begin with.
Re:After a year of using Node.js in production by MichaelGG on Tuesday May 03, 2016 @03:52AM (#11618719)
But aren't all Node.js deploys fronted by a reverse proxy (like nginx) to multiple node processes? That gives them actual parallelism in practise, right?

Or is it remotely common to just have a single node process and never use more than one core?

Re:After a year of using Node.js in production by anonyfox on Tuesday May 03, 2016 @05:07AM (#11619014)
splitting the load through multiple node processes is fine for simple usecases and in general you're fine if you do mostly IO stuff.

But there are usecases that have to crunch numbers or do other CPU intensive algorithms that can be parallelized on the algorithm level. This is where node.js just falls apart. Additionally, if an algorithm requires quite much memory (multiple gigs), node.js performs very poorly.

Most companies that do actual CPU intensive work have services written in other languages to handle this, and "we're using node!" mostly means that they just serve results or do other IO-Tasks with node. But not the actual work.

Re:After a year of using Node.js in production by danneu on Wednesday May 04, 2016 @04:14AM (#11626936)
I reckon it's common for Heroku apps to be deployed as one process per dyno.
Re:After a year of using Node.js in production by zamalek on Tuesday May 03, 2016 @02:31AM (#11618383)
> All of those frameworks are threaded/synchronous

You're getting downvoted because some of those frameworks had generators (some specifically built for concurrency) before the concept of ES6.

Re:After a year of using Node.js in production by justabystander on Tuesday May 03, 2016 @03:16AM (#11618565)
> All of those frameworks are threaded/synchronous

"Threaded" and "synchronous" are orthogonal concepts that don't deserve being lumped together with a slash. They can have significantly different effects on performance depending on the scenario. C#/.NET isn't explicitly threaded (or single-threaded) or synchronous, and it's right in the middle of your list. It has more in common with Java than with the other three. Keep in mind that there are node packages for threads, too.

Node evangelists often don't seem to get that non-blocking behavior isn't a Node exclusive. You can do asynchronous non-blocking code with C#. You can do an event loop and play node all day long with any number of threads you want. It's not that opinionated about how you run your code. There is a lot of old code that is synchronous. All languages have significant amounts of old code hanging around that drags us down. But things like the TPL, async/await and IOCP can make C# code perform significantly faster than Node. And it's in the middle of a serious public overhaul.

Java and the JVM can do this as well. Java itself might be a bit behind on language features, but it tends to outperform the CLR (also uses more memory). And libraries like Netty and Vert.x are seriously impressive. You can do incredibly amazing things with the JVM, and it's been one of the leaders in performance among GC-ed environments for a long time. You've also got the option to use languages like Scala and Clojure on the JVM.

I'll give you that Node applications might outperform Ruby and Python apps when running on the default environments. But those also can run on separate runtimes which can significantly boost performance. And we're ignoring less common server languages like Erlang which are quite suitable for certain situations.

You should also note that Javascript (and node) performance will be a bit questionable for a while, anyway, as the recent ES6 support has introduced a lot of performance wrinkles (https://kpdecker.github.io/six-speed/) that will take a while to iron out. ES6 adds some really attractive features, so expect node performance to drop (albeit perhaps only temporarily) as your package dependencies start adopting ES6-isms.

Just as there are hundreds of people jumping on the Node train, there are hundreds jumping off. Javascript tends to prototype rather quickly, which has huge drawing power. The constantly shifting ecosystem and the weak tooling, among other things, can affect its staying power. Some people are leaving due to code maintainability, others are leaving because of performance concerns, others are leaving because of ecosystem things like left-pad. There's a lot of variables involved in choosing a language, Performance is only one of them and no languages is a silver bullet.

We can pick on other languages all day, but there's always something to make fun of about our own language/ecosystem. So let's let people pick the tools they want and maybe critically evangelize a lot less. If they pick something ill-suited to their requirements, they'll just have to switch later. It's a pain, but it's not the end of the world.

Re:After a year of using Node.js in production by romanovcode on Tuesday May 03, 2016 @04:10AM (#11618789)
They are probably 10x faster. You'd be surprised that Node is actually pretty slow by itself and only selling point is async which for the most part is not even used e.g. callbacks inside callbacks.

And if you leverage parallelism of those languages they become 100x faster since they can do multi-threaded processing unlike Node.

Re:After a year of using Node.js in production by paulddraper on Tuesday May 03, 2016 @12:52AM (#11617995)
Yeah, but is that really necessary? GitHub runs Rails and they have load.
Re:After a year of using Node.js in production by beders on Tuesday May 03, 2016 @01:48PM (#11622763)
It's all about cost.

If they would switch to more efficient languages, they could probably run on half of their current servers.

But there's the huge cost of rewriting something you already have. Will that affect your total cost significantly, if you can run on less servers.

I.e. it's too late to switch now. There needs to be a significant business reason to switch. "Stuff-that-kinda-works but needs more hardware thrown at it" is probably not a good reason.

Re:After a year of using Node.js in production by paulddraper on Wednesday May 04, 2016 @09:35PM (#11633345)
So ... "Nice but there's more important things"
Re:After a year of using Node.js in production by Const-me on Tuesday May 03, 2016 @05:35AM (#11619098)
C#/.NET isn't threaded. It was the first widely used language to feature async-await.
Re:After a year of using Node.js in production by pedalpete on Monday May 02, 2016 @07:39PM (#11616711)
I think the 'big application' bit is what challenges many people. From what I understand, Netflix is essential a huge group of micro-services, and I 'think' this is where Node.js shines.

What are your thoughts on that? When you're developing a service at Netflix, does it feel like you're building a single large application? Does the mentality of micro-services change how you approach code and therefore the validity of the original posts arguments?

Re:After a year of using Node.js in production by Scarbutt on Monday May 02, 2016 @08:48PM (#11617014)
He said they write services with the JVM, nodejs just for the frontend, at their scale I doubt they will change from the JVM to nodejs for services.
Re:After a year of using Node.js in production by ChrisAntaki on Monday May 02, 2016 @07:04PM (#11616471)
> There's always a multitude of ways to get something done, and it's up to you to decide what tool will do it best

Well said.

By the way, what is Netflix's take on Promises vs RxJS?

Re:After a year of using Node.js in production by tylerlh on Monday May 02, 2016 @08:15PM (#11616876)
One of the core tenets of the Netflix culture is "Freedom & Responsibility". In this context it means that each team is free to make calls like that as they see fit. Promises, Observables, Generators, Callbacks -- it's up to your team to determine what makes the most sense.

That said, we do make heavy use of Rx on the API layer (RxJava/RxGroovy). My team isn't currently using RxJs, but I expect that to change in the future. There are a lot of Observable fans here :)

Re:After a year of using Node.js in production by ZoeZoeBee on Monday May 02, 2016 @07:42PM (#11616729)
I'm pretty sure Netflix is in the Observables camp, as Ben Lesh over at Netflix is RxJs
Re:After a year of using Node.js in production by Akkuma on Monday May 02, 2016 @09:04PM (#11617087)
I watched one of the recent Netflix engineering videos where they moved to a customized version of React and I could have sworn in that talk they actually moved away from Observables[1]. What was confusing is that the other talked released at the same time they talk about enhancing RxJS.

[1]: https://youtu.be/5sETJs2_jwo?t=5m32s

Re:After a year of using Node.js in production by mikeryan on Monday May 02, 2016 @11:51PM (#11617780)
A friend of mine runs some UI engineering at Netflix from talking to him reactive JavaScript is still heavily used.
Re:After a year of using Node.js in production by Akkuma on Tuesday May 03, 2016 @12:49AM (#11617987)
I'm sure it is still heavily used, but it looks like there are two very opposing views with one going so far as completely removing it.
Re:After a year of using Node.js in production by zamalek on Tuesday May 03, 2016 @05:29AM (#11619077)
> By the way, what is Netflix's take on Promises vs RxJS?

We've been doing tons of research into the Netflix methodology and teams are highly compartmentalized (albeit communicate richly). This means that when you ask "What do you do at Netflix?" you should really be asking "What does team X do at Netflix?" or "Does any team at Netflix do X?"

For instance, unless things have changed or I have the story wrong, JVM is used for the streaming because that's the tool which that team chose. The other teams merely communicate with it over an API (regardless of client language).

Re:After a year of using Node.js in production by MichaelGG on Tuesday May 03, 2016 @03:50AM (#11618710)
How big is the Netflix webapp, though? There's what, 5 or 6 main content "views", then around 20 user-editable forms? Plus the help site. Am I viewing this incorrectly? It doesn't just doesn't feel like Netflix is a large app from the UI perspective - maybe that's just good design.

Hope this doesn't come off as "I could do this in a weekend", just questioning how big the actual webapp is.

Re:After a year of using Node.js in production by tylerlh on Wednesday May 04, 2016 @10:43PM (#11633645)
I believe you would be surprised were you to look under the hood.

There are a number of different "UI areas" in Netflix.com -- homepage, titles, signup (multiple flavors of this, depending on how you're signing up), onboarding, member browsing/viewing experiences, account management, numerous partner integrations, etc... not to mention all the work that goes into per-user customization, AB testing, and internationalization.

No offense taken on the question. IMO, if you look at the site and view it as simple then we've done our job correctly. :)

Re:After a year of using Node.js in production by lenkite on Wednesday May 04, 2016 @12:20PM (#11629423)
If I am not wrong, Netflix folks make heavy use of 'stream based programming' using RxJs. This greatly simplifies a lot of the standard problems faced in JS - like callback hell and error handling, if one adopts it consistently across the stack. Not many folks have discovered this as yet.