Skip to content

piyushkbstack/load_testing_SUT

Repository files navigation

RCA Mock Site - Load Testing SUT

A production-ready System Under Test (SUT) for load testing and Root Cause Analysis (RCA) validation.

๐ŸŽฏ Purpose

This is a deterministic mock API built with Cloudflare Pages + Functions designed for:

  • โœ… Load testing with controlled behaviors
  • โœ… RCA agent validation
  • โœ… Browser performance metrics testing (LCP, INP, FCP, TTFB)
  • โœ… Simulating real-world failure scenarios

๐Ÿ—๏ธ Architecture

/ (repo root)
โ”‚
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ wrangler.toml
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ DEPLOYMENT.md
โ”‚
โ”œโ”€โ”€ /public
โ”‚   โ”œโ”€โ”€ index.html          # Main page with API call
โ”‚   โ”œโ”€โ”€ large.html          # LCP testing page
โ”‚   โ””โ”€โ”€ /assets
โ”‚       โ””โ”€โ”€ large-image.jpg # 1200x800 test image
โ”‚
โ””โ”€โ”€ /functions
    โ””โ”€โ”€ /api
        โ””โ”€โ”€ [[route]].js    # Catch-all API handler

๐Ÿš€ Features

Controlled API Behaviors

The API supports query parameters for deterministic testing:

Parameter Type Purpose Example
delay ms Artificial latency ?delay=3000
status HTTP code Simulate HTTP errors ?status=500
size integer Payload size (KB) ?size=500
errorType string Semantic error type ?errorType=db

Error Types

  • db - Database connection timeout
  • auth - Unauthorized access

๐Ÿ“Š API Examples

Success Response

curl https://your-site.pages.dev/api/test

Simulating Latency

curl https://your-site.pages.dev/api/test?delay=3000

Simulating 500 Error

curl https://your-site.pages.dev/api/test?status=500

Simulating Database Error

curl https://your-site.pages.dev/api/test?status=500&errorType=db

Large Payload

curl https://your-site.pages.dev/api/test?size=500

Combined Scenario

curl https://your-site.pages.dev/api/test?delay=2000&status=503&errorType=db&size=100

๐Ÿงช Test Scenarios

DB Bottleneck

/api/test?delay=2000

Infrastructure Crash

/api/test?status=500

Authentication Failure

/api/test?status=401&errorType=auth

Large Payload Latency

/api/test?size=1000

Mixed Load Pattern

Generate traffic with:

  • 70% success (200)
  • 20% latency (delay=1000-3000ms)
  • 10% errors (500)

๐Ÿ“ˆ Browser Performance Testing

Main Page (/)

  • Measures LCP with single large image
  • API call button for interaction testing
  • Lightweight for baseline metrics

Large Page (/large.html)

  • Multiple large images for LCP regression
  • Slow and fast API buttons
  • Real-time duration display

๐Ÿ”ง Local Development

Prerequisites

npm install -g wrangler

Local Testing

wrangler pages dev public --compatibility-date=2024-01-01

Access at: http://localhost:8788

๐ŸŒ Deployment

See DEPLOYMENT.md for complete deployment instructions.

Quick deploy to Cloudflare Pages:

  1. Push to GitHub
  2. Connect repo in Cloudflare Dashboard
  3. Set build output: public
  4. Deploy

๐ŸŽฏ RCA Signal Mapping

Behavior Expected RCA
delay โ†‘ Backend latency
status=500 spike Infrastructure failure
status=401 spike Functional auth issue
Large payload + LCP โ†‘ Frontend regression

โœ… Validation Checklist

Before load testing:

  • Public URL accessible
  • 200 response works
  • 500 response works
  • delay parameter works
  • size parameter works
  • Browser page loads correctly
  • No caching (check headers)
  • Images load properly

๐Ÿšซ What This Is NOT

  • โŒ Not a real backend
  • โŒ No database required
  • โŒ No authentication system
  • โŒ No external dependencies
  • โŒ No random behavior (deterministic only)

๐Ÿ“ Technical Constraints

  • Cloudflare Pages + Functions only
  • No Node.js server
  • No external APIs
  • No database
  • Free tier compatible
  • Public URL

๐Ÿ”ฎ Future Enhancements (Phase 2)

Potential additions:

  • Random failure rate parameter
  • CPU-intensive operations
  • Memory load simulation
  • Edge region routing

๐Ÿ“„ License

Private project for load testing purposes.

๐Ÿค Contributing

This is a controlled testing environment. Changes should maintain deterministic behavior.


Note: This SUT is designed for reliability and reproducibility in load testing scenarios.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published