[CalendarServer-changes] [7710] CalendarServer/trunk/contrib/performance/loadtest
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jul 6 08:00:30 PDT 2011
Revision: 7710
http://trac.macosforge.org/projects/calendarserver/changeset/7710
Author: exarkun at twistedmatrix.com
Date: 2011-07-06 08:00:27 -0700 (Wed, 06 Jul 2011)
Log Message:
-----------
Allow client software class to receive parameters from the configuration file as well; use it to allow xmpp to be enabled or disabled.
Modified Paths:
--------------
CalendarServer/trunk/contrib/performance/loadtest/config.plist
CalendarServer/trunk/contrib/performance/loadtest/ical.py
CalendarServer/trunk/contrib/performance/loadtest/population.py
CalendarServer/trunk/contrib/performance/loadtest/sim.py
CalendarServer/trunk/contrib/performance/loadtest/test_sim.py
Modified: CalendarServer/trunk/contrib/performance/loadtest/config.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/config.plist 2011-07-05 20:05:01 UTC (rev 7709)
+++ CalendarServer/trunk/contrib/performance/loadtest/config.plist 2011-07-06 15:00:27 UTC (rev 7710)
@@ -93,6 +93,24 @@
<key>software</key>
<string>loadtest.ical.SnowLeopard</string>
+ <!-- Arguments to use to initialize the SnowLeopard instance. -->
+ <key>params</key>
+ <dict>
+ <!-- SnowLeopard can poll the calendar home at some interval. This
+ is in seconds. -->
+ <key>calendarHomePollInterval</key>
+ <integer>900</integer>
+
+ <!-- If the server advertises xmpp push, SnowLeopard can wait for
+ notifications about calendar home changes instead of polling for
+ them periodically. If this option is true, then look for the
+ server advertisement for xmpp push and use it if possible.
+ Still fall back to polling if there is no xmpp push
+ advertised. -->
+ <key>supportPush</key>
+ <true/>
+ </dict>
+
<!-- The profiles define certain types of user behavior on top of the
client software being simulated. -->
<key>profiles</key>
Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py 2011-07-05 20:05:01 UTC (rev 7709)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py 2011-07-06 15:00:27 UTC (rev 7710)
@@ -195,7 +195,7 @@
email = None
- def __init__(self, reactor, root, record, auth, calendarHomePollInterval=None):
+ def __init__(self, reactor, root, record, auth, calendarHomePollInterval=None, supportPush=True):
self.reactor = reactor
self.agent = AuthHandlerAgent(Agent(self.reactor), auth)
self.root = root
@@ -205,6 +205,8 @@
calendarHomePollInterval = self.CALENDAR_HOME_POLL_INTERVAL
self.calendarHomePollInterval = calendarHomePollInterval
+ self.supportPush = supportPush
+
# Keep track of the calendars on this account, keys are
# Calendar URIs, values are Calendar instances.
self._calendars = {}
@@ -584,7 +586,7 @@
# Start monitoring PubSub notifications, if possible.
# _checkCalendarsForEvents populates self.xmpp if it finds
# anything.
- if calendarHome in self.xmpp:
+ if self.supportPush and calendarHome in self.xmpp:
self._monitorPubSub(calendarHome, self.xmpp[calendarHome])
# Run indefinitely.
yield Deferred()
Modified: CalendarServer/trunk/contrib/performance/loadtest/population.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/population.py 2011-07-05 20:05:01 UTC (rev 7709)
+++ CalendarServer/trunk/contrib/performance/loadtest/population.py 2011-07-06 15:00:27 UTC (rev 7710)
@@ -61,12 +61,21 @@
"""
compareAttributes = ("clientType", "profileTypes")
- def __init__(self, clientType, profileTypes):
+ def __init__(self, clientType, clientParams, profileTypes):
self.clientType = clientType
+ self.clientParams = clientParams
self.profileTypes = profileTypes
+ def new(self, reactor, serverAddress, userRecord, authInfo):
+ """
+ Create a new instance of this client type.
+ """
+ return self.clientType(
+ reactor, serverAddress, userRecord, authInfo, **self.clientParams)
+
+
class PopulationParameters(object, FancyEqMixin):
"""
Descriptive statistics about a population of Calendar Server users.
@@ -175,7 +184,7 @@
clientType = self._pop.next()
reactor = loggedReactor(self.reactor)
- client = clientType.clientType(
+ client = clientType.new(
reactor, self.server, self.getUserRecord(number), auth)
d = client.run()
d.addErrback(self._clientFailure, reactor)
Modified: CalendarServer/trunk/contrib/performance/loadtest/sim.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/sim.py 2011-07-05 20:05:01 UTC (rev 7709)
+++ CalendarServer/trunk/contrib/performance/loadtest/sim.py 2011-07-06 15:00:27 UTC (rev 7710)
@@ -191,13 +191,14 @@
clientConfig["weight"],
ClientType(
namedAny(clientConfig["software"]),
+ cls._convertParams(clientConfig["params"]),
[ProfileType(
namedAny(profile["class"]),
cls._convertParams(profile["params"]))
for profile in clientConfig["profiles"]]))
if not parameters.clients:
parameters.addClient(
- 1, ClientType(SnowLeopard, [Eventer, Inviter, Accepter]))
+ 1, ClientType(SnowLeopard, {}, [Eventer, Inviter, Accepter]))
observers = []
if 'observers' in options.config:
Modified: CalendarServer/trunk/contrib/performance/loadtest/test_sim.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/test_sim.py 2011-07-05 20:05:01 UTC (rev 7709)
+++ CalendarServer/trunk/contrib/performance/loadtest/test_sim.py 2011-07-06 15:00:27 UTC (rev 7710)
@@ -296,6 +296,7 @@
config.setContent(writePlistToString({
"clients": [{
"software": "loadtest.ical.SnowLeopard",
+ "params": {"foo": "bar"},
"profiles": [{
"params": {
"interval": 25,
@@ -312,7 +313,7 @@
sim = LoadSimulator.fromCommandLine(['--config', config.path])
expectedParameters = PopulationParameters()
expectedParameters.addClient(
- 3, ClientType(SnowLeopard, [ProfileType(Eventer, {
+ 3, ClientType(SnowLeopard, {"foo": "bar"}, [ProfileType(Eventer, {
"interval": 25,
"eventStartDistribution": NormalDistribution(123, 456)})]))
self.assertEquals(sim.parameters, expectedParameters)
@@ -329,7 +330,7 @@
sim = LoadSimulator.fromCommandLine(['--config', config.path])
expectedParameters = PopulationParameters()
expectedParameters.addClient(
- 1, ClientType(SnowLeopard, [Eventer, Inviter, Accepter]))
+ 1, ClientType(SnowLeopard, {}, [Eventer, Inviter, Accepter]))
self.assertEquals(sim.parameters, expectedParameters)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110706/be2e0925/attachment.html>
More information about the calendarserver-changes
mailing list