Quantcast
Viewing all articles
Browse latest Browse all 4737

Lua tasks and blocking IO, okay?

Hello everyone,

I had a quick question about blocking system calls while writing Lua code to expand HAproxy functionality. From https://raw.githubusercontent.com/haproxy/haproxy/master/doc/lua.txt, I’ve been reading that it is discouraged to use io.*` calls as they’re blocking in nature, so I understand that when those blocking operations are happening, HAproxy thread will not be able to process other HTTP requests.

It definitely makes sense if they are done in lua service/actions etc, however, does that hold true for tasks as well?

From the doc,

The task does not have a timeout because it runs in the background along the HAProxy process life.

It seems that tasks are run in the background, and are different from the HAProxy process. So, is it okay to use io.* calls in task ? For example, is this a valid use-case of updating ACLs as it depends on reading files in tasks? haproxy-lua-examples/background_thread.lua at f5853013087642c0ed34ed47bea4c6efbf96dd29 · zareenc/haproxy-lua-examples · GitHub .

What if the disk operations are momentarily slow, will it block actual HTTP requests? Thank you in advance!

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>