{"id":30739981,"url":"https://github.com/kingabzpro/stress-testing-fastapi","last_synced_at":"2026-02-12T18:30:51.922Z","repository":{"id":297931706,"uuid":"998309859","full_name":"kingabzpro/Stress-Testing-FastAPI","owner":"kingabzpro","description":"Build a FastAPI web application and perform stress testing using Locust.","archived":false,"fork":false,"pushed_at":"2025-06-11T10:57:01.000Z","size":576,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-03T23:47:53.189Z","etag":null,"topics":["fastapi","locust","machine-learning","stress-testing"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kingabzpro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-08T10:37:46.000Z","updated_at":"2025-08-17T11:27:58.000Z","dependencies_parsed_at":"2025-06-08T12:42:40.138Z","dependency_job_id":null,"html_url":"https://github.com/kingabzpro/Stress-Testing-FastAPI","commit_stats":null,"previous_names":["kingabzpro/stress-testing-fastapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kingabzpro/Stress-Testing-FastAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingabzpro%2FStress-Testing-FastAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingabzpro%2FStress-Testing-FastAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingabzpro%2FStress-Testing-FastAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingabzpro%2FStress-Testing-FastAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kingabzpro","download_url":"https://codeload.github.com/kingabzpro/Stress-Testing-FastAPI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingabzpro%2FStress-Testing-FastAPI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29376812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T18:17:34.915Z","status":"ssl_error","status_checked_at":"2026-02-12T18:17:34.495Z","response_time":55,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","locust","machine-learning","stress-testing"],"created_at":"2025-09-03T23:45:52.994Z","updated_at":"2026-02-12T18:30:51.914Z","avatar_url":"https://github.com/kingabzpro.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# California Housing Price Prediction API\n\nA FastAPI-based machine learning web application that predicts California housing prices using a Random Forest model trained on scikit-learn's California housing dataset.\n\n## Features\n\n- RESTful API for house price predictions\n- Random Forest model trained on California housing dataset\n- Single prediction endpoints\n- Model information endpoint\n- Health check endpoints\n- Load testing with Locust\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/kingabzpro/Stress-Testing-FastAPI.git\ncd Stress-Testing-FastAPI\n```\n\n2. Create a virtual environment (recommended):\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n```\n\n3. Install dependencies:\n```bash\npip install -r requirements.txt\n```\n\n## Running the Application\n\nStart the FastAPI server:\n```bash\npython run_server.py  \n```\n\nThe API will be available at `http://localhost:8000`\n\nAccess the interactive API documentation at `http://localhost:8000/docs`\n\n## API Endpoints\n\n### 1. Health Check\n- **GET** `/` - Root endpoint\n- **GET** `/health` - Health check endpoint\n\n### 2. Model Information\n- **GET** `/model-info` - Get information about the ML model and features\n\n### 3. Predictions\n- **POST** `/predict` - Single house price prediction\n  \n  Request body:\n  ```json\n  {\n    \"features\": [8.3252, 41.0, 6.984, 1.024, 322.0, 2.556, 37.88, -122.23]\n  }\n  ```\n\n- **POST** `/batch-predict` - Batch predictions for multiple houses\n\n## Features Description\n\nThe model requires 8 features in the following order:\n\n1. **MedInc**: Median income in block group\n2. **HouseAge**: Median house age in block group\n3. **AveRooms**: Average number of rooms per household\n4. **AveBedrms**: Average number of bedrooms per household\n5. **Population**: Block group population\n6. **AveOccup**: Average number of household members\n7. **Latitude**: Block group latitude\n8. **Longitude**: Block group longitude\n\n## Load Testing with Locust\n\n### Running Locust with Web UI\n\n```bash\nlocust -f tests/locustfile.py --host http://localhost:8000\n```\n\nOpen `http://localhost:8089` in your browser to access the Locust web interface.\n\n### Running Locust in Headless Mode\n\n```bash\nlocust -f tests/locustfile.py --host http://localhost:8000 --headless -u 50 -r 5 -t 60s\n```\n\nParameters:\n- `-u 50`: Total number of users to simulate\n- `-r 5`: Spawn rate (users per second)\n- `-t 60s`: Test duration\n\n### Generate HTML Report\n\n```bash\nlocust -f tests/locustfile.py --host http://localhost:8000 --headless -u 100 -r 10 -t 120s --html report.html\n```\n\n## Model Performance\n\nThe Random Forest model is trained on the California housing dataset with:\n- 100 estimators\n- Maximum depth of 10\n- Features are standardized using StandardScaler\n\n## Project Structure\n\n```\nml-fastapi-app/\n├── app/\n│   ├── __init__.py      # Package initialization\n│   ├── main.py          # FastAPI application\n│   ├── models.py        # Pydantic models\n│   └── ml_model.py      # ML model implementation\n├── tests/\n│   └── locustfile.py    # Locust test scenarios\n├── requirements.txt     # Python dependencies\n└── README.md           # This file\n```\n\n## Requirements\n\n- Python 3.8+\n- FastAPI\n- scikit-learn\n- NumPy\n- Pandas\n- Locust\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingabzpro%2Fstress-testing-fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkingabzpro%2Fstress-testing-fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingabzpro%2Fstress-testing-fastapi/lists"}