protected override IEventHubQueueCache CreateCache(IStreamQueueCheckpointer <string> checkpointer, Logger cacheLogger, IObjectPool <FixedSizeBuffer> bufferPool, TimePurgePredicate timePurge, SerializationManager serializationManager) { //set defaultMaxAddCount to 10 so TryCalculateCachePressureContribution will start to calculate real contribution shortly. var cache = new EventHubQueueCache(defaultMaxAddCount, checkpointer, new EventHubDataAdapter(serializationManager, bufferPool), EventHubDataComparer.Instance, cacheLogger, new EventHubCacheEvictionStrategy(cacheLogger, timePurge)); _caches.Add(cache); return(cache); }
protected override IEventHubQueueCache CreateCache(string partition, EventHubStreamProviderSettings providerSettings, IStreamQueueCheckpointer <string> checkpointer, Logger cacheLogger, IObjectPool <FixedSizeBuffer> bufferPool, string blockPoolId, TimePurgePredicate timePurge, SerializationManager serializationManager, EventHubMonitorAggregationDimensions sharedDimensions) { var cacheMonitorDimensions = new EventHubCacheMonitorDimensions(sharedDimensions, partition, blockPoolId); var cacheMonitor = this.CacheMonitorFactory(cacheMonitorDimensions, cacheLogger); //set defaultMaxAddCount to 10 so TryCalculateCachePressureContribution will start to calculate real contribution shortly var cache = new EventHubQueueCache(defaultMaxAddCount, checkpointer, new EventHubDataAdapter(serializationManager, bufferPool), EventHubDataComparer.Instance, cacheLogger, new EventHubCacheEvictionStrategy(cacheLogger, cacheMonitor, providerSettings.StatisticMonitorWriteInterval, timePurge), cacheMonitor, providerSettings.StatisticMonitorWriteInterval); this.caches.Add(cache); return(cache); }
private IEventHubQueueCache CreateQueueCache(string partition, IStreamQueueCheckpointer <string> checkpointer, Logger cacheLogger) { // the same code block as with EventHubAdapterFactory to define default CacheFactory // except for at the end we put the created cache in CreatedCaches list if (this.bufferPool == null) { this.bufferPool = new FixedSizeObjectPool <FixedSizeBuffer>(adapterSettings.CacheSizeMb, () => new FixedSizeBuffer(1 << 20)); } if (this.timePurge == null) { this.timePurge = new TimePurgePredicate(adapterSettings.DataMinTimeInCache, adapterSettings.DataMaxAgeInCache); } //ser defaultMaxAddCount to 10 so TryCalculateCachePressureContribution will start to calculate real contribution shortly. var cache = new EventHubQueueCache(defaultMaxAddCount, checkpointer, new EventHubDataAdapter(this.SerializationManager, bufferPool, timePurge), EventHubDataComparer.Instance, cacheLogger); if (adapterSettings.AveragingCachePressureMonitorFlowControlThreshold.HasValue) { var avgMonitor = new AveragingCachePressureMonitor(adapterSettings.AveragingCachePressureMonitorFlowControlThreshold.Value, cacheLogger); cache.AddCachePressureMonitor(avgMonitor); } if (adapterSettings.SlowConsumingMonitorPressureWindowSize.HasValue || adapterSettings.SlowConsumingMonitorFlowControlThreshold.HasValue) { var slowConsumeMonitor = new SlowConsumingPressureMonitor(cacheLogger); if (adapterSettings.SlowConsumingMonitorFlowControlThreshold.HasValue) { slowConsumeMonitor.FlowControlThreshold = adapterSettings.SlowConsumingMonitorFlowControlThreshold.Value; } if (adapterSettings.SlowConsumingMonitorPressureWindowSize.HasValue) { slowConsumeMonitor.PressureWindowSize = adapterSettings.SlowConsumingMonitorPressureWindowSize.Value; } cache.AddCachePressureMonitor(slowConsumeMonitor); } this.createdCaches.Add(cache); return(cache); }