send load information periodically even if not currently solicited. (#187)
This commit is contained in:
Родитель
214780d51c
Коммит
dfac505ddd
|
@ -40,6 +40,9 @@ namespace DurableTask.Netherite
|
|||
[DataMember]
|
||||
public DateTime[] TransferCommandsReceived { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
DateTime LastSentToLoadMonitor = DateTime.MinValue;
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override TrackedObjectKey Key => new TrackedObjectKey(TrackedObjectKey.TrackedObjectType.Activities);
|
||||
|
||||
|
@ -107,13 +110,14 @@ namespace DurableTask.Netherite
|
|||
}
|
||||
|
||||
// called frequently, directly from the StoreWorker. Must not modify any [DataMember] fields.
|
||||
public void CollectLoadMonitorInformation()
|
||||
public void CollectLoadMonitorInformation(DateTime now)
|
||||
{
|
||||
// send load information if there is a backlog of if it was solicited recently
|
||||
if (this.LocalBacklog.Count > 0
|
||||
|| this.QueuedRemotes.Count > 0
|
||||
|| (now - this.LastSentToLoadMonitor) > TimeSpan.FromSeconds(10)
|
||||
|| (this.LastSolicitation.HasValue
|
||||
&& (DateTime.UtcNow - this.LastSolicitation.Value) < LoadMonitor.SOLICITATION_VALIDITY))
|
||||
&& (now - this.LastSolicitation.Value) < LoadMonitor.SOLICITATION_VALIDITY))
|
||||
{
|
||||
this.Partition.Send(new LoadInformationReceived()
|
||||
{
|
||||
|
@ -124,6 +128,7 @@ namespace DurableTask.Netherite
|
|||
AverageActCompletionTime = this.AverageActivityCompletionTime,
|
||||
TransfersReceived = (DateTime[]) this.TransferCommandsReceived.Clone()
|
||||
});
|
||||
this.LastSentToLoadMonitor = now;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -487,7 +487,7 @@ namespace DurableTask.Netherite.Faster
|
|||
if (this.partition.NumberPartitions() > 1 && this.partition.Settings.ActivityScheduler == ActivitySchedulerOptions.Locavore)
|
||||
{
|
||||
var activitiesState = (await this.store.ReadAsync(TrackedObjectKey.Activities, this.effectTracker)) as ActivitiesState;
|
||||
activitiesState.CollectLoadMonitorInformation();
|
||||
activitiesState.CollectLoadMonitorInformation(DateTime.UtcNow);
|
||||
}
|
||||
|
||||
if (this.loadInfo.IsBusy() != null)
|
||||
|
|
Загрузка…
Ссылка в новой задаче