API Docs | Dashboard Features | Google Sheets Report
A complete solution for load testing the Sarvam Transliteration API:
- Automated load test scripts
- Streamlit dashboard for configuration & live monitoring
- Tools for aggregating and analyzing results
- Designed for both quick and advanced load sweeps
- Clear reporting and troubleshooting guidance
- Project Structure
- Requirements
- Setup
- .env File Setup
- Running Tests
- Dashboard Features
- Google Sheets Report
- Troubleshooting
- Notes
| File/Folder | Description |
|---|---|
API_Requests.py |
Locust script for load test tasks (Hindi, Tamil, Bengali) |
dashboard.py |
Streamlit dashboard for config, live metrics, and results |
run_tests.sh |
Bash script for load sweep (varying users/spawn rates) |
process_results.py |
Aggregates CSV outputs into summary.csv |
<prefix>_stats.csv |
Per-test CSV stats (e.g., simple_test_stats.csv) |
<prefix>_stats_history.csv |
Per-test CSV history |
summary.csv |
Aggregated results from all tests |
requirements.txt |
Python dependencies |
.env |
(Optional) API keys and environment variables |
Report/ |
Final PDF report |
All dependencies are listed in requirements.txt:
streamlit
requests
plotly
pandas
locust
python-dotenvInstall all dependencies:
pip install -r requirements.txt-
Clone the Repository
git clone https://github.com/justAbhinav/Sarvam_AI_API_Load_testing cd Sarvam_AI_API_Load_testing -
Install Dependencies
pip install -r requirements.txt
-
Set Up Environment Variables
You can set your Sarvam API key in your shell or in a
.envfile (recommended for convenience and security).
Create a .env file in the project root:
SARVAM_API_KEY=your_api_key_here- Replace
your_api_key_herewith your actual Sarvam API key (Get it here). - The project uses
python-dotenvto load environment variables automatically.
Alternatively, export the variable in your shell:
export SARVAM_API_KEY="your_api_key_here"-
Free Required Ports
The dashboard and Locust use ports
8089and8090. Ensure these ports are free:lsof -i :8089 lsof -i :8090 kill -9 <pid>
-
Load Sweep Tests
Run the load sweep to test different user counts and spawn rates:
chmod +x run_tests.sh ./run_tests.sh
-
Process Results
Aggregate all CSV outputs into a single
summary.csv:python3 process_results.py
-
Run the Dashboard
Launch the Streamlit dashboard for interactive test configuration and live monitoring:
streamlit run dashboard.py
- Open http://localhost:8501 in your browser.
- Choose Simple (1 user, 1 spawn rate, 1m) or Custom test type.
- Configure concurrency, spawn rate, run time (e.g.,
30s), and CSV prefix as needed. - Click Run Test to view live metrics and final results.
-
Test Configuration
- Simple Mode: Fixed parameters (1 user, 1 spawn rate, 1m duration,
simple_testprefix) - Custom Mode: User-defined concurrency, spawn rate, run time, and CSV prefix
- Simple Mode: Fixed parameters (1 user, 1 spawn rate, 1m duration,
-
Live Metrics
- Median, average, and p95 latency (ms)
- Requests per second (RPS)
- Error rate (%)
-
Final Results
- Total requests, RPS, average/p50/p75/p95 latency, error rate
- Language-specific p95 latency (Hindi, Tamil, Bengali) with a bar chart
Note: There is a bug where you need to refresh the page for final results. All CSV files are saved correctly in the dashboard directory.
-
CSV Output
- Generates
<prefix>_stats.csvand<prefix>_stats_history.csvper test
- Generates
A detailed Google Sheets report is available for further analysis and visualization:
Sarvam Transliteration API Load Test Results
- Tabs:
- Summary Dashboard: Visualizations of key metrics
- Raw Data: Imported CSV data
- Sweep Configurations/Notes: Test parameters and observations
- Port Conflicts
- Free ports
8089/8090as shown in Setup. - Check for running Locust processes:
ps aux | grep locust kill -9 <locust_pid>
- Free ports
- The dashboard uses a single Locust instance on port
8089for live metrics and a headless instance on port8090for CSV generation. - If live metrics fail, verify API connectivity.
- Ensure your API key is valid and your network connection is stable.
For questions or contributions, please open an issue or submit a pull request.