function main() { /**************************** * Model specific variables * ****************************/ $noNodes = 0; $noStreams = 0; $tech = APPROX; // EXACT $pop = 0; $think = 0.0; /************************ * Initialize the model * ************************/ /* Give model a name */ printf("**** %s ****:\n", $tech == EXACT ? "EXACT" : "APPROX"); printf("%s\t\t%s\t\t%s\t\t%s\t\t%s\n", "POP", "N:w1", "RESP:w1", "N:w2", "RESP:w2"); printf("-----------------------------------------------------------------------------\n"); for ($pop = 1; $pop < 10; $pop++) { PDQ_Init("Test_Exact_calc"); /* Define the workload and circuit type */ $noStreams = PDQ_CreateClosed("w1", TERM, 1.0 * $pop, $think); $noStreams = PDQ_CreateClosed("w2", TERM, 1.0 * $pop, $think); /* Define the queueing center */ $noNodes = PDQ_CreateNode("node", CEN, FCFS); /* Define service demand */ PDQ_SetDemand("node", "w1", 1.0); PDQ_SetDemand("node", "w2", 0.5); /******************* * Solve the model * *******************/ PDQ_Solve($tech); printf("%d\t\t%d\t\t%3.4f\t\t%d\t\t%3.4f\n", $pop, getjob_pop(getjob_index("w1")), PDQ_GetResponse(TERM, "w1"), getjob_pop(getjob_index("w1")), PDQ_GetResponse(TERM, "w2")); } }
function main() { global $job; /**************************** * Model specific variables * ****************************/ $noNodes = 0; $noStreams = 0; $pop = 0; $servers = 2; $s = 0; $w = HOMEPG; $work = array(0 => "stress", 1 => "homepg"); /* stress */ /* homepg */ $time = array(0 => 0.0044, 1 => 0.03); $slave = array(0 => "slave0", "slave1", "slave2", "slave3", "slave4", "slave5", "slave6", "slave7", "slave8", "slave9", "slave10", "slave11", "slave12", "slave13", "slave14", "slave15"); if (PREFORK) { printf("Pre-Fork Model under \"%s\" Load (m = %d)\n", $w == STRESS ? $work[STRESS] : $work[HOMEPG], $servers); } else { printf("Forking Model under \"%s\" Load \n", $w == STRESS ? $work[STRESS] : $work[HOMEPG]); } printf("N\tX\tR\n"); for ($pop = 1; $pop <= 10; $pop++) { PDQ_Init("HTTPd_Server"); $noStreams = PDQ_CreateClosed($work[$w], TERM, 1.0 * $pop, 0.0); $noNodes = PDQ_CreateNode("master", CEN, FCFS); if (PREFORK) { for ($s = 0; $s < $servers; $s++) { $noNodes = PDQ_CreateNode($slave[$s], CEN, FCFS); } PDQ_SetDemand("master", $work[$w], 0.0109); for ($s = 0; $s < $servers; $s++) { PDQ_SetDemand($slave[$s], $work[$w], $time[$w] / $servers); } } else { /* FORKING */ $noNodes = PDQ_CreateNode("forks", CEN, ISRV); PDQ_SetDemand("master", $work[$w], 0.0165); PDQ_SetDemand("forks", $work[$w], $time[$w]); } PDQ_Solve(EXACT); printf("%3.2f\t%3.4f\t%3.4f\n", getjob_pop(getjob_index($work[$w])), PDQ_GetThruput(TERM, $work[$w]), PDQ_GetResponse(TERM, $work[$w])); } }
function main() { global $job; $model = "Middleware I"; $work = "eBiz-tx"; $node1 = "WebServer"; $node2 = "AppServer"; $node3 = "DBMServer"; $think = 0.0 * 0.001; // treated as free param // Added dummy servers for calibration $node4 = "DummySvr"; // User loads employed in WAS tool ... $noNodes = 0; $noStreams = 0; $users = 0; $u1pdq = array(); // double [MAXUSERS+1]; $u2pdq = array(); // double [MAXUSERS+1]; $u3pdq = array(); // double [MAXUSERS+1]; $u1err = array(); // double [MAXUSERS+1]; $u2err = array(); // double [MAXUSERS+1]; $u3err = array(); // double [MAXUSERS+1]; // Utilization data from the paper ... // In this example the following vectros contain zero value, so on line 106/107/108 can cause division by zero error!! $u1dat = array(0.0, 21.0, 41.0, 0.0, 74.0, 0.0, 0.0, 95.0, 0.0, 0.0, 96.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 96.0); // double [MAXUSERS+1] $u2dat = array(0.0, 8.0, 13.0, 0.0, 20.0, 0.0, 0.0, 23.0, 0.0, 0.0, 22.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 22.0); // double [MAXUSERS+1] $u3dat = array(0.0, 4.0, 5.0, 0.0, 5.0, 0.0, 0.0, 5.0, 0.0, 0.0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0); // double [MAXUSERS+1] // Output header ... printf("\n"); printf("(Tx: \"%s\" for \"%s\")\n\n", $work, $model); printf("Client delay Z=%5.2f mSec. (Assumed)\n\n", $think * 1000.0); printf("%3s\t%6s %6s %6s %6s %6s\n", " N ", " X ", " R ", "%Uws", "%Uas", "%Udb"); printf("%3s\t%6s %6s %6s %6s %6s\n", "---", "------", "------", "------", "------", "------"); for ($users = 1; $users <= MAXUSERS; $users++) { PDQ_Init($model); $noStreams = PDQ_CreateClosed($work, TERM, (double) $users, $think); $noNodes = PDQ_CreateNode($node1, CEN, FCFS); $noNodes = PDQ_CreateNode($node2, CEN, FCFS); $noNodes = PDQ_CreateNode($node3, CEN, FCFS); $noNodes = PDQ_CreateNode($node4, CEN, FCFS); //$noNodes = PDQ_CreateNode($node5, CEN, FCFS); //$noNodes = PDQ_CreateNode($node6, CEN, FCFS); // NOTE: timebase is seconds PDQ_SetDemand($node1, $work, 9.800000000000001 * 0.001); PDQ_SetDemand($node2, $work, 2.5 * 0.001); PDQ_SetDemand($node3, $work, 0.72 * 0.001); // dummy (network) nodes ... PDQ_SetDemand($node4, $work, 9.800000000000001 * 0.001); PDQ_Solve(EXACT); // set up for error analysis of utilzations $u1pdq[$users] = PDQ_GetUtilization($node1, $work, TERM) * 100; $u2pdq[$users] = PDQ_GetUtilization($node2, $work, TERM) * 100; $u3pdq[$users] = PDQ_GetUtilization($node3, $work, TERM) * 100; $u1err[$users] = 100 * ($u1pdq[$users] - $u1dat[$users]) / $u1dat[$users]; // cause division by zero error due to u1dat vector initialization $u2err[$users] = 100 * ($u2pdq[$users] - $u2dat[$users]) / $u2dat[$users]; // cause division by zero error due to u2dat vector initialization $u3err[$users] = 100 * ($u3pdq[$users] - $u3dat[$users]) / $u3dat[$users]; // cause division by zero error due to u3dat vector initialization printf("%3d\t%6.2f %6.2f %6.2f %6.2f %6.2f\n", $users, PDQ_GetThruput(TERM, $work), PDQ_GetResponse(TERM, $work) * 1000.0, $u1pdq[$users], $u2pdq[$users], $u3pdq[$users]); } // for user printf("\nError Analysis of Utilizations\n\n"); printf("%3s\t%12s %12s %12s\n", " ", " WS ", " AS ", " DB "); printf("%3s\t%12s %12s %12s\n", " ", "----------------------", "----------------------", "----------------------"); printf("%3s ", " N "); printf("%6s %6s %6s ", "%Udat", "%Updq", "%Uerr"); printf("%6s %6s %6s ", "%Udat", "%Updq", "%Uerr"); printf("%6s %6s %6s\n", "%Udat", "%Updq", "%Uerr"); printf("%3s ", "---"); printf("%6s %6s %6s ", "-----", "-----", "-----"); printf("%6s %6s %6s ", "-----", "-----", "-----"); printf("%6s %6s %6s\n", "-----", "-----", "-----"); for ($users = 1; $users <= MAXUSERS; $users++) { switch ($users) { case 1: case 2: case 4: case 7: case 10: case 20: printf("%3d\t%5.2f\t%5.2f\t%5.2f", $users, $u1dat[$users], $u1pdq[$users], $u1err[$users]); printf("\t%5.2f\t%5.2f\t%5.2f", $u2dat[$users], $u2pdq[$users], $u2err[$users]); printf("\t%5.2f\t%5.2f\t%5.2f\n", $u3dat[$users], $u3pdq[$users], $u3err[$users]); break; default: break; } } printf("\n"); // Uncomment the following line for a standard PDQ summary. PDQ_Report(); }
function main() { global $job; $noNodes = 0; $noStreams = 0; $users = 0; $delta = 0; $model = "IIS Server"; $work = "http GET 20KB"; $node1 = "CPU"; $node2 = "DSK"; $node3 = "NET"; $node4 = "Dummy"; $think = 1.5 * 0.001; $u2demand = 0.1 * 0.001; $u1pdq = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // array of double [11] $u2pdq = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // array of double [11] $u3pdq = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // array of double [11] $u1err = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // array of double [11] $u2err = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // array of double [11] $u3err = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // array of double [11] // Utilization data from the paper ... $u1dat = array(0.0, 9.0, 14.0, 17.0, 21.0, 24.0, 26.0, 0.0, 0.0, 0.0, 26.0); // this can cause division by zero error $u2dat = array(0.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 0.0, 0.0, 0.0, 2.0); // this can cause division by zero error $u3dat = array(0.0, 26.0, 46.0, 61.0, 74.0, 86.0, 92.0, 0.0, 0.0, 0.0, 94.0); // this can cause division by zero error // Output main header ... printf("\n"); printf("(Tx: \"%s\" for \"%s\")\n\n", $work, $model); printf("Client delay Z=%5.2f mSec. (Assumed)\n\n", $think * 1000.0); printf("%3s\t%6s %6s %6s %6s %6s\n", " N ", " X ", " R ", "%Ucpu", "%Udsk", "%Unet"); printf("%3s\t%6s %6s %6s %6s %6s\n", "---", "------", "------", "------", "------", "------"); for ($users = 1; $users <= 10; $users++) { PDQ_Init($model); $noStreams = PDQ_CreateClosed($work, TERM, (double) $users, $think); $noNodes = PDQ_CreateNode($node1, CEN, FCFS); $noNodes = PDQ_CreateNode($node2, CEN, FCFS); $noNodes = PDQ_CreateNode($node3, CEN, FCFS); $noNodes = PDQ_CreateNode($node4, CEN, FCFS); // NOTE: timebase is seconds PDQ_SetDemand($node1, $work, 0.44 * 0.001); PDQ_SetDemand($node2, $work, $u2demand); /* make load-indept */ PDQ_SetDemand($node3, $work, 1.45 * 0.001); PDQ_SetDemand($node4, $work, 1.6 * 0.001); PDQ_Solve(EXACT); // set up for error analysis of utilzations $u1pdq[$users] = PDQ_GetUtilization($node1, $work, TERM) * 100; $u2pdq[$users] = PDQ_GetUtilization($node2, $work, TERM) * 100; $u3pdq[$users] = PDQ_GetUtilization($node3, $work, TERM) * 100; $u1err[$users] = 100 * ($u1pdq[$users] - $u1dat[$users]) / $u1dat[$users]; // raise division by zero error!! $u2err[$users] = 100 * ($u2pdq[$users] - $u2dat[$users]) / $u2dat[$users]; // raise division by zero error!! $u3err[$users] = 100 * ($u3pdq[$users] - $u3dat[$users]) / $u3dat[$users]; // raise division by zero error!! $u2demand = 0.015 / PDQ_GetThruput(TERM, $work); /* http GETs-per-second */ /* milliseconds */ printf("%3d\t%6.2f %6.2f %6.2f %6.2f %6.2f\n", $users, PDQ_GetThruput(TERM, $work), PDQ_GetResponse(TERM, $work) * 1000.0, $u1pdq[$users], $u2pdq[$users], $u3pdq[$users]); } printf("\nError Analysis of Utilizations\n\n"); printf("%3s\t%12s %12s %12s\n", " ", " CPU ", " DSK ", " NET "); printf("%3s\t%12s %12s %12s\n", " ", "----------------------", "----------------------", "----------------------"); printf("%3s ", " N "); printf("%6s %6s %6s ", "%Udat", "%Updq", "%Uerr"); printf("%6s %6s %6s ", "%Udat", "%Updq", "%Uerr"); printf("%6s %6s %6s\n", "%Udat", "%Updq", "%Uerr"); printf("%3s ", "---"); printf("%6s %6s %6s ", "-----", "-----", "-----"); printf("%6s %6s %6s ", "-----", "-----", "-----"); printf("%6s %6s %6s\n", "-----", "-----", "-----"); for ($users = 1; $users <= 10; $users++) { if ($users <= 6 || $users == 10) { printf("%3d\t%5.2f\t%5.2f\t%5.2f", $users, $u1dat[$users], $u1pdq[$users], $u1err[$users]); printf("\t%5.2f\t%5.2f\t%5.2f", $u2dat[$users], $u2pdq[$users], $u2err[$users]); printf("\t%5.2f\t%5.2f\t%5.2f\n", $u3dat[$users], $u3pdq[$users], $u3err[$users]); } } printf("\n"); }