Skip to content

Commit 1cf4fcd

Browse files
authored
Users/nmalkapuram/memtier parser bug (#227)
* parser update for general output of memtier * updating version
1 parent 3d7acc8 commit 1cf4fcd

File tree

6 files changed

+64
-14
lines changed

6 files changed

+64
-14
lines changed

.pipelines/azure-pipelines-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ resources:
1616
options: --entrypoint=""
1717

1818
variables:
19-
VcVersion : 1.13.7
19+
VcVersion : 1.13.8
2020
ROOT: $(Build.SourcesDirectory)
2121
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
2222
ENABLE_PRS_DELAYSIGN: 1

.pipelines/azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pool:
1818
vmImage: windows-latest
1919

2020
variables:
21-
VcVersion : 1.13.7
21+
VcVersion : 1.13.8
2222
ROOT: $(Build.SourcesDirectory)
2323
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
2424
ENABLE_PRS_DELAYSIGN: 1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
3 Threads
2+
1 Connections per thread
3+
120 Seconds
4+
5+
6+
ALL STATS
7+
============================================================================================================================================================
8+
Type Ops/sec Hits/sec Misses/sec Avg. Latency p50 Latency p90 Latency p95 Latency p99 Latency p99.9 Latency KB/sec
9+
------------------------------------------------------------------------------------------------------------------------------------------------------------
10+
Sets 39687.53 --- --- 1.44784 1.35900 2.46300 3.00700 4.57500 8.70300 50661.28
11+
Gets 92604.15 92604.15 0.00 1.44246 1.35900 2.46300 2.99100 4.57500 8.70300 117368.48
12+
Waits 0.00 --- --- --- --- --- --- --- --- ---
13+
Totals 132291.67 92604.15 0.00 1.44408 1.35900 2.46300 2.99100 4.57500 8.70300 168029.76

src/VirtualClient/VirtualClient.Actions.UnitTests/Memtier/MemtierMetricsParserTests.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,48 @@ public void MemtierMetricsParserParsesTheExpectedMetricsFromRedisResultsCorrectl
386386
MetricAssert.Exists(metrics, "SET_Latency-P99.9_Avg", 1.54300, MetricUnit.Milliseconds);
387387
}
388388

389+
[Test]
390+
public void MemtierMetricsParserParsesTheExpectedMetricsFromRedisResultsCorrectly_4()
391+
{
392+
List<string> resultsList = new List<string>();
393+
string results = File.ReadAllText(Path.Combine(MockFixture.ExamplesDirectory, @"Memtier\RedisResults_4.txt"));
394+
resultsList.Add(results);
395+
var parser = new MemtierMetricsParser(false, resultsList);
396+
397+
IList<Metric> metrics = parser.Parse();
398+
399+
Assert.AreEqual(138, metrics.Count);
400+
401+
MetricAssert.Exists(metrics, "Throughput_Avg", 132291.67, MetricUnit.RequestsPerSec);
402+
MetricAssert.Exists(metrics, "Bandwidth_Avg", 168029.76, MetricUnit.KilobytesPerSecond);
403+
MetricAssert.Exists(metrics, "Hits/sec_Avg", 92604.15);
404+
MetricAssert.Exists(metrics, "Misses/sec_Avg", 0);
405+
MetricAssert.Exists(metrics, "Latency-Avg_Avg", 1.44408, MetricUnit.Milliseconds);
406+
MetricAssert.Exists(metrics, "Latency-P50_Avg", 1.359, MetricUnit.Milliseconds);
407+
MetricAssert.Exists(metrics, "Latency-P90_Avg", 2.463, MetricUnit.Milliseconds);
408+
MetricAssert.Exists(metrics, "Latency-P95_Avg", 2.991, MetricUnit.Milliseconds);
409+
MetricAssert.Exists(metrics, "Latency-P99_Avg", 4.575, MetricUnit.Milliseconds);
410+
MetricAssert.Exists(metrics, "Latency-P99.9_Avg", 8.703, MetricUnit.Milliseconds);
411+
412+
MetricAssert.Exists(metrics, "GET_Throughput_Avg", 92604.15, MetricUnit.RequestsPerSec);
413+
MetricAssert.Exists(metrics, "GET_Bandwidth_Avg", 117368.48, MetricUnit.KilobytesPerSecond);
414+
MetricAssert.Exists(metrics, "GET_Latency-Avg_Avg", 1.44246, MetricUnit.Milliseconds);
415+
MetricAssert.Exists(metrics, "GET_Latency-P50_Avg", 1.359, MetricUnit.Milliseconds);
416+
MetricAssert.Exists(metrics, "GET_Latency-P90_Avg", 2.463, MetricUnit.Milliseconds);
417+
MetricAssert.Exists(metrics, "GET_Latency-P95_Avg", 2.991, MetricUnit.Milliseconds);
418+
MetricAssert.Exists(metrics, "GET_Latency-P99_Avg", 4.575, MetricUnit.Milliseconds);
419+
MetricAssert.Exists(metrics, "GET_Latency-P99.9_Avg", 8.703, MetricUnit.Milliseconds);
420+
421+
MetricAssert.Exists(metrics, "SET_Throughput_Avg", 39687.53, MetricUnit.RequestsPerSec);
422+
MetricAssert.Exists(metrics, "SET_Bandwidth_Avg", 50661.28, MetricUnit.KilobytesPerSecond);
423+
MetricAssert.Exists(metrics, "SET_Latency-Avg_Avg", 1.44784, MetricUnit.Milliseconds);
424+
MetricAssert.Exists(metrics, "SET_Latency-P50_Avg", 1.359, MetricUnit.Milliseconds);
425+
MetricAssert.Exists(metrics, "SET_Latency-P90_Avg", 2.463, MetricUnit.Milliseconds);
426+
MetricAssert.Exists(metrics, "SET_Latency-P95_Avg", 3.007, MetricUnit.Milliseconds);
427+
MetricAssert.Exists(metrics, "SET_Latency-P99_Avg", 4.575, MetricUnit.Milliseconds);
428+
MetricAssert.Exists(metrics, "SET_Latency-P99.9_Avg", 8.703, MetricUnit.Milliseconds);
429+
}
430+
389431
[Test]
390432
public void MemtierMetricsParserParsesTheExpectedMetricsFromRedisForMoreThan1RedisServerInstancesResultsCorrectly_1()
391433
{

src/VirtualClient/VirtualClient.Actions/Memtier/MemtierBenchmarkClientExecutor.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class MemtierBenchmarkClientExecutor : MemcachedExecutor
3737
private List<Metric> aggregatedMetrics;
3838
private List<string> perProcessOutputList;
3939
private List<string> perProcessCommandList;
40+
private string commonAggregateMetricCommandArguments;
4041
private int startingServerPort;
4142

4243
/// <summary>
@@ -347,6 +348,7 @@ private void CaptureMetrics(DateTime startTime, DateTime endTime, EventContext t
347348

348349
MemtierMetricsParser memtierMetricsAggregateParser = new MemtierMetricsParser(this.PerProcessMetric, this.perProcessOutputList, this.perProcessCommandList);
349350
IList<Metric> metrics = memtierMetricsAggregateParser.Parse();
351+
350352
string commandline = "commandline";
351353

352354
foreach (Metric metric in metrics)
@@ -360,7 +362,7 @@ private void CaptureMetrics(DateTime startTime, DateTime endTime, EventContext t
360362
metric.Value,
361363
metric.Unit,
362364
null,
363-
metric.Metadata.ContainsKey(commandline) ? (string)metric.Metadata[commandline] : null,
365+
metric.Metadata.ContainsKey(commandline) ? (string)metric.Metadata[commandline] : this.commonAggregateMetricCommandArguments,
364366
this.Tags,
365367
telemetryContext,
366368
metric.Relativity);
@@ -429,11 +431,6 @@ private Task ExecuteWorkloadsAsync(IPAddress serverIPAddress, ServerState server
429431

430432
if (!this.WarmUp)
431433
{
432-
foreach (string output in this.perProcessOutputList)
433-
{
434-
Console.WriteLine($"output is : {output}");
435-
}
436-
437434
this.CaptureMetrics(startTime, endTime, telemetryContext, cancellationToken);
438435
}
439436
}
@@ -473,7 +470,8 @@ private async Task ExecuteWorkloadAsync(int serverPort, string command, string c
473470
if (!this.WarmUp)
474471
{
475472
string output = process.StandardOutput.ToString();
476-
string parsedCommandArguments = this.ParseCommand(process.FullCommand(), serverPort);
473+
this.commonAggregateMetricCommandArguments = this.ParseCommand(process.FullCommand());
474+
string parsedCommandArguments = (this.commonAggregateMetricCommandArguments + @$" --VCpuID {serverPort - this.startingServerPort}").Trim();
477475
this.perProcessOutputList.Add(output);
478476
this.perProcessCommandList.Add(parsedCommandArguments);
479477
}
@@ -522,7 +520,7 @@ private async Task<ServerState> GetServerStateAsync(IApiClient serverApiClient,
522520
return state.Definition;
523521
}
524522

525-
private string ParseCommand(string command, int serverPort)
523+
private string ParseCommand(string command)
526524
{
527525
List<string> excludingRegexList = new List<string>
528526
{
@@ -543,7 +541,6 @@ private string ParseCommand(string command, int serverPort)
543541

544542
command = Regex.Replace(command, @"\s+", " "); // Removes extra spaces
545543

546-
command += @$" --VCpuID {serverPort - this.startingServerPort}";
547544
return command.Trim();
548545
}
549546
}

src/VirtualClient/VirtualClient.Actions/Memtier/MemtierMetricsParser.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class MemtierMetricsParser : MetricsParser
2929
// Totals 48271.29 43444.12 0.00 2.62213 2.75100 3.90300 4.41500 7.42300 29.31100 4053.46
3030
private static readonly Regex GetsExpression = new Regex(@"(?<=Gets).*(?=\n)", RegexOptions.IgnoreCase);
3131
private static readonly Regex SetsExpression = new Regex(@"(?<=Sets).*(?=\n)", RegexOptions.IgnoreCase);
32-
private static readonly Regex TotalsExpression = new Regex(@"(?<=Totals).*(?=\n)", RegexOptions.IgnoreCase);
32+
private static readonly Regex TotalsExpression = new Regex(@"(?<=Totals).*", RegexOptions.IgnoreCase);
3333

3434
private bool perProcessMetric = false;
3535
private List<string> memtierCommandLines = new List<string>();
@@ -54,11 +54,9 @@ public override IList<Metric> Parse()
5454
List<Metric> combinedMetrics = new List<Metric>();
5555
List<string> rawTextList = this.RawText.Split(ProcessResultSectionDelimiter).Select(s => s.Trim()).ToList();
5656

57-
Console.WriteLine($"rawTextListLength: {rawTextList.Count}");
5857
for (int i = 0; i < rawTextList.Count; i++)
5958
{
6059
string rawText = rawTextList[i];
61-
Console.WriteLine($"rawText {i}: {rawText}");
6260
// Example Format:
6361
//
6462
// ALL STATS

0 commit comments

Comments
 (0)