~eco-devx/charms/trusty/cassandra/trunk

« back to all changes in this revision

Viewing changes to actions/stress

  • Committer: Marco Ceppi
  • Date: 2015-05-01 04:26:15 UTC
  • Revision ID: marco@ceppi.net-20150501042615-192dlldyt13wdjc3
port from bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
set -eux
 
3
 
 
4
chlp benchmark-start || true
 
5
 
 
6
# /etc/cassandra/cassandra.yaml - listen_address: 10.0.3.124
 
7
ARGS=''
 
8
KEYSPACE='Keyspace1'
 
9
 
 
10
ARG=`action-get operations`
 
11
if [ -n "$ARG" ]; then
 
12
    ARGS+=" -o ${ARG:-INSERT}"
 
13
fi
 
14
 
 
15
 
 
16
ARG=`action-get num-different-keys`
 
17
if [[ -n "$ARG" && "$ARG" -gt "0" ]]; then
 
18
    ARGS+=" -F $ARG"
 
19
fi
 
20
 
 
21
ARG=`action-get truststore`
 
22
if [ -n "$ARG" ]; then
 
23
    ARGS+=" -ts $ARG"
 
24
fi
 
25
 
 
26
ARG=`action-get cardinality`
 
27
if [ -n "$ARG" ]; then
 
28
    ARGS+=" -C $ARG"
 
29
fi
 
30
 
 
31
ARG=`action-get enable-cql`
 
32
if [ -n "$ARG" ]; then
 
33
    ARGS+=" -L"
 
34
fi
 
35
 
 
36
ARG=`action-get enable-cql3`
 
37
if [ -n "$ARG" ]; then
 
38
    ARGS+=" -L3"
 
39
fi
 
40
 
 
41
ARG=`action-get transport-factory`
 
42
if [ -n "$ARG" ]; then
 
43
    ARGS+=" -tf $ARG"
 
44
fi
 
45
 
 
46
ARG=`action-get skip-keys`
 
47
if [ -n "$ARG" ]; then
 
48
    ARGS+=" -N $ARG"
 
49
fi
 
50
 
 
51
ARG=`action-get strategy-properties`
 
52
if [ -n "$ARG" ]; then
 
53
    ARGS+=" -O $ARG"
 
54
fi
 
55
 
 
56
ARG=`action-get ssl-protocol`
 
57
if [ -n "$ARG" ]; then
 
58
    ARGS+=" -prtcl $ARG"
 
59
fi
 
60
 
 
61
ARG=`action-get compression`
 
62
if [ -n "$ARG" ]; then
 
63
    ARGS+=" -I $ARG"
 
64
fi
 
65
 
 
66
ARG=`action-get ciphers`
 
67
if [ -n "$ARG" ]; then
 
68
    ARGS+=" -ciphers $ARG"
 
69
fi
 
70
 
 
71
ARG=`action-get throttle`
 
72
if [ -n "$ARG" ] && [ "$ARG" -gt "0" ]; then
 
73
    ARGS+=" -th $ARG"
 
74
fi
 
75
 
 
76
ARG=`action-get keep-trying`
 
77
if [ -n "$ARG" ]; then
 
78
    ARGS+=" -K $ARG"
 
79
fi
 
80
 
 
81
ARG=`action-get comparator`
 
82
if [ -n "$ARG" ]; then
 
83
    ARGS+=" -U $ARG"
 
84
fi
 
85
 
 
86
ARG=`action-get replication-on-write`
 
87
if [ -n "$ARG" ]; then
 
88
    ARGS+=" -W"
 
89
fi
 
90
 
 
91
ARG=`action-get average-size`
 
92
if [ -n "$ARG" ]; then
 
93
    ARGS+=" -v"
 
94
fi
 
95
 
 
96
ARG=`action-get query-names`
 
97
if [ -n "$ARG" ]; then
 
98
    ARGS+=" -Q $ARG"
 
99
fi
 
100
 
 
101
ARG=`action-get use-prepared-statements`
 
102
if [ -n "$ARG" ]; then
 
103
    ARGS+=" -P"
 
104
fi
 
105
 
 
106
ARG=`action-get column-size`
 
107
if [ -n "$ARG" ]; then
 
108
    ARGS+=" -S $ARG"
 
109
fi
 
110
 
 
111
ARG=`action-get replication-strategy`
 
112
if [ -n "$ARG" ]; then
 
113
    ARGS+=" -R $ARG"
 
114
fi
 
115
 
 
116
ARG=`action-get store-type`
 
117
if [ -n "$ARG" ]; then
 
118
    ARGS+=" -st $ARG"
 
119
fi
 
120
 
 
121
ARG=`action-get compaction-strategy`
 
122
if [ -n "$ARG" ]; then
 
123
    ARGS+=" -Z $ARG"
 
124
fi
 
125
 
 
126
ARG=`action-get ssl-alg`
 
127
if [ -n "$ARG" ]; then
 
128
    ARGS+=" -alg $ARG"
 
129
fi
 
130
 
 
131
ARG=`action-get keys-per-call`
 
132
if [ -n "$ARG" ]; then
 
133
    ARGS+=" -g $ARG"
 
134
fi
 
135
 
 
136
ARG=`action-get consistency-level`
 
137
if [ -n "$ARG" ]; then
 
138
    ARGS+=" -e $ARG"
 
139
fi
 
140
 
 
141
ARG=`action-get native-protocol`
 
142
if [ -z "$ARG" ]  && [ "$ARG" eq "True" ]; then
 
143
    ARGS+=" --enable-native-protocol"
 
144
fi
 
145
 
 
146
ARG=`action-get columns`
 
147
if [ -n "$ARG" ]; then
 
148
    ARGS+=" -c $ARG"
 
149
fi
 
150
 
 
151
ARG=`action-get num-keys`
 
152
if [ -n "$ARG" ]; then
 
153
    ARGS+=" -n $ARG"
 
154
fi
 
155
 
 
156
ARG=`action-get replication-factor`
 
157
if [ -n "$ARG" ]; then
 
158
    ARGS+=" -l $ARG"
 
159
fi
 
160
 
 
161
ARG=`action-get keep-going`
 
162
if [ -n "$ARG" ]; then
 
163
    ARGS+=" -k"
 
164
fi
 
165
 
 
166
ARG=`action-get truststore-password`
 
167
if [ -n "$ARG" ]; then
 
168
    ARGS+=" -tspw $ARG"
 
169
fi
 
170
 
 
171
ARG=`action-get supercolumns`
 
172
if [ -n "$ARG" ]; then
 
173
    ARGS+=" -u $ARG"
 
174
fi
 
175
 
 
176
ARG=`action-get threads`
 
177
if [ -n "$ARG" ]; then
 
178
    ARGS+=" -t $ARG"
 
179
fi
 
180
 
 
181
ARG=`action-get stdev`
 
182
if [ -n "$ARG" ]; then
 
183
    ARGS+=" -s $ARG"
 
184
fi
 
185
 
 
186
ARG=`action-get random`
 
187
if [ -n "$ARG" ]; then
 
188
    ARGS+=" -r"
 
189
fi
 
190
 
 
191
ARG=`action-get family-type`
 
192
if [ -n "$ARG" ]; then
 
193
    ARGS+=" -y $ARG"
 
194
fi
 
195
 
 
196
ARG=`action-get create-index`
 
197
if [ -n "$ARG" ]; then
 
198
    ARGS+=" -x $ARG"
 
199
fi
 
200
 
 
201
NODES=`grep listen_address /etc/cassandra/cassandra.yaml | awk '{print $2}'| head -n 1`
 
202
 
 
203
run=`date +%s`
 
204
mkdir -p /opt/cassandra-stress/results/$run
 
205
 
 
206
cassandra-stress -f /opt/cassandra-stress/results/$run/stress.log -d $NODES $ARGS
 
207
 
 
208
# Parse the results
 
209
`cat /opt/cassandra-stress/results/$run/stress.log | python $CHARM_DIR/actions/stress2json.py`
 
210
 
 
211
chlp benchmark-finish || true