Event loop for large files?

前端 未结 2 1173
我在风中等你
我在风中等你 2020-12-28 11:18

If I\'m not mistaken, I remember the \"event loop\" model of asynchronous I/O (Node.js, Nginx) not being well-suited for the sake of serving large files.

Is this t

2条回答
  •  旧时难觅i
    2020-12-28 11:50

    If I'm not mistaken, I remember the "event loop" model of asynchronous I/O (Node.js, Nginx) not being well-suited for the sake of serving large files.

    I think you stand correct that node.js is not optimized for serving big files. I advice you to have a look at Ryan Dahl's slides. Especially

    Slide 14

    Wow. Node sucks at serving large files. Well over 3 second responses for 256 kilobyte files at 300 concurrent connections.

    Slide 15

    What’s happening: V8 has a generational garbage collector. Moves objects around randomly. Node can’t get a pointer to raw string data to write to socket.

    Slide 21

    But the fact remains, pushing large strings to socket is slow.

    Hopefully this can be mitigated in the future.

    are interesting. Maybe this has changed, but I think it would probably be better to use NGinx to serve your static files(or maybe a CDN). I think you are misinformed that NGinx is bad at serving large files. Node.js is(was) a bad at this because of V8 garbage collection, not because of event-loop. Also this link might be interesting.

提交回复
热议问题