Meteor internals: how does fibers work?


Meteor makes heavy use of fibers with each clients requests running in a separate fiber, but what does this actually do?

From reading around the advantage of fibers seems to be that they let you write asynchronous code in a synchronous manner. Is that all they do?

Also, how does this.unblock() work in methods? The docs say: ‘In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node.’

How does fibers mimic threads, while not actually being a thread? If a Meteor method performs a long computation, how does it not block the event loop?


No responses here, but an SO user has some harsh words about the docs. Any truth to what he says?

AFAIK this line in the Meteor docs is pure bull poop. Meteor is single-threaded natively, what they mean by “thread” is instead a “Fiber”. I am afraid explaining the whole concept of Fibers is a bit too much for a StackOverflow question.