[Zope-Checkins] CVS: Zope/lib/python/Products/Sessions/stresstests
- stresstestMultiThread.py:1.6.36.2
Chris McDonough
chrism at plope.com
Sat May 15 17:56:59 EDT 2004
Update of /cvs-repository/Zope/lib/python/Products/Sessions/stresstests
In directory cvs.zope.org:/tmp/cvs-serv9436
Modified Files:
Tag: Zope-2_7-branch
stresstestMultiThread.py
Log Message:
Less verbose output.
=== Zope/lib/python/Products/Sessions/stresstests/stresstestMultiThread.py 1.6.36.1 => 1.6.36.2 ===
--- Zope/lib/python/Products/Sessions/stresstests/stresstestMultiThread.py:1.6.36.1 Sat Feb 28 15:09:44 2004
+++ Zope/lib/python/Products/Sessions/stresstests/stresstestMultiThread.py Sat May 15 17:56:58 2004
@@ -37,7 +37,9 @@
from ZODB.DemoStorage import DemoStorage
from tempstorage.TemporaryStorage import TemporaryStorage
from OFS.Application import Application
+from OFS.Folder import Folder
import sys
+import traceback
from zLOG import log_time
sys.setcheckinterval(200)
@@ -77,7 +79,7 @@
def _populate(app):
bidmgr = BrowserIdManager(idmgr_name)
- tf = MountedTemporaryFolder(tf_name, title="Temporary Folder")
+ tf = MountedTemporaryFolder(tf_name, 'Temporary Folder')
toc = TransientObjectContainer(toc_name, title='Temporary '
'Transient Object Container', timeout_mins=1)
session_data_manager=SessionDataManager(id=sdm_name,
@@ -114,12 +116,12 @@
def go(self, token):
readers = []
writers = []
- readiters = 100
- writeiters = 100
+ readiters = 3
+ writeiters = 3
readout = []
writeout = []
- numreaders = 4
- numwriters = 2
+ numreaders = 2
+ numwriters = 4
numvaluers = 1
db = _getDB()
for i in range(numreaders):
@@ -137,11 +139,11 @@
for thread in writers:
thread.start()
time.sleep(0.1)
- active = 2
+ active = threading.activeCount()
while active > 1:
active = threading.activeCount()
print 'waiting for %s threads' % active
- time.sleep(1)
+ time.sleep(5)
class BaseReaderWriter(threading.Thread):
def __init__(self, db, iters, token=None):
@@ -153,7 +155,6 @@
self.app.REQUEST.browser_id_ = token
self.iters = iters
self.sdm_name = sdm_name
- self.out = []
threading.Thread.__init__(self)
def run(self):
@@ -164,22 +165,25 @@
self.run1()
return
except ReadConflictError:
- print "read conflict"
+ print "R",
except BTreesConflictError:
- print "btrees conflict"
+ print "B",
except ConflictError:
- print "general conflict"
+ print "W",
except:
get_transaction().abort()
print log_time()
+ traceback.print_exc()
raise
+
i = i + 1
get_transaction().abort()
+ self.conn.sync()
time.sleep(random.randrange(5) * .1)
finally:
self.conn.close()
del self.app
- print i
+ print '%s finished' % self.__class__
class ReaderThread(BaseReaderWriter):
def run1(self):
@@ -190,8 +194,6 @@
get_transaction().commit()
for i in range(self.iters):
data = session_data_manager.getSessionData()
- if not data.has_key(t):
- self.out.append(1)
time.sleep(random.choice(range(3)))
get_transaction().commit()
More information about the Zope-Checkins
mailing list