Bug 218444 - mail/sa-utils: periodic script needs anticongestion sleep
Summary: mail/sa-utils: periodic script needs anticongestion sleep
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Matthew Seaman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-07 02:56 UTC by Alan Somers
Modified: 2017-04-09 11:36 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (matthew)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2017-04-07 02:56:48 UTC
Periodic scripts that hit external servers can cause a "thundering herd" problem, whereby many systems' periodic scripts run at the same time, and overload the server.  To prevent this, such scripts should sleep for a random amount of time before hitting the external server.

After r316432, there is a common anticongestion function to handle this.  For an example of how to use it, see
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=181374&action=diff
Comment 1 Matthew Seaman freebsd_committer freebsd_triage 2017-04-07 07:12:06 UTC
Committed, thanks!
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-04-07 07:12:35 UTC
A commit references this bug:

Author: matthew
Date: Fri Apr  7 07:11:41 UTC 2017
New revision: 437913
URL: https://svnweb.freebsd.org/changeset/ports/437913

Log:
  New version: 0.03

  Add a random delay using the standard 'anticongestion' function (where
  available) before attempting to download updates.  This to avoid the
  'thundering herd' of many simultaneous downloads.

  PR:		218444
  Reported by:	asomers

Changes:
  head/mail/sa-utils/Makefile
  head/mail/sa-utils/files/sa-utils.in
Comment 3 Alan Somers freebsd_committer freebsd_triage 2017-04-07 14:02:43 UTC
I guess I should've been a little clearer, matthew.  In the example diff I showed, the SLEEP variable, the random function, and the -nodelay option were all particular to that particular port, and were defined elsewhere in the periodic script.  r437913 is not going to work because SLEEP and random are undefined.  Here is a simpler example:

https://bugs.freebsd.org/bugzilla/attachment.cgi?id=181556&action=diff