Service Fabric 是否会无限期地保留参与者信息?

Does Service Fabric keep actor information indefinitely?

出于 GDPR 原因,我需要确保不存储我不再需要的客户数据。在查看 Service Fabric Actors 时,我不确定“垃圾收集”的真正含义。

[StatePersistence(StatePersistence.Persisted)]
internal class Actor1 : Actor, IActor1
{
    public Actor1(ActorService actorService, ActorId actorId) 
        : base(actorService, actorId)
    {
    }

    public Task PingAsync(CancellationToken cancellationToken)
    {
        return Task.CompletedTask;
    }
}
IActorService actorServiceProxy = ActorServiceProxy.Create(
    new Uri("fabric:/MyApp/MyActorService"), partitionKey);
// ...
do
{
    PagedResult<ActorInformation> page = await actorServiceProxy.GetActorsAsync(continuationToken, cancellationToken);
// ...

在测试环境中枚举 actor instances 时,在我看来演员信息至少保留了 2 个月,即使演员没有任何存储状态。

我发现有多篇文章提到如果 actor 有剩余状态,我将需要手动删除它们,但在我的例子中,唯一的“状态”是 actorId“存在”这一事实。如果我使用用户电子邮件地址等敏感信息作为 actorId,Service Fabric 是否会自行删除有关 actorId 的信息?

垃圾收集(在此上下文中)意味着从内存中删除 Actor 对象以释放资源。如果 Actor 有 StatePersistence.Persisted,其状态将被写入底层 ActorService 的每个副本上的磁盘。即使您没有在 StateManager 中显式存储任何内容,也会存在 Actor 的记录(使用 ActorId 作为键)。

作为开发人员,您需要管理 Actor 状态的生命周期。显式删除 Actor 也会删除其状态。

Garbage collection of deactivated actors only cleans up the actor object, but it does not remove data that is stored in an actor's State Manager. When an actor is reactivated, its data is again made available to it through the State Manager. In cases where actors store data in State Manager and are deactivated but never reactivated, it may be necessary to clean up their data.

更多信息here