This is a POC of replacing the systemd timer which ran pvesr.service (an
exec of `pvesr run`) once a minute. The timer was not used, somehow, to
trigger pvesr on the correct time, as one could think, but rather as a
daemon replacement. our replication logic handles the "when must which
job run" logic completely itself.
Add a really small daemon, which forks of a process once a minute which
then runs the job. The end result should be quite identical with the
systemd timer variant, besides reducing the journal spam, as we do not
log 4 lines to the journal each minute, but rather only then when
something actually happens, i.e., a job runs.
There is still potential for improvements, some obvious are:
* produce a pvesrd manpage in the doc-generator, I have a placeholder
one just for the sake of avoiding build/lintian errors.
* integrate this simple-daemon but with worker mix in PVE::Daemons, as I
* duplicate the logic to create and reap child processes a bit for now,
in the RFC stage
* some possible improvements are described in the commit message of the
patch itself.
* I had once an issue that the pvesrd.service was enabled, but not
started when upgrading from an older system to test the transitions
to a pvesr.timer-less system with replication jobs configured, did not
really investigated this yet, it should get started by postinst
though, just FYI.
I did this as side project, it isn't too important, but feedback would
be really great. Memory usage of this daemon is around 60 MB here
(perl...), KSM should make real impact much lower. But also with the
timer approach it wasn't smaller, it just had to be loaded into memory
each minute for a short period, not really better, IMO.
cheers,
Thomas Lamprecht (1):
WIP: replace systemd timer with pvesrd daemon
PVE/Service/Makefile | 2 +-
PVE/Service/pvesrd.pm | 102 ++
bin/Makefile | 6 ++-
bin/init.d/Makefile | 3 +-
bin/init.d/pvesr.service | 7
bin/init.d/pvesr.timer| 12 --
bin/init.d/pvesrd.service | 16
bin/pvesrd| 20 +
debian/postinst | 3 +-
9 files changed, 147 insertions(+), 24 deletions(-)
create mode 100644 PVE/Service/pvesrd.pm
delete mode 100644 bin/init.d/pvesr.service
delete mode 100644 bin/init.d/pvesr.timer
create mode 100644 bin/init.d/pvesrd.service
create mode 100755 bin/pvesrd
--
2.14.2
___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel