Skip to content

Commit e79cdb8

Browse files
committed
Fix bug in SockPerf that allows the executable to remain running after the VC scenario completes. Include client request ID in networking workloads for ease-of-correlation between client operations and like server operations.
2 parents 34f9f2b + 6230926 commit e79cdb8

39 files changed

+1297
-952
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.11.4
19+
VcVersion : 1.11.6
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.11.4
21+
VcVersion : 1.11.6
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

src/VirtualClient/VirtualClient.Actions.FunctionalTests/DiskSpdProfileTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public async Task DiskSpdWorkloadProfileExecutesTheExpectedWorkloadsOnWindowsPla
7979
this.mockFixture.ProcessManager.OnCreateProcess = (command, arguments, workingDir) =>
8080
{
8181
IProcessProxy process = this.mockFixture.CreateProcess(command, arguments, workingDir);
82-
if (arguments.Contains("--name=diskspd", StringComparison.OrdinalIgnoreCase))
82+
if (arguments.Contains("diskspd", StringComparison.OrdinalIgnoreCase))
8383
{
8484
process.StandardOutput.Append(TestDependencies.GetResourceFileContents("Results_DiskSpd.txt"));
8585
}

src/VirtualClient/VirtualClient.Actions.FunctionalTests/SpecJvmProfileTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public async Task SpecJvmWorkloadProfileInstallsTheExpectedDependenciesOnLinuxPl
4444
this.mockFixture.Setup(PlatformID.Unix);
4545

4646
// The location of the Java (Java SDK) executable
47-
string expectedJavaExecutablePath = this.mockFixture.GetPackagePath("microsoft-jdk-17.0.5/linux-x64/bin/java");
47+
string expectedJavaExecutablePath = this.mockFixture.GetPackagePath("microsoft-jdk-17.0.9/linux-x64/bin/java");
4848
this.mockFixture.SetupFile(expectedJavaExecutablePath);
4949

5050
using (ProfileExecutor executor = TestDependencies.CreateProfileExecutor(profile, this.mockFixture.Dependencies, dependenciesOnly: true))
@@ -68,7 +68,7 @@ public async Task SpecJvmWorkloadProfileInstallsTheExpectedDependenciesOnWindows
6868
this.mockFixture.Setup(PlatformID.Win32NT);
6969

7070
// The location of the Java (Java SDK) executable
71-
string expectedJavaExecutablePath = this.mockFixture.GetPackagePath(@"microsoft-jdk-17.0.5\win-x64\bin\java.exe");
71+
string expectedJavaExecutablePath = this.mockFixture.GetPackagePath(@"microsoft-jdk-17.0.9\win-x64\bin\java.exe");
7272
this.mockFixture.SetupFile(expectedJavaExecutablePath);
7373

7474
using (ProfileExecutor executor = TestDependencies.CreateProfileExecutor(profile, this.mockFixture.Dependencies, dependenciesOnly: true))

src/VirtualClient/VirtualClient.Actions.FunctionalTests/SysbenchOLTP/SysbenchOLTPClientProfileTests.cs

Lines changed: 94 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ namespace VirtualClient.Actions
1010
using System.Runtime.InteropServices;
1111
using System.Threading;
1212
using System.Threading.Tasks;
13-
using Microsoft.CodeAnalysis.Scripting;
1413
using Moq;
1514
using NUnit.Framework;
1615
using VirtualClient.Common;
16+
using VirtualClient.Common.Contracts;
1717
using VirtualClient.Contracts;
18+
using static VirtualClient.Actions.SysbenchOLTPExecutor;
1819

1920
[TestFixture]
2021
[Category("Functional")]
@@ -54,8 +55,13 @@ public void SysbenchOLTPWorkloadProfileActionsWillNotBeExecutedIfTheWorkloadPack
5455
[TestCase("PERF-MYSQL-SYSBENCH-OLTP.json", PlatformID.Unix, Architecture.X64)]
5556
public async Task SysbenchOLTPWorkloadProfileExecutesTheExpectedWorkloadsOnUnixPlatform(string profile, PlatformID platform, Architecture architecture)
5657
{
57-
IEnumerable<string> expectedCommands = this.GetProfileExpectedCommands(platform, architecture);
58+
IEnumerable<string> expectedCommands = this.GetProfileExpectedCommands(singleVM: false);
5859
this.SetupDefaultMockBehaviors(platform, architecture);
60+
61+
this.mockFixture.Setup(PlatformID.Unix, architecture, this.clientAgentId).SetupLayout(
62+
new ClientInstance(this.clientAgentId, "1.2.3.4", "Client"),
63+
new ClientInstance(this.serverAgentId, "1.2.3.5", "Server"));
64+
5965
this.SetupApiClient(this.serverAgentId, serverIPAddress: "1.2.3.5");
6066

6167
string scriptPath = this.mockFixture.PlatformSpecifics.GetScriptPath("sysbencholtp");
@@ -86,44 +92,106 @@ public async Task SysbenchOLTPWorkloadProfileExecutesTheExpectedWorkloadsOnUnixP
8692
}
8793
}
8894

89-
private IEnumerable<string> GetProfileExpectedCommands(PlatformID platform, Architecture architecture)
95+
[Test]
96+
[TestCase("PERF-MYSQL-SYSBENCH-OLTP.json", PlatformID.Unix, Architecture.X64)]
97+
public async Task SysbenchOLTPWorkloadProfileExecutesTheExpectedWorkloadsOnSingleVMUnixPlatform(string profile, PlatformID platform, Architecture architecture)
9098
{
91-
return new List<string>()
99+
IEnumerable<string> expectedCommands = this.GetProfileExpectedCommands(singleVM: true);
100+
this.SetupDefaultMockBehaviors(platform, architecture);
101+
102+
this.mockFixture.Setup(PlatformID.Unix, architecture, this.clientAgentId).SetupLayout(
103+
new ClientInstance(this.serverAgentId, "1.2.3.5", "Server"));
104+
105+
this.SetupApiClient(this.serverAgentId, serverIPAddress: "1.2.3.5");
106+
107+
string scriptPath = this.mockFixture.PlatformSpecifics.GetScriptPath("sysbencholtp");
108+
109+
string balancedClientScript = this.mockFixture.PlatformSpecifics.Combine(scriptPath, "balanced-client.sh");
110+
string balancedServerScript = this.mockFixture.PlatformSpecifics.Combine(scriptPath, "balanced-server.sh");
111+
string inMemoryScript = this.mockFixture.PlatformSpecifics.Combine(scriptPath, "in-memory.sh");
112+
113+
this.mockFixture.SetupFile(balancedServerScript);
114+
this.mockFixture.SetupFile(balancedClientScript);
115+
this.mockFixture.SetupFile(inMemoryScript);
116+
117+
this.mockFixture.ProcessManager.OnCreateProcess = (command, arguments, workingDir) =>
92118
{
93-
"git clone https://github.com/akopytov/sysbench.git /home/user/tools/VirtualClient/packages/sysbench",
94-
95-
"sudo ./autogen.sh",
96-
"sudo ./configure",
97-
"sudo make -j",
98-
"sudo make install",
99-
100-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_write --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 cleanup",
101-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_common --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 prepare",
102-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_write --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
103-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_only --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
104-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_delete --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
105-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_insert --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
106-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_update_index --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
107-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_update_non_index --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
108-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench select_random_points --threads=64 --tables=1 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
109-
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench select_random_ranges --threads=64 --tables=1 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run"
119+
IProcessProxy process = this.mockFixture.CreateProcess(command, arguments, workingDir);
120+
if (arguments.Contains("run", StringComparison.OrdinalIgnoreCase))
121+
{
122+
process.StandardOutput.Append(TestDependencies.GetResourceFileContents("Results_SysbenchOLTP.txt"));
123+
}
124+
125+
return process;
110126
};
127+
128+
using (ProfileExecutor executor = TestDependencies.CreateProfileExecutor(profile, this.mockFixture.Dependencies))
129+
{
130+
await executor.ExecuteAsync(ProfileTiming.OneIteration(), CancellationToken.None).ConfigureAwait(false);
131+
WorkloadAssert.CommandsExecuted(this.mockFixture, expectedCommands.ToArray());
132+
}
133+
}
134+
135+
private IEnumerable<string> GetProfileExpectedCommands(bool singleVM)
136+
{
137+
if (singleVM)
138+
{
139+
return new List<string>()
140+
{
141+
"git clone https://github.com/akopytov/sysbench.git /home/user/tools/VirtualClient/packages/sysbench",
142+
143+
"sudo ./autogen.sh",
144+
"sudo ./configure",
145+
"sudo make -j",
146+
"sudo make install",
147+
148+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_write --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 --time=1200 cleanup",
149+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_common --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 prepare",
150+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_write --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 --time=1200 run",
151+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_only --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 --time=1200 run",
152+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_delete --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 --time=1200 run",
153+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_insert --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 --time=1200 run",
154+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_update_index --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 --time=1200 run",
155+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_update_non_index --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 --time=1200 run",
156+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench select_random_points --threads=64 --tables=1 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 --time=1200 run",
157+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench select_random_ranges --threads=64 --tables=1 --table-size=10000 --mysql-db=sbtest --mysql-host=127.0.0.1 --time=1200 run"
158+
};
159+
}
160+
else
161+
{
162+
return new List<string>()
163+
{
164+
"git clone https://github.com/akopytov/sysbench.git /home/user/tools/VirtualClient/packages/sysbench",
165+
166+
"sudo ./autogen.sh",
167+
"sudo ./configure",
168+
"sudo make -j",
169+
"sudo make install",
170+
171+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_write --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 cleanup",
172+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_common --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 prepare",
173+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_write --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
174+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_only --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
175+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_delete --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
176+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_insert --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
177+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_update_index --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
178+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_update_non_index --threads=64 --tables=10 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
179+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench select_random_points --threads=64 --tables=1 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run",
180+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench select_random_ranges --threads=64 --tables=1 --table-size=10000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=1200 run"
181+
};
182+
}
111183
}
112184

