concurrency-benchmarks icon indicating copy to clipboard operation
concurrency-benchmarks copied to clipboard

Use a better algorithm in async jsws using streams

Open kranfix opened this issue 3 years ago • 1 comments

Here there is an example to implement the async web server in JS. https://nodejs.org/en/knowledge/advanced/streams/how-to-use-fs-create-read-stream/

Currently, the server works this way with promises only:

file: aaaAAAAaaaAAaaaa
res: --------------------bbbBBBBbbbBBbbbb

But, it would be better this way with steam:

file: aaaAAAAaaaAAaaaa
res: ---bbbBBBBbbbBBbbbb

The same idea can be applied to Rust, for example.

kranfix avatar Feb 06 '22 22:02 kranfix

I tried this but on benchmarks, the req/second goes down with this

deepu105 avatar Feb 08 '22 09:02 deepu105