-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy paththreadexecution.html
More file actions
201 lines (155 loc) · 6.2 KB
/
threadexecution.html
File metadata and controls
201 lines (155 loc) · 6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!-- Creator : groff version 1.22.3 -->
<!-- CreationDate: Mon Mar 18 08:51:07 2024 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>threadexecution</title>
</head>
<body>
<h1 align="center">threadexecution</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNTAX">SYNTAX</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#USAGE">USAGE</a><br>
<a href="#EXAMPLE">EXAMPLE</a><br>
<a href="#BUGS">BUGS</a><br>
<a href="#COPYRIGHT">COPYRIGHT</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<hr>
<h2>NAME
<a name="NAME"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">threadexecution
− RWP*Load Simulator start and control threads</p>
<h2>SYNTAX
<a name="SYNTAX"></a>
</h2>
<pre style="margin-left:11%; margin-top: 1em">threadexecution ::=
<b>run
</b> thread<b> ;</b> { thread<b> ;</b> }
<b>end</b> [<b> run</b> ]
thread ::=
<b>threads</b> expression [ atclause ]
statementlist
<b>end</b> [<b> threads</b> ]</pre>
<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The <b>run</b>
keyword initiating thread execution is the primary means in
the RWP*Load Simulator to simulate actual workload, which it
does by starting threads and waiting for these to complete.
Threads are grouped, and all threads in each group execute
the same.</p>
<h2>USAGE
<a name="USAGE"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Each group of
threads consists of a specified number of threads that
execute the same list of statements; the number of threads
(which must be zero or larger) is provided as the expression
after the <b>threads</b> keyword. Similarly to the
<b>execute</b> statement, you can optionally provide an at
clause to specify a database that the threads will use while
executing the list of statements.</p>
<p style="margin-left:11%; margin-top: 1em">The threads
will be started using the threading interface of Oracle Call
Interface and the threads will start executing immediately
and will finish when the last statement in the list
finishes. To have threads start actual work at a known time,
you must use the control loop with some <b>start</b> time.
You must similarly use a control loop if you want threads to
run for some period of time using the <b>stop</b> option in
the control loop.</p>
<p style="margin-left:11%; margin-top: 1em">Variables
except those with the <b>threads sum</b> attribute and files
open for reading will initially have their values from the
main program. At thread start <b>threads sum</b> variables
will have the value zero and the value will be added to the
value in main when threads complete. Files open for reading
will be closed in threads.</p>
<p style="margin-left:11%; margin-top: 1em">It is common
that different threads should execute different workloads,
which can be achieved in two different ways:</p>
<p style="margin-left:11%; margin-top: 1em">If the work to
be performed has a different nature, say some threads
execute business logic while others execute dba work, you
start these as different groups of threads i.e. using
multiple <b>threads ... end</b> keywords. You would often
also use different at clauses for these.</p>
<p style="margin-left:11%; margin-top: 1em">If you want
your threads to emulate different types of business logic
that each is implemented in some procedure, use a single
thread group - possibly with many threads - that all execute
some random procedure.</p>
<h2>EXAMPLE
<a name="EXAMPLE"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The following
example shows a total of 11 threads being started.</p>
<p style="margin-left:11%; margin-top: 1em">The first ten
will start at the common start time and 10 times per second
(i.e. with a random arrival rate of 0.1s between each)
randomly execute one the three types of business logic.
Assuming each of the three business logic procedures include
some sql processing, and assuming the database named mydb
uses a session pool, a database session will be acquired and
released at the begin and end of each procedure call.</p>
<p style="margin-left:11%; margin-top: 1em">The last thread
will call the procedure syswork() every 10s.</p>
<p style="margin-left:11%; margin-top: 1em">All threads
will run for 300 seconds.</p>
<pre style="margin-left:17%; margin-top: 1em">procedure abc() ... end;
procedure def() ... end;
procedure xyz() ... end;
random procedure array doit (abc 5, def 70, xyz 25);
procedure syswork() ... end;
run
threads 10 at mydb
for queue every erlang2(1/10) stop 300 loop
doit();
end;
end;
threads 1 at systemdb
for start 10 every 10 stop 300 loop
syswork();
end loop;
end threads;
end;</pre>
<h2>BUGS
<a name="BUGS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">It could very
well be considered a bug, that a thread execution is not a
statement and therefore cannot be done inside a procedure or
inside any compound statement; it is only available as part
of your main code similar to complex declarations. Fixing
this will, however, be very complex and the restriction is
unlikely to be lifted.</p>
<h2>COPYRIGHT
<a name="COPYRIGHT"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Copyright
© 2023 Oracle Corporation <br>
Licensed under the Universal Permissive License v 1.0 as
shown at https://oss.oracle.com/licenses/upl</p>
<h2>SEE ALSO
<a name="SEE ALSO"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><a href="controlloop.html">controlloop(1rwl)</a>,
<a href="statement.html">statement(1rwl)</a>, <a href="atclause.html">atclause(1rwl)</a>, <a href="declaration.html">declaration(1rwl)</a>,
<a href="proceduredeclaration.html">proceduredeclaration(1rwl)</a>,
<a href="randomproceduredeclaration.html">randomproceduredeclaration(1rwl)</a></p>
<hr>
</body>
</html>