Skip to content

Repository files navigation

Multi-Tier Web Application Performance Simulation

This project implements a discrete-event simulation (DES) of a three-tier e-commerce web application using SimPy. It is designed as a full course project for studying capacity planning, performance, and cost optimization under variable load.

Features

  • Three-tier architecture:
    • Web server pool
    • Application server pool
    • Database + cache layer
  • Time-varying, non-homogeneous Poisson arrivals with daily pattern and load multipliers
  • Detailed per-request timings across tiers
  • Support for multiple scenarios:
    • Web/app server scaling
    • Cache hit ratio impact
    • Load multipliers (1x/2x/3x)
    • Combined “optimal configuration” search
  • Multiple replications per scenario with random seeds and 95% confidence intervals
  • Automatic storage of raw results and aggregated metrics
  • Plotting utilities for all major figures required by the report

Test Configuration

For development and verification, a reduced test configuration is available:

  • 10 req/s (vs 100 req/s baseline)
  • 1 hour simulation (vs 24 hours)
  • 3 replications (vs 10)
  • ~10,800 total requests (vs ~8.64 million)

This runs in ~10 seconds and produces the same metrics as the full simulation.

Project Structure

project/
├── src/
│   ├── simulation.py        # Core SimPy model
│   ├── metrics.py           # Metrics collection and statistics
│   ├── config.py            # Baseline and scenario configurations
│   ├── experiments.py       # Scenario definitions and experiment runner
│   └── visualization.py     # Plotting and figure generation
├── data/
│   ├── raw_results/         # Raw per-run outputs
│   └── processed/           # Aggregated metrics
├── figures/                 # Generated plots for the report
├── notebooks/
│   └── analysis.ipynb       # Interactive analysis (optional)
├── requirements.txt         # Python dependencies
├── run_all_experiments.py   # Master script to run all scenarios
└── README.md

Quick Start

  1. Create and activate a virtual environment (recommended).
  2. Install requirements:
pip install -r requirements.txt
  1. First, test the simulation (runs in ~10 seconds):

    python run_all_experiments.py --test
  2. Run baseline configuration only:

    python run_all_experiments.py --baseline
  3. Generate figures with real + synthetic data (recommended):

    python generate_figures.py --combined

    This uses your simulation results for available scenarios and fills in synthetic data for others.

  4. Run all predefined experiments (~30+ minutes):

    python run_all_experiments.py
  5. After runs complete:

    • Raw CSVs will be under data/raw_results/
    • Aggregated summaries under data/processed/
    • Figures under figures/
  6. Open notebooks/analysis.ipynb in Jupyter for further exploration and to support the 15+ page report.

Notes for the Report

  • The code is structured to map directly to the report sections:
    • Conceptual Model / Simulation Designsimulation.py, config.py
    • Data & Input Analysis → traffic and service-time utilities in config.py and plots in visualization.py
    • Experimentation & Resultsexperiments.py, run_all_experiments.py, metrics.py
  • Use the generated CSVs and figures as the basis for tables, charts, and analysis described in the project prompt.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages