News for hackers. Stuff that matters.
Re:Case Study: Npm uses Rust for its CPU-bound bottlenecks [... by Filligree on Sunday March 03, 2019 @01:26PM (#19295916)
Lots of users. Anything will be CPU-heavy if you give it enough work.

Except the things that end up being memory-bound instead, but the NPM database isn't large enough for that.

Re:Case Study: Npm uses Rust for its CPU-bound bottlenecks [... by Dylan16807 on Sunday March 03, 2019 @02:29PM (#19296300)
> Anything will be CPU-heavy if you give it enough work.

Not in a relative sense. If authorization is 5% of the work, scaling it leaves it at 5% of the work, and it's never a bottleneck. Authorization was being a significant bottleneck, not a tiny percent, and that is somewhat surprising.

Re:Case Study: Npm uses Rust for its CPU-bound bottlenecks [... by andy_ppp on Sunday March 03, 2019 @03:10PM (#19296524)
Obviously authorisation will be a huge overhead compared to sendfile + nginx right? Am I misunderstanding what npm does?
Re:Case Study: Npm uses Rust for its CPU-bound bottlenecks [... by Dylan16807 on Sunday March 03, 2019 @05:34PM (#19297378)
I mean, to use sendfile you need to open the file, and that does a permission check too...
Re:Case Study: Npm uses Rust for its CPU-bound bottlenecks [... by andy_ppp on Sunday March 03, 2019 @09:54PM (#19298444)
No I'm talking about private NPM right. The perms on the file system are not equal to (or as costly as) the auth I need to have to access my private NPM repo.
Re:Case Study: Npm uses Rust for its CPU-bound bottlenecks [... by yawaramin on Sunday March 03, 2019 @03:39PM (#19296701)
Couldn't you implement the authorization logic in, say, Redis? Then the npm service is I/O-bound again, and everyone is doing the job they're optimized for.
Re:Case Study: Npm uses Rust for its CPU-bound bottlenecks [... by Filligree on Monday March 04, 2019 @09:10AM (#19301319)
Authorization checks aren't that expensive. The overhead of using an external service might well make it take up more hardware overall.