Module molly.thread_fiber
Module with implementation of threads based on fibers.
Fibers are a unique Tarantool feature - 'green' threads or coroutines that run independently of operating system threads. Fibers nicely illustrate Tarantool's theoretical grounding in the actor model, which is based on the concept of a number of light processes that cooperatively multitask and communicate with one another through messaging. An advantageous feature of Tarantool fibers is that they include local storage.
Tarantool is programmed using Lua, which has its own coroutines, but due to the way that fibers interface with Tarantool's asynchronous event loop, it is better to use fibers rather than Lua coroutines. Fibers work well with all of the non-blocking I/O that is built into Tarantool's application server and fibers yield implicitly to other fibers, whereas this logic would have to be added for coroutines.
References
- Tarantool Documentation: Module fiber
- Tarantool Documentation: Transaction Control
- Tarantool Internals: Fibers
- Separate roles of fibers that do network I/O and execute requests
- When to use fibers and when to use co-routines in Tarantool?