Commit 3e69a36f authored by David Auer's avatar David Auer
Browse files

Add host-count argument for benchmarking

parent 7340a642
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ extern "C" {
#define RPC_DATA                                                               \
    (static_cast<gkfs::daemon::RPCData*>(gkfs::daemon::RPCData::getInstance()))

int benchmark(std::string);
int
benchmark(std::string, long hosts_count);

#endif // GKFS_DAEMON_DAEMON_HPP
+11 −6
Original line number Diff line number Diff line
@@ -569,6 +569,9 @@ main(int argc, const char* argv[]) {
        desc.add_options()(
                "benchmark", po::value<string>(),
                "WIP: Benchmark single code-paths. Supported values: rng, simplehash, randomslicing, randomslicing-agedconf");
        desc.add_options()(
                "host-count", po::value<long>(),
                "With --benchmark: Number of hosts to use in simulation.");
    }
    desc.add_options()(
            "auto-sm",
@@ -585,7 +588,8 @@ main(int argc, const char* argv[]) {

    if(vm.count("benchmark")) {
        cout << "Benchmark mode\n";
        return benchmark(vm["benchmark"].as<string>());
        return benchmark(vm["benchmark"].as<string>(),
                         vm["host-count"].as<long>());
    }

    if(vm.count("version")) {
@@ -691,10 +695,10 @@ random_string(std::string::size_type length) {


int
benchmark(string selector) {
benchmark(string selector, long host_count) {
    // TODO rng, simplehash, randomslicing, randomslicing-agedconf
    long rounds = 1e7;
    size_t hosts_size = 100; // TODO(daue) rs-conf fails with 1000 :/
    // TODO(dauer) rs-conf fails with hosts_size = 1000 :/
    bool simplehash = false;
    bool randomslicing = false;
    bool agedconf = false;
@@ -717,12 +721,12 @@ benchmark(string selector) {
    // init stuff (always both RS and simplehash)

    auto distributor = std::shared_ptr<gkfs::rpc::Distributor>(
            new gkfs::rpc::SimpleHashDistributor(0, hosts_size));
            new gkfs::rpc::SimpleHashDistributor(0, host_count));

    // mock up a random slicing distribution with hosts_size hosts
    auto rs_dist = std::make_shared<VDRIVE::DistRandSlice>();
    list<VDRIVE::Disk*> disks;
    for(size_t i = 0; i < hosts_size; i++) {
    for(size_t i = 0; i < host_count; i++) {
        disks.emplace_back(new VDRIVE::Disk(i, 1, "hostname", "uri"));
    }
    rs_dist->addDisks(&disks);
@@ -765,7 +769,8 @@ benchmark(string selector) {
         << " operations/s or " << ((double) rounds / 1000 / duration_ms)
         << " mega-ops/s\n";
    cout << "Note: Each operation consists of one locate_data and one locate_file_metadata call.\n";
    cout << "Simulation run with " << hosts_size << " hosts.\n";
    cout << "Simulation run with " << host_count << " hosts and "
         << rs_dist->getNumIntervals() << " random slicing intervals.\n";
    // TODO(dauer) Print RS-Conf information