Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
7374a625
Commit
7374a625
authored
May 16, 2004
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make output a little more informative and emulate Zope better by opening
and closing a connection between each request.
parent
f41ed0b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
14 deletions
+40
-14
lib/python/Products/Sessions/stresstests/stresstestMultiThread.py
...on/Products/Sessions/stresstests/stresstestMultiThread.py
+40
-14
No files found.
lib/python/Products/Sessions/stresstests/stresstestMultiThread.py
View file @
7374a625
...
...
@@ -116,10 +116,10 @@ class TestMultiThread(TestCase):
def
go
(
self
,
token
):
readers
=
[]
writers
=
[]
valuers
=
[]
readiters
=
3
writeiters
=
3
readout
=
[]
writeout
=
[]
valueiters
=
3
numreaders
=
2
numwriters
=
4
numvaluers
=
1
...
...
@@ -128,8 +128,8 @@ class TestMultiThread(TestCase):
thread
=
ReaderThread
(
db
,
readiters
,
token
)
readers
.
append
(
thread
)
for
i
in
range
(
numvaluers
):
thread
=
ValuesGetterThread
(
db
,
read
iters
,
token
)
read
ers
.
append
(
thread
)
thread
=
ValuesGetterThread
(
db
,
value
iters
,
token
)
valu
ers
.
append
(
thread
)
for
i
in
range
(
numwriters
):
thread
=
WriterThread
(
db
,
writeiters
,
token
)
writers
.
append
(
thread
)
...
...
@@ -139,32 +139,52 @@ class TestMultiThread(TestCase):
for
thread
in
writers
:
thread
.
start
()
time
.
sleep
(
0.1
)
for
thread
in
valuers
:
thread
.
start
()
time
.
sleep
(
0.1
)
active
=
threading
.
activeCount
()
while
active
>
1
:
active
=
threading
.
activeCount
()
while
active
>
0
:
active
=
threading
.
activeCount
()
-
1
print
'waiting for %s threads'
%
active
print
"readers: "
,
numActive
(
readers
),
print
"writers: "
,
numActive
(
writers
),
print
"valuers: "
,
numActive
(
valuers
)
time
.
sleep
(
5
)
def
numActive
(
threads
):
i
=
0
for
thread
in
threads
:
if
not
thread
.
isFinished
():
i
+=
1
return
i
class
BaseReaderWriter
(
threading
.
Thread
):
def
__init__
(
self
,
db
,
iters
,
token
=
None
):
self
.
conn
=
db
.
open
()
self
.
app
=
self
.
conn
.
root
()[
'Application'
]
self
.
app
=
makerequest
.
makerequest
(
self
.
app
)
if
token
is
None
:
token
=
getNewBrowserId
()
self
.
app
.
REQUEST
.
browser_id_
=
token
self
.
iters
=
iters
self
.
sdm_name
=
sdm_name
self
.
finished
=
0
self
.
db
=
db
self
.
token
=
token
threading
.
Thread
.
__init__
(
self
)
def
run
(
self
):
i
=
0
try
:
while
1
:
self
.
conn
=
self
.
db
.
open
()
self
.
app
=
self
.
conn
.
root
()[
'Application'
]
self
.
app
=
makerequest
.
makerequest
(
self
.
app
)
if
self
.
token
is
None
:
token
=
getNewBrowserId
()
else
:
token
=
self
.
token
self
.
app
.
REQUEST
.
browser_id_
=
token
try
:
self
.
run1
()
return
except
ReadConflictError
:
#traceback.print_exc()
print
"R"
,
except
BTreesConflictError
:
print
"B"
,
...
...
@@ -178,13 +198,19 @@ class BaseReaderWriter(threading.Thread):
i
=
i
+
1
get_transaction
().
abort
()
self
.
conn
.
sync
()
time
.
sleep
(
random
.
randrange
(
5
)
*
.
1
)
self
.
conn
.
close
()
time
.
sleep
(
random
.
randrange
(
10
)
*
.
1
)
finally
:
get_transaction
().
abort
()
self
.
conn
.
close
()
del
self
.
app
self
.
finished
=
1
print
'%s finished'
%
self
.
__class__
def
isFinished
(
self
):
return
self
.
finished
class
ReaderThread
(
BaseReaderWriter
):
def
run1
(
self
):
session_data_manager
=
getattr
(
self
.
app
,
self
.
sdm_name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment