示例#1
0
        public MDBReplicationHealthMonitor(WlmResource owner, Guid mdbGuid) : base(owner, new MdbReplicationResourceHealthMonitorKey(mdbGuid))
        {
            MailboxReplicationServicePerMdbPerformanceCountersInstance perfCounter = MDBPerfCounterHelperCollection.GetMDBHelper(mdbGuid, true).PerfCounter;
            WorkloadType wlmWorkloadType = owner.WlmWorkloadType;

            if (wlmWorkloadType == WorkloadType.MailboxReplicationService)
            {
                base.ResourceHealthPerfCounter  = perfCounter.ResourceHealthMDBReplication;
                base.DynamicCapacityPerfCounter = perfCounter.DynamicCapacityMDBReplication;
                return;
            }
            if (wlmWorkloadType == WorkloadType.MailboxReplicationServiceHighPriority)
            {
                base.ResourceHealthPerfCounter  = perfCounter.ResourceHealthMDBReplicationHiPri;
                base.DynamicCapacityPerfCounter = perfCounter.DynamicCapacityMDBReplicationHiPri;
                return;
            }
            switch (wlmWorkloadType)
            {
            case WorkloadType.MailboxReplicationServiceInternalMaintenance:
                base.ResourceHealthPerfCounter  = perfCounter.ResourceHealthMDBReplicationInternalMaintenance;
                base.DynamicCapacityPerfCounter = perfCounter.DynamicCapacityMDBReplicationInternalMaintenance;
                return;

            case WorkloadType.MailboxReplicationServiceInteractive:
                base.ResourceHealthPerfCounter  = perfCounter.ResourceHealthMDBReplicationCustomerExpectation;
                base.DynamicCapacityPerfCounter = perfCounter.DynamicCapacityMDBReplicationCustomerExpectation;
                return;

            default:
                return;
            }
        }
示例#2
0
        public void PickupHeavyJobs(out bool mdbIsUnreachable)
        {
            SystemMailboxHeavyJobs systemMailboxHeavyJobs = new SystemMailboxHeavyJobs(this.MdbGuid);

            this.LastScanTimestamp = DateTime.UtcNow;
            MailboxReplicationServicePerMdbPerformanceCountersInstance perfCounter = MDBPerfCounterHelperCollection.GetMDBHelper(this.MdbGuid, true).PerfCounter;

            perfCounter.LastScanTime.RawValue = CommonUtils.TimestampToPerfcounterLong(this.LastScanTimestamp);
            systemMailboxHeavyJobs.PickupJobs();
            mdbIsUnreachable      = (systemMailboxHeavyJobs.ScanFailure != null);
            this.LastScanDuration = DateTime.UtcNow - this.LastScanTimestamp;
            perfCounter.LastScanDuration.RawValue = (long)this.LastScanDuration.TotalMilliseconds;
            perfCounter.LastScanFailure.RawValue  = (mdbIsUnreachable ? 1L : 0L);
            this.LastScanFailure = systemMailboxHeavyJobs.ScanFailure;
            this.LastScanResults = systemMailboxHeavyJobs.ScanResults;
            if (systemMailboxHeavyJobs.ScanResults != null)
            {
                foreach (JobPickupRec jobPickupRec in systemMailboxHeavyJobs.ScanResults)
                {
                    if (jobPickupRec.PickupResult == JobPickupResult.JobPickedUp && jobPickupRec.Timestamp > this.LastJobPickup)
                    {
                        this.LastJobPickup = jobPickupRec.Timestamp;
                    }
                }
            }
            if (mdbIsUnreachable)
            {
                this.NextRecommendedScan = DateTime.UtcNow + MRSQueue.ScanRetryInterval;
                return;
            }
            if (this.NextRecommendedScan <= this.LastScanTimestamp)
            {
                this.NextRecommendedScan                = ((systemMailboxHeavyJobs.RecommendedNextScan < MRSService.NextFullScanTime) ? systemMailboxHeavyJobs.RecommendedNextScan : MRSService.NextFullScanTime);
                perfCounter.MdbQueueQueued.RawValue     = (long)systemMailboxHeavyJobs.QueuedJobsCount;
                perfCounter.MdbQueueInProgress.RawValue = (long)systemMailboxHeavyJobs.InProgressJobsCount;
                this.QueuedJobsCount     = systemMailboxHeavyJobs.QueuedJobsCount;
                this.InProgressJobsCount = systemMailboxHeavyJobs.InProgressJobsCount;
            }
        }