From d45287920a6cf221da67b0ef7b8243503e8a36a6 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 7 May 2021 23:09:11 +0200 Subject: [PATCH] Add Add Python/Oracle version --- Results | 12 ++++++++++-- dcb_python_oracle | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100755 dcb_python_oracle diff --git a/Results b/Results index b935632..a0790f9 100644 --- a/Results +++ b/Results @@ -12,12 +12,12 @@ trintignant:~/wrk/database_connect_bench 22:30 :-) 1084% time ./dcb_perl_psql 0.00405609997687861 session 2 ./dcb_perl_psql 0.07s user 0.00s system 90% cpu 0.079 total -rorschach:~database_connect_bench 0:12 :-) 1094% time ./dcb_python_mysql --database=simba --user=simba --password=EilaeC2j +rorschach:~database_connect_bench 0:12 :-) 1094% time ./dcb_python_mysql --database=simba --user=simba --password=xxxxxxxx 0.045608792919665575 import 0.0019447151571512222 connect 0.04812890104949474 total 0.0025201081298291683 session -./dcb_python_mysql --database=simba --user=simba --password=EilaeC2j 0.07s user 0.00s system 98% cpu 0.076 total +./dcb_python_mysql --database=simba --user=simba --password=xxxxxxxx 0.07s user 0.00s system 98% cpu 0.076 total rorschach:~database_connect_bench 0:13 :-) 1096% time ./dcb_python_psql 0.02288187202066183 import @@ -39,3 +39,11 @@ trintignant:~/wrk/database_connect_bench 19:29 :-) 1077% time ./dcb_go_psql 0.0178164 session ./dcb_go_psql 0.01s user 0.01s system 52% cpu 0.044 total +(ora) oraxe:~/wrk/database_connect_bench 23:04 :-) 37% time ./dcb_python_oracle --user hjp --password xxxxxxxxxxxxxxx +[(datetime.datetime(2021, 5, 7, 23, 4, 59, 357630),)] +0.003943046999665967 import +0.04385234999972454 connect +0.04904494299989892 total +0.045101896000232955 session +./dcb_python_oracle --user hjp --password ieFohb5aixi6oic 0.07s user 0.02s system 74% cpu 0.116 total + diff --git a/dcb_python_oracle b/dcb_python_oracle new file mode 100755 index 0000000..47c3013 --- /dev/null +++ b/dcb_python_oracle @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +import argparse +import time + +ap = argparse.ArgumentParser() +ap.add_argument("--user") +ap.add_argument("--password") +args = ap.parse_args() + +t0 = time.monotonic() + +import cx_Oracle + +t1 = time.monotonic() +db = cx_Oracle.connect(f"{args.user}/{args.password}@localhost/XEPDB1") +t2 = time.monotonic() +csr = db.cursor() +csr.execute("select current_timestamp from dual") +r = csr.fetchall() +print(r) +t3 = time.monotonic() +db.close() +t4 = time.monotonic() +print(t1 - t0, "import") +print(t2 - t1, "connect") +print(t4 - t0, "total") +print(t4 - t1, "session")