public void PerformanceTest() { var client = new InfluxDBClient("192.168.1.100", 8086, "root", "root", "PerfTests"); // Create a database for this test List <string> databaseList = client.GetDatabaseList(); if (!databaseList.Contains("PerfTests")) { client.CreateDatabase("PerfTests"); } client.Query("DROP SERIES foo"); // Create var serie = new Serie { Name = "foo", ColumnNames = new[] { "value", "value_str" } }; var series = new List <Serie> { serie }; const int N = 10000; for (int i = 0; i < N; i++) { serie.Points.Add(new object[] { i, "yoyo" }); } // Measure insert Stopwatch chrono = Stopwatch.StartNew(); client.Insert(series); chrono.Stop(); Debug.Write("Insert Elapsed:" + chrono.Elapsed.TotalMilliseconds + " ms" + Environment.NewLine); // Ugly Thread.Sleep(1000); // Give some time to the database to process insert. There must be a better way to do this // Make sure write was succesful List <Serie> result = client.Query("select count(value) from foo"); Assert.AreEqual(N, result[0].Points[0][1]); // Measure query chrono.Restart(); result = client.Query("select * from foo"); chrono.Stop(); Assert.AreEqual(N, result[0].Points.Count); Debug.Write("Query Elapsed:" + chrono.Elapsed.TotalMilliseconds + " ms" + Environment.NewLine); // Clean up client.DeleteDatabase("PerfTests"); }
public void PerformanceTest() { var client = new InfluxDBClient("192.168.1.100", 8086, "root", "root", "PerfTests"); // Create a database for this test List<string> databaseList = client.GetDatabaseList(); if (!databaseList.Contains("PerfTests")) { client.CreateDatabase("PerfTests"); } client.Query("DROP SERIES foo"); // Create var serie = new Serie {Name = "foo", ColumnNames = new[] {"value", "value_str"}}; var series = new List<Serie> {serie}; const int N = 10000; for (int i = 0; i < N; i++) { serie.Points.Add(new object[] {i, "yoyo"}); } // Measure insert Stopwatch chrono = Stopwatch.StartNew(); client.Insert(series); chrono.Stop(); Debug.Write("Insert Elapsed:" + chrono.Elapsed.TotalMilliseconds + " ms" + Environment.NewLine); // Ugly Thread.Sleep(1000); // Give some time to the database to process insert. There must be a better way to do this // Make sure write was succesful List<Serie> result = client.Query("select count(value) from foo"); Assert.AreEqual(N, result[0].Points[0][1]); // Measure query chrono.Restart(); result = client.Query("select * from foo"); chrono.Stop(); Assert.AreEqual(N, result[0].Points.Count); Debug.Write("Query Elapsed:" + chrono.Elapsed.TotalMilliseconds + " ms" + Environment.NewLine); // Clean up client.DeleteDatabase("PerfTests"); }
public void runMe() { var serie = new Serie { ColumnNames = new[] { "full_reported", "hospital_sn", "pending_doctor", "pending_bed", "pending_ward", "pending_icu", "update_time" } }; var series = new List <Serie> { serie }; string info = run_cmd(CMD, "C:/EHNABF/data/" + scrapername, ""); ER_data ER = (ER_data)JsonConvert.DeserializeObject(info, typeof(ER_data)); serie.Name = seriename; serie.Points.Add(new object[] { ER.full_reported, ER.hospital_sn, ER.pending_doctor, ER.pending_bed, ER.pending_ward, ER.pending_icu, ER.update_time }); InfluxDBClient client = new InfluxDBClient("59.126.164.5", 8086, "ERman", "erM12", "twer"); client.Insert(series); //Thread.Sleep(500); Thread.Sleep(500); client.Query("delete from " + seriename + " where time < now() - 35d"); //serie.Points.Clear(); }