VBOX: Introduce a random checkpoint offset value on initial start up to interleave the disk I/O when multiple vboxwrappers are running.

This commit is contained in:
Rom Walton 2014-04-05 14:28:33 -04:00
parent d9229aabe5
commit 1a744614b6
2 changed files with 34 additions and 13 deletions

View File

@ -372,6 +372,7 @@ int main(int argc, char** argv) {
BOINC_OPTIONS boinc_options;
VBOX_VM vm;
APP_INIT_DATA aid;
double random_checkpoint_factor = 0;
double elapsed_time = 0;
double trickle_period = 0;
double fraction_done = 0;
@ -432,6 +433,29 @@ int main(int argc, char** argv) {
// Log important information
//
// Choose a random interleave value for checkpoint intervals to stagger disk I/O.
//
random_checkpoint_factor = (double)(((int)(drand() * 100000.0)) % 600);
fprintf(
stderr,
"%s Feature: Checkpoint interval offset (%f seconds)\n",
vboxwrapper_msg_prefix(buf, sizeof(buf)),
random_checkpoint_factor
);
// Display trickle value if specified
//
if (trickle_period > 0.0) {
fprintf(
stderr,
"%s Feature: Enabling trickle-ups (Interval: %f)\n",
vboxwrapper_msg_prefix(buf, sizeof(buf)), trickle_period
);
}
// Initialize system services
//
#if defined(_WIN32) && defined(USE_WINSOCK)
WSADATA wsdata;
retval = WSAStartup( MAKEWORD( 1, 1 ), &wsdata);
@ -446,14 +470,6 @@ int main(int argc, char** argv) {
}
#endif
if (trickle_period > 0.0) {
fprintf(
stderr,
"%s Feature: Enabling trickle-ups (Interval: %f)\n",
vboxwrapper_msg_prefix(buf, sizeof(buf)), trickle_period
);
}
// Check for architecture incompatibilities
//
#if defined(_WIN32) && defined(_M_IX86)
@ -973,7 +989,12 @@ int main(int argc, char** argv) {
if (boinc_time_to_checkpoint()) {
// Only peform a VM checkpoint every ten minutes or so.
//
if (elapsed_time >= checkpoint_cpu_time + 600.0) {
if (elapsed_time >= checkpoint_cpu_time + random_checkpoint_factor + 600.0) {
// Basic interleave factor is only needed once.
if (random_checkpoint_factor > 0) {
random_checkpoint_factor = 0.0;
}
// Basic bookkeeping
if (vm.job_duration) {
fraction_done = elapsed_time / vm.job_duration;

View File

@ -128,12 +128,12 @@
</ResourceCompile>
<Link>
<AdditionalDependencies>libcmt.lib;libcpmt.lib;kernel32.lib;user32.lib;gdi32.lib;ole32.lib;wsock32.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26073_windows_intelx86.exe</OutputFile>
<OutputFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26077_windows_intelx86.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26073_windows_intelx86.pdb</ProgramDatabaseFile>
<ProgramDatabaseFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26077_windows_intelx86.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
@ -177,12 +177,12 @@
</ResourceCompile>
<Link>
<AdditionalDependencies>libcmt.lib;libcpmt.lib;kernel32.lib;user32.lib;gdi32.lib;ole32.lib;wsock32.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26073_windows_x86_64.exe</OutputFile>
<OutputFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26077_windows_x86_64.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26073_windows_x86_64.pdb</ProgramDatabaseFile>
<ProgramDatabaseFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26077_windows_x86_64.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>