Skip to content

mliezun/python-web-benchmarks

Repository files navigation

Python Web Benchmarks

Real-world performance benchmarking of Python web applications across different Python versions.

🎯 Project Overview

This project benchmarks Wagtail CMS (a popular Django-based CMS) across multiple Python versions to provide actionable insights for version migration decisions.

Supported Python Versions:

  • Python 3.10, 3.11, 3.12, 3.13, 3.14
  • Python 3.13t (free-threaded/nogil)
  • Python 3.14t (free-threaded/nogil)
  • Python 3.14-tailcall (experimental tailcall optimization)

📊 Latest Results

Python 3.11 shows ~18% average performance improvement over Python 3.10!

See BENCHMARK_SUMMARY.md for detailed results.

Quick Stats

  • Python 3.11: Best overall performance (+18% vs 3.10)
  • Python 3.12: Competitive with 3.11
  • Memory Usage: Similar across all versions (~270-287 MB)
  • Success Rate: 100% across all tests

🚀 Quick Start

Prerequisites

  • Docker installed
  • Python 3.x
  • Apache Bench (ab)

Run Benchmarks

# Build Docker images for all Python versions
make build

# Run the benchmark suite
make run

# Generate summary report
python3 scripts/generate_summary.py

📁 Project Structure

python-web-benchmarks/
├── apps/
│   └── wagtail/              # Wagtail CMS configuration
│       ├── Dockerfile
│       ├── setup_realworld_data.py  # Real-world data generator
│       └── entrypoint.sh
├── benchmarks/
│   ├── runner.py             # Main orchestration
│   ├── metrics_collector.py  # Resource monitoring
│   └── load_generator.py     # HTTP load testing
├── config/
│   └── config.yaml          # Benchmark configuration
├── data/
│   ├── raw/                 # JSON results
│   └── BENCHMARK_SUMMARY.md # Summary report
├── scripts/
│   └── generate_summary.py  # Report generator
└── Makefile                 # Build and run commands

🧪 Test Scenarios

The benchmark includes real-world test scenarios:

  1. Homepage Load - Full page with navigation, sections, and content
  2. Admin Login - Authentication and admin interface
  3. Page Browsing - Blog pages with 15+ articles

Each scenario is tested with:

  • 1, 5, 10, and 20 concurrent users
  • Multiple requests per user
  • Full resource monitoring

📈 Real-World Data

The Wagtail instance includes:

  • ✅ 15+ blog posts with realistic content
  • ✅ Multiple pages (About, Services, Contact, etc.)
  • ✅ Fully configured admin interface
  • ✅ Real database with migrations
  • ✅ Static file serving

🔧 Configuration

Edit config/config.yaml to:

  • Add/remove Python versions
  • Modify test scenarios
  • Adjust concurrent user levels
  • Change test duration

📊 Results Format

Results are saved as JSON in data/raw/ with metrics including:

  • Requests per second (RPS)
  • Response times
  • Error rates
  • CPU usage
  • Memory consumption

🎨 Available Commands

make help      # Show available commands
make install   # Install Python dependencies
make build     # Build Docker images
make run       # Run benchmark suite
make clean     # Clean up containers and images

🏆 Key Findings

Based on the latest benchmark run:

  1. Performance: Python 3.11 provides the best overall performance
  2. Stability: 100% success rate across all Python versions
  3. Resources: Memory usage is consistent across versions
  4. Recommendation: Upgrade to Python 3.11 or 3.12 for production workloads

📝 License

MIT

🤝 Contributing

Contributions welcome! Areas for improvement:

  • Add more web applications (Airflow, Sentry, etc.)
  • Add visualization dashboards
  • Implement CI/CD pipelines
  • Test additional Python experimental features

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages