Beispiel #1
0
    def retrieve(self, config: Configuration) -> SimulationResult:
        if self.exists(config) is False:
            return None

        ident = config.get_ident_values()
        index_filename = self._get_archive_folder() + self.FILENAME_JOIN_STR.join(ident) + self.JSON_EXT
        with open(index_filename, 'rb') as json_index_file:
            index = pickle.load(json_index_file)

            results = SimulationResult(index.config, index.requests)
            for vms, index_result in index.index.items():
                filename = index_result.strip()
                entry = self._read_file(filename)
                results.add_simulator_result(vms, entry)
        return results
Beispiel #2
0
def main():
    setup_logging('main.log', level=logging.INFO)

    # prepare the simulation
    config = Configuration()
    runner = SimulationRunner(config)

    # for load_name in ['constant', 'sawtooth', 'sinusoid', 'square', 'triangle']:
    for load_name in ['ndist']:
        config.load_name = load_name

        path = 'pareto_optimal_{load}.csv'.format(load=config.load_name)
        with open(path, 'w', newline='') as csvfile:
            writer = csv.writer(csvfile)
            writer.writerow(config.get_ident_keys() + ['vms', 'cost'])

            # for altitude in [1, 2, 4, 8, 16, 32, 64]:
            for altitude in [700]:
                config.load_altitude = altitude

                try:
                    results = runner.load_cache()
                    if results is None:
                        results = runner.run()
                        runner.persist(results)

                    for num_vms, simulation in results.simulations.items():
                        writer.writerow(results.config.get_ident_values() +
                                        [num_vms, simulation.total_cost])

                    with open('_'.join(config.get_ident_values()) + '.csv',
                              'w',
                              newline='') as loadfile:
                        loadwriter = csv.writer(loadfile)
                        loadwriter.writerow(['timestamp', 'requests'])
                        for step, request_step in enumerate(results.requests):
                            loadwriter.writerow([step, len(request_step)])
                except Exception as e:
                    logging.error(
                        'Execution in run with sigma {sigma} failed: {e}'.
                        format(sigma=altitude, e=e))
Beispiel #3
0
def main():
    setup_logging('main.log', level=logging.INFO)

    # use-case configuration
    param = 131072
    request_memory = 112
    vm_request_duration = 2055.25 / 1000  # in seconds

    # prepare the simulation
    config = Configuration()
    runner = SimulationRunner(config)

    config.load_name = 'constant'
    config.load_spacing = 3600
    config.load_num_requests = 14400  # only relevant for ndist load
    config.simulation_end = 3600
    config.request_memory = request_memory
    config.request_duration = vm_request_duration

    for load_name in [
            'constant', 'sawtooth', 'sinusoid', 'square', 'triangle'
    ]:
        # for load_name in ['ndist']:
        config.load_name = load_name

        path = 'pareto_optimal_{load}.csv'.format(load=config.load_name)
        with open(path, 'w', newline='') as csvfile:
            writer = csv.writer(csvfile)
            writer.writerow(config.get_ident_keys() + ['vms', 'cost'])

            for altitude in [1, 2, 4, 8, 16, 32, 64]:
                #for altitude in [100, 250, 500, 750, 1000]:
                config.load_altitude = altitude

                try:
                    results = runner.load_cache()
                    if results is None:
                        results = runner.run()
                        runner.persist(results)

                    for num_vms, simulation in results.simulations.items():
                        writer.writerow(results.config.get_ident_values() +
                                        [num_vms, simulation.total_cost])

                    with open('_'.join(config.get_ident_values()) + '.csv',
                              'w',
                              newline='') as loadfile:
                        loadwriter = csv.writer(loadfile)
                        loadwriter.writerow(['timestamp', 'requests'])
                        for step, request_step in enumerate(results.requests):
                            loadwriter.writerow([step, len(request_step)])
                except Exception as e:
                    logging.error(
                        'Execution in run with sigma {sigma} failed: {e}'.
                        format(sigma=altitude, e=e))
 def __init__(self):
     self.config = Configuration()
     self.simulator = SimulatorComponent(self.config)
 def remove(self, config: Configuration):
     ident = config.get_ident_values()
     path = self._get_archive_folder() + self.FILENAME_JOIN_STR.join(
         ident) + self.JSON_EXT
     if os.path.exists(path):
         os.remove(path)
 def exists(self, config: Configuration) -> bool:
     ident = config.get_ident_values()
     path = self._get_archive_folder() + self.FILENAME_JOIN_STR.join(
         ident) + self.JSON_EXT
     return os.path.exists(path)
    def create() -> Configuration:
        config = Configuration()
        config.simulation_start = 0
        config.simulation_end = 10

        config.request_duration = 2
        config.request_memory = 255
        config.request_variation = 0.0

        config.vm_parallel = 2
        config.vm_scaling_degradation = 0.00
        config.vm_min_instances = 0
        config.vm_auto_scaling = True
        config.faas_performance_m = 0
        config.faas_performance_a = 1

        config.load_name = "constant"
        config.load_altitude = 3
        config.load_spacing = 20

        config.plotting = False

        return config