[PATCH] configurehood: Introduce random delays to dilute requests

robert rlanghammer at web.de
Mo Okt 29 13:28:13 CET 2018


Hallo,

Christians Vorschlag gefaellt mir auch besser, als in das configurehood
sleeps einzubauen.

Robert

Am 29.10.18 um 13:02 schrieb Christian Dresel:
> hi
>
> macht es nicht evtl. Sinn, das ganze bereits im Cron etwas zu entzerren
> so wie es bereits beim Nodewatcher [1] der Fall ist?
>
> */5 * * * * sleep $(/usr/bin/random 0 60); [ -f /tmp/started ] &&
> /usr/sbin/configurehood
>
> dann wäre es auch kein Problem, das ganze noch deutlich weiter zu
> entzerren, mir schweben da aktuell (wie im Beispiel oben) so 0 bis 60
> Sekunden vor?
>
> mfg
>
> Christian
>
> [1]
> https://github.com/FreifunkFranken/firmware/blob/master/src/packages/fff/fff-nodewatcher/files/usr/lib/micron.d/fff-nodewatcher
>
> Am 29.10.18 um 12:48 schrieb Adrian Schmutzler:
>> Gerade noch eingefallen:
>>
>> Ist sleep beim micrond im Path oder soll ich
>>
>> /bin/sleep
>>
>> nehmen?
>>
>> Grüße
>>
>> Adrian
>>
>>> -----Original Message-----
>>> From: franken-dev [mailto:franken-dev-bounces at freifunk.net] On Behalf Of
>>> Adrian Schmutzler
>>> Sent: Montag, 29. Oktober 2018 12:45
>>> To: franken-dev at freifunk.net
>>> Subject: [PATCH] configurehood: Introduce random delays to dilute requests
>>>
>>> Instead of having 1000 routers accessing the KeyXchange in the
>>> same second, this will dilute the request within a period of
>>> 10 seconds.
>>>
>>> Same is done for queries from gateways.
>>>
>>> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
>>> ---
>>>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>>> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>>> index 47e228b7..b6cae476 100755
>>> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>>> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>>> @@ -74,6 +74,7 @@ if [ -s "$hoodfilelocal" ]; then
>>>  else
>>>  	# if we have Internet, we download the Hoodfile from the
>>> keyxchangev2
>>>  	if hasInternet ; then
>>> +		sleep $(/usr/bin/random 1 10)
>>>  		getKeyserverHoodfile "$hoodfiletmp" && cp "$hoodfiletmp"
>>> "$hoodfilewww"
>>>
>>>  		#if no Internet, we connect to the hidden AP and download the
>>> file from another Node in range
>>> @@ -95,6 +96,8 @@ else
>>>  			getEthernetHoodfile "$hoodfiletmp" ||
>>> getWirelessHoodfile "$hoodfiletmp"
>>>  		else
>>>  			echo "We have a Gateway in Range, we load the
>>> keyxchangev2data from fe80::1"
>>> +
>>> +			sleep $(/usr/bin/random 1 10)
>>>  			getGatewayHoodfile "$hoodfiletmp" && cp
>>> "$hoodfiletmp" "$hoodfilewww"
>>>  		fi
>>>  	fi
>>> --
>>> 2.11.0

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 833 bytes
Beschreibung: OpenPGP digital signature
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20181029/ee4cd2ee/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev