<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Period Pain</title>
	<atom:link href="http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/</link>
	<description>An Irishman's Fiery</description>
	<lastBuildDate>Tue, 17 May 2011 19:12:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>By: diamond</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-323131</link>
		<dc:creator>diamond</dc:creator>
		<pubDate>Wed, 03 Feb 2010 19:59:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-323131</guid>
		<description>Nice writeup, i must bear this in mind.

Btw, in the interests of simplicity, line 14 of your first code snippet could be simplified from:

    if sorted(numbers)[-1] &gt;= 30:

to:

    if max(numbers) &gt;= 30:

Steve</description>
		<content:encoded><![CDATA[<p>Nice writeup, i must bear this in mind.</p>
<p>Btw, in the interests of simplicity, line 14 of your first code snippet could be simplified from:</p>
<p>    if sorted(numbers)[-1] &gt;= 30:</p>
<p>to:</p>
<p>    if max(numbers) &gt;= 30:</p>
<p>Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: warpedvisions.org :: Link: The problem of periodic processes</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-320790</link>
		<dc:creator>warpedvisions.org :: Link: The problem of periodic processes</dc:creator>
		<pubDate>Sun, 03 Jan 2010 00:54:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-320790</guid>
		<description>[...] smart writeup of the problem of periodic processes, or why to consider gossipy protocols.    window.onload = [...]</description>
		<content:encoded><![CDATA[<p>[...] smart writeup of the problem of periodic processes, or why to consider gossipy protocols.    window.onload = [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: /~colmmacc/ &#187; Period Pain 3</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-317879</link>
		<dc:creator>/~colmmacc/ &#187; Period Pain 3</dc:creator>
		<pubDate>Thu, 26 Nov 2009 21:44:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-317879</guid>
		<description>[...] promised, though it&#8217;s been a while coming, I wrote that there&#8217;d be a followup on scheduling [...]</description>
		<content:encoded><![CDATA[<p>[...] promised, though it&#8217;s been a while coming, I wrote that there&#8217;d be a followup on scheduling [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: /~colmmacc/ &#187; Period Pain part 2</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-313309</link>
		<dc:creator>/~colmmacc/ &#187; Period Pain part 2</dc:creator>
		<pubDate>Sun, 27 Sep 2009 12:37:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-313309</guid>
		<description>[...] week I wrote about problems with periodicity but it was only half of the problem. But before moving on to the second half, it seems like a good [...]</description>
		<content:encoded><![CDATA[<p>[...] week I wrote about problems with periodicity but it was only half of the problem. But before moving on to the second half, it seems like a good [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brady</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-312530</link>
		<dc:creator>brady</dc:creator>
		<pubDate>Sun, 20 Sep 2009 21:11:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-312530</guid>
		<description>Here is an example of something that uses the md5sum of the hostname using modern bashisms. Its not the best code in the world but it works. =)

(the last line is a cheap abs() function as the mod function in bash returns negative numbers)

SYS_HASH=$(echo $HOSTNAME &#124; md5sum &#124; awk &#039;{print $1}&#039;)
SLEEP_TIME=$(( (16#$SYS_HASH)%3600 ))
SLEEP_TIME=${SLEEP_TIME/-/}</description>
		<content:encoded><![CDATA[<p>Here is an example of something that uses the md5sum of the hostname using modern bashisms. Its not the best code in the world but it works. =)</p>
<p>(the last line is a cheap abs() function as the mod function in bash returns negative numbers)</p>
<p>SYS_HASH=$(echo $HOSTNAME | md5sum | awk &#8216;{print $1}&#8217;)<br />
SLEEP_TIME=$(( (16#$SYS_HASH)%3600 ))<br />
SLEEP_TIME=${SLEEP_TIME/-/}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-312137</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Thu, 17 Sep 2009 10:49:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-312137</guid>
		<description>The cron.daily for spamassassin in ubuntu seems to have this feature, if you&#039;re volunteering to keep a list...</description>
		<content:encoded><![CDATA[<p>The cron.daily for spamassassin in ubuntu seems to have this feature, if you&#8217;re volunteering to keep a list&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Foobot</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-312028</link>
		<dc:creator>Foobot</dc:creator>
		<pubDate>Wed, 16 Sep 2009 18:41:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-312028</guid>
		<description>1. Taking the *daily* apt script as the example, and then extrapolating it to a nominally hourly event is a bit off. A 60 min wobble factor is perfectly reasonable for a daily event. Especially if it&#039;s something like this which is kicked off across the globe at the same *local* time.
A 60 min wobble for an hourly event is bonkers, because 60 mins is a stupid value to use, not because randomising the wait period is necessarily bad.

2. If we&#039;re talking about worst-cases then &quot;Pick a random number once&quot; still has the same worst-case as &quot;random every time&quot;; everybody might randomly pick the same number, only this way they&#039;ll never pick again and the thundering herd
will be a permanent feature of that time-of-day. Predictability is nice but I&#039;m not sure that&#039;s solving the right problem :)</description>
		<content:encoded><![CDATA[<p>1. Taking the *daily* apt script as the example, and then extrapolating it to a nominally hourly event is a bit off. A 60 min wobble factor is perfectly reasonable for a daily event. Especially if it&#8217;s something like this which is kicked off across the globe at the same *local* time.<br />
A 60 min wobble for an hourly event is bonkers, because 60 mins is a stupid value to use, not because randomising the wait period is necessarily bad.</p>
<p>2. If we&#8217;re talking about worst-cases then &#8220;Pick a random number once&#8221; still has the same worst-case as &#8220;random every time&#8221;; everybody might randomly pick the same number, only this way they&#8217;ll never pick again and the thundering herd<br />
will be a permanent feature of that time-of-day. Predictability is nice but I&#8217;m not sure that&#8217;s solving the right problem :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gavinmc</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-311801</link>
		<dc:creator>gavinmc</dc:creator>
		<pubDate>Tue, 15 Sep 2009 12:22:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-311801</guid>
		<description>It might be useful if cron could have option #1 built into it, so you could do something like:

R 4     * * *   root    test -x /usr/sbin/cron-apt &amp;&amp; /usr/sbin/cron-apt

and cron could make up a random valid number for the R and remember it either permanently for that line or until it was next restarted.</description>
		<content:encoded><![CDATA[<p>It might be useful if cron could have option #1 built into it, so you could do something like:</p>
<p>R 4     * * *   root    test -x /usr/sbin/cron-apt &amp;&amp; /usr/sbin/cron-apt</p>
<p>and cron could make up a random valid number for the R and remember it either permanently for that line or until it was next restarted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: colmmacc</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-311794</link>
		<dc:creator>colmmacc</dc:creator>
		<pubDate>Tue, 15 Sep 2009 09:02:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-311794</guid>
		<description>@cliff , @jcorn - the easiest and fastest way is to use the mod operator.

$md5sum % 60

will turn it into an evenly distributed number in the 0:59 range.</description>
		<content:encoded><![CDATA[<p>@cliff , @jcorn &#8211; the easiest and fastest way is to use the mod operator.</p>
<p>$md5sum % 60</p>
<p>will turn it into an evenly distributed number in the 0:59 range.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jcorn</title>
		<link>http://www.stdlib.net/~colmmacc/2009/09/14/period-pain/comment-page-1/#comment-311790</link>
		<dc:creator>jcorn</dc:creator>
		<pubDate>Tue, 15 Sep 2009 07:18:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.stdlib.net/~colmmacc/?p=473#comment-311790</guid>
		<description>You know, I changed my mind: multiply by 59 instead.  I always get all mixed up by this procedure.</description>
		<content:encoded><![CDATA[<p>You know, I changed my mind: multiply by 59 instead.  I always get all mixed up by this procedure.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

