{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Theodolite Analysis - Demand Metric\n", "\n", "This notebook applies Theodolite's *demand* metric to describe scalability of a SUT based on Theodolite measurement data.\n", "\n", "Theodolite's *demand* metric is a function, mapping load intensities to the minimum required resources (e.g., instances) that are required to process this load. With this notebook, the *demand* metric function is approximated by a map of tested load intensities to their minimum required resources.\n", "\n", "The final output when running this notebook will be a CSV file, providig this mapping. It can be used to create nice plots of a system's scalability using the `demand-metric-plot.ipynb` notebook." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the following cell, we need to specifiy:\n", "\n", "* `exp_id`: The experiment id that is to be analyzed.\n", "* `warmup_sec`: The number of seconds which are to be ignored in the beginning of each experiment.\n", "* `max_lag_trend_slope`: The maximum tolerable increase in queued messages per second.\n", "* `measurement_dir`: The directory where the measurement data files are to be found.\n", "* `results_dir`: The directory where the computed demand CSV files are to be stored." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "exp_id = 200\n", "warmup_sec = 60\n", "max_lag_trend_slope = 2000\n", "measurement_dir = '/measurements'\n", "results_dir = '/results'\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "With the following call, we compute our demand mapping." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from src.demand import demand\n", "\n", "demand = demand(exp_id, measurement_dir, max_lag_trend_slope, warmup_sec)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We might already want to plot a simple visualization here:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "demand.plot(kind='line',x='load',y='resources')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally we store the results in a CSV file." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "\n", "demand.to_csv(os.path.join(results_dir, f'exp{exp_id}_demand.csv'), index=False)" ] } ], "metadata": { "file_extension": ".py", "interpreter": { "hash": "e9e076445e1891a25f59b525adcc71b09846b3f9cf034ce4147fc161b19af121" }, "kernelspec": { "display_name": "Python 3.8.10 64-bit ('.venv': venv)", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" }, "mimetype": "text/x-python", "name": "python", "npconvert_exporter": "python", "orig_nbformat": 2, "pygments_lexer": "ipython3", "version": 3 }, "nbformat": 4, "nbformat_minor": 2 }