[CalendarServer-changes] [14964] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 14 17:55:00 PDT 2015
Revision: 14964
http://trac.calendarserver.org//changeset/14964
Author: cdaboo at apple.com
Date: 2015-07-14 17:55:00 -0700 (Tue, 14 Jul 2015)
Log Message:
-----------
Add -j option to job load test tool to specify number of jobs created per HTTP request.
Modified Paths:
--------------
CalendarServer/trunk/contrib/performance/jobqueue/loadtest.py
CalendarServer/trunk/twistedcaldav/controlapi.py
Modified: CalendarServer/trunk/contrib/performance/jobqueue/loadtest.py
===================================================================
--- CalendarServer/trunk/contrib/performance/jobqueue/loadtest.py 2015-07-14 21:01:30 UTC (rev 14963)
+++ CalendarServer/trunk/contrib/performance/jobqueue/loadtest.py 2015-07-15 00:55:00 UTC (rev 14964)
@@ -52,6 +52,7 @@
"action": "testwork",
"when": config["when"],
"delay": config["delay"],
+ "jobs": config["jobs"],
"priority": PRIORITY[config["priority"]],
"weight": config["weight"],
})
@@ -99,6 +100,7 @@
-n NUM Number of child processes [10]
-i MSEC Millisecond delay between each request [1000]
-r RATE Requests/second rate [10]
+ -j JOBS Number of jobs per HTTP request [1]
-s HOST:PORT Host/port to connect to [localhost:8443]
-b SEC Number of seconds for notBefore [0]
-d MSEC Number of milliseconds for the work [10]
@@ -136,6 +138,7 @@
config = {
"numProcesses": 10,
"interval": 1000,
+ "jobs": 1,
"server": "localhost:8443",
"when": 0,
"delay": 10,
@@ -147,7 +150,7 @@
interval = None
rate = None
- options, args = getopt.getopt(sys.argv[1:], "b:d:hi:l:n:p:r:s:w:", [])
+ options, args = getopt.getopt(sys.argv[1:], "b:d:hi:j:l:n:p:r:s:w:", [])
for option, value in options:
if option == "-h":
@@ -156,6 +159,8 @@
numProcesses = int(value)
elif option == "-i":
interval = int(value)
+ elif option == "-j":
+ config["jobs"] = int(value)
elif option == "-r":
rate = int(value)
if rate <= 100:
@@ -205,6 +210,8 @@
print(" Number of processes: {}".format(config["numProcesses"]))
print(" Interval between requests: {} ms".format(config["interval"]))
print(" Effective request rate: {} req/sec".format(effective_rate))
+ print(" Jobs per request: {}".format(config["jobs"]))
+ print(" Effective job rate: {} jobs/sec".format(effective_rate * config["jobs"]))
print(" Total number of requests: {}").format(config["limit"] if config["limit"] != 0 else "unlimited")
print("")
print("Work details:")
Modified: CalendarServer/trunk/twistedcaldav/controlapi.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/controlapi.py 2015-07-14 21:01:30 UTC (rev 14963)
+++ CalendarServer/trunk/twistedcaldav/controlapi.py 2015-07-15 00:55:00 UTC (rev 14964)
@@ -377,14 +377,19 @@
delay = j["delay"]
except KeyError:
delay = 0
+ try:
+ jobs = j["jobs"]
+ except KeyError:
+ jobs = 1
- yield TestWork.schedule(
- self._store,
- when,
- priority,
- weight,
- delay,
- )
+ for _ in range(jobs):
+ yield TestWork.schedule(
+ self._store,
+ when,
+ priority,
+ weight,
+ delay,
+ )
returnValue(self._ok("ok", "Test work scheduled"))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150714/ddd64554/attachment.html>
More information about the calendarserver-changes
mailing list