0

I have a (multi-process) daemon, written in C.

I would like it to make its internal counters available to observing processes on the same machine.

It is critical that this daemon is never stopped or significantly slower by an observer. If an observer is unable to keep up, it should just lose updates, not slow the daemon.

I've considered shared memory and unix domain sockets.

Are there better approaches?

fadedbee
  • 42,671
  • 44
  • 178
  • 308
  • 1
    What do you mean by "If an observer is unable to keep up, it should lose updates, not slow the daemon"? You wanted the observer to be synchronized with the daemon? – khanh Oct 07 '19 at 17:59
  • 1
    Not many other options, of course you probably need both where the daemon is always updating shared memory, and a single observer process is in charge of pub/sub notifications to all other observers to minimize slowing down the daemon. – jxh Oct 07 '19 at 23:45
  • @NgọcKhánhNguyễn An observer process might be logging the counter values to disk. If the disk is not fast enough, I would like some counter values to be missed, rather than for the daemon to slow down. Whatever the daemon has to do to write or publish values to observers must be async. – fadedbee Oct 08 '19 at 07:36
  • 1
    @fadedbee As my limited understanding sending SOCK_DGRAM is an asynchronous call. So it would not slow down the daemon. – khanh Oct 08 '19 at 11:14

0 Answers0