113185
private void SetupApiClient(string serverName, string serverIPAddress)
114186
{
115187
IPAddress.TryParse(serverIPAddress, out IPAddress ipAddress);
116-
IApiClient apiClient = this.mockFixture.ApiClientManager.GetOrCreateApiClient(serverName, ipAddress);
188+
IApiClient apiClient = this.mockFixture.ApiClientManager.GetOrCreateApiClient(serverIPAddress, ipAddress);
117189
}
118190

119191
private void SetupDefaultMockBehaviors(PlatformID platform, Architecture architecture)
120192
{
121193
this.mockFixture.Setup(platform, architecture);
122194
this.mockFixture.SetupWorkloadPackage("sysbench", expectedFiles: "sysbench");
123-
this.mockFixture.Setup(PlatformID.Unix, architecture, this.clientAgentId).SetupLayout(
124-
new ClientInstance(this.clientAgentId, "1.2.3.4", "Client"),
125-
new ClientInstance(this.serverAgentId, "1.2.3.5", "Server"));
126-
127195
this.mockFixture.SystemManagement.Setup(mgr => mgr.GetCpuInfoAsync(It.IsAny<CancellationToken>()))
128196
.ReturnsAsync(new CpuInfo("cpu", "description", 4, 8, 4, 4, false));
129197
}

src/VirtualClient/VirtualClient.Actions.FunctionalTests/VirtualClient.Actions.FunctionalTests.csproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@
7777
<Content Include="..\TestResources\Results_MLPerf_Harness_Summary.json" Link="Resources\Results_MLPerf_Harness_Summary.json">
7878
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
7979
</Content>
80-
<Content Include="..\TestResources\Results_Postgresql.txt" Link="Resources\Results_Postgresql.txt">
81-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
82-
</Content>
80+
<Content Include="..\TestResources\Results_Postgresql.txt" Link="Resources\Results_Postgresql.txt">
81+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
82+
</Content>
8383
<Content Include="..\TestResources\Results_Prime95.txt" Link="Resources\Results_Prime95.txt">
8484
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8585
</Content>
@@ -146,7 +146,7 @@
146146
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
147147
</Content>
148148
<Content Include="..\VirtualClient.Main\profiles\PERF-CPU-HPLINPACK.json" Link="Profiles\PERF-CPU-HPLINPACK.json">
149-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
149+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
150150
</Content>
151151
<Content Include="..\VirtualClient.Main\profiles\PERF-CPU-LAPACK.json" Link="Profiles\PERF-CPU-LAPACK.json">
152152
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -169,9 +169,9 @@
169169
<Content Include="..\VirtualClient.Main\profiles\PERF-OPENFOAM.json" Link="Profiles\PERF-OPENFOAM.json">
170170
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
171171
</Content>
172-
<Content Include="..\VirtualClient.Main\profiles\PERF-SQL-POSTGRESQL.json" Link="Profiles\PERF-SQL-POSTGRESQL.json">
173-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
174-
</Content>
172+
<Content Include="..\VirtualClient.Main\profiles\PERF-SQL-POSTGRESQL.json" Link="Profiles\PERF-SQL-POSTGRESQL.json">
173+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
174+
</Content>
175175
<Content Include="..\VirtualClient.Main\profiles\PERF-STRESSNG.json" Link="Profiles\PERF-STRESSNG.json">
176176
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
177177
</Content>
@@ -203,8 +203,8 @@
203203
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
204204
</Content>
205205
<Content Include="..\VirtualClient.Main\profiles\PERF-MYSQL-SYSBENCH-OLTP.json" Link="Profiles\PERF-MYSQL-SYSBENCH-OLTP.json">
206-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
207-
</Content>
206+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
207+
</Content>
208208
<Content Include="..\VirtualClient.Main\profiles\PERF-NETWORK-DEATHSTARBENCH.json" Link="Profiles\PERF-NETWORK-DEATHSTARBENCH.json">
209209
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
210210
</Content>

src/VirtualClient/VirtualClient.Actions.UnitTests/DiskSpd/DiskSpdExecutorTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ namespace VirtualClient.Actions.DiskPerformance
88
using System.Diagnostics;
99
using System.IO;
1010
using System.Linq;
11+
using System.Reflection;
1112
using System.Threading;
1213
using System.Threading.Tasks;
1314
using Microsoft.Extensions.DependencyInjection;
1415
using NUnit.Framework;
1516
using Polly;
17+
using VirtualClient.Common;
1618
using VirtualClient.Common.Telemetry;
1719
using VirtualClient.Contracts;
1820

@@ -23,6 +25,7 @@ public class DiskSpdExecutorTests
2325
private DependencyFixture fixture;
2426
private Dictionary<string, IConvertible> profileParameters;
2527
private IEnumerable<Disk> disks;
28+
private string output;
2629

2730
[SetUp]
2831
public void SetupDefaultBehavior()
@@ -41,6 +44,18 @@ public void SetupDefaultBehavior()
4144
{ nameof(DiskSpdExecutor.ProcessModel), WorkloadProcessModel.SingleProcess },
4245
{ nameof(DiskSpdExecutor.TestName), "diskspd_randwrite_4GB_direct" }
4346
};
47+
48+
string workingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
49+
string outputPath = Path.Combine(workingDirectory, @"Examples\DiskSpd\DiskSpdExample-ReadWrite.txt");
50+
this.output = File.ReadAllText(outputPath);
51+
52+
this.fixture.ProcessManager.OnCreateProcess = (command, arguments, workingDir) =>
53+
{
54+
IProcessProxy process = this.fixture.CreateProcess(command, arguments, workingDir);
55+
process.StandardOutput.Append(this.output);
56+
57+
return process;
58+
};
4459
}
4560

4661
[Test]
@@ -301,6 +316,9 @@ public async Task DiskSpdExecutorExecutesExpectedProcesses()
301316
OnHasExited = () => true
302317
};
303318

319+
process1.StandardOutput.Append(this.output);
320+
process2.StandardOutput.Append(this.output);
321+
304322
List<DiskWorkloadProcess> expectedWorkloads = new List<DiskWorkloadProcess>
305323
{
306324
new DiskWorkloadProcess(process1, "anyTestedInstance", "D:\\any\file.dat"),

0 commit comments

Comments
 (0)