Skip to content

oracle-quickstart/db-endpoint-latency-testing-ammeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

85 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DELTA - FastAPI based WebApp to Test Database Latency (NEW, 2025)

This project is a secure, lightweight SaaS-like database latency testing tool with a Mobile GUI, along with REST API.

DB.Latency.Checker.Demo.mov

Built with ❀️ using FastAPI.

Clone Repository

git clone https://github.com/oracle-quickstart/db-endpoint-latency-testing-ammeter.git && cd db-endpoint-latency-testing-ammeter/

Quick Build with One-Command

 bash build.sh

Alternate : Step-by-Step Manual Build

1. Create a Python Virtual Environment

python3 -m venv .venv

Activate on Unix/macOS:

source .venv/bin/activate

Activate on Windows:

.venv\Scripts\activate

2. Install requirements

pip3 install -r requirements.txt

3. Launch the Web App

uvicorn app.main:app --host 0.0.0.0 --port 8000

4. Open your browser at:

http://localhost:8000
  • Log in: admin / change_this (update password in app/main.py for production).
  • Fill out the form and run latency tests in real time with live chart and table views.
  • For any errors (connection, authentication) you'll see detailed front-end feedback.
Screenshot 2025-07-04 at 2 49 25β€―AM

5. Default SQL : API Usage via Curl/CLI MySQL Example

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="YourPassword1##" \
  -d database=testdb \
  -d interval=1 \
  -d period=10 \
  | jq .
DB.Latency.Checker.Demo.Cmd-Line.mov

6. Custom User SQL : API Usage via Curl/CLI MySQL Example

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:

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="YourPassword1##" \
  -d database=testdb \
  -d interval=1 \
  -d period=10 \
  -d custom_sql="SELECT * FROM mytable WHERE status='ACTIVE' LIMIT 10" \
  | jq .
  • If custom_sql is included (and not empty), that query is used for measuring latency (instead of SELECT 1).

  • All other parameters stay the same as before.

  • 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)".

Important Note when using Custom queries

  • Custom queries that are slower will always yield fewer completed test cycles in a fixed period. For eg: If your custom query takes, for example, 0.3 seconds and your interval is 1 second, each full cycle is actually ~1.3s, so over a 10 second period you’ll only get about 7-8 cycles.

  • For SELECT 1, each loop is closer to 1s so you see 10 full cycles.

  • This is expected behavior and the code is running safely/correctly.

  • Custom queries that are slower will always yield fewer completed test cycles in a fixed period. Hence use Custom queries carefully.

Databases Supported πŸ”Œ :

Oracle DB >= 12.2 πŸ“Œ :

  • Amazon RDS Oracle
  • OCI Autonomous Database
  • OCI VMDB
  • OCI Exadata Cloud Service
  • Oracle Database On-Premise

Postgres >= 11 πŸ“Œ :

  • Amazon RDS Postgres
  • Amazon RDS Aurora Postgres
  • Postgres On-premise

MySQL >= 5.7 πŸ“Œ :

  • Amazon RDS MySQL
  • Amazon RDS Aurora MySQL
  • OCI MySQL Database Service
  • OCI MySQL Heatwave
  • MySQL On-Premise

URL - HTTPS | HTTP πŸ“Œ :

  • Check Public or Private URLs for latency

Contributing

This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide

Security

Please consult the security guide for our responsible security vulnerability disclosure process

License

Copyright (c) 2025 Oracle and/or its affiliates.

Released under the Apache License Version 2.0, January 2004 http://www.apache.org/licenses/.

About

A tool to measure cloud database endpoint latency using SQL queries.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •