https://github.com/oracle-quickstart/db-endpoint-latency-testing-ammeter
A tool to measure cloud database endpoint latency using SQL queries.
https://github.com/oracle-quickstart/db-endpoint-latency-testing-ammeter
Last synced: 14 days ago
JSON representation
A tool to measure cloud database endpoint latency using SQL queries.
- Host: GitHub
- URL: https://github.com/oracle-quickstart/db-endpoint-latency-testing-ammeter
- Owner: oracle-quickstart
- License: apache-2.0
- Created: 2023-10-16T07:16:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-14T12:27:50.000Z (8 months ago)
- Last Synced: 2025-04-20T18:40:10.407Z (2 months ago)
- Language: Python
- Size: 69.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DB(D) Endpoint(E) Latency(L) Testing(T) Ammeter(A)
## DELTA
π Introducing DELTA (DB Endpoint Latency Testing Ammeter). DELTA is a tool to test real-world latency against a remote database using execution of a query and calculating the network return time. The tool provides functions to test latency of Oracle, MySQL and Postgres databases.
The tool uses the oracledb python package to connect to Oracle databases and execute a single query per request (you can specify multiple requests as well). The tool uses the time module to measure the time it takes to execute the query, fetch the results, and close the connection. It calculates the latency of each request and the average latency of all requests.
π§ DELTA is a cloud tool to test real-world latency against a remote database endpoint using execution of a query and calculating the network return time.
π§ Network tools like ping ,iperf or tcp ping can only give you network based latency which does not always translate well to an application running those queries on a remote database.
π DELTA uses Python client for Oracle, MySQL and PostgreSQL to run a query like βSELECT 1β or "SELECT 1 FROM DUAL". You can then specific the number of executions of the query and DELTA calculates the average network round-trip time for all the executions of the query on the remote database. The script also includes error handling to track failed requests. You can also include your own custom queries.
## 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
# Deploy
## Requirement
```
Python >= 3.6.8
```## Clone Repo
```
git clone https://github.com/oracle-quickstart/db-endpoint-latency-testing-ammeter.gitcd db-endpoint-latency-testing-ammeter/
python3 -m venv db-endpoint-latency-testing-ammeter
source db-endpoint-latency-testing-ammeter/bin/activate
```## Install Python packages
```
## On CentOS or Oracle Linux or Redhat Linux
sudo yum install postgresql postgresql-devel python36-devel## On Ubuntu
sudo apt install libpq-dev python3.x-dev## Install requirements
pip3 install -r requirements.txt
```# Calculate Latency for Oracle DB
Set the below credentials in the delta.py script
```
oracle_un='your_user'
oracle_pw='your_password'
oracle_cs='your_connection_string'
```
Run
```
python3 delta.py --db oracle --interval 3 --period 5 --csvoutput oracle_latency.csv
```# Calculate Latency for MySQL
Set the below credentials in the delta.py script
```
mysql_un = 'mysql'
mysql_pw = 'your_password'
mysql_host = 'localhost'
mysql_port = '3306'
mysql_db = 'mysql'
```
Run
```
python3 delta.py --db mysql --interval 3 --period 5 --csvoutput mysql_latency.csv
```# Calculate Latency for PostgreSQL
Set the below credentials in the delta.py script
```
pgsql_un = 'postgres'
pgsql_pw = 'your_password'
pgsql_host = 'localhost'
pgsql_port = '5432'
pgsql_db = 'postgres'
```
Run
```
python3 delta.py --db postgresql --interval 3 --period 5 --csvoutput postgres_latency.csv
```# Calculate URL Latency
Set the below parameter in the delta.py script
```
test_url = 'your_url'
```
Run
```
python3 delta.py --db url --interval 3 --period 5 --csvoutput url_latency.csv
```# Test Cases for Each DB and URL
```
python3 delta.py --db oracle --interval 3 --period 5 --csvoutput oracle_latency.csvpython3 delta.py --db mysql --interval 3 --period 5 --csvoutput mysql_latency.csv
python3 delta.py --db postgresql --interval 3 --period 5 --csvoutput postgres_latency.csv
python3 delta.py --db url --interval 3 --period 5 --csvoutput url_latency.csv
```