Issues related to overhead and response times are ongoing concerns for many products. Evlua is an innovative Lua-based solution designed to address these issues using event-driven I/O handling in a multi-threaded architecture.
Traditional systems often rely on blocking I/O, which presents several operational challenges. The result is a significant trade-off between maintaining open connections and managing system resources effectively.
Setting up connections, including the TCP 3-way handshake and TLS session setup, can be resource-intensive when performed repeatedly.
Synchronous app servers typically allocate one worker thread per connection, leading to increased overhead as the number of connections grows.
To support numerous clients, systems often need to implement strategies for closing connections after a set number of requests or time period, potentially impacting performance.
Evlua addresses these challenges by implementing event-driven I/O handling for both network and file-based operations. This approach enables systems to maintain open connections with reduced overhead, potentially leading to improved average response times for server requests.
Event processing for optimized polling and event handling on the server side.
Implementation of a fixed number of worker threads, typically matching the number of server cores or a small multiple thereof.
Adoption of client request-level multiplexing, ensuring more equitable distribution of server resources across all client requests.
While existing solutions offer certain benefits, they also have limitations. Evlua aims to provide the advantages of an event-driven, multi-threaded system within an interpreted environment, addressing these limitations.
Many existing solutions operate on a single-threaded event loop, requiring multiple processes to fully use machine capacity.
Many event-driven platforms require developers to manage asynchronous events using platform-specific constructs, potentially increasing code complexity.
Golang addresses these issues, however Evlua operates on a scripted/interpreted environment, bringing its own benefits.
Three technical innovations that we have brought in through Evlua to address the challenges above.
A file I/O approach specifically designed for server program requirements. ef_read returns data synchronously when it is available in the buffer, and asynchronously with a callback when data is not available, allowing for efficient thread management. ef_write is implemented as a non-blocking operation, enabling immediate data copying to a buffer with asynchronous disk transfer.
evpoco is one of the main components of Evlua, providing a multi-threaded TCP server. Forked from POCO, the evpoco controller threads schedule either new tasks or those for which IO has been completed on the wait queue. The worker threads pick up the tasks ready for execution and process them.
A Lua library used in conjunction with evpoco, providing APIs that make application development easy. All of it runs in an asynchronous, event-driven manner, while the application programmer gets a uniform simple interface without promises or callbacks.
Evlua is an open-source, Lua-based platform from Tekenlight for large-scale multi-user systems. It uses event-driven I/O handling for network and file operations in a multi-threaded architecture, which lets systems keep connections open with reduced overhead.
Many event-driven platforms run a single-threaded event loop and need multiple processes to use a whole machine. Evlua runs a fixed number of worker threads, typically matching the number of server cores or a small multiple of it.
No. The work runs asynchronously underneath through evpoco, while application programmers get a uniform, simple interface without promises or callbacks.
evpoco is the multi-threaded TCP server at the core of Evlua, forked from POCO. Controller threads schedule new tasks and tasks whose I/O has completed, and worker threads pick up and process the tasks that are ready.
Evlua is available from Tekenlight on GitHub at github.com/Tekenlight.