Hirevo / persist

A fast and simple asynchronous process manager.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Persist home management

CedricThomas opened this issue · comments

It would be really interesting to be able to manage several projects with a single persistence daemon and to manage them individually.

I thought a bit more about this, and I think that an interesting possible design to explore could be one similar to git.

The idea would be to have the persist cli to recursively search for a .persist directory within the current directory and all of its parents and connect to its controlling daemon.

This would remove the need for the PERSIST_HOME environment variable, and maybe we could add a persist init or something to ease creation of a new daemon and its .persist folder for the current directory.

This would still be a multiple-daemon design, though.
I am not sure about having a single daemon for all projects, I am a bit worried about the number of simultaneously open file descriptors growing too big.

Spawning a process currently causes the daemon to open 4 file descriptors:

  • 2 for the process' stdout and stderr pipes
  • 2 for their corresponding log files

(Also note that we're likely to use another file descriptor per process for their stdin, which is currently nullified, to add support for a persist attach subcommand, à la pm2 attach)

The daemon also has a file descriptor for the Unix domain server socket and it uses an additional one (the client socket) whenever a persist command is invoked (although only persist logs currently makes a long-lived usage of that socket).