[Python-Dev] Python startup time - daemon
On Fri, May 11, 2018 at 07:38:05AM -0700, Chris Barker - NOAA Federal via Python-Dev <python-dev at python.org> wrote:
> Could one make a little startup utility that, when invoked the first
> time, starts up a raw python interpreter, keeps it running somewhere,
> and then forks it to run the actual python code.
> Then every invocation after that would make a new fork.
Used to be implemented (and discussed in this list) many times. Just
a few examples:
Proven to be hard and never gain any traction.
a) you don't want the daemon to import all possible modules so you need
to run a separate copy of the daemon for every Python version, every
user and every client program;
b) you need to find "your" daemon - using TCP? unix sockets? named pipes?
b) need to redirect stdio to/from the daemon;
c) need to redirect signals and exceptions;
d) have problems with elevated privileges (how do you elevate the daemon
if the client was started with `sudo -H`?);
e) not portable (there is a popular GUI that cannot fork).
> Sent from my iPhone
Oleg Broytman http://phdru.name/ phd at phdru.name
Programmers don't die, they just GOSUB without RETURN.