How Mummy's threading model works
masterMummy uses a hybrid model to maximize performance without the complexity of {.async.}:
- Socket IO Thread: A single thread handles all multiplexed socket IO.
- Worker Pool: Incoming HTTP requests and WebSocket events are dispatched to a pool of worker threads.
Key Benefits for Developers:
- No Async/Await: You do not need to use
{.async.},Future[], orawait. Your code remains synchronous and easy to read. - Blocking is Safe: Because requests are dispatched to worker threads, you can perform blocking operations (like database queries or file reads) inside your handlers without stalling the entire server.
- Simpler Error Handling: Use standard
try...exceptblocks. Uncaught exceptions in handlers will not crash the entire server. - Thread Safety: Mummy handles the threading and dispatching, so most request handlers do not need to manage threads manually.