Re: dependant services

From: Steve Litt <slitt_at_troubleshooters.com>
Date: Wed, 22 Apr 2015 09:10:47 -0400

On Tue, 21 Apr 2015 16:52:39 -0700
Avery Payne <avery.p.payne_at_gmail.com> wrote:


> Dependency handling "with guarantee" means there is some means by
> which the child service itself signals "I'm fully up and running",
> vs. "I'm started but not ready". Because there is no polling going
> on, this allows the start-up of the parent daemon to sleep until it
> either is notified or times out. And you get a "clean" start-up of
> the parent because the children have directly signaled that "we're
> all ready".
>
> Dependency handling "without guarantee" is what my project does as an
> optional feature - it brings up the child process and then calls the
> child's ./check script to see if everything is OK, which is polling
> the child (and wasting CPU cycles). This is fine for "light" use
> because most child processes will start quickly and the parent won't
> time out while waiting.

I really like the ./check method. I don't need to make any assumptions
about the startup behavior of the the dependency. I have all sorts of
./run scripts in my daemontools looking like:

if ! ping -q -c1 8.8.8.8 > /dev/null; then
  echo failed ping test on $pingaddr
  sleep 3
  echo "Bailing til next time"
  exit 1
fi

I personally get to choose what I consider to be "operational" for a
dependency.

> There are trade-offs for using this
> feature. First, ./check scripts may have unintended bugs, behaviors,
> or issues that you can't see or resolve, unlike the child directly
> signalling that it is ready for use. Second, the polling approach
> adds to CPU overhead, making it less than ideal for mobile computing
> - it will draw more power over time. Third, there are edge cases
> where it can make a bad situation worse - picture a heavily loaded
> system that takes 20+ minutes to start a child process, and the
> result being the parent spawn-loops repeatedly, which just adds even
> more load.

I think the three tradeoffs you listed above are three variations on
the same theme: One or more dependency services take too long to start.
My first thought is whether you want a service like that on your
computer at all.





SteveT

Steve Litt
April 2015 featured book: Twenty Eight Tales of Troubleshooting
http://www.troubleshooters.com/28
Received on Wed Apr 22 2015 - 13:10:47 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC