3 ms·
From the paper it appears to be an authorization service that decides what rights a particular user has. Not a webserver or CDN. It mentions it being CPU bound
by tyingq 8y ago
From the paper it appears to be an authorization service that decides what rights a particular user has. Not a webserver or CDN. It mentions it being CPU bound, though it isn't clear to me why it would be, or why JS wouldn't work well enough for that.
- Outpox 8y agoWell I'd say that if it's an authorization service there will be cryptographic calculation which is "heavy" on the CPU.
- tyingq 8y agoI don't think that's what it does. "the authorization service that determines whether a user is allowed to, say, publish a particular package" Also, I would assume any crypto in v8 is already written in C, with JS calling into it.
- throwaway66666 8y agoUsers who suggest cryptography are getting downvoted (myself included). I am curious as to why. Is it perceived as spam or an attack on nodejs? Encrypted cookies and JWT (json web tokens) rely on a similar strategy so this is pretty standard. It would be pretty secure as long as the encryption key is not unique, so definitely not criticism on the NPM team but mere theories as to why a (what one would assume is a) database or memory bottle-neck is being presented as a CPU bottleneck in this scenario.
- Quenty 8y agoThe paper makes it clear they were evaluating languages based upon efficiency. The rust implementation was more efficient than the JS one. A CPU bound service of course is bottlenecked at the CPU, and this benefits from efficiency. At scale, it makes sense to replace this with Rust. Javascript did the job, but did not provide the same efficiency as Rust.
- tyingq 8y agoI'm not clear on why this is particularly CPU heavy, though: "the authorization service that determines whether a user is allowed to, say, publish a particular package"
- Filligree 8y agoLots 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.
- Dylan16807 8y ago> 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.
- andy_ppp 8y agoObviously authorisation will be a huge overhead compared to sendfile + nginx right? Am I misunderstanding what npm does?
- Dylan16807 8y agoI mean, to use sendfile you need to open the file, and that does a permission check too...
- andy_ppp 8y agoNo 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.
- 8y ago