[CalendarServer-changes] [6639] CalendarServer/trunk/contrib/performance
source_changes at macosforge.org
source_changes at macosforge.org
Tue Nov 16 10:56:56 PST 2010
Revision: 6639
http://trac.macosforge.org/projects/calendarserver/changeset/6639
Author: exarkun at twistedmatrix.com
Date: 2010-11-16 10:56:50 -0800 (Tue, 16 Nov 2010)
Log Message:
-----------
Try reading the RunRoot from the config plist instead of hard-coding data/Logs
Modified Paths:
--------------
CalendarServer/trunk/contrib/performance/benchlib.sh
CalendarServer/trunk/contrib/performance/benchmark.py
CalendarServer/trunk/contrib/performance/sample.sh
Added Paths:
-----------
CalendarServer/trunk/contrib/performance/extractconf
Modified: CalendarServer/trunk/contrib/performance/benchlib.sh
===================================================================
--- CalendarServer/trunk/contrib/performance/benchlib.sh 2010-11-15 21:44:43 UTC (rev 6638)
+++ CalendarServer/trunk/contrib/performance/benchlib.sh 2010-11-16 18:56:50 UTC (rev 6639)
@@ -10,6 +10,9 @@
# backend, and PID files will be discovered beneath it.
SOURCE=~/Projects/CalendarServer/trunk
+# The plist the server will respect.
+CONF=$SOURCE/conf/caldavd-dev.plist
+
PIDFILE=$SOURCE/data/Logs/caldavd.pid
# Names of benchmarks we can run.
@@ -23,7 +26,7 @@
# Change the config beneath $SOURCE to use a particular database backend.
function setbackend() {
- ./setbackend $SOURCE/conf/caldavd-test.plist $1 > $SOURCE/conf/caldavd-dev.plist
+ ./setbackend $SOURCE/conf/caldavd-test.plist $1 > $CONF
}
# Clean up $SOURCE, update to the specified revision, and build the
@@ -42,11 +45,14 @@
# (which is only a weak metric for "the server is ready to use").
function start() {
NUM_INSTANCES=$1
+ PIDDIR=$SOURCE/$(extractconf $CONF RunRoot)
+
shift
./run -d -n $*
while sleep 2; do
- instances=($SOURCE/data/Logs/*instance*)
+ instances=($PIDDIR/*instance*)
if [ "${#instances[*]}" -eq "$NUM_INSTANCES" ]; then
+ echo "instance pid files: ${instances[*]}"
break
fi
done
Modified: CalendarServer/trunk/contrib/performance/benchmark.py
===================================================================
--- CalendarServer/trunk/contrib/performance/benchmark.py 2010-11-15 21:44:43 UTC (rev 6638)
+++ CalendarServer/trunk/contrib/performance/benchmark.py 2010-11-16 18:56:50 UTC (rev 6639)
@@ -1,4 +1,4 @@
-import sys, os
+import sys, os, plistlib
from os.path import dirname
from signal import SIGINT
@@ -301,13 +301,7 @@
@inlineCallbacks
-def benchmark(host, port, directory, label, benchmarks):
- # Figure out which pids we are benchmarking.
- if directory:
- pids = [masterPID(directory)] + instancePIDs(directory)
- else:
- pids = []
-
+def benchmark(host, port, pids, label, benchmarks):
parameters = [1, 9, 81]
samples = 200
@@ -340,9 +334,10 @@
'Hostname or IPv4 address on which a CalendarServer is listening'),
('port', 'p', 8008,
'Port number on which a CalendarServer is listening', portCoerce),
- ('log-directory', 'd', None,
- 'Logs directory of the CalendarServer being benchmarked (if and only '
- 'if the CalendarServer is on the same host as this benchmark process)',
+ ('source-directory', 'd', None,
+ 'The base of the CalendarServer source checkout being benchmarked '
+ '(if and only if the CalendarServer is on the same host as this '
+ 'benchmark process and dtrace-based metrics are desired)',
logsCoerce),
('label', 'l', 'data', 'A descriptive string to attach to the output filename.'),
]
@@ -357,7 +352,15 @@
raise UsageError("Specify at least one benchmark")
+def whichPIDs(source, conf):
+ """
+ Return a list of PIDs to dtrace.
+ """
+ run = source.preauthChild(conf['RunRoot'])
+ return [run.child(conf['PIDFile'])] + [
+ pid.getContent() for pid in run.globChildren('*instance*')]
+
def main():
from twisted.python.log import startLogging, err
@@ -372,11 +375,17 @@
from twisted.python.failure import startDebugMode
startDebugMode()
+ if options['source-directory']:
+ source = options['source-directory']
+ conf = source.child('conf').child('caldavd-dev.plist')
+ pids = whichPIDs(source, plistlib.PlistParser().parse(conf.open()))
+ else:
+ pids = []
+
startLogging(file('benchmark.log', 'a'), False)
d = benchmark(
- options['host'], options['port'],
- options['log-directory'], options['label'],
+ options['host'], options['port'], pids, options['label'],
[(arg, namedAny(arg).measure) for arg in options['benchmarks']])
d.addErrback(err)
reactor.callWhenRunning(d.addCallback, lambda ign: reactor.stop())
Added: CalendarServer/trunk/contrib/performance/extractconf
===================================================================
--- CalendarServer/trunk/contrib/performance/extractconf (rev 0)
+++ CalendarServer/trunk/contrib/performance/extractconf 2010-11-16 18:56:50 UTC (rev 6639)
@@ -0,0 +1,5 @@
+#!/usr/bin/python
+
+import sys, plistlib
+
+print plistlib.PlistParser().parse(file(sys.argv[1]))[sys.argv[2]]
Property changes on: CalendarServer/trunk/contrib/performance/extractconf
___________________________________________________________________
Added: svn:executable
+ *
Modified: CalendarServer/trunk/contrib/performance/sample.sh
===================================================================
--- CalendarServer/trunk/contrib/performance/sample.sh 2010-11-15 21:44:43 UTC (rev 6638)
+++ CalendarServer/trunk/contrib/performance/sample.sh 2010-11-16 18:56:50 UTC (rev 6639)
@@ -17,7 +17,6 @@
stop
rm -rf data/
start 2
- echo "instance pid files: ${instances[*]}"
popd
sudo ./run.sh ./benchmark --label r$REV-$backend --log-directory $LOGS $BENCHMARKS
data=`echo -n r$REV-$backend*`
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101116/3ffd6594/attachment.html>
More information about the calendarserver-changes
mailing list