Exemple #1
0
    // we would just use the UUID but this
    // gets passed to srand which needs an int
    $objKey = crc32($objId) >> 16 & 0x7fff;
    $objs[$objId] = array('objKey' => $objKey);
}
// 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;
Exemple #2
0
require_once 'PHPDFS/DataLocator/HonickyMillerR.php';
foreach ($bucketConfs as $currConfig => &$confStats) {
    $hm = new PHPDFS_DataLocator_HonickyMillerR($configs['data'][$currConfig]);
    echo $hm->getTotalNodes() . "\n" . $failedDiskArg . "\n";
    $failedDisk = $failedDiskArg;
    if ($failedDiskArg > $hm->getTotalNodes()) {
        $failedDisk = $hm->getTotalNodes();
    } else {
        if ($failedDiskArg < 0) {
            $failedDisk = 0;
        }
    }
    $confStats['stats']['failedDisk'] = $failedDisk;
    if ($currConfig > 0) {
        // make the locator for the previous config
        $hmPrev = new PHPDFS_DataLocator_HonickyMillerR($configs['data'][$currConfig - 1]);
    }
    foreach ($objs as $objId => $obj) {
        $objKey = $obj['objKey'];
        $disks = $hm->findNodes($objKey);
        $replicaCt = count($disks);
        for ($replica = 0; $replica < $replicaCt; $replica++) {
            $disk = $disks[$replica];
            if ($failedDisk == $disk) {
                // 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;
                        }