DeathVoteExpirationTimeout in Orleans

本文探讨了Orleans集群管理中的DeathVoteExpirationTimeout配置,该配置用于确定成员资格表中死亡投票的过期时间,默认为120秒。在ClusterHealthMonitor、LocalSiloHealthMonitor和MembershipTableManager类的多个方法中,此超时用于忽略过期的投票,确保集群健康监测的准确性。
摘要由CSDN通过智能技术生成

DeathVoteExpirationTimeout in Orleans

(Jin Qing’s Column, Dec., 2021)

Try to find out why Orleans need a DeathVoteExpirationTimeout config.

https://dotnet.github.io/orleans/docs/implementation/cluster_management.html#extension-to-totally-order-membership-views

DeathVoteExpirationTimeout - Expiration time in seconds for death vote in the membership table. Default is 120 seconds

GetFreshVotes

DeathVoteExpirationTimeout is only used by GetFreshVotes(), which has 3 occurence:

    class ClusterHealthMonitor
    {
        ...
        private UpdateMonitoredSilos(...)
        {
            ...
            bool isSuspected = candidateEntry.GetFreshVotes(now, DeathVoteExpirationTimeout).Count > 0;
            ...
        }
    }
    class LocalSiloHealthMonitor
    {
        ...
        private int CheckSuspectingNodes(DateTime now, List<string> complaints)
        {
            ...
            var freshVotes = membershipEntry.GetFreshVotes(now, DeathVoteExpirationTimeout);
            ...
        }
        ...
    }

    class MembershipTableManager
    {
        ...
        public TryToSuspectOrKill(SiloAddress silo)
        {
            ...
            // get all valid (non-expired) votes
            var freshVotes = entry.GetFreshVotes(DateTime.UtcNow, DeathVoteExpirationTimeout);
            ...
        }
        ...
    }

GetFreshVotes() uses this expiration time to ignore old voter:

        internal GetFreshVotes(DateTime now, TimeSpan expiration)
        {
            ...
            foreach (var voter in this.SuspectTimes)
            {
                var otherVoterTime = voter.Item2;
                if (now.Subtract(otherVoterTime) < expiration)
                {
                    result.Add(voter);
                }
            }

            return result.ToImmutable();
        }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值