|
Aha, I take back some of what I said. ChangeLog is not big enough, that's all. When running with a 16MB file, there's some more CPU spiking, but only if it's served as a single write. Investigating further, I found that there's a bug in my gists, and I'm testing res.url instead of req.url, so I was making all the exact same mistakes in your test! Hah! With this test, we see it spike up to 10% for a big string, but a big buffer still stays well below 1%. https://gist.github.com/2339010 I did it in coffeescript to just rule that out as a possible source of work. The moral of the story is that Buffer<->string conversion is WAY too expensive in Node, and leads to situations where the easy approach leads to poor performance. That's a problem. Thankfully, it's one we already are aware of, and plan to fix, and it's easy to work around by just using a buffer rather than doing extra conversions. |
thanks for responding, it's nice of you to acknowledge it as a bug, and say you're working on it.
> First of all, writing bug reports to Hacker News is usually a bit like complaining about the government at a bus stop.
just a little note on this one, i've made clear in my original writing this is not hate and i sent an email to substack, and ryan to some others i know. i guess i will send you an email next time as well.
not filing as a bug: you are right, i should have done that.
Buffer<->string conversion is WAY too expensive in Node: yes it is, hope you can make this way better, because we don't want to hit cpu each time we pull data from a e.g. database.
writing it to hackernews/stackoverflow: it's because i'm asking for solutions outside of nodejs domain, varnish,nginx or any other way this issue can be worked around. i'm sure you understand. and this was quite helpful as we're now deploying a few varnish and nginx servers to mitigate this problem.