Live data from Hacker News

Case Study: Npm uses Rust for its CPU-bound bottlenecks [pdf]

rust-lang.org

21–30 of 307 posts

Re: Case Study: Npm uses Rust for its CPU-bound bottlenecks [pdf]

#21
post #5

Title could be improved, as I was wondering if the command line tool npm had itself been rewritten. It’s actually one of npm’s web services that was rewritten. FTA: “Java was excluded from consideration because of the requirement of deploying the JVM and associated libraries along with any program to their production servers. This was an amount of operational complexity and resource overhead that was as undesirable a…

I just unpack JDK, I have no idea what so complex about it. It was complex on Windows because I used VM to install Java and then copy folder, but they made it easier with 11.

Re: Case Study: Npm uses Rust for its CPU-bound bottlenecks [pdf]

#23

This entire article is a pretty damning report on JavaScript in general, but this sentence takes the cake (emphasis mine): > The process of deploying the new Rust service was straight-forward, and soon they were able to forget about the Rust service because it caused so few operational issues. At npm, the usual experience of deploying a JavaScript service to production was that the service would need extensive monito…

They also state that writing the service in Node took them an hour, two days for Go, and a week for Rust. Even taking into account their unfamiliarity with the language, it's probably fair to say that when switching to Rust, you'll usually spend more time writing and less time debugging. Whether that trade-off is worth it depends on the project.

Re: Case Study: Npm uses Rust for its CPU-bound bottlenecks [pdf]

#24
post #8
post #5

Title could be improved, as I was wondering if the command line tool npm had itself been rewritten. It’s actually one of npm’s web services that was rewritten. FTA: “Java was excluded from consideration because of the requirement of deploying the JVM and associated libraries along with any program to their production servers. This was an amount of operational complexity and resource overhead that was as undesirable a…

JVM tuning (especially the GC and memory allocation scaling) can be a huge PITA.

But having options is always good, isn't the same with compiled languages? you keep the defaults options but if you want extra performance you try different compiler flags or different compiler if the language has more then one.

Re: Case Study: Npm uses Rust for its CPU-bound bottlenecks [pdf]

#25

> ““Java was excluded from consideration because of the requirement of deploying the JVM and associated libraries along with any program to their production servers. This was an amount of operational complexity and resource overhead that was as undesirable as the unsafety of C or C++.” To me this reads like someone has a chip on their shoulder to demand that Rust be viewed as generally superior instead of merely bein…

Well, this is a PR piece about Rust, hosted at rust-lang.org. What did you expect?

Re: Case Study: Npm uses Rust for its CPU-bound bottlenecks [pdf]

#27

> ““Java was excluded from consideration because of the requirement of deploying the JVM and associated libraries along with any program to their production servers. This was an amount of operational complexity and resource overhead that was as undesirable as the unsafety of C or C++.” To me this reads like someone has a chip on their shoulder to demand that Rust be viewed as generally superior instead of merely bein…

Well, this is a PR piece about Rust, hosted at rust-lang.org. What did you expect?

Grown up discussion that modulates excitement over the pros with candid explanation of the cons and respect for alternatives.

Re: Case Study: Npm uses Rust for its CPU-bound bottlenecks [pdf]

#28
post #5

Title could be improved, as I was wondering if the command line tool npm had itself been rewritten. It’s actually one of npm’s web services that was rewritten. FTA: “Java was excluded from consideration because of the requirement of deploying the JVM and associated libraries along with any program to their production servers. This was an amount of operational complexity and resource overhead that was as undesirable a…

I just unpack JDK, I have no idea what so complex about it. It was complex on Windows because I used VM to install Java and then copy folder, but they made it easier with 11.

One example might be that if you unpacked the Oracle JDK, you owe Oracle a non-trivial amount of money now.

Re: Case Study: Npm uses Rust for its CPU-bound bottlenecks [pdf]

#29

> ““Java was excluded from consideration because of the requirement of deploying the JVM and associated libraries along with any program to their production servers. This was an amount of operational complexity and resource overhead that was as undesirable as the unsafety of C or C++.” To me this reads like someone has a chip on their shoulder to demand that Rust be viewed as generally superior instead of merely bein…

Nothing in the article says no one should consider Java, just that they rejected it.

You know nothing about their team expertise (probably very little Java background) and their deployment setup.

The concerns are perfectly valid in my opionion:

* JVM brings an increase in deployment complexity (version upgrades, etc)

* Deploying a high-volume Java application requires experience and usually also tuning of the VM parameters, which also means trial + error and a increased monitoring burden for the ops team

* Java is a old language with plenty of quirks and oddities, which is fine if you work with it a lot, but a consideration if you want to bring it in as a new stack

Personally, I also always reach for Go or Rust first because of the mentioned benefits:

- single, static binary means trivial deployment

- performance and memory usage is pretty predictable, often good enough without much adaptation, and requires no parameter tuning

Re: Case Study: Npm uses Rust for its CPU-bound bottlenecks [pdf]

#30
post #2

A better title would be the subtitle of the article: "The npm Registry uses Rust for its CPU-bound bottlenecks". Note that only one service (authentication) was rewritten from node to Rust.

That’s what I titled it when I submitted it after we first published this.

There’s also a second service we know about in Rust, and that’s the one that renders package README pages.

Post reply on HN