Flattening Recursion with Fibers

December 13, 2024 30 min Free

Description

We used Ruby's fibers at MongoDB to unwind a recursive algorithm and execute it horizontally, without the stack overhead of recursion. In this presentation, we'll summarize the problem encountered while working with recursive callbacks, and give an overview of fibers in Ruby. Then, we'll put the two together and show you exactly how we ended up using fibers to solve an issue that was completely unrelated to concurrency.