Page MenuHomePhabricator

When a lease triggers a resource allocation for a resource which must activate, awaken the lease task after the resource activates

Authored by epriestley on Oct 24 2018, 4:33 PM.



Depends on D19753. Ref T13210. This is a small optimization that saves us from waiting up to 15 seconds for a yield.

When there are no Working Copy resources and a new lease comes in, we'll allocate one and yield until it activates.

If activating it (SSH'ing and running git clone) takes less than 15 seconds, the resource will activate (say, at T+4) but the lease won't update again for a while (say, until T+15). This leaves us with a pointless wait (in this example, we're sitting around for 9 seconds when we could move forward).

To improve this a little bit, let resources wake up the lease update tasks that triggered allocation after they activate. In the best case, that task runs ~15 seconds sooner. In the worst case, the awaken is just a no-op.

With a more-full queue, this has a smaller effect (it's likely something else will run and be able to use the resource in those 9 seconds).

With already-activated resources, this has no effect (when resources are already activated, we can lease immediately).

Test Plan
  • Cleaned up all working copy resources.
  • Requested a new "A" working copy.
  • Before patch: got a working copy after 17-18 seconds, most of which was spent yielded.
  • After patch: got a working copy after 3-4 seconds.

Diff Detail

rP Phabricator
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Oct 24 2018, 4:33 PM
Owners added a subscriber: Restricted Owners Package.Oct 24 2018, 4:33 PM
epriestley requested review of this revision.Oct 24 2018, 4:34 PM
amckinley accepted this revision.Oct 26 2018, 1:51 AM
This revision is now accepted and ready to land.Oct 26 2018, 1:51 AM
This revision was automatically updated to reflect the committed changes.