Example #1
0
    def run_remote_simulate(self, config: RemoteSimulateConfig):
        cmd = [
            "python3",
            "../remote_simulate.py",
            "--generation-period-ms",
            str(config.block_gen_interval_ms),
            "--num-blocks",
            str(config.num_blocks),
            "--txs-per-block",
            str(config.txs_per_block),
            "--generate-tx-data-len",
            str(config.tx_size),
            "--tx-pool-size",
            str(1_000_000),
        ] + OptionHelper.parsed_options_to_args(
            dict(
                filter(lambda kv: kv[0] not in self.exp_latency_options,
                       vars(self.options).items())))

        if config.data_propagate_enabled:
            cmd.extend([
                "--data-propagate-enabled",
                "--data-propagate-interval-ms",
                str(config.data_propagate_interval_ms),
                "--data-propagate-size",
                str(config.data_propagate_size),
            ])

        log_file = open(self.simulate_log_file, "w")
        print("[CMD]: {} > {}".format(cmd, self.simulate_log_file))
        ret = subprocess.run(cmd, stdout=log_file, stderr=log_file).returncode
        assert ret == 0, "Failed to run remote simulator, return code = {}. Please check [{}] for more details".format(
            ret, self.simulate_log_file)

        os.system('grep "(ERROR)" {}'.format(self.simulate_log_file))
Example #2
0
    def after_options_parsed(self):
        ConfluxTestFramework.after_options_parsed(self)

        # num_nodes is set to nodes_per_host because setup_chain() generates configs
        # for each node on the same host with different port number.
        self.num_nodes = self.options.nodes_per_host
        self.enable_tx_propagation = self.options.enable_tx_propagation
        self.ips = []
        with open(self.options.ips_file, 'r') as ip_file:
            for line in ip_file.readlines():
                line = line[:-1]
                self.ips.append(line)

        self.conf_parameters = OptionHelper.conflux_options_to_config(
            vars(self.options), RemoteSimulate.PASS_TO_CONFLUX_OPTIONS)

        # Default Conflux memory consumption
        target_memory = 16
        # Overwrite with scaled configs so that Conflux consumes storage_memory_gb rather than target_memory.
        for k in ["db_cache_size", "ledger_cache_size",
            "storage_delta_mpts_cache_size", "storage_delta_mpts_cache_start_size",
            "storage_delta_mpts_slab_idle_size"]:
            self.conf_parameters[k] = str(
                conflux.config.production_conf[k] // target_memory * self.options.storage_memory_gb)
        self.conf_parameters["tx_pool_size"] = \
            self.options.tx_pool_size // target_memory * self.options.storage_memory_gb

        # Do not keep track of tx index to save CPU/Disk costs because they are not used in the experiments
        self.conf_parameters["record_tx_index"] = "false"

        if self.enable_tx_propagation:
            self.conf_parameters["generate_tx"] = "true"
            self.conf_parameters["generate_tx_period_us"] = str(1000000 * len(self.ips) // self.options.tps)
        else:
            self.conf_parameters["send_tx_period_ms"] = "31536000000" # one year to disable txs propagation
Example #3
0
    def __init__(self):
        self.exp_name = "latency_latest"
        self.stat_confirmation_latency = False
        self.simulate_log_file = "exp.log"
        self.stat_log_file = "exp_stat_latency.log"
        self.stat_archive_file = "exp_stat_latency.tgz"

        parser = argparse.ArgumentParser(usage="%(prog)s [options]")
        self.exp_latency_options = dict(
            vms=10,
            batch_config=
            "500:1:150000:1000,500:1:200000:1000,500:1:250000:1000,500:1:300000:1000,500:1:350000:1000"
        )
        OptionHelper.add_options(parser, self.exp_latency_options)

        def k_from_kv(kv):
            (k, v) = kv
            return k

        remote_simulate_options = dict(
            filter(
                lambda kv: k_from_kv(kv) in set([
                    "bandwidth", "profiler", "enable_tx_propagation",
                    "ips_file"
                ]), list(RemoteSimulate.SIMULATE_OPTIONS.items())))
        remote_simulate_options.update(RemoteSimulate.PASS_TO_CONFLUX_OPTIONS)
        # Configs with different default values than RemoteSimulate
        remote_simulate_options["nodes_per_host"] = 1
        remote_simulate_options["storage_memory_gb"] = 2
        remote_simulate_options["connect_peers"] = 8
        remote_simulate_options["tps"] = 4000

        OptionHelper.add_options(parser, remote_simulate_options)
        self.options = parser.parse_args()

        if os.path.getsize("./genesis_secrets.txt") % 65 != 0:
            print(
                "genesis secrets account error, file size should be multiple of 65"
            )
            exit()
        self.options.txgen_account_count = int(
            (os.path.getsize("./genesis_secrets.txt") / 65) //
            (self.options.vms * self.options.nodes_per_host))
Example #4
0
 def add_options(self, parser: ArgumentParser):
     OptionHelper.add_options(parser, {"nodes_per_host": 1})
     super().add_options(parser)
Example #5
0
 def add_options(self, parser: ArgumentParser):
     OptionHelper.add_options(parser, RemoteSimulate.SIMULATE_OPTIONS)
     OptionHelper.add_options(parser,
                              RemoteSimulate.PASS_TO_CONFLUX_OPTIONS)