Esempio n. 1
0
def main():
    # first we initialize parameter in exp_config before importing any local module.
    parser = argparse.ArgumentParser("script_one", "Runs a GNS test on a set of remote machines based on config file")
    parser.add_argument("config_file", help="config file describing test")
    args = parser.parse_args()
    local_config_file = args.config_file
    exp_config.initialize(local_config_file)
    os.system('cat ' + local_config_file)
    output_folder = os.path.join(exp_config.local_output_folder, 'log')
    run_one_experiment(output_folder, local_config_file)
Esempio n. 2
0
def main():
    # first we initialize parameter in exp_config before importing any local module.
    parser = argparse.ArgumentParser(
        "script_one",
        "Runs a GNS test on a set of remote machines based on config file")
    parser.add_argument("config_file", help="config file describing test")
    args = parser.parse_args()
    local_config_file = args.config_file
    exp_config.initialize(local_config_file)
    os.system('cat ' + local_config_file)
    output_folder = os.path.join(exp_config.local_output_folder, 'log')
    run_one_experiment(output_folder, local_config_file)
Esempio n. 3
0
def run_name_server(node_id, config_file, node_config_file):
    """ Executes an instance of Name Server with the give parameters """

    # print 'Node id', node_id
    # print 'Config file', config_file
    # print 'Node config file', node_config_file

    if config_file is not None and config_file != "":
        exp_config.initialize(config_file)

    # Parameters: Update as required
    name_server_jar = exp_config.remote_jar_file
    primary_name_server = exp_config.primary_name_server
    aggregate_interval = exp_config.replication_interval  # In seconds
    replication_interval = exp_config.replication_interval  # In seconds
    # Used for calculating number of replicas as per this formula:
    # NumReplicas = lookupRate / (updateRate * normalizing_constant)
    normalizing_constant = exp_config.normalizing_constant
    moving_avg_window_size = 1  # Used for calculating inter-arrival update time and ttl value

    is_static_replication = exp_config.is_static_replication  # Static3

    is_random_replication = exp_config.is_random_replication  # Uniform

    is_location_replication = exp_config.is_location_replication  # Locality
    name_server_selection_vote_size = exp_config.name_server_selection_vote_size  # top-k size.
    min_replica = exp_config.min_replica
    max_replica = exp_config.max_replica

    is_beehive_replication = exp_config.is_beehive_replication
    c_hop = exp_config.c_hop
    base = 16
    alpha = exp_config.alpha

    read_coordination = exp_config.read_coordination
    paxos_log_folder = exp_config.paxos_log_folder  # folder does paxos store its state in

    # Interval (in sec) between two failure detection messages sent to a node
    failure_detection_msg_interval = exp_config.failure_detection_msg_interval
    # Interval (in sec) after which a node is declared failed is no response is recvd for failure detection messages
    failure_detection_timeout_interval = exp_config.failure_detection_timeout_interval

    mongo_port = exp_config.mongo_port

    is_debug_mode = exp_config.is_debug_mode
    is_experiment_mode = exp_config.is_experiment_mode  # Always set to True to run experiments

    emulate_ping_latencies = exp_config.emulate_ping_latencies
    variation = exp_config.variation

    # logging related parameters:
    ## values: ALL, OFF, INFO, FINE, FINER, FINEST,.. see java documentation.
    file_logging_level = exp_config.nslog
    console_output_level = exp_config.nslog
    stat_file_logging_level = exp_config.nslogstat
    stat_console_output_level = exp_config.nslogstat

    worker_thread_count = exp_config.worker_thread_count

    java_bin = exp_config.remote_java_bin

    check_file(name_server_jar)
    check_file(node_config_file)

    command = "nohup " + java_bin + "/java -cp " + name_server_jar + " " + exp_config.ns_main

    command += " " + ID + " " + str(node_id)
    command += " " + NAMESERVER_FILE + " " + node_config_file
    command += " " + PRIMARY_NAMESERVERS + " " + str(primary_name_server)
    command += " " + AGGREGATE_INTERVAL + " " + str(aggregate_interval)
    command += " " + REPLICATION_INTERVAL + " " + str(replication_interval)
    command += " " + NORMALIZING_CONSTANT + " " + str(normalizing_constant)
    command += " " + MOVING_AVG_WINDOW_SIZE + " " + str(moving_avg_window_size)

    if is_static_replication:
        command += " " + STATIC_REPLICATION
    elif is_random_replication:
        command += " " + RANDOM_REPLICATION
    elif is_location_replication:
        command += " " + LOCATION_REPLICATION
        command += " " + NAMESERVER_SELECTION_VOTE_SIZE + " " + str(name_server_selection_vote_size)
    elif is_beehive_replication:
        command += " " + BEEHIVE_REPLICATION
        command += " " + C + " " + str(c_hop)
        command += " " + BASE + " " + str(base)
        command += " " + ALPHA + " " + str(alpha)
    else:
        print "Error: No replication model selected"
        sys.exit(2)
    # min and max number of replica
    # if min_replica != primary_name_server:
    command += " " + MIN_REPLICA + " " + str(min_replica)
    # if max_replica != 100:
    command += " " + MAX_REPLICA + " " + str(max_replica)
    command += " " + MAX_REQ_RATE + " " + str(exp_config.max_req_rate)

    command += " " + FILE_LOGGING_LEVEL + " " + file_logging_level
    command += " " + CONSOLE_OUTPUT_LEVEL + " " + console_output_level
    command += " " + STAT_FILE_LOGGING_LEVEL + " " + stat_file_logging_level
    command += " " + STAT_CONSOLE_OUTPUT_LEVEL + " " + stat_console_output_level

    if primary_name_server == 1:
        command += " " + SINGLE_NS

    if emulate_ping_latencies:
        command += " " + EMULATE_PING_LATENCIES
        command += " " + VARIATION + " " + str(variation)

    if read_coordination is not False:
        command += " " + READ_COORDINATION

    if paxos_log_folder != "":
        command += " " + PAXOS_LOG_FOLDER + " " + os.path.join(paxos_log_folder, "log_" + str(node_id))

    command += " " + FAILURE_DETECTION_MSG_INTERVAL + " " + str(failure_detection_msg_interval)
    command += " " + FAILURE_DETECTION_TIMEOUT_INTERVAL + " " + str(failure_detection_timeout_interval)

    command += " " + MONGO_PORT + " " + str(mongo_port)
    if exp_config.multipaxos:
        command += " " + MULTIPAXOS

    if exp_config.no_paxos_log:
        command += " " + NO_PAXOS_LOG
    if exp_config.dummy_gns:
        command += " " + DUMMY_GNS

    command += " " + WORKER_THREAD_COUNT + " " + str(worker_thread_count)

    if is_experiment_mode:
        command += " " + EXPERIMENT_MODE

    if is_debug_mode:
        command += " " + DEBUG_MODE
    command += " > log_ns_" + str(node_id)
    command += " 2> log_ns_" + str(node_id)
    command += " &"
    print command
    os.system(command)
