Closed richardhundt closed 12 years ago
Adding evq.on_idle() callback function was wrong way. I've to remove it and find the way to improve performance of coroutine tasks.
Now callback based echosrvr.lua is much faster than echosrvr_co.lua. And adding on_idle() was bad workaround to avoid threading overheads.
I think to run coroutines (tasks) as callbacks on event-queue and somehow migrate them to scheduler automatically on blocking calls...
Fixed in tnodir/luasys@3f21c5d6018b5f3356c71ed3a7f8c6f3cff8014b
Hi Nodir,
I think luasys needs to have an idle task more than an idle event. You basically want to finish running your all active tasks before servicing I/O.
The echosrvr_co.lua test shows this issue. You only call the scheduler when the event loop is idle. A server under load would starve tasks which are created to process the data. I think this is the wrong way. Instead you want to call the event loop when the scheduler is idle.
What do you think?
Cheers, Richard