Skip to content

Commit 3c5acb4

Browse files
ericavellaErica Vellanoweth
andauthored
sysbench thread count has ceiling -- protecting against failures for vms with high cpu count (#237)
Co-authored-by: Erica Vellanoweth <[email protected]>
1 parent 1427070 commit 3c5acb4

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

src/VirtualClient/VirtualClient.Actions.UnitTests/SysbenchOLTP/SysbenchOLTPClientExecutorTests.cs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,70 @@ public async Task SysbenchOLTPClientExecutorUsesDefinedParameters()
372372
}
373373
}
374374

375+
[Test]
376+
public async Task SysbenchOLTPClientExecutorUsesThreadCeilingForHighCoreCount()
377+
{
378+
SetupDefaultBehavior();
379+
380+
this.mockFixture.SystemManagement.Setup(mgr => mgr.GetCpuInfoAsync(It.IsAny<CancellationToken>()))
381+
.ReturnsAsync(new CpuInfo("cpu", "description", 4, 16, 4, 4, false));
382+
383+
this.mockFixture.StateManager.OnGetState().ReturnsAsync(JObject.FromObject(new SysbenchOLTPExecutor.SysbenchOLTPState()
384+
{
385+
SysbenchInitialized = false
386+
}));
387+
388+
string[] expectedCommands =
389+
{
390+
"sudo ./autogen.sh",
391+
"sudo ./configure",
392+
"sudo make -j",
393+
"sudo make install",
394+
$"sudo mysql -u sbtest -h 1.2.3.5 sbtest --execute=\"USE sbtest; SHOW tables; SELECT FOUND_ROWS();\"",
395+
$"sudo mysql -u sbtest -h 1.2.3.5 sbtest --execute=\"USE sbtest; SELECT COUNT(*) FROM sbtest1;\"",
396+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_write --threads=64 --tables=10 --table-size=1000000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=10 cleanup",
397+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_common --tables=10 --table-size=1000000 --mysql-db=sbtest --mysql-host=1.2.3.5 prepare",
398+
$"sudo /home/user/tools/VirtualClient/packages/sysbench/src/sysbench oltp_read_write --threads=64 --tables=10 --table-size=1000000 --mysql-db=sbtest --mysql-host=1.2.3.5 --time=10 run"
399+
};
400+
401+
int commandNumber = 0;
402+
bool commandExecuted = false;
403+
this.mockFixture.ProcessManager.OnCreateProcess = (exe, arguments, workingDir) =>
404+
{
405+
406+
string expectedCommand = expectedCommands[commandNumber];
407+
if (expectedCommand == $"{exe} {arguments}")
408+
{
409+
commandExecuted = true;
410+
}
411+
Assert.IsTrue(commandExecuted);
412+
commandExecuted = false;
413+
commandNumber += 1;
414+
415+
InMemoryProcess process = new InMemoryProcess
416+
{
417+
StartInfo = new ProcessStartInfo
418+
{
419+
FileName = exe,
420+
Arguments = arguments
421+
},
422+
ExitCode = 0,
423+
OnStart = () => true,
424+
OnHasExited = () => true
425+
};
426+
427+
string resultsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Examples", "SysbenchOLTP", "SysbenchOLTPExample.txt");
428+
process.StandardOutput.Append(File.ReadAllText(resultsPath));
429+
430+
return process;
431+
};
432+
433+
using (TestSysbenchOLTPClientExecutor SysbenchExecutor = new TestSysbenchOLTPClientExecutor(this.mockFixture.Dependencies, this.mockFixture.Parameters))
434+
{
435+
await SysbenchExecutor.ExecuteAsync(CancellationToken.None);
436+
}
437+
}
438+
375439
[Test]
376440
public async Task SysbenchOLTPClientExecutorRunsTheExpectedWorkloadCommandBalancedScenario()
377441
{

src/VirtualClient/VirtualClient.Actions/SysbenchOLTP/SysbenchOLTPClientExecutor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ public int Threads
158158
numThreads = threads.ToInt32(CultureInfo.InvariantCulture);
159159
}
160160

161+
numThreads = Math.Min(numThreads, 64);
162+
161163
return numThreads;
162164
}
163165
}

website/docs/workloads/sysbench-oltp/sysbench-oltp-profiles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Runs a system-intensive workload using the Sysbench Benchmark to test the bandwi
113113
|---------------------------|-------------------------------------------------------------------------------------------------------------------------|-------------|
114114
| DatabaseName | Not Required. Configure the name of database under test. |sbtest |
115115
| DatabaseScenario | Not Required. Configures the scenario in which to stress the database. | Default |
116-
| Threads | Not Required. Number of threads to use during workload execution. | vCPU * 8 |
116+
| Threads | Not Required. Number of threads to use during workload execution. | vCPU * 8, max 64 |
117117
| RecordCount | Not Required. Number of records per table in the database. | 10^(vCPU + 2) |
118118
| NumTables | Not Required. Number of tables created in the database. | 10 |
119119
| Duration | Required. Timespan duration of the workload. | N/A |

0 commit comments

Comments
 (0)