|
1 | 1 | # DELTA - FastAPI based WebApp to Test Database Latency (NEW, 2025)
|
2 | 2 |
|
3 |
| -This project is a secure, lightweight SaaS-like database latency testing GUI and API, built with FastAPI. |
| 3 | +This project is a secure, lightweight SaaS-like database latency testing tool with a Mobile GUI, along with REST API. |
4 | 4 |
|
5 |
| -https://github.com/user-attachments/assets/e3eaf179-914b-4c17-bc47-35f17e86aee0 |
| 5 | +Built with ❤️ using FastAPI. |
6 | 6 |
|
7 | 7 |
|
8 | 8 | ## Clone Repository ##
|
@@ -56,95 +56,43 @@ http://localhost:8000
|
56 | 56 |
|
57 | 57 | 
|
58 | 58 |
|
59 |
| -### 5. API Usage via Curl/CLI Example: |
| 59 | +### 5. Default SQL : API Usage via Curl/CLI MySQL Example |
60 | 60 | ```bash
|
61 |
| -curl -u admin:change_this -X POST http://localhost:8000/api/test-latency -d dbtype=mysql -d host=localhost -d port=3390 -d username=testuser -d password="YOurP@ssword#12" -d database=testdb -d interval=1 -d period=10 | jq . |
62 |
| -``` |
| 61 | +curl -u admin:change_this -X POST http://localhost:8000/api/test-latency \ |
| 62 | + -d dbtype=mysql \ |
| 63 | + -d host=localhost \ |
| 64 | + -d port=3390 \ |
| 65 | + -d username=testuser \ |
| 66 | + -d password="YourPassword1##" \ |
| 67 | + -d database=testdb \ |
| 68 | + -d interval=1 \ |
| 69 | + -d period=10 \ |
| 70 | + | jq . |
63 | 71 | ```
|
64 | 72 |
|
65 |
| - % Total % Received % Xferd Average Speed Time Time Time Current |
66 |
| - Dload Upload Total Spent Left Speed |
67 |
| -100 1260 100 1145 100 115 107 10 0:00:11 0:00:10 0:00:01 259 |
68 |
| -{ |
69 |
| - "success": true, |
70 |
| - "error": null, |
71 |
| - "latency_stats": { |
72 |
| - "p99": 65.00130997534143, |
73 |
| - "p90": 64.45847470022272, |
74 |
| - "avg": 59.44308740145061, |
75 |
| - "stddev": 3.661004661748353, |
76 |
| - "mean": 59.44308740145061, |
77 |
| - "runs": 10 |
78 |
| - }, |
79 |
| - "details": [ |
80 |
| - { |
81 |
| - "timestamp": "2025-07-04 01:18:22", |
82 |
| - "latency_ms": 61.802583004464395, |
83 |
| - "success": true, |
84 |
| - "error": null |
85 |
| - }, |
86 |
| - { |
87 |
| - "timestamp": "2025-07-04 01:18:23", |
88 |
| - "latency_ms": 61.06654200993944, |
89 |
| - "success": true, |
90 |
| - "error": null |
91 |
| - }, |
92 |
| - { |
93 |
| - "timestamp": "2025-07-04 01:18:24", |
94 |
| - "latency_ms": 64.39145799959078, |
95 |
| - "success": true, |
96 |
| - "error": null |
97 |
| - }, |
98 |
| - { |
99 |
| - "timestamp": "2025-07-04 01:18:25", |
100 |
| - "latency_ms": 53.58212499413639, |
101 |
| - "success": true, |
102 |
| - "error": null |
103 |
| - }, |
104 |
| - { |
105 |
| - "timestamp": "2025-07-04 01:18:26", |
106 |
| - "latency_ms": 65.06162500591017, |
107 |
| - "success": true, |
108 |
| - "error": null |
109 |
| - }, |
110 |
| - { |
111 |
| - "timestamp": "2025-07-04 01:18:27", |
112 |
| - "latency_ms": 57.83200000587385, |
113 |
| - "success": true, |
114 |
| - "error": null |
115 |
| - }, |
116 |
| - { |
117 |
| - "timestamp": "2025-07-04 01:18:29", |
118 |
| - "latency_ms": 54.59125000925269, |
119 |
| - "success": true, |
120 |
| - "error": null |
121 |
| - }, |
122 |
| - { |
123 |
| - "timestamp": "2025-07-04 01:18:30", |
124 |
| - "latency_ms": 57.854083002894185, |
125 |
| - "success": true, |
126 |
| - "error": null |
127 |
| - }, |
128 |
| - { |
129 |
| - "timestamp": "2025-07-04 01:18:31", |
130 |
| - "latency_ms": 60.93537498963997, |
131 |
| - "success": true, |
132 |
| - "error": null |
133 |
| - }, |
134 |
| - { |
135 |
| - "timestamp": "2025-07-04 01:18:32", |
136 |
| - "latency_ms": 57.31383299280424, |
137 |
| - "success": true, |
138 |
| - "error": null |
139 |
| - } |
140 |
| - ] |
141 |
| -} |
| 73 | +### 6. Custom User SQL : API Usage via Curl/CLI MySQL Example |
| 74 | + |
| 75 | +To test with a custom SQL query from the command line, simply add a -d custom_sql="YOUR SQL HERE" parameter to your curl command, like this: |
| 76 | + |
| 77 | +```bash |
| 78 | +curl -u admin:change_this -X POST http://localhost:8000/api/test-latency \ |
| 79 | + -d dbtype=mysql \ |
| 80 | + -d host=localhost \ |
| 81 | + -d port=3390 \ |
| 82 | + -d username=testuser \ |
| 83 | + -d password="YourPassword1##" \ |
| 84 | + -d database=testdb \ |
| 85 | + -d interval=1 \ |
| 86 | + -d period=10 \ |
| 87 | + -d custom_sql="SELECT * FROM mytable WHERE status='ACTIVE' LIMIT 10" \ |
| 88 | + | jq . |
142 | 89 | ```
|
143 | 90 |
|
144 |
| -## Command-Line (delta.py) Usage — Secure, No Stored Credentials |
| 91 | +- If `custom_sql` is included (and not empty), that query is used for measuring latency (instead of `SELECT 1`). |
145 | 92 |
|
146 |
| -The original `delta.py` script remains available for CLI power users and can test Oracle, PostgreSQL, MySQL, and URLs. **No credentials are stored in this file**; you must supply all values as arguments or interactively via a prompt. |
| 93 | +- All other parameters stay the same as before. |
147 | 94 |
|
| 95 | +- You can enter multi-line SQL in the terminal by wrapping it in quotes, or you can pipe in a file with `-d custom_sql="$(cat myquery.sql)"`. |
148 | 96 |
|
149 | 97 | ## Databases Supported 🔌 :
|
150 | 98 |
|
|
0 commit comments