Intervals should be staggered

Bug #1788518 reported by Ryan Finnie on 2018-08-22
48
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Landscape Client
High
Simon Poirier
landscape-client (Ubuntu)
Undecided
Unassigned
Xenial
Undecided
Unassigned
Bionic
Undecided
Unassigned
Disco
Undecided
Unassigned

Bug Description

[Impact]

 * Restarting hosts/clouds of multiple VMs or containers managed by
   landscape leads to synchronized monitoring tasks. This can generate
   significant recurring load.

 * The fix adds a configurable randomized interval to scheduled tasks.

[Test Case]

sudo landscape-config --stagger-launch 0.5 --log-level debug
# accept client in server interface
sudo tail -f /var/log/landscape/monitor.log
# Check for debug log entries mentioning monitors getting delayed

[Regression Potential]

 * Although changing the scheduler for non-fixed loop intervals could
   have been slightly better at avoid load peaks on shared hosts, the
   current approach has been deemed safer as it simply adds an initial
   delay to tasks. The current logic of scheduling is unchanged.

 * External scripts expecting monitors to run instantly on
   landscape-client restart could be affected. I'm not aware of
   any such case, as the async nature of the code never made that
   guarantee.

 * The stagger interval is configurable with a flag and a configuration
   entry to work around regressions.

[Original Description]

The various intervals appear to be statically determined from program start. As a practical example, a rebooted VM host with a large number of guests means all the guests start landscape-client at about the same time. Then every 30 minutes, package-monitor runs (which is a rather heavy operation). Multiply by a hundred or so and you've got a large flood on the host.

When the client starts up, it would be good to have the initial schedule for each timer be ((interval / 2) + random(interval)), so the collective load is spread out over the entire interval.

Related branches

Changed in landscape-client:
importance: Undecided → High
tags: added: is
Joel Sing (jsing) wrote :

In addition to (or instead of) spreading the initial schedule, it would be beneficial to +/- a random percentage (e.g. between -10% and +10%) to the next interval on each run. This means that instead of running at hard intervals, the runs become skewed but remain at the given interval on average. This avoids synchronisation and consistent load spikes if the initial offset results in it matching another fixed processing schedule (e.g. from a cronjob). The same applies with load distribution on the server side (if applicable).

no longer affects: ubuntu
Changed in landscape-client:
status: New → Triaged
Ryan Finnie (fo0bar) wrote :

The attached patch spreads out the various reactor calls +/- 10% and was used as a cowboy in our use case. It's not production ready in that it should be a configurable option (and would also need to do the initial stagger which I couldn't figure out how to do -- mine works over time, not immediately), but should be a good starting point.

Ryan Finnie (fo0bar) wrote :

Sorry, I should clarify this patch does NOT solve the problem over time, since the +/- 10% theoretically averages out to zero over time. What solved our synchronized load spikes was pushing out the patched landscape-client via landscape, so the units updated themselves over an N-hour window and spread out the initial timers.

Simon Poirier (simpoir) on 2019-02-13
Changed in landscape-client:
assignee: nobody → Simon Poirier (simpoir)
status: Triaged → In Progress
Junien Fridrick (axino) wrote :

Hi, what's the progress here ? Maintaining our own landscape-client package is painful.

Thanks

Adam Collard (adam-collard) wrote :

Hi Junien,

There's a branch in review for this at https://github.com/CanonicalLtd/landscape-client/pull/63

As Ryan noted, the patch he attached will tend towards all the landscape-clients averaging out to the same intervals.

Any feedback you have on the above PR is welcome.

Simon Poirier (simpoir) on 2019-03-26
Changed in landscape-client:
status: In Progress → Fix Committed
Simon Poirier (simpoir) on 2019-06-18
description: updated
Changed in landscape-client (Ubuntu):
status: New → Fix Released

Hello Ryan, or anyone else affected,

Accepted landscape-client into disco-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/landscape-client/18.01-0ubuntu7.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-disco to verification-done-disco. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-disco. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in landscape-client (Ubuntu Disco):
status: New → Fix Committed
tags: added: verification-needed verification-needed-disco
Brian Murray (brian-murray) wrote :

Hello Ryan, or anyone else affected,

Accepted landscape-client into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/landscape-client/18.01-0ubuntu3.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in landscape-client (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed-bionic
Simon Poirier (simpoir) wrote :

Verified bionic and disco proposed, by setting launching a couple of instances and verifying the monitors are scattered in the logs.

tags: added: verification-done-bionic verification-done-disco
removed: verification-needed-bionic verification-needed-disco
Brian Murray (brian-murray) wrote :

Hello Ryan, or anyone else affected,

Accepted landscape-client into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/landscape-client/16.03-0ubuntu2.16.04.7 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in landscape-client (Ubuntu Xenial):
status: New → Fix Committed
tags: added: verification-needed-xenial
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers