-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kiwix-serve: support passing socket as stdin (inetd-style) #610
Comments
@rgaudin @mgautierfr @veloman-yunkan You validate the feature request? |
It seems good to me. |
Thanks for the link ; I've recently experimented with this and found it under-documented and somewhat difficult. The main question would be which mode(s) to support: single server that gets instantiated on first request or per-connection instances. From my limited understanding of how libkiwix works, per-connection instances would be terrible. I had difficulties with the Singleton mode (couldn't get a hold on the initial request) but I wasn't ready to invest much time in this and relied on third parties. I believe apache has a module that allows this so it might be a useful implementation sample. |
Generally a (modern) daemon does the multiplexing, so that initialization only happens once. This corresponds to |
If I think that my response somewhat repeats @rgaudin's comment above yet I thought that the concern better be stated straightforwardly. |
That the format spec is free to be painted on the walls does not change the vendor lock-in effects if I can't access zim with favorite third-party tools; or I must use a web server that parses downloaded material, but also requires network access; or have to wait ages because compliance with the big redistributors is not a top priority (no LTS branch for Debian, app non-freeness caused by non-free build deps for F-droid) . So the very general context is adhering to proven, widespread, basic design patterns and integrating into the free software community / ecosystem, in favor of the technical or privacy-minded WMF projects user. This specific feature request just changes where kiwix takes the socket from. Everyone says so far that it's better that kiwix makes connections from a socket ("single server that gets instantiated on first request" from above). A daemon can take a socket and forget where it's taken from, then make connections from it, regardless of how it was constructed. I've amended the title to remove the reference to stdout. |
There is few different things in your last comment.
This sound like a rant because we don't do enough. Guest what, this is free software. You can do more than open issue, pull request are welcomed. We are a really small team, not working fulltime on kiwix. We do the best we can do depending on our priorities and our capacities (we are the "only" ones to know the code where a lot of people can do the packaging).
Here I agree with you. We are just discussing the feature to properly understand it and implement it the correct way. |
@rgaudin,
This is a valid question but it is a question for the administrator, not us. Administrator just have to configure the service correctly to use the "instantiate of first request" mode if they want something efficient.
@veloman-yunkan The idea is that systemd passes us the INET socket so we have to use it instead of binding to The patch to cups (given in blog's article) http://0pointer.de/public/cups-patch-core.txt show us how we can get the socket from the fd. |
Sorry for the tone. You do too much already.; It's just the mentioned lack of integration. |
@opk12 Thank you for opening this issue. We all agree that this would be a good ticket to implement. I will work to integrate it in a future milestone, but for now it does not belong to the top priorities. So, you will need a bit of patience ;) |
FWIW, looks like you can approximate direct socket activation like this:
I don't think it's quite perfect because sometimes it appears it tries to forward the connection before kiwix-serve has finished initializing, but it comes fairly close. Native support would be great but this looks like a reasonable stop-gap! |
Traditionally on *nix, a service manager spawns the daemon and duplicates the socket to its standard input and standard output. The socket can even be AF_UNIX, bridged to the network interface by the service manager.
This approach is common nowadays (and supported by systemd), but it's called
inetd
-style because of historical reasons. More info at systemd "Converting inetd services".Why it's better than binding to the network interface directly:
The text was updated successfully, but these errors were encountered: