r/javascript • • Aug 11 '15

Netflix.com Adopts Universal JavaScript, Drops Java From Rendering Pipeline

http://www.infoq.com/news/2015/08/netflix-universal-javascript
482 Upvotes

115 comments sorted by

View all comments

25

u/freebit Aug 11 '15

I think the biggest news here is the dropping of Java in a company that was plum full of Java developers.

25

u/awj Aug 11 '15

They dropped it from the server rendering of their frontend website. No mention of anything else. That part is the tip of the Netflix iceberg, I'm sure there's still boatloads of Java making the service happen.

2

u/clarle Aug 12 '15

Many of the rest of Netflix's services are still in Java, but a lot of those services are also open-sourced and very solid.

The Node.js apps communicate with the JVM-based libraries over HTTP through Prana, which is also open-sourced.

The Netflix GitHub organization has the rest of them, as well as a lot of the tools built on AWS that are being used in production today, so definitely check them out!

0

u/[deleted] Aug 11 '15

[deleted]

6

u/[deleted] Aug 11 '15

Yeah but I would guess their back end are Java-based web services.

11

u/stormcrowsx Aug 11 '15 edited Aug 11 '15

From the sounds of it they only dropped it from the rendering line. Most of the people who worked in rendering probably knew Javascript as good or better than Java. So it makes a lot of sense for everything rendering to be in Javascript.

Their backend api's and services are probably mostly Java and it wouldn't make much sense to go about rewriting all of that to Javascript.

4

u/fooey Aug 11 '15

If you haven't read their culture slide deck, it's worse than you think.

NetFlix is really mercenary about their employees. They pay top dollar, but there's very little loyalty expected in either direction.

7

u/dsk Aug 11 '15 edited Aug 11 '15

Did they actually drop it or did they drop it from rendering HTML but kept the service APIs Java-based? Because if they did the former, that would be idiotic. The latter makes a ton of sense.

2

u/novagenesis Aug 11 '15

Can I ask why? Our APIs are all in node.js right now and they have scaled fantastically.

Is it just "it wasn't broken, we don't fix it"? I'm assuming whatever they changed was "not good enough".

12

u/stormcrowsx Aug 11 '15

I would think the "it wasn't broken, don't fix it" would apply here.

The list of issues I can think of with moving it all to Javascript: You'd have to retrain all the Java devs to Javascript, you'd move a massive codebase to a language without static type checking (done wrong this is a disaster waiting to happen), and performance wise Javascript isn't going to beat Java by any significant numbers.

None of the cons I list above affect the rendering/frontend side because most Java devs on the front know javascript, rendering HTML in Java is not static type checked typically, and its not crazy fast.

7

u/jimbobhickville Aug 11 '15

Javascript is very limiting for writing backend services like APIs, even with everything available from NPM. You hit one blocking call, you're done. I generally dislike Java, but it makes a lot more sense for those things than Javascript does. It's not just an "it isn't broken", it's a better tool for the job.

3

u/way2know Aug 12 '15

You hit one blocking call, you're done.

Why would you hit a blocking call if you're writing proper async JavaScript code?

→ More replies (1)

5

u/fooey Aug 11 '15

If you write blocking code in JS you're doing it wrong.

If you're running Node, it's expected that absolutely everything is done async.

→ More replies (1)

2

u/Calabri Aug 11 '15

I think there's a few layers to the system. Nodejs is perfectly fine as a frontend API - and you can put node in front of Java, but I would assume 90% of the data is cached, and if it's not cached then the node server would probably outsource the task, and that would prevent blocking.

2

u/novagenesis Aug 11 '15

I've noticed no such issues. Most of our calls are handled by the db, not the app. We're using two servers and have incredible load tests. We had plans to 5+5 cluster against our load balancer for scale, and discovered no need.

We calculated our product would scale 5x again before we bottleneck on the app itself with these two threads , at which point we would already have clustered mysql servers. You have to be smart with your code using node, but then the scale comes incredibly easy

The answer to a for loop issue for us was just to add bluebird into the mix. We scale with less work than the company's scala apps

4

u/juhmayfay Aug 12 '15

It's also extremely important to realize the use cases. For simple db operations, sure, node scales well. But if you need to start doing heavy processing before or after your db calls then java will destroy node.

3

u/novagenesis Aug 12 '15

I used to drink that same Kool Aid. "Node's great for I/O, but choose something else for everything else".

Two thoughts on that. First, people are as likely to choose Python as Java for heavy math... While node's math libraries aren't mature, it tends to crush python by orders of magnitudes with apple-to-apple calculations.

But yeah, Java's still faster than node for heavy stuff... But I think there's more caveats than people realize here.

You're not going to make your heavy duty operation as a POJO and start hitting it a million times per minute. Just because node.js gives you great I/O scale for free, doesn't mean there's a bad ROI on careful scale for math.

As I said before, for loops and recursion, you can async them to disable blocking (works for heavy operations as much as it does for database operations).

If it's one massive calculation, instead of millions of big calculations, you have to add a service infrastructure... but you have to setup a JBoss server or the equivalent to handle that scale in Java in a real world scenario.

Maybe Java has higher ROI for big-math scale, but I've discovered the profitable way that it's not nearly as bad for node as the stereotype claims. You're talking a 2-3x, not 2-3 orders of magnitude.

I'm not saying Java is not worth it. There's times when 2-3x is worth the greater programmer-share and greater maintenance. There's also the paradigm shift to node. Some problems don't breakdown well in terms of defers and events. They need to be mapped. Alternatively, some problems don't breakdown well in terms of objects. We're just more trained to normalize to OO more than other paradigms.

I've yet to find a problem that can't be solved in node and can't scale in node. I have often found problems that require rethinking in node.

→ More replies (2)
→ More replies (1)

2

u/[deleted] Aug 11 '15

Why fix something that isn't broken? Especially since there is a lot of big data stuff for Java. The cost to retrain/rehire/rewrite the back end in JavaScript is pretty high.

→ More replies (1)
→ More replies (3)

5

u/FricoSuave Aug 11 '15

So now they have to learn Script, big deal.

3

u/[deleted] Aug 11 '15

Javascript isn't the same as Java?

/s

5

u/xXxdethl0rdxXx Aug 11 '15

Tell that to a good half of the recruiter spam I get.

→ More replies (4)
→ More replies (4)