Skip to content

Commit 27ab65a

Browse files
committed
Implement rategradient for gradual rate increase
1 parent 87d2595 commit 27ab65a

File tree

11 files changed

+119
-13
lines changed

11 files changed

+119
-13
lines changed

bin/oltpcore

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
# Changes
1313
#
14+
# bengsig 15-nov-2022 - rategradient, -i, -d options
1415
# bengsig 1-nov-2022 - --no-awr option
1516
# bengsig 25-oct-2022 - External control
1617
# bengsig 9-sep-2022 - Better aw query control
@@ -20,7 +21,7 @@
2021
# show how we were called
2122
tty -s || echo $0 $*
2223

23-
options="bo:gn:k:r:hHp:s:a2x:R:WK: -l xc_run_dedicated,simulatebatch,help,extraout:,runfile:,runnumberfile:,startseconds:,processcount:,key:,runperiod:,preallocate,awrwait,awrkill:,graphs,no-awr"
24+
options="i:d:bo:gn:k:r:hHp:s:a2x:R:WK: -l integer:,double:,xc_run_dedicated,simulatebatch,help,extraout:,runfile:,runnumberfile:,startseconds:,processcount:,key:,runperiod:,preallocate,awrwait,awrkill:,graphs,no-awr"
2425
usage="$commandname [-h|H] [-g] [-a] [-W] [-K n] [-n processes] [-k key] [-r runperiod] [-R runfile] [-p file] [-s file] [-o file] komment text ..."
2526
runperiod=295
2627

@@ -40,6 +41,8 @@ allocate=no
4041
simulatebatch=0
4142
xc_run_dedicated='0'
4243
killfile=''
44+
extra_args=''
45+
4346
unset RWLOLTP_SIDE
4447

4548
getopt -Q -o $options -- "$@" || exit 1
@@ -48,6 +51,8 @@ set -- `getopt -u -n $commandname -o $options -- "$@"`
4851
while test $1 != '--'
4952
do
5053
case $1 in
54+
-i|--integer|-d|--double) extra_args="$extra_args $1 $2"; shift; shift;
55+
;;
5156
-o|--extraout) extraout=$2; shift; shift;
5257
;;
5358
-s|--startseconds) startsecondsfile=$2; shift; shift;
@@ -134,14 +139,12 @@ then
134139
exit 1
135140
fi
136141

137-
extra_args=''
138-
139142

140143
rwloadsim -i simulatebatch:=$simulatebatch parameters.rwl || exit $?
141144

142145
#
143146
# show the contents of our parameters file as a reference
144-
rwloadsim -q -i simulatebatch:=$simulatebatch -i runperiod:=$runperiod -i proccount:=$procs -i show_changed_values:=1 parameters.rwl
147+
rwloadsim -q $extra_args -i simulatebatch:=$simulatebatch -i runperiod:=$runperiod -i proccount:=$procs -i show_changed_values:=1 parameters.rwl
145148

146149
# Set shell variables
147150
eval `rwloadsim -q -i proccount:=$procs -i runperiod:=$runperiod parameters2shell.rwl`
@@ -200,7 +203,7 @@ then
200203
else
201204
echo "plotactive=no" >> $resultsdir/$subdir/$runnumber/env
202205
fi
203-
rwloadsim -q -i simulatebatch:=$simulatebatch -i runperiod:=$runperiod -i proccount:=$procs -i show_changed_values:=1 parameters.rwl > $resultsdir/$subdir/$runnumber/parmatstart.txt
206+
rwloadsim -q $extra_args -i simulatebatch:=$simulatebatch -i runperiod:=$runperiod -i proccount:=$procs -i show_changed_values:=1 parameters.rwl > $resultsdir/$subdir/$runnumber/parmatstart.txt
204207

205208
# Start ping gather and also ask for event notification
206209
rwloadsim -u -E -q -R $prepfile -i simulatebatch:=$simulatebatch -i runperiod:=$runperiod runping.rwl &
@@ -213,7 +216,7 @@ fi
213216
quiet=''
214217

215218
# Start sys gather
216-
rwloadsim -u -A 1 -r -q -i procnumber:=99999 -i simulatebatch:=$simulatebatch -i runperiod:=$runperiod -i proccount:=$procs -R $prepfile $extra_args -i doawr:=$doawr runsys.rwl $starttime &
219+
rwloadsim -u -A 1 -r -q -i procnumber:=99999 -i simulatebatch:=$simulatebatch -i runperiod:=$runperiod -i proccount:=$procs -R $prepfile -i doawr:=$doawr runsys.rwl $starttime &
217220
awrpid=$!
218221

219222
if test x$killfile != x

bin/oltprun

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77

88
# Changes
99
#
10+
# bengsig 15-nov-2022 - rategradient, -i, -d options
1011
# bengsig 2-jul-2022 - Add simulatebatch
1112
# bengsig 26-jan-2022 - Use mktemp rather than $$ for intermediate files
1213
# bengsig 14-jan-2021 - Copy out file to awrdir .txt file after extra scripts
1314

1415
# This is mostly a wrapper for runcore.sh that
1516
# saves stdout and stderr in a file
1617

17-
options="bx:n:gk:r:hHa2R:WK:o: -l simulatebatch,help,extraout:,runfile:,startseconds:,processcount:,key:,runperiod:,preallocate,awrwait,awrkill:,graphs,extrascript:"
18+
options="i:d:bx:n:gk:r:hHa2R:WK:o: -l integer:,double:,simulatebatch,help,extraout:,runfile:,startseconds:,processcount:,key:,runperiod:,preallocate,awrwait,awrkill:,graphs,extrascript:"
1819
usage="$commandname [-H] [-g] [-a] [-2] [-k key] [-r runperiod] [-R file] [-n procs] [-x script] [-o file] [-W] [-K nn] [komment text ...]"
1920
runperiod=295
2021

@@ -44,7 +45,7 @@ do
4445
;;
4546
--simulatebatch|-b|--graphs|--awrwait|--preallocate|-W|-a|-g|-2) copyargs="$copyargs $1"; shift;
4647
;;
47-
--runfile|--awrkill|-R|-K) copyargs="$copyargs $1 $2"; shift; shift;
48+
-i|-d|--integer|--double|--runfile|--awrkill|-R|-K) copyargs="$copyargs $1 $2"; shift; shift;
4849
;;
4950
-h|--help|-H ) help=yes; shift;
5051
;;

docs/refman/oltpcore.html

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/refman/oltprun.html

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/refman/oltpsetup.html

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/man2rwl/oltpcore.2rwl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ Add the contents of the named text file to generated html output; this can be us
9191
to add more information than feasible using komment.
9292
.RE
9393
.P
94+
.B -i|--integer|-d|--double spec
95+
.RS 4
96+
Provide the option to rwloadsim when doing the actual run, i.e. when run.rwl (or the file
97+
given as the -R option) is executed.
98+
.RE
99+
.P
94100
.B -W|--awrwait
95101
.P
96102
.B -K|--awrkill n

man/man2rwl/oltprun.2rwl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ Execute the named script (which must be in your current directory) after complet
9191
it will be provided one argument which is the runnumber.
9292
.RE
9393
.P
94+
.B -i|--integer|-d|--double spec
95+
.RS 4
96+
Provide the option to rwloadsim when doing the actual run, i.e. when run.rwl (or the file
97+
given as the -R option) is executed.
98+
.RE
99+
.P
94100
.B -W|--awrwait
95101
.P
96102
.B -K|--awrkill n

man/man2rwl/oltpsetup.2rwl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,20 @@ You can very approximately assume that with the default value together with the
315315
\fBthreadcount\fR, making runs with one process will require in the order of 0.2 database CPU seconds per second.
316316
.RE
317317
.P
318+
\fBrategradient\fR
319+
.RS 4
320+
This is a double value that can be used to make the overall workload increase gradually during
321+
a run.
322+
If the value is 0 (or is unset), the arrival rate will be constant during the run;
323+
this is the default behavior.
324+
If the value is set higher than 0 and at most to 1, the arrival rate will initially be
325+
\fIlower\fR than specified via \fBratefactor\fR, half way through the run it will be
326+
what \fBratefactor\fR specifies and at the finish of the run, it will be \fIhigher\fR.
327+
Effectively, the rate will gradually increase from 100*rategradient percent below normal
328+
to 100*rategradient percent above normal.
329+
Values outside the range [0;1] will be adjusted to either 0 or 1.
330+
.RE
331+
.P
318332
\fBthreadcount\fR
319333
.RS 4
320334
This is an integer value (default 50) that sets the number of worker threads per process.

oltp/oltp.rwl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,16 @@ gnuplotjs := "/usr/share/gnuplot/4.6/js";
254254
# the workload. Initially, leave it at the default.
255255
# ratefactor := 0.2; # proportionally changes load (default 0.2)
256256

257+
# Rather than a constant workload, you can make it gradually increase
258+
# during the run by setting rategradient.
259+
# If set to NULL or 0, same rate through whole run; this is the default
260+
# Otherwise the workload will start 100*rategradient % lower
261+
# and finish 100*rategradient % higher.
262+
# The value must be in the range [0.0;1.0]
263+
# As an example, if you uncomment this following line
264+
# rategradient := 0.25;
265+
# the rate will gradually increase from 75% to 125%.
266+
257267
# If using the oltpforever command to run continously, this parameter
258268
# sets the number of processes in oltpforever (and oltpforever2)
259269
# forever_proccount := 1; # process count per side in continuous tests

oltp/parameters.rwl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Licensed under the Universal Permissive License v 1.0
33
# as shown at https://oss.oracle.com/licenses/upl/
44

5+
# bengsig 15-nov-2022 - Add rategradient
56
# bengsig 25-oct-2022 - External control
67
# bengsig 2019 - Creation
78

@@ -19,6 +20,10 @@ $errortime:on
1920
# per process on a 2GHz CPU. Higher values means proportionally higher load
2021
double ratefactor := 0.2;
2122

23+
double rategradient;
24+
# NULL or 0, same rate through whole run
25+
# otherwise multiply ratefactor by 1+gradient*(runseconds-runperiod/2)/(runperiod/2)
26+
2227
# How many seconds rampump between worker threads
2328
double rampfactor := 0.1;
2429

@@ -248,6 +253,18 @@ double xc_sessionwait := 120; # seconds timeout waitit for a free session, 0 for
248253

249254
$include:"$RWLOLTP_NAME.rwl"
250255

256+
# gradient stuff
257+
double halfperiod := runperiod / 2.0;
258+
if rategradient is not null then
259+
if rategradient < 0.0 then
260+
rategradient := 0.0;
261+
end if;
262+
if rategradient > 1.0 then
263+
rategradient := 1.0;
264+
end if;
265+
end if;
266+
267+
251268
if sysawr_connect = "" then
252269
sysawr_connect := system_connect;
253270
end if;
@@ -311,7 +328,14 @@ if show_changed_values then
311328
if simulatebatch then
312329
printline "ratefactor is not used in busy loop";
313330
else
314-
printline "ratefactor="||ratefactor " (" xeqpsec " tps outside bursts)";
331+
if rategradient is not null then
332+
double xeqpslo := threadcount * proccount * ratefactor * (1.0-rategradient) / 0.08;
333+
double xeqpshi := threadcount * proccount * ratefactor * (1.0+rategradient) / 0.08;
334+
printf "ratefactor=%.2f (gradual increase from %.f to %.f tps outside bursts)\n"
335+
, ratefactor, xeqpslo, xeqpshi;
336+
else
337+
printline "ratefactor="||ratefactor " (" xeqpsec " tps outside bursts)";
338+
end if;
315339
printline "per worker: " ratefactor/0.08 "/s average arrival rate, " 0.08/ratefactor "s average time";
316340
printline "per process: " threadcount*ratefactor/0.08 "/s average arrival rate, "
317341
0.08/(ratefactor*threadcount) "s average time";

0 commit comments

Comments
 (0)