send load information periodically even if not currently solicited. (#187)

This commit is contained in:
Sebastian Burckhardt 2022-08-11 08:19:29 -07:00 коммит произвёл GitHub
Родитель 214780d51c
Коммит dfac505ddd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -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)