public string GetChart() { Dictionary <string, string> summary = new Dictionary <string, string>(); Dictionary <string, int> good = Controller.latencySummaryDict; //sort the dict good = good.OrderByDescending(p => p.Value).ToDictionary(x => x.Key, x => x.Value); string dictChart = OutputProcessor.ConvertDictionaryToHTMLTable(good); // string barChartHtmlraw = OutputProcessor.CreateBarHtmlForDictionary(good, "barChartWaitType", 900, 300, null, false, "false"); // string barChartHtml = OutputProcessor.CreateBarHtmlForDictionary(good, "barChartWaitType", 900, 300, null, true, "false"); // return dictChart+ "<br>"+ barChartHtml; string barJs = Output.HighCharts.GetBarHtml("SummaryBar", "Avg Latency Summary", "", "", "Time (ms)", good); string chartHtml = Output.HighCharts.GetChartHtml("Latency charts", "", "Time", "Latency (ms)", Controller.chartsData, "RED", 600); string AGLatencyImg = "<br><br><hr><span style='color:goldenrod; font-size:150%;'><i class='fa fa-lightbulb-o'></i></span> <b>Explanation</b><br>Below figure shows how the latency is caculated. <br><img src='../images/AGLatency.png' height='600'/>"; return(barJs + "<br>" + chartHtml + AGLatencyImg); }
public string GetChart() { Dictionary <string, string> summary = new Dictionary <string, string>(); Dictionary <string, int> good = new Dictionary <string, int>(); Dictionary <string, List <string> > curlve = new Dictionary <string, List <string> >(); var sum = Controller.latencySummaryDict_new.OrderBy(p => p.Key); int i = 1; foreach (var p in sum) { good.Add(i.ToString() + " " + p.Value.Key, p.Value.Value); i++; } var charts = Controller.chartsData_new.OrderBy(p => p.Key); i = 1; foreach (var p in charts) { curlve.Add(i.ToString() + " " + p.Value.Key, p.Value.Value); i++; } //Ignore the sort //good = good.OrderByDescending(p => p.Value).ToDictionary(x=>x.Key,x=>x.Value); string dictChart = OutputProcessor.ConvertDictionaryToHTMLTable(good); // string barChartHtmlraw = OutputProcessor.CreateBarHtmlForDictionary(good, "barChartWaitType", 900, 300, null, false, "false"); // string barChartHtml = OutputProcessor.CreateBarHtmlForDictionary(good, "barChartWaitType", 900, 300, null, true, "false"); // return dictChart+ "<br>"+ barChartHtml; string barJs = Output.HighCharts.GetBarHtml("SummaryBar", "Avg Latency Summary", "", "", "Time (Microsecond)", good); string link = "The terms of the delay here has the same meaning as in below link:<br><a href='https://blogs.msdn.microsoft.com/sql_server_team/new-in-ssms-always-on-availability-group-latency-reports/'>https://blogs.msdn.microsoft.com/sql_server_team/new-in-ssms-always-on-availability-group-latency-reports/</a><br><br>"; string chartHtml = Output.HighCharts.GetChartHtml("Latency charts-Avg Processing Time", "", "Time", "Latency (Microsecond)", curlve, "RED", 600); string explain = link + @"<b>Primary->commit time</b>: Avg. Time to commit a transaction on the Primary Replica<br> <b>Remote Harden Time</b>: Time elapsed between sending a log block to a secondary replica and getting the associated harden_lsn message back from the secondary replicas.<br> <b>Secondary->processing time</b>:Time elapsed on the secondary between the log block getting received and ack lsn sending out completed. This is basically the total time of a log block being processed on secondary.<br><br> So on primary:<br> <b>Remote Harden time </b>= primary->send + network wire+ secondary->processing + network wire+ primary->receive +other processing time on primary.<br> <b>Secondary->processing</b> =secondary:receive + decompression + local flush + send + other <br> <b>Primary->Commit</b>= max(primary->local flush, primary->remote harden) <br> "; string AGLatencyImg = @"<br><br><hr><span style='color:goldenrod; font-size:150%;'><i class='fa fa-lightbulb-o'></i></span> <b>Annotation</b><br>Below figure shows how the latency is caculated. <br>" + HttpUtility.JavaScriptStringEncode(explain) + "<img src='../images/AG-datamovement.png' height='600'/>"; return(barJs + "<br>" + chartHtml + AGLatencyImg); }
public string GetChart() { Dictionary <string, string> summary = new Dictionary <string, string>(); Int64 total = 0; Int64 duration = 0; foreach (Latency.LogBlockNetLatency_Sec lb in list) { total += lb.LogBlocks; duration += lb.Sum_Latency; } summary.Add("Total Log Block Messages Processed", total.ToString()); summary.Add("Log Block Messages Avg Latency", ((1.0 * duration) / total).ToString("F") + " ms"); string sumHtml = OutputProcessor.ConvertDictionaryToHTMLTable(summary); Controller.latencySummaryDict.Add("Secondary->Primary Net Latency", (int)(duration / total)); Dictionary <string, List <string> > dict = new Dictionary <string, List <string> >(); /*Date.UTC(1970, 10, 25,10,20,55), 1*/ List <string> Avg_Latency = new List <string>(); foreach (Latency.LogBlockNetLatency_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.Avg_Latency; Avg_Latency.Add(str); } dict.Add("Avg_Latency", Avg_Latency); Controller.AddChartData("Sync Secondary->Primary", Avg_Latency); Dictionary <string, List <string> > dict2 = new Dictionary <string, List <string> >(); List <string> logBlocks = new List <string>(); foreach (Latency.LogBlockNetLatency_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.LogBlocks; logBlocks.Add(str); } dict2.Add("LogBlocks", logBlocks); string chartHtml = Output.HighCharts.GetChartHtml("Log Block Ack Messages Avg Network Latency Per Second", title, "Time", "Latency (ms)", dict, "#800000"); string chartHtml2 = Output.HighCharts.GetChartHtml(" Log Block Ack Messages Sum Per Second", title, "Time", "Log Blocks", dict2, "#408000"); return(sumHtml + "<br>" + chartHtml + "<br>" + chartHtml2); }
public string GetChart() { Dictionary <string, string> summary = new Dictionary <string, string>(); Int64 total = 0; Int64 duration = 0; foreach (Latency.FlowControl_Sec lb in list) { total += lb.Occurence; duration += lb.Sum_Duration; } summary.Add("Total Flow Control Occurence", total.ToString()); summary.Add("Avg Flow Control Duration", ((1.0 * duration) / total).ToString("F") + " ms"); string sumHtml = OutputProcessor.ConvertDictionaryToHTMLTable(summary); Controller.latencySummaryDict.Add("DB Flow Control (db=" + dbReplica.Substring(0, 8) + ")", (int)(duration / total)); Dictionary <string, List <string> > dict = new Dictionary <string, List <string> >(); /*Date.UTC(1970, 10, 25,10,20,55), 1*/ List <string> avg_Duration = new List <string>(); foreach (Latency.FlowControl_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.Avg_Duration; avg_Duration.Add(str); } dict.Add("Avg Duration", avg_Duration); Controller.AddChartData("FlowControl_Avg_Duration", avg_Duration); Dictionary <string, List <string> > dict2 = new Dictionary <string, List <string> >(); List <string> occurences = new List <string>(); foreach (Latency.FlowControl_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.Occurence; occurences.Add(str); } dict2.Add("Occurence", occurences); string chartHtml = Output.HighCharts.GetChartHtml("Primary - Database Flow Control Avg Duration Per Second", title, "Time", "Duration (ms)", dict, "#4da6ff"); string chartHtml2 = Output.HighCharts.GetChartHtml("Database Flow Control Occurence Sum Per Second", title, "Time", "Occurences", dict2, "#408000"); return(sumHtml + "<br>" + chartHtml + "<br>" + chartHtml2); }
public string GetChart() { Dictionary <string, string> summary = new Dictionary <string, string>(); Int64 total = 0; Int64 duration = 0; foreach (Latency.TranProcessingTime_Sec lb in list) { total += lb.TranCommits; duration += lb.Sum_Duration; } summary.Add("Total Transaction Processed", total.ToString()); summary.Add("Transaction Commit Avg Duration", ((1.0 * duration) / total).ToString("F") + " ms"); string sumHtml = OutputProcessor.ConvertDictionaryToHTMLTable(summary); Controller.latencySummaryDict.Add("Transaction Processing (db=" + dbid + ")", (int)(duration / total)); Dictionary <string, List <string> > dict = new Dictionary <string, List <string> >(); /*Date.UTC(1970, 10, 25,10,20,55), 1*/ List <string> Avg_Duration = new List <string>(); foreach (Latency.TranProcessingTime_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.Avg_Duration; Avg_Duration.Add(str); } dict.Add("Avg_Duration", Avg_Duration); Controller.AddChartData("Trans processing (db=" + dbid + ")", Avg_Duration); Dictionary <string, List <string> > dict2 = new Dictionary <string, List <string> >(); List <string> trans = new List <string>(); foreach (Latency.TranProcessingTime_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.TranCommits; trans.Add(str); } dict2.Add("TransCommit", trans); string chartHtml = Output.HighCharts.GetChartHtml("Transaction Processing Avg Duration Per Second", title, "Time", "Duration (ms)", dict, "#005c99"); string chartHtml2 = Output.HighCharts.GetChartHtml(" Transaction Processing Sum Per Second", title, "Time", "Transactions Processing", dict2, "#408000"); return(sumHtml + "<br>" + chartHtml + "<br>" + chartHtml2); }
public string GetChart() { Dictionary <string, string> summary = new Dictionary <string, string>(); Int64 total = 0; Int64 duration = 0; foreach (Latency.LogBlockFlush_Sec lb in list) { total += lb.LogBlocks; duration += lb.Sum_Duration; } summary.Add("Total Log Blocks Processed", total.ToString()); summary.Add("Log Blocks Avg Harden Duration", ((1.0 * duration) / total).ToString("F") + " ms"); string sumHtml = OutputProcessor.ConvertDictionaryToHTMLTable(summary); if (repl == Replica.Primary) { Controller.latencySummaryDict.Add("Primary Log Harden (db=" + dbid + ")", (int)(duration / total)); } else { Controller.latencySummaryDict.Add("Secondary Log Harden (db=" + dbid + ")", (int)(duration / total)); } Dictionary <string, List <string> > dict = new Dictionary <string, List <string> >(); /*Date.UTC(1970, 10, 25,10,20,55), 1*/ List <string> Avg_Duration = new List <string>(); foreach (Latency.LogBlockFlush_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.Avg_Duration; Avg_Duration.Add(str); } dict.Add("Avg_Duration", Avg_Duration); if (repl == Replica.Primary) { Controller.AddChartData("Primary Log Harden (db=" + dbid + ")", Avg_Duration); } else { Controller.AddChartData("Secondary Log Harden (db=" + dbid + ")", Avg_Duration); } Dictionary <string, List <string> > dict2 = new Dictionary <string, List <string> >(); List <string> logBlocks = new List <string>(); foreach (Latency.LogBlockFlush_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.LogBlocks; logBlocks.Add(str); } dict2.Add("LogBlocks", logBlocks); string chartHtml = Output.HighCharts.GetChartHtml("Log Block Local Harden Avg Duration Per Second", title, "Time", "Duration (ms)", dict, "#005c99"); string chartHtml2 = Output.HighCharts.GetChartHtml(" Log Blocks Sum Per Second", title, "Time", "Log Blocks", dict2, "#408000"); return(sumHtml + "<br>" + chartHtml + "<br>" + chartHtml2); }
public string GetChart() { if (list == null || list.Count == 0) { return(""); } Dictionary <string, string> summary = new Dictionary <string, string>(); Int64 total = 0; Int64 total_processingTime = 0; Int64 max_processingTime = 0; foreach (Latency.EventRecord_Sec lb in list) { total += lb.Count; total_processingTime += lb.Sum_ProcessingTime; if (max_processingTime < lb.Max_ProcessingTime) { max_processingTime = lb.Max_ProcessingTime; } } summary.Add("Events Processed", total.ToString()); summary.Add("Avg Processing Time", ((total_processingTime) / total) + " microseconds"); summary.Add("Max Processing Time", max_processingTime + " microseconds"); string sumHtml = OutputProcessor.ConvertDictionaryToHTMLTable(summary); Controller.AddChartDataSummary_new(order, chartName, (int)((total_processingTime) / total)); Dictionary <string, List <string> > dict = new Dictionary <string, List <string> >(); /*Date.UTC(1970, 10, 25,10,20,55), 1*/ List <string> Avg_Duration = new List <string>(); foreach (Latency.EventRecord_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.Avg_ProcessingTime; Avg_Duration.Add(str); } dict.Add(chartName + "->Avg_ProcessingTime", Avg_Duration); Controller.AddChartData_new(order, chartName, Avg_Duration); Dictionary <string, List <string> > dict2 = new Dictionary <string, List <string> >(); List <string> trans = new List <string>(); foreach (Latency.EventRecord_Sec lb in list) { string str = "Date.UTC(" + lb.EventTimeStamp.Year.ToString() + "," + lb.EventTimeStamp.Month.ToString() + "," + lb.EventTimeStamp.Day.ToString() + "," + lb.EventTimeStamp.Hour.ToString() + "," + lb.EventTimeStamp.Minute.ToString() + "," + lb.EventTimeStamp.Second.ToString() + ")," + lb.Count; trans.Add(str); } dict2.Add(chartName + "->Count/Sec", trans); string chartHtml = Output.HighCharts.GetChartHtml(chartName + "->Avg ProcessingTime/sec", "", "Time", "Duration (Microsecond)", dict, "#005c99"); string chartHtml2 = Output.HighCharts.GetChartHtml(chartName + "->Count/sec", "", "Time", "Count", dict2, "#408000"); return(sumHtml + "<br>" + chartHtml + "<br>" + chartHtml2); }