tipidee + nph + long-lived connection

From: Mario Rugiero <mrugiero_at_gmail.com>
Date: Sat, 31 May 2025 13:56:47 -0300

Hello. I wanted to discuss a problem I think is interesting and get feedback on ideas to deal with it.

When using tipidee with some CGI programs that transfer potentially big amounts of data (in this
case, a synchronization service I'm writing for TaskWarrior), it is desirable to use `sendfile` to reduce
both memory and copying overhead. This is, to the best of my knowledge, only viable with NPH
scripts, as regular CGI always needs to load the script's response into the web server's memory.

OTOH, because tipidee will `exec` into the NPH script, when the script finishes running we'll lose
the open connection (one could think of persisting the NPH script itself, but then it will need to know
how to parse HTTP and handle incoming requests and at that point it no longer makes sense have
a web server and an NPH script). While this might seem minor, establishing an HTTPS connection
may very well be a significant overhead compared to the operation itself.

I've been trying to think of strategies to deal with this:
- The most straightforward one is just to pick which source of overhead I prefer and live with it. Easy,
but no fun at all.
- Duct tape something with s6-fdholder, but I'm not sure how I would react to new activity on the fd.
- The most interesting one I could come up with is `exec`'ing into tipidee after sending the response.
I think that one might be viable, but I'm not 100% sure.

Any input would be appreciated.

Cheers,
Mario.
Received on Sat May 31 2025 - 18:56:47 CEST

This archive was generated by hypermail 2.4.0 : Sat May 31 2025 - 18:57:47 CEST