Ejemplo n.º 1
0
}
// now we loop on each config
// and take stats on the distribution
// and data movement
$configs = makeConfigs(1, 39);
$totalConfs = count($configs);
$timings = array();
require_once 'PHPDFS/DataLocator/HonickyMillerR.php';
for ($n = 0; $n < $totalConfs; $n++) {
    echo "processing conf {$n} with " . count($configs[$n]['clusters']) . " clusters.\n";
    $totalTime = 0;
    $hm = new PHPDFS_DataLocator_HonickyMillerR($configs[$n]);
    foreach ($objs as $objId => $obj) {
        $objKey = $obj['objKey'];
        $time = microtime(1);
        $hm->findNode($objKey);
        $time2 = microtime(1);
        $totalTime += $time2 - $time;
    }
    $timings[$n] = $totalTime / $totalObjs;
    echo "avgtime:" . $timings[$n] . "\n";
}
print_r($timings);
function makeConfigs($numConfigs = 1, $subClusters = 1)
{
    $configs = array();
    $replicationDegree = 3;
    for ($num = 0; $num < $numConfigs; $num++) {
        $configs[$num] = array('replicationDegree' => $replicationDegree, 'clusters' => array());
        $weight = 1;
        $disk = 1;
Ejemplo n.º 2
0
     // track replica distribution
     // for a failed disk
     foreach ($disks as $diskNo) {
         if ($diskNo != $disk) {
             if (!isset($confStats['stats']['failed'][$diskNo])) {
                 $confStats['stats']['failed'][$diskNo] = 0;
             }
             $confStats['stats']['failed'][$diskNo]++;
         }
     }
 }
 // figure out if this object is being moved
 // something can only be moved if the curr config is greater than 0
 $prevDisk = null;
 if ($currConfig > 0) {
     $prevDisk = $hmPrev->findNode($objKey, $replica);
     if ($prevDisk == $disk) {
         $prevDisk = null;
     }
 }
 //  now set the stats for the buckets
 if (!isset($confStats['stats']['dist'][$disk])) {
     $confStats['stats']['dist'][$disk] = 0;
 }
 $confStats['stats']['dist'][$disk]++;
 if ($prevDisk !== null) {
     if (!isset($confStats['stats']['moved']['from'][$prevDisk])) {
         $confStats['stats']['moved']['from'][$prevDisk] = 0;
     }
     $confStats['stats']['moved']['from'][$prevDisk]++;
     if (!isset($confStats['stats']['moved']['to'][$disk])) {