public PodcastUpdateHandler(PodcastDbContext podcastDbContext, ILogger <PodcastUpdateHandler> logger, IFeedClient feedClient) { _podcastDbContext = podcastDbContext; _logger = logger; _feedClient = feedClient; }
static void ManualBenchmark(IFeedClient client) { var connectedMre = new ManualResetEvent(false); client.Connected += () => { connectedMre.Set(); }; Thread.Sleep(3000); client.Start($"{client.GetType().Name}"); if (!connectedMre.WaitOne(1000)) { Console.WriteLine("Cannot connect"); return; } var benchmark = new Benchmark(client); int size; int delay; int burst = 1; while (true) { while (true) { try { Console.WriteLine("Enter size in bytes, delay in micros, and (optionally) burst , e.g. 512 100 2"); var sizeDelay = Console.ReadLine(); if (string.IsNullOrEmpty(sizeDelay) || sizeDelay == "q") { client.Dispose(); return; } var parts = sizeDelay.Split(' '); size = int.Parse(parts[0]); delay = int.Parse(parts[1]); if (parts.Length > 2) { burst = int.Parse(parts[2]); } break; } catch { } } benchmark.Start(size, delay, burst); Console.ReadLine(); benchmark.Stop(); } }
private static void RunClient(IFeedClient client) { var histogram = new LongHistogram(TimeSpan.FromSeconds(10).Ticks, 2); var receivedMessageCount = 0; void OnMessageReceived(ReadOnlySpan <byte> message) { var now = Stopwatch.GetTimestamp(); var start = Unsafe.ReadUnaligned <long>(ref MemoryMarshal.GetReference(message)); var rrt = now - start; var latencyInMicroseconds = unchecked (rrt * 1_000_000 / (double)Stopwatch.Frequency); receivedMessageCount++; histogram.RecordValue((long)latencyInMicroseconds); } using (client) { var connectedSignal = new AutoResetEvent(false); client.Connected += () => Console.WriteLine($"Connected {connectedSignal.Set()}"); client.MessageReceived += OnMessageReceived; client.Start("client " + Guid.NewGuid()); connectedSignal.WaitOne(); do { Console.WriteLine("Bench? (<message count> <message size> <delay in micro> <burst>, eg.: 100000 128 10 1)"); var benchArgs = Console.ReadLine(); if (!TryParseBenchArgs(benchArgs, out var args)) { break; } histogram.Reset(); RunBench(client, args, ref receivedMessageCount); histogram.OutputPercentileDistribution(Console.Out, 1); Console.WriteLine("FailSends : " + Counters.FailedReceivingNextCount); Console.WriteLine("FailReceives : " + Counters.FailedReceivingNextCount); Counters.Reset(); } while (true); client.Stop(); } }
public Benchmark(IFeedClient feedClientManual, string outFolder = null, string transportId = null) { _feedClientManual = feedClientManual; var osPrefix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "w" : "l"; _transportId = osPrefix + transportId; _outFolder = outFolder ?? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "benchmarks", $"{DateTime.UtcNow:yyyyMMdd_HHmmss}"); Directory.CreateDirectory(_outFolder); _messageCounter = 0L; }
public SearchInstanceRebooter( IFeedClient feedClient, ISearchServiceClient searchServiceClient, IAzureManagementAPIWrapper azureManagementAPIWrapper, ITelemetryService telemetryService, IOptionsSnapshot <MonitorConfiguration> configuration, ILogger <SearchInstanceRebooter> logger) { _feedClient = feedClient ?? throw new ArgumentNullException(nameof(feedClient)); _searchServiceClient = searchServiceClient ?? throw new ArgumentNullException(nameof(searchServiceClient)); _azureManagementAPIWrapper = azureManagementAPIWrapper ?? throw new ArgumentNullException(nameof(azureManagementAPIWrapper)); _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _healthyThreshold = TimeSpan.FromSeconds(_configuration.Value.HealthyThresholdInSeconds); _unhealthyThreshold = TimeSpan.FromSeconds(_configuration.Value.UnhealthyThresholdInSeconds); }
public static void Start() { try { feedName = System.Configuration.ConfigurationSettings.AppSettings["FeedName"]; if (feedName == "Simulation DataFeed" || feedName == "DDF") { dataServerClient = new Connector(); } //else if (feedName == "Simulation DataFeed" || feedName == "DDF") //{ // dataServerClient = new DataServerClient(); // //dataServerClient.Start(); //} else { dataServerClient = new DDFAppClient(); } } catch (Exception ex) { Logger.Error(ex); } }
public PodcastIngestionHandler(PodcastDbContext podcastDbContext, IFeedClient feedClient, ILogger <PodcastIngestionHandler> logger) { _podcastDbContext = podcastDbContext; _feedClient = feedClient; _logger = logger; }
public FeedCrawler(IFeedClient feedClient, IFeedIndexer feedGraphTracker) { _feedClient = feedClient; }
private static void RunBench(IFeedClient client, (int messageCount, int messageSize, int delayInMicros, int burstSize) args, ref int receivedMessageCount)