C++ Postgres proxy that logs client's sql queries to a log file.
Default log file location: "/tmp/sql_queries.log" (see Makefile).
Make sure that ssl is disabled in Postgres.
(README на Русском)
- gcc, g++
- make
- linux libraries (epoll)
- postgres, createdb, pgbench
- optional: docker, python
In one terminal:
make build_n_runIn another:
docker-compose up -d
make docker_create_stress_db
make docker_stress_testOptional: In a 3-rd terminal (if you want to test for a big query):
cd py
python -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
python main.pymake build_n_runBefore running stress test create db like so.
- Docker (Recommended)
make docker_create_stress_db- Native
make create_stress_dbRun test commands in another terminal after running the proxy server
- Docker (Recommended)
make docker_stress_test- Native
Postgres must be configured, listening on 6432 port
make stress_testIn another terminal
cd py
python -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
python main.pyTested on: CPU 8-core 3.6 Ghz + 16GB RAM
pgbench (14.23 (Debian 14.23-1.pgdg13+1))
starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 5
query mode: simple
number of clients: 50
number of threads: 4
duration: 310 s
number of transactions actually processed: 804150
latency average = 19.328 ms
initial connection time = 109.933 ms
tps = 2586.907398 (without initial connection time)