Parallel Processing Within Components
IguanaX components operate on a single thread or within a single Lua instance. This means that when a message is received by a component, it must complete the full execution of the main()
function before the next message can be processed.
For workflows that require handling multiple simultaneous tasks, such as a multi-threaded web server managing concurrent connections, parallel processing is a powerful technique to improve efficiency and scalability. This approach is only suitable for when the order in which messages are processed is not important.
In IguanaX, parallel processing within components is achieved using the component.clone
method to create multiple Lua instances (or threads) for processing. Messages can then be distributed across these threads with component.call
, which invokes the main()
function of the processing component and passes the data to be processed. Each thread processes messages independently, allowing for faster performance in high-throughput scenarios.
For an example use case, refer to the Web Service Multithread component.
Â