From owner-freebsd-pkg@freebsd.org Mon Feb 13 22:07:19 2017 Return-Path: Delivered-To: freebsd-pkg@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25BB9CDEA64 for ; Mon, 13 Feb 2017 22:07:19 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 045A9B33 for ; Mon, 13 Feb 2017 22:07:19 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 00D69CDEA63; Mon, 13 Feb 2017 22:07:19 +0000 (UTC) Delivered-To: pkg@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2E73CDEA62 for ; Mon, 13 Feb 2017 22:07:18 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-yw0-x242.google.com (mail-yw0-x242.google.com [IPv6:2607:f8b0:4002:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6FBFB31; Mon, 13 Feb 2017 22:07:18 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-yw0-x242.google.com with SMTP id q71so8317113ywg.3; Mon, 13 Feb 2017 14:07:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=GCz2E96GiutMIhZGhgMSJ2h9SkUsfzaFHAGQZ1OK7D0=; b=hJAcr7K95qU9uQEAS5jY9HhJCXzXVfSnT0F4tiz+OFw+MN+FmcZdZv+j4jIqlMu0gt msn1j8AUPKlJx4SIUwaw8QsTPg8hY1IgWr0O5ujMwuEE7szIQNzSEjZiLSAhDmjr6Wni EHJ19hWkwK7jcYFBZHYXEtLnjExWDte0V2oJfNomr0qmjEUVeZ+ZbhHNMuOj59Tgzc9k jm1H4202j4NY5c7l1ZoRwtHHrY2i1eVijX1Zicq0FN/IcmNM79DDm0qpVeRrks5vzkWm tKwZyhWNgeoanJs0PTtGwPC/4QN5UKRpDOhnefiERsHE27UehKyNwQna7Oiob3qtLQHO svYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=GCz2E96GiutMIhZGhgMSJ2h9SkUsfzaFHAGQZ1OK7D0=; b=cCMlR2elZUloZifAwTdsSYsMmzGUgur0bmt+lBNJO5XN3bIZsabk8JWInWxdLmVYxm jYZnr4BwBQzCMV3Zz0KrZiUTWrjiGE6o0qmwtmZIE6iT62UgQzq14WNKwWqxytM6nIKn FhhhhTUjgupLgE7bNUZ9zP4k9BUlVZUEJKbaPZoW10U3p+uy1etQtWvCNpAlpQ71XC3W sjLJrLxlqvnAJgPEbh6IcQoLNC1d5i1v0Q7vD1/f7cyEMu7Dy88DnZM/TGlN6TxZ00Mc vL+KcO5sq/NAjkGpiLVsJ9t67DTZMb1699fbj+ta18gcFfeHfxqRiKFCzWgO4sIJpPw0 9+lA== X-Gm-Message-State: AMke39ndNL5+LBjLP7JJskC/IROrNLvxjOyW8bLEAUwpE9kKLSsNIbZa1bjHavXMhLrz9lhOdrcJx+WvRAC6oA== X-Received: by 10.129.141.6 with SMTP id d6mr19018531ywg.36.1487023637666; Mon, 13 Feb 2017 14:07:17 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.129.38.133 with HTTP; Mon, 13 Feb 2017 14:07:17 -0800 (PST) In-Reply-To: <201702132125.v1DLP5LD063026@slippy.cwsent.com> References: <201702132125.v1DLP5LD063026@slippy.cwsent.com> From: Alan Somers Date: Mon, 13 Feb 2017 15:07:17 -0700 X-Google-Sender-Auth: qfjt7dnLFCJpnyQjSIAdQD1nhLQ Message-ID: Subject: Re: Bug 217055 - Consolidate random sleeps in periodic scripts To: Cy Schubert Cc: scrappy@freebsd.org, Brian Somers , freebsd-bugzilla@ayaken.net, Cy Schubert , pkg@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-pkg@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Binary package management and package tools discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2017 22:07:19 -0000 On Mon, Feb 13, 2017 at 2:25 PM, Cy Schubert wrote: > In message om> > , Alan Somers writes: >> On Mon, Feb 13, 2017 at 12:01 AM, Cy Schubert wrot >> e: >> > In message > c >> > om> >> > , Alan Somers writes: >> >> I propose that we remove the various anti-congestion sleeps from >> >> different periodic scripts, and add a single anti-congestion sleep to >> >> the very beginning. Does this sound like a good idea to all of you? >> >> >> >> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217055 >> > >> > I think the problem with the sleeps is simply the sleeps. My original plan >> > to put my sleep/fetch in the background was shot down by some who thought >> > it wasn't simple enough. >> > >> > Secondly, we don't need sleeps every boot. Ntpd for example only needs a >> > sleep twice a year max to fetch a new leapfile so, to have a sleep every >> > boot would be annoying. >> > >> > The best solution to replace sleeps would be to put a list of files:URLs >> > into a queue to be fetched by fetcher script which would fetch only needed >> > files that boot (or in the case of ntp via periodic.conf twice a year). >> > >> > A single script with a queue of files to fetch with one anti-congestion >> > sleep, preferably in the background. >> > >> > NTP, btw can (will) use the leapfile in /etc/ntp until a fresher copy is >> > fetched. >> > >> > Let's remove all fetching functions from the various rc scripts and queue >> > them up early in a fetcher rc script, preferably in the background if at >> > all possible. >> > >> > >> > -- >> > Cheers, >> > Cy Schubert >> > FreeBSD UNIX: Web: http://www.FreeBSD.org >> > >> > The need of the many outweighs the greed of the few. >> >> Unfortunately that won't work, Cy. Some scripts may need to >> dynamically determine what files to fetch, in a way that we can't do >> in a single separate fetcher script. Worse, some scripts, like >> 300.statistics from sysutils/bsdstats, need to _post_ a URL, not get >> one. > > Diverse requirements cannot be addressed by one knob. To assume that > various applications all have the same sleep requirement won't work. Can you think any any periodic script whose sleep needs couldn't be satisified by a single sleep at the beginning of the periodic run? I can't. All sleeps I know of in /etc/periodic and /usr/local/etc/periodic are for the purposes of reducing congestion spikes on a server somewhere. The only way a single sleep could be insufficient is if the random time interval is too small. > > I suppose we could have an optional single sleep script but we can't > summarily remove all sleeps and assume all rc and periodic scripts sleep > for some, one or possibly no applications requiring a sleep at any given > time. What? I can't make sense of that sentence. > We can have a general sleep but removing the option of others would > be counter productive. It doesn't make sense to have an arbitrary sleep > just in case a subsequent script might need it. Nothing in /etc/periodic needs to be run at a precise time, so adding a sleep won't hurt anything. And if the sleep is configurable, a sysadmin can always disable it. Also, from an anticongestion standpoint it's objectively less good to chain multiple sleeps together instead of using a single longer sleep. The reason is because when you add several uniformly distributed random variables, the result approaches a normal distribution with a peak in the middle. But for anticongestion purposes, a uniform distribution is really what you want. > If we have to, let's either > reduce the length of the sleeps or put better yet background them. I don't like the idea of backgrounding parts of the periodic scripts, for three reasons. One, it's complicated. Two, it prevents periodic(8) from sending a single status email. Three, periodic(8) might start the next day's run before the previous day's is complete. > > What's motivating this? Server? Laptop? Servers mostly. A confounding issue is Bug 210188 - periodic daily sleeps even when invoked from a terminal . When I run periodic by hand, it still sleeps. It would be easier to fix that bug if only one sleep were involved instead of several. -Alan