Skip to content

Commit baa9046

Browse files
committed
change deploy directory structure;
change dtmbench output format to json;
1 parent 39054f0 commit baa9046

File tree

5 files changed

+42
-35
lines changed

5 files changed

+42
-35
lines changed

tests/deploy/cluster.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,33 @@
99
pg_repo: https://github.com/kelvich/postgresql.git
1010
pg_version_tag: xtm_patched
1111
pg_destroy_and_init: true
12-
pg_datadir: ./postgrespro-data
1312
pg_config_role:
1413
- line: "dtm.vacuum_delay=60"
1514

1615
tasks:
1716

1817
- name: clone dtm sources
1918
git: repo=https://github.com/postgrespro/pg_tsdtm.git
20-
dest=./pg_tsdtm
19+
dest={{pg_prefix}}/pg_tsdtm
2120
accept_hostkey=yes
2221
update=yes
2322
force=yes
2423
register: dtm_sources
2524

2625
- name: build dtm
27-
shell: "PG_CONFIG={{pg_dst}}/bin/pg_config make clean && PG_CONFIG={{pg_dst}}/bin/pg_config make -j {{makejobs}} install"
26+
shell: "make clean && make -j {{makejobs}} install"
2827
args:
29-
chdir: ./pg_tsdtm
28+
chdir: "{{pg_prefix}}/pg_tsdtm"
29+
environment:
30+
PG_CONFIG: "{{pg_dst}}/bin/pg_config"
3031
when: dtm_sources.changed
3132

3233
- name: enable dtm extension on datanodes
3334
lineinfile:
3435
dest: "{{pg_datadir}}/postgresql.conf"
35-
regexp: "^shared_preload_libraries "
36+
regexp: "^shared_preload_libraries"
3637
line: "shared_preload_libraries = 'pg_dtm'"
3738
state: present
3839

3940
- name: restart postgrespro
40-
command: "{{pg_dst}}/bin/pg_ctl restart -w -D ./postgrespro-data -l ./postgrespro-data/pg.log"
41+
command: "{{pg_dst}}/bin/pg_ctl restart -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log"

tests/deploy/roles/postgres/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
when: ansible_os_family == "RedHat"
3131
sudo: yes
3232

33+
- name: increase semaphores
34+
shell: sysctl kernel.sem='1000 128000 128 512'
35+
sudo: yes
36+
3337
- name: clone postgres sources
3438
git: repo={{pg_repo}}
3539
dest={{pg_src}}

tests/deploy/roles/postgres/vars/main.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
---
33
makejobs: 4
44

5-
deploy_postgres: false
6-
deploy_dtm: false
7-
deploy_pg_shard: false
8-
95
pg_repo: git://git.postgresql.org/git/postgresql.git
106
pg_version_tag: master
117

12-
138
pg_destroy_and_init: false
149

15-
1610
pg_port: 5432
1711
pg_dtm_enable: false
1812
pg_dtm_host: "127.0.0.1"
@@ -27,18 +21,9 @@ pg_config:
2721
- line: "port = {{pg_port}}"
2822
pg_config_role:
2923
- line: "#pg_config_role"
30-
pg_src: ~/postgrespro
31-
pg_dst: /tmp/postgrespro-build
32-
pg_datadir: ~/postgrespro-data
33-
34-
libuv:
35-
version: v1.7.5
36-
src: ./libuv
37-
dst: /tmp/libuv-build
3824

39-
dtmd:
40-
port: 5431
41-
dst: ./dtmd
42-
datadir: ./dtmd-data
43-
log: ./dtmd.log
25+
pg_prefix: "{{ansible_env.HOME}}/pg_cluster"
26+
pg_src: "{{pg_prefix}}/src"
27+
pg_dst: "{{pg_prefix}}/install"
28+
pg_datadir: "{{pg_prefix}}/data_{{pg_port}}"
4429

tests/dtmbench.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,19 @@ int main (int argc, char* argv[])
271271
}
272272

273273
time_t elapsed = getCurrentTime() - start;
274-
printf("TPS(updates)=%f, TPS(selects)=%f\n", (double)(nWrites*USEC)/elapsed, (double)(nReads*USEC)/elapsed);
274+
275+
276+
277+
printf(
278+
"{\"update_tps\":%f, \"read_tps\":%f, \"readers\":%d, \"writers\":%d, \"accounts\":%d, \"iterations\":%d, \"hosts\":%d}\n",
279+
(double)(nWrites*USEC)/elapsed,
280+
(double)(nReads*USEC)/elapsed,
281+
cfg.nReaders,
282+
cfg.nWriters,
283+
cfg.nAccounts,
284+
cfg.nIterations,
285+
cfg.connections.size()
286+
);
287+
275288
return 0;
276289
}

tests/perf.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22

3-
- hosts: clients[0]
3+
- hosts: clients
44
gather_facts: no
55
tasks:
66

@@ -15,21 +15,25 @@
1515
set_fact:
1616
connections: "{{ connstrs.results | map(attribute='ansible_facts.connstr') | join }}"
1717

18-
- name: copy transfers binary
18+
# - name: copy transfers binary
19+
# copy: src=./{{item}} dest=~/{{item}} mode=0755
20+
# with_items:
21+
# - "dtmbench"
22+
# - "libpqxx-4.0.so"
23+
24+
- name: copy transfers source
1925
copy: src=./{{item}} dest=~/{{item}} mode=0755
2026
with_items:
2127
- "dtmbench.cpp"
2228

2329
- name: compile dtmbench
24-
shell: "g++ -g -Wall -O2 -o dtmbench dtmbench.cpp -lpqxx -pthread "
30+
shell: "g++ -g -Wall -O2 -o dtmbench dtmbench.cpp -lpqxx -pthread"
2531

26-
- hosts: clients[0]
27-
gather_facts: no
28-
tasks:
2932
- name: run transfers
30-
shell: "./dtmbench {{connections}} -w {{item}} -r 1 -n 1000 -a 100000 -i "
33+
shell: "./dtmbench {{connections}} -w {{item}} -r 1 -n 100 -a 100000 -i "
3134
register: transfers_result
32-
with_sequence: start=20 end=400 stride=20
35+
with_sequence: start=100 end=200 stride=100
3336

34-
- debug: msg={{transfers_result.results | map(attribute='stdout_lines') | join }}
37+
- local_action: shell echo "{{transfers_result.results | map(attribute='stdout') | join('\n')}}" >> x.out
3538

39+
- debug: msg="{{ transfers_result.results | map(attribute='stdout') | join('\n') }}"

0 commit comments

Comments
 (0)