4 ms·
Threads are more difficult than writing event-loop based code IMO
by dharbin 13y ago
Threads are more difficult than writing event-loop based code IMO
- EGreg 13y agoNot just more difficult. Threads are really wasteful to spawn just so you can hit 10 shards. Even if you have a thread pool. Evented I/O is much better than threads. When NGiNX launched, it was the evented web server in a sea of threaded servers. Guess which paradigm won.
- bascule 13y agoIt's not a dichotomy. The answer is that both models are useful, and most systems support hybrid threaded and evented modes. Node.js only supports one model, which is a huge drawback.
- pswenson 13y agothreads don't have to be more difficult. check out actors. Meteor seems to think threads are the way to go (Fibers)