Esempio n. 4
0
script_folder = os.path.dirname(
    os.path.abspath(inspect.getfile(
        inspect.currentframe())))  # script directory
parent_folder = os.path.split(script_folder)[0]
sys.path.append(parent_folder)

# first we initialize parameter in exp_config before importing any local module.
parser = argparse.ArgumentParser(
    "script_one",
    "Runs a GNS test on a set of remote machines based on config file")
parser.add_argument("config_file", help="config file describing test")
args = parser.parse_args()
print "Config file1:", args.config_file

import exp_config
exp_config.initialize(args.config_file)

from logparse.parse_log import parse_log  # added parent_folder to path to import parse_log module here
from generate_multinode_config_file import generate_multinode_config_file
from run_all_lns import run_all_lns, run_all_ns


def main():
    """Runs this main file."""

    output_folder = os.path.join(exp_config.output_folder, 'log')

    exp_time_sec = exp_config.experiment_run_time

    lookupTrace = exp_config.lookupTrace
Esempio n. 5
0
import argparse

script_folder = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))  # script directory
parent_folder = os.path.split(script_folder)[0]
sys.path.append(parent_folder)

import exp_config

# first we initialize parameter in exp_config before importing any local module.

parser = argparse.ArgumentParser("run_all_local", "Runs a GNS setup on local machine based on config file")
parser.add_argument("config_file", help="config file describing all experiments")
args = parser.parse_args()
print "Config file:", args.config_file
#print "Output folder:", args.output_folder
exp_config.initialize(args.config_file)

from generate_config_file import write_local_config_file
import name_server
import local_name_server

from logparse.parse_log import parse_log  # added parent_folder to path to import parse_log module here


def run_exp():
    from kill_local import kill_local_gnrs
    kill_local_gnrs()
    node_config = exp_config.node_config
    # folder where GNS logs are output
    log_output_folder = os.path.join(exp_config.output_folder, exp_config.DEFAULT_GNS_OUTPUT_FOLDER)
    # folder where GNS stats are output
Esempio n. 6
0
def run_local_name_server(node_id, config_file, node_config_file, update_trace, workload_config_file):
    """ Executes an instance of the Local Name Server with the give parameters """
    # print 'node id ', node_id
    # print 'config file', config_file
    # print 'node config file', node_config_file
    # print 'update trace', update_trace
    # print 'workload config file', workload_config_file

    if config_file is not None and config_file != '':
        exp_config.initialize(config_file)

    local_name_server_jar = exp_config.remote_jar_file  # Local name server jar
    # node_config_file = 'pl_config'  # Name server information: ID Node_Name Ping_Latency Latitude Longitude
    primary_name_server = exp_config.primary_name_server  # Number of primary name servers
    cache_size = exp_config.cache_size  # Cache Size

    output_sample_rate = exp_config.output_sample_rate

    # Location Replication / Random Replication
    # Select location aware replication. If True, the local name server periodically
    is_location_replication = exp_config.is_location_replication
    #(once every vote_interval) votes for its closest name server
    #Set it to False for random replication
    vote_interval = exp_config.replication_interval  # Time between votes (in seconds)

    # Load balance
    load_balancing = exp_config.load_balancing  # local name servers start load balancing among name servers
    load_monitor_interval = exp_config.replication_interval  # interval of monitoring load at every nameserver (seconds)

    # Beehive replication
    is_beehive_replication = exp_config.is_beehive_replication  # Beehive replication
    beehive_base = 16  # Beehive DHT base, default 16
    beehive_leaf_set = 4  # Beehive Leaf set size

    # Experiment duration
    is_experiment_mode = exp_config.is_experiment_mode  # Always set to True to run experiments.
    print "LNS: is_experiment_mode = ", is_experiment_mode
    #restart=False
    is_debug_mode = exp_config.is_debug_mode  # Prints logs if True. Used for testing.

    # retransmission parameters
    max_query_wait_time = exp_config.maxQueryWaitTime  # max wait time before query is declared failed (milli-seconds)
    query_timeout = exp_config.queryTimeout  # query timeout interval
    adaptive_timeout = exp_config.adaptiveTimeout
    delta = exp_config.delta  # Weight assigned to latest sample in calculating moving average.
    mu = exp_config.mu  # Co-efficient of estimated RTT in calculating timeout.
    phi = exp_config.phi  # Co-efficient of deviation in calculating timeout.

    emulate_ping_latencies = exp_config.emulate_ping_latencies
    variation = exp_config.variation

    # logging related parameters:
    ## values: ALL, OFF, INFO, FINE, FINER, FINEST,.. see java documentation.
    file_logging_level = exp_config.lnslog
    console_output_level = exp_config.lnslog
    stat_file_logging_level = exp_config.lnslogstat
    stat_console_output_level = exp_config.lnslogstat

    java_bin = exp_config.remote_java_bin

    check_file(local_name_server_jar)
    check_file(node_config_file)

    command = 'nohup ' + java_bin + '/java -cp ' + local_name_server_jar + ' ' \
              ' -Djava.rmi.server.useCodebaseOnly=false -Djava.rmi.server.codebase=file:' + local_name_server_jar \
              + ' ' + exp_config.lns_main

    command += ' ' + ID + ' ' + str(node_id)
    command += ' ' + NAMESERVER_FILE + ' ' + node_config_file
    command += ' ' + CACHE_SIZE + ' ' + str(cache_size)
    command += ' ' + PRIMARY_NAMESERVERS + ' ' + str(primary_name_server)
    if is_location_replication:
        command += ' ' + LOCATION_REPLICATION
        command += ' ' + VOTE_INTERVAL + ' ' + str(vote_interval)

    if is_beehive_replication:
        command += ' ' + BEEHIVE_REPLICATION
        command += ' ' + BEEHIVEDHTBASE + ' ' + str(beehive_base)
        command += ' ' + BEEHIVELEAFSET + ' ' + str(beehive_leaf_set)

    if load_balancing:
        command += ' ' + LOAD_BALANCING
        command += ' ' + LOAD_MONITOR_INTERVAL + ' ' + str(load_monitor_interval)

    if workload_config_file is not None and workload_config_file != '':
        command += ' ' + WORKLOAD_FILE + ' ' + workload_config_file

    if update_trace is not None and update_trace != '' and os.path.exists(update_trace):
        command += ' ' + UPDATE_TRACE_FILE + ' ' + update_trace

    command += ' ' + OUTPUT_SAMPLE_RATE + ' ' + str(output_sample_rate)

    command += ' ' + MAX_QUERY_WAIT_TIME + ' ' + str(max_query_wait_time)
    command += ' ' + QUERY_TIMEOUT + ' ' + str(query_timeout)

    if adaptive_timeout:
        command += ' ' + ADAPTIVE_TIMEOUT
        command += ' ' + DELTA + ' ' + str(delta)
        command += ' ' + MU + ' ' + str(mu)
        command += ' ' + PHI + ' ' + str(phi)

    if emulate_ping_latencies:
        command += ' ' + EMULATE_PING_LATENCIES
        command += ' ' + VARIATION + ' ' + str(variation)

    command += ' ' + FILE_LOGGING_LEVEL + ' ' + file_logging_level
    command += ' ' + CONSOLE_OUTPUT_LEVEL + ' ' + console_output_level
    command += ' ' + STAT_FILE_LOGGING_LEVEL + ' ' + stat_file_logging_level
    command += ' ' + STAT_CONSOLE_OUTPUT_LEVEL + ' ' + stat_console_output_level
    if is_experiment_mode:
        command += ' ' + EXPERIMENT_MODE
    if is_debug_mode:
        command += ' ' + DEBUG_MODE
    command += ' 2> log_lns_' + str(node_id)
    command += ' > log_lns_' + str(node_id)
    command += ' &'
    print command
    os.system(command)
Esempio n. 7
0
def run_name_server(node_id, config_file, node_config_file):
    """ Executes an instance of Name Server with the give parameters """

    # print 'Node id', node_id
    # print 'Config file', config_file
    # print 'Node config file', node_config_file

    if config_file is not None and config_file != '':
        exp_config.initialize(config_file)

    #Parameters: Update as required
    name_server_jar = exp_config.remote_jar_file
    primary_name_server = exp_config.primary_name_server
    aggregate_interval = exp_config.replication_interval  # In seconds
    replication_interval = exp_config.replication_interval  # In seconds
    # Used for calculating number of replicas as per this formula:
    # NumReplicas = lookupRate / (updateRate * normalizing_constant)
    normalizing_constant = exp_config.normalizing_constant
    moving_avg_window_size = 1  # Used for calculating inter-arrival update time and ttl value

    is_static_replication = exp_config.is_static_replication  # Static3

    is_random_replication = exp_config.is_random_replication  # Uniform

    is_location_replication = exp_config.is_location_replication  # Locality
    name_server_selection_vote_size = exp_config.name_server_selection_vote_size  # top-k size.
    min_replica = exp_config.min_replica
    max_replica = exp_config.max_replica

    is_beehive_replication = exp_config.is_beehive_replication
    c_hop = exp_config.c_hop
    base = 16
    alpha = exp_config.alpha

    read_coordination = exp_config.read_coordination
    paxos_log_folder = exp_config.paxos_log_folder  # folder does paxos store its state in

    # Interval (in sec) between two failure detection messages sent to a node
    failure_detection_msg_interval = exp_config.failure_detection_msg_interval
    # Interval (in sec) after which a node is declared failed is no response is recvd for failure detection messages
    failure_detection_timeout_interval = exp_config.failure_detection_timeout_interval

    mongo_port = exp_config.mongo_port

    is_debug_mode = exp_config.is_debug_mode
    is_experiment_mode = exp_config.is_experiment_mode  # Always set to True to run experiments

    emulate_ping_latencies = exp_config.emulate_ping_latencies
    variation = exp_config.variation

    # logging related parameters:
    ## values: ALL, OFF, INFO, FINE, FINER, FINEST,.. see java documentation.
    file_logging_level = exp_config.nslog
    console_output_level = exp_config.nslog
    stat_file_logging_level = exp_config.nslogstat
    stat_console_output_level = exp_config.nslogstat

    worker_thread_count = exp_config.worker_thread_count

    java_bin = exp_config.remote_java_bin

    check_file(name_server_jar)
    check_file(node_config_file)

    command = 'nohup ' + java_bin + '/java -cp ' + name_server_jar + ' ' + exp_config.ns_main

    command += ' ' + ID + ' ' + str(node_id)
    command += ' ' + NAMESERVER_FILE + ' ' + node_config_file
    command += ' ' + PRIMARY_NAMESERVERS + ' ' + str(primary_name_server)
    command += ' ' + AGGREGATE_INTERVAL + ' ' + str(aggregate_interval)
    command += ' ' + REPLICATION_INTERVAL + ' ' + str(replication_interval)
    command += ' ' + NORMALIZING_CONSTANT + ' ' + str(normalizing_constant)
    command += ' ' + MOVING_AVG_WINDOW_SIZE + ' ' + str(moving_avg_window_size)

    if is_static_replication:
        command += ' ' + STATIC_REPLICATION
    elif is_random_replication:
        command += ' ' + RANDOM_REPLICATION
    elif is_location_replication:
        command += ' ' + LOCATION_REPLICATION
        command += ' ' + NAMESERVER_SELECTION_VOTE_SIZE + ' ' + str(
            name_server_selection_vote_size)
    elif is_beehive_replication:
        command += ' ' + BEEHIVE_REPLICATION
        command += ' ' + C + ' ' + str(c_hop)
        command += ' ' + BASE + ' ' + str(base)
        command += ' ' + ALPHA + ' ' + str(alpha)
    else:
        print 'Error: No replication model selected'
        sys.exit(2)
    # min and max number of replica
    # if min_replica != primary_name_server:
    command += ' ' + MIN_REPLICA + ' ' + str(min_replica)
    # if max_replica != 100:
    command += ' ' + MAX_REPLICA + ' ' + str(max_replica)
    command += ' ' + MAX_REQ_RATE + ' ' + str(exp_config.max_req_rate)

    command += ' ' + FILE_LOGGING_LEVEL + ' ' + file_logging_level
    command += ' ' + CONSOLE_OUTPUT_LEVEL + ' ' + console_output_level
    command += ' ' + STAT_FILE_LOGGING_LEVEL + ' ' + stat_file_logging_level
    command += ' ' + STAT_CONSOLE_OUTPUT_LEVEL + ' ' + stat_console_output_level

    if primary_name_server == 1:
        command += ' ' + SINGLE_NS

    if emulate_ping_latencies:
        command += ' ' + EMULATE_PING_LATENCIES
        command += ' ' + VARIATION + ' ' + str(variation)

    if read_coordination is not False:
        command += ' ' + READ_COORDINATION

    if paxos_log_folder != '':
        command += ' ' + PAXOS_LOG_FOLDER + ' ' + os.path.join(
            paxos_log_folder, 'log_' + str(node_id))

    command += ' ' + FAILURE_DETECTION_MSG_INTERVAL + ' ' + str(
        failure_detection_msg_interval)
    command += ' ' + FAILURE_DETECTION_TIMEOUT_INTERVAL + ' ' + str(
        failure_detection_timeout_interval)

    command += ' ' + MONGO_PORT + ' ' + str(mongo_port)
    if exp_config.multipaxos:
        command += ' ' + MULTIPAXOS

    if exp_config.no_paxos_log:
        command += ' ' + NO_PAXOS_LOG
    if exp_config.dummy_gns:
        command += ' ' + DUMMY_GNS

    command += ' ' + WORKER_THREAD_COUNT + ' ' + str(worker_thread_count)

    if is_experiment_mode:
        command += ' ' + EXPERIMENT_MODE

    if is_debug_mode:
        command += ' ' + DEBUG_MODE
    command += ' > log_ns_' + str(node_id)
    command += ' 2> log_ns_' + str(node_id)
    command += ' &'
    print command
    os.system(command)