Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3c80286

Browse files
committed
Running pgbench.
1 parent 7686e9e commit 3c80286

File tree

6 files changed

+98
-12
lines changed

6 files changed

+98
-12
lines changed

devops/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.retry
22
inventory_manual/manual
33
logs/
4+
res/
45

56
/postgresql.conf.common
67
/postgresql.conf.lord

devops/inventory

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ shardman_version_tag=master
3737

3838
shardman_shardlord_connstring="host={{ shardlord_ip }} port={{ pg_port }} user={{ ansible_user }}"
3939

40+
test_id=""
41+
logs=logs
42+
4043
[nodes:children]
4144
ec2
4245
manual

devops/logs.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
1-
### Collect logs
1+
### Collect logs to {{ logs }}
22

33
---
44
- hosts: nodes
55

66
tasks:
77
- name: rm -rf logs
8-
local_action: file path=logs state=absent
8+
local_action: file path={{ logs }} state=absent
99
run_once: true
10-
- name: fetch logs
10+
11+
- name: fetch logs to {{ logs }}
1112
fetch:
1213
src: "{{ pg_logfile }}"
13-
dest: logs/{{ inventory_hostname }}.log
14+
dest: "{{ logs }}/{{ inventory_hostname }}.log"
1415
validate_checksum: no # new logs might constantly arrive
1516
flat: yes
1617

1718
- name: touch logs/united.log
18-
local_action: copy content="" dest=logs/united.log
19+
local_action: copy content="" dest={{ logs }}/united.log
1920
run_once: true
2021

2122
- name: unite logs
22-
local_action: shell cat logs/{{ item }}.log >> logs/united.log
23+
local_action: shell cat {{ logs }}/{{ item }}.log >> {{ logs }}/united.log
2324
with_items: "{{ groups.nodes }}"
2425
run_once: true
2526

26-
- hosts: shardlord
27-
28-
tasks:
2927
- name: create symlink to shadlord log
3028
local_action: file
31-
src={{ inventory_hostname }}.log
32-
dest=logs/shardlord.log
29+
src={{ groups['shardlord'][0] }}.log
30+
dest={{ logs }}/shardlord.log
3331
state=link

devops/pgbench_prepare.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
### create pgbench_history everywhere, create pgbench tables on init node,
22
# shard them. TODO: drop sharded tables.
3+
# Controlling vars: scale, nparts, repfactor
4+
5+
# This is useful since we don't drop tables yet
6+
- import_playbook: init.yml
7+
tags:
8+
- init
39

410
- hosts: workers
511
environment:
@@ -70,3 +76,21 @@
7076
tags:
7177
- set_repfactor
7278
when: repfactor != 0
79+
80+
81+
- hosts: shardlord
82+
environment:
83+
PATH: "{{ pg_dst }}/bin:{{ ansible_env.PATH }}"
84+
85+
tasks:
86+
- name: wait for cmd finishing
87+
command: >
88+
psql -p {{ pg_port }} -qtA -c "
89+
select count(*) from shardman.cmd_log
90+
where status in ('waiting', 'in progress');
91+
"
92+
register: jobs_count
93+
until: jobs_count.stdout == "0"
94+
retries: 19481948 # oh my
95+
tags:
96+
- wait

devops/pgbench_run.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
### create pgbench_history everywhere, create pgbench tables on init node,
2+
# shard them. TODO: drop sharded tables.
3+
# Controlling vars: tmstmp (true/false), tname, clients, seconds.
4+
5+
6+
# set global var to use in all plays, oh my
7+
- hosts: nodes
8+
vars:
9+
tmstmp: True
10+
tname: pgbench
11+
tasks:
12+
- name: gen test date
13+
local_action: command date "+%Y-%m-%d-%H-%M"
14+
run_once: true
15+
register: now
16+
17+
- set_fact: test_id="{{ tname }}"
18+
- set_fact: test_id="{{ test_id }}-{{ now.stdout }}"
19+
when: tmstmp
20+
21+
- hosts: workers
22+
vars:
23+
clients: 1
24+
seconds: 5
25+
environment:
26+
PATH: "{{ pg_dst }}/bin:{{ ansible_env.PATH }}"
27+
28+
tasks:
29+
- name: vacuum
30+
command: >
31+
psql -p {{ pg_port }} -U {{ ansible_user }} -c "VACUUM;"
32+
33+
- name: run pgbench
34+
shell: >
35+
pgbench -p {{ pg_port }} --report-latencies --progress 1 --no-vacuum
36+
-c {{ clients }} -T {{ seconds }} 2>&1 > "{{ test_id }}.out"
37+
38+
- name: fetch pgbench exec times
39+
fetch:
40+
src: "{{ test_id }}.out"
41+
dest: res/{{ test_id }}/pgbench/{{ inventory_hostname }}.out
42+
flat: yes
43+
44+
- name: grep tps
45+
local_action: >
46+
shell grep -h -R "tps.*including" res/{{ test_id }}/pgbench/ |
47+
awk '{print $3}' > res/{{ test_id }}/tps.txt
48+
run_once: true
49+
50+
- name: calc sum tps
51+
local_action: >
52+
shell echo "sum: `awk '{ sum += $1 } END { print sum }'
53+
res/{{ test_id }}/tps.txt`" >> res/{{test_id}}/tps.txt
54+
run_once: true
55+
56+
- import_playbook: logs.yml logs=res/{{ test_id }}/logs
57+
tags:
58+
- logs

devops/readme.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ Read nodes table on workers:
5555
nodes': ansible-playbook -i inventory_ec2/ psql.yml --limit 'workers' -e "cmd='\'table shardman.nodes\''"
5656

5757
Create, fill and shard pgbench tables:
58-
ansible-playbook -i inventory_ec2/ pgbench_prepare.yml -e "scale=10 nparts=10 repfactor=1"
58+
ansible-playbook -i inventory_ec2/ pgbench_prepare.yml -e "scale=10 nparts=3 repfactor=0"
59+
Run pgbench test:
60+
ansible-playbook -f 20 -i inventory_ec2/ pgbench_run.yml -e "tmstmp=false tname=test seconds=30"
5961

6062
Gather logs to ./logs:
6163
ansible-playbook -i inventory_ec2/ logs.yml

0 commit comments

Comments
 (0)