Python Proxy Test
Prompt
Act as a Principal Distributed Systems Architect. Write a complete, production-grade Python script for a "Distributed Caching & Rate-Limiting Proxy" in a single runnable file. No placeholders, no missing functions, and no shortcuts. Requirements: 1. Rate Limiting Algorithms: Implement both Token Bucket and Sliding Window algorithms to track and block IPs exceeding limits dynamically. 2. Thread-Safe & Distributed Lock: Use thread-safe locking mechanisms and distributed state management to prevent data races during high concurrent requests (thousands of threads). 3. Stress Test & Load Simulator: Include an integrated stress test function that spawns hundreds of simulated concurrent requests to test proxy response and high-load handling. 4. Excel & JSON Telemetry Exporter: Export advanced proxy status reports in both JSON and Excel (.xlsx) format using real formulas (e.g., =SUM(), =AVERAGE(), =COUNTIF()) inside cells to calculate total successful and blocked requests cleanly. Constraints: Clean Code, SOLID principles, strict Type Hinting, and fully commented production-ready logic.
Response not available