Exemple #1
0
    $success = false;
}
// write 10k messages to category foodoo (handled by prefix store)
print "test writing 10k messages to category foodoo\n";
stress_test('foodoo', 'client1', 10000, 10000, 20, 100, 1);
sleep(5);
$results = resultChecker('/tmp/scribetest_/foo', 'foo-', 'client1');
if ($results["count"] != 10000 || $results["out_of_order"] != 0) {
    $success = false;
}
// write 10k messages to category rock (handled by categories prefix store)
print "test writing 100k messages to category rock\n";
stress_test('rock', 'client1', 100, 10000, 20, 100, 1);
sleep(5);
$results = resultChecker('/tmp/scribetest_/rockpaper', 'rockpaper-', 'client1');
if ($results["count"] != 10000 || $results["out_of_order"] != 0) {
    $success = false;
}
// write 10k messages to category paper (handled by categories store)
print "test writing 10k messages to category paper\n";
stress_test('paper', 'client2', 1000, 10000, 20, 500, 1);
sleep(5);
$results = resultChecker('/tmp/scribetest_/rockpaper', 'rockpaper-', 'client2');
if ($results["count"] != 10000 || $results["out_of_order"] != 0) {
    $success = false;
}
if (!scribe_stop($GLOBALS['SCRIBE_CTRL'], $GLOBALS['SCRIBE_PORT'], $pid)) {
    print "ERROR: could not stop scribe\n";
    return false;
}
return $success;
function super_stress_test($categories, $client_name, $rate, $total, $msg_per_call, $avg_size)
{
    $parallel = count($categories);
    // Fork a new process for every category
    for ($i = 0; $i < $parallel; ++$i) {
        $pid = pcntl_fork();
        if ($pid == -1) {
            print "Error: Could not fork\n";
            break;
        } else {
            if ($pid == 0) {
                // In child process
                print "Sending messages for category {$categories[$i]}...\n";
                stress_test($categories[$i], $client_name, $rate, $total, $msg_per_call, $avg_size);
                print "Done sending messages for category {$categories[$i]}.\n";
                break;
            }
        }
    }
}
Exemple #3
0
function super_stress_test($categories, $client_name, $rate, $total, $msg_per_call, $avg_size, $category_multiplier)
{
    $pids = array();
    // Fork a new process for every category
    foreach ($categories as $category) {
        $pid = pcntl_fork();
        if ($pid == -1) {
            print "Error: Could not fork\n";
            return;
        } else {
            if ($pid == 0) {
                // In child process
                print "Sending messages for category {$category}...\n";
                stress_test($category, $client_name, $rate, $total, $msg_per_call, $avg_size, $category_multiplier);
                print "Done sending messages for category {$category}.\n";
                exit(0);
            } else {
                // In parent process
                $pids[] = $pid;
            }
        }
    }
    // have parent wait for all children
    foreach ($pids as $pid) {
        pcntl_waitpid($pid, $status);
    }
}
<?php

//  Copyright (c) 2007-2008 Facebook
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
// See accompanying file LICENSE or visit the Scribe site at:
// http://developers.facebook.com/scribe/
include_once 'tests.php';
if ($argc > 1) {
    $client = $argv[1];
} else {
    $client = 'client1';
}
print 'starting test...';
stress_test('context', $client, 10000, 200000, 20, 100);
print 'done';
Exemple #5
0
<?php

//  Copyright (c) 2007-2008 Facebook
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
// See accompanying file LICENSE or visit the Scribe site at:
// http://developers.facebook.com/scribe/
include_once 'tests.php';
if ($argc > 1) {
    $client = $argv[1];
} else {
    $client = 'client1';
}
print 'starting test...';
stress_test('scribe_test', $client, 10000, 200000, 20, 100, 3);
print 'done';
Exemple #6
0
// write 10k messages to category test (handled by default store)
print "test writing 10k messages to category test\n";
stress_test('test', 'client1', 1000, 10000, 20, 100, 1);
// write another 10k messages to category test (should see 1 out of order)
sleep(2);
print "test writing another 10k messages (will see 1 out of order)\n";
stress_test('test', 'client1', 1000, 10000, 20, 100, 1);
// write 200k messages to category test using different client name
print "test writing 200k more messages to category test\n";
stress_test('test', 'client2', 10000, 200000, 50, 100, 1);
// write 10k messages to category foodoo (handled by prefix store)
print "test writing 10k messages to category foodoo\n";
stress_test('foodoo', 'client1', 10000, 10000, 20, 100, 1);
// write 10k messages to category rock (handled by categories prefix store)
print "test writing 100k messages to category rock\n";
stress_test('rock', 'client1', 100, 10000, 20, 100, 1);
// re-create primary store path
system("mkdir /tmp/scribetest_", $error);
if ($error) {
    print "ERROR: unable to recreate /tmp/scribetest_\n";
}
// sleep for a while to wait for buffers to flush
print "Waiting for buffers to flush...\n";
sleep(120);
// verify all messages got logged
$results = resultChecker('/tmp/scribetest_/test', 'test-', 'client1');
if ($results["count"] != 20000 || $results["out_of_order"] != 1) {
    $success = false;
}
$results = resultChecker('/tmp/scribetest_/test', 'test-', 'client2');
if ($results["count"] != 200000 || $results["out_of_order"] != 0) {