[Solved] module development with blocking I/O

Added by kf over 10 years ago


I was inspired by and hoped to use mod_magnet to run a LUA script that connects to a database, but after reading the warning on the mod_magnet doc site i gave up this idear.

It seems the "correct" solution is to use mod_fastcgi to connect to PHP and have this external process run the blocking database access. Sadly PHP is not an option for me.

I am considering writing my own plugin and doing the database I/O in the C code. But before starting, I wanted to check in with you: is the blocking call issue specific to mod_magnet or will all modules cause new incomming requests to hang if the mod is slow?


Replies (2)

RE: module development with blocking I/O - Added by nitrox over 10 years ago

They all block, use fastcgi with the language of your liking.

RE: module development with blocking I/O - Added by stbuehler over 10 years ago

It is - theoretically - possible to write your own async modules, but you'd probably have to write your own database connection code.

As you had to ask I agree with nitrox: use fastcgi (writing async stuff requires a deeper understanding, and writing async lighttpd modules is hard).