<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[15645] CalendarServer/trunk/contrib/performance/loadtest</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/15645">15645</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2016-05-31 10:36:37 -0700 (Tue, 31 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add client sim profiles for deep refreshes and time range queries</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkcontribperformanceloadtestclientsplist">CalendarServer/trunk/contrib/performance/loadtest/clients.plist</a></li>
<li><a href="#CalendarServertrunkcontribperformanceloadtestconfigplist">CalendarServer/trunk/contrib/performance/loadtest/config.plist</a></li>
<li><a href="#CalendarServertrunkcontribperformanceloadtesticalpy">CalendarServer/trunk/contrib/performance/loadtest/ical.py</a></li>
<li><a href="#CalendarServertrunkcontribperformanceloadtestprofilespy">CalendarServer/trunk/contrib/performance/loadtest/profiles.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkcontribperformanceloadtestclientsplist"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/clients.plist (15644 => 15645)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/clients.plist        2016-05-31 17:34:48 UTC (rev 15644)
+++ CalendarServer/trunk/contrib/performance/loadtest/clients.plist        2016-05-31 17:36:37 UTC (rev 15645)
</span><span class="lines">@@ -731,6 +731,45 @@
</span><span class="cx">                                         </dict>
</span><span class="cx">
</span><span class="cx">
</span><ins>+                                        <!-- A profile which periodically does calendar-query reports
+                                                on a random calendar. -->
+                                        <dict>
+                                                <key>class</key>
+                                                <string>contrib.performance.loadtest.profiles.TimeRanger</string>
+
+                                                <key>params</key>
+                                                <dict>
+                                                        <key>enabled</key>
+                                                        <false/>
+
+                                                        <!-- Define the interval (in seconds) at which this profile will use
+                                                                its client to run a report. -->
+                                                        <key>interval</key>
+                                                        <integer>10</integer>
+
+                                                </dict>
+                                        </dict>
+
+
+                                        <!-- A profile which periodically does a "deep refresh" of PROPFINDs
+                                         on each calendar. -->
+                                        <dict>
+                                                <key>class</key>
+                                                <string>contrib.performance.loadtest.profiles.DeepRefresher</string>
+
+                                                <key>params</key>
+                                                <dict>
+                                                        <key>enabled</key>
+                                                        <true/>
+
+                                                        <!-- Define the interval (in seconds) at which this profile will use
+                                                                its client to refresh. -->
+                                                        <key>interval</key>
+                                                        <integer>600</integer>
+
+                                                </dict>
+                                        </dict>
+
</ins><span class="cx">                                         <!-- A profile which will periodically reset itself, as if a user removed
</span><span class="cx">                                                 and re-added their account. -->
</span><span class="cx">                                         <dict>
</span><span class="lines">@@ -806,8 +845,9 @@
</span><span class="cx">                                 <!-- Determine the frequency at which this client configuration will
</span><span class="cx">                                         appear in the clients which are created by the load tester. -->
</span><span class="cx">                                 <key>weight</key>
</span><del>-                                <integer>1</integer>
</del><ins>+                                <integer>2</integer>
</ins><span class="cx">                         </dict>
</span><ins>+
</ins><span class="cx">                 </array>
</span><span class="cx">         </dict>
</span><span class="cx"> </plist>
</span></span></pre></div>
<a id="CalendarServertrunkcontribperformanceloadtestconfigplist"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/config.plist (15644 => 15645)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/config.plist        2016-05-31 17:34:48 UTC (rev 15644)
+++ CalendarServer/trunk/contrib/performance/loadtest/config.plist        2016-05-31 17:36:37 UTC (rev 15645)
</span><span class="lines">@@ -143,21 +143,21 @@
</span><span class="cx">                         <dict>
</span><span class="cx">                                 <!-- groups gives the total number of groups of clients to introduce. -->
</span><span class="cx">                                 <key>groups</key>
</span><del>-                                <integer>10</integer>
</del><ins>+                                <integer>15</integer>
</ins><span class="cx">
</span><span class="cx">                                 <!-- groupSize is the number of clients in each group of clients. It's
</span><span class="cx">                                         really only a "smooth" ramp up if this is pretty small. -->
</span><span class="cx">                                 <key>groupSize</key>
</span><del>-                                <integer>3</integer>
</del><ins>+                                <integer>1</integer>
</ins><span class="cx">
</span><span class="cx">                                 <!-- Number of seconds between the introduction of each group. -->
</span><span class="cx">                                 <key>interval</key>
</span><del>-                                <integer>3</integer>
</del><ins>+                                <integer>15</integer>
</ins><span class="cx">
</span><span class="cx">                                 <!-- Number of clients each user is assigned to. -->
</span><span class="cx">                                 <!-- Set weight of clients to 1 if this is > 1. Number of clients must match this value if > 1. -->
</span><span class="cx">                                 <key>clientsPerUser</key>
</span><del>-                                <integer>2</integer>
</del><ins>+                                <integer>3</integer>
</ins><span class="cx">                         </dict>
</span><span class="cx">
</span><span class="cx">                 </dict>
</span></span></pre></div>
<a id="CalendarServertrunkcontribperformanceloadtesticalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py (15644 => 15645)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/ical.py        2016-05-31 17:34:48 UTC (rev 15644)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py        2016-05-31 17:36:37 UTC (rev 15645)
</span><span class="lines">@@ -849,7 +849,59 @@
</span><span class="cx"> returnValue((calendars, notificationCollection, result,))
</span><span class="cx">
</span><span class="cx">
</span><ins>+
+ def timeRangeQuery(self, url, start, end):
+
+ requestBody = """<?xml version="1.0" encoding="utf-8" ?>
+ <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
+ <D:prop>
+ <D:getetag/>
+ <C:calendar-data>
+ <C:expand start="{start}" end="{end}"/>
+ <C:comp name="VCALENDAR">
+ <C:prop name="VERSION"/>
+ <C:comp name="VEVENT">
+ <C:prop name="SUMMARY"/>
+ <C:prop name="DTSTART"/>
+ <C:prop name="DTEND"/>
+ <C:prop name="LOCATION"/>
+ <C:prop name="UID"/>
+ <C:prop name="RECURRENCE-ID"/>
+ </C:comp>
+ </C:comp>
+ </C:calendar-data>
+ </D:prop>
+ <C:filter>
+ <C:comp-filter name="VCALENDAR">
+ <C:comp-filter name="VEVENT">
+ <C:time-range start="{start}" end="{end}"/>
+ </C:comp-filter>
+ </C:comp-filter>
+ </C:filter>
+ </C:calendar-query>""".format(start=start, end=end)
+
+ return self._report(
+ url,
+ requestBody,
+ allowedStatus=(MULTI_STATUS,),
+ method_label="REPORT{calendar-query}"
+ )
+
+
</ins><span class="cx"> @inlineCallbacks
</span><ins>+ def deepRefresh(self):
+ calendars, notificationCollection, results = yield self._calendarHomePropfind(self.calendarHomeHref)
+ for calendar in calendars:
+ yield self._propfind(
+ calendar.url,
+ self._POLL_CALENDAR_PROPFIND_D1,
+ depth='1',
+ method_label="PROPFIND{calendar}"
+ )
+
+
+
+ @inlineCallbacks
</ins><span class="cx"> def _extractPrincipalDetails(self):
</span><span class="cx"> # Using the actual principal URL, retrieve principal information
</span><span class="cx"> principal = yield self._principalPropfind()
</span><span class="lines">@@ -2269,7 +2321,7 @@
</span><span class="cx">
</span><span class="cx"> _client_type = "OS X 10.11"
</span><span class="cx">
</span><del>- USER_AGENT = "Mac+OS+X/10.11 (15A283) CalendarAgent/361"
</del><ins>+ USER_AGENT = "Mac+OS+X/10.11 (15A283) CalendarAgent/361 Simulator"
</ins><span class="cx">
</span><span class="cx"> # The default interval, used if none is specified in external
</span><span class="cx"> # configuration. This is also the actual value used by El
</span></span></pre></div>
<a id="CalendarServertrunkcontribperformanceloadtestprofilespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/profiles.py (15644 => 15645)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/profiles.py        2016-05-31 17:34:48 UTC (rev 15644)
+++ CalendarServer/trunk/contrib/performance/loadtest/profiles.py        2016-05-31 17:36:37 UTC (rev 15645)
</span><span class="lines">@@ -46,7 +46,8 @@
</span><span class="cx"> from pycalendar.datetime import DateTime
</span><span class="cx"> from pycalendar.duration import Duration
</span><span class="cx">
</span><del>-from datetime import datetime
</del><ins>+from datetime import datetime, timedelta
+import dateutil
</ins><span class="cx">
</span><span class="cx"> class ProfileBase(object):
</span><span class="cx"> """
</span><span class="lines">@@ -1064,7 +1065,69 @@
</span><span class="cx"> return self._newOperation("create", d)
</span><span class="cx">
</span><span class="cx">
</span><ins>+class TimeRanger(ProfileBase):
+ """
+ A profile which does time queries
+ """
</ins><span class="cx">
</span><ins>+ def setParameters(
+ self,
+ enabled=True,
+ interval=25,
+ ):
+ self.enabled = enabled
+ self._interval = interval
+
+
+ def run(self):
+ self._call = LoopingCall(self._runQuery)
+ self._call.clock = self._reactor
+ return self._call.start(self._interval)
+
+
+ def _runQuery(self):
+ # Don't perform any operations until the client is up and running
+ if not self._client.started:
+ return succeed(None)
+
+ now = datetime.now(dateutil.tz.tzutc())
+ start = now.strftime("%Y%m%dT%H%M%SZ")
+ end = (now + timedelta(seconds=24 * 60 * 60)).strftime("%Y%m%dT%H%M%SZ")
+
+ calendar = self._getRandomCalendarOfType('VEVENT')
+ return self._client.timeRangeQuery(calendar.url, start, end)
+
+
+
+class DeepRefresher(ProfileBase):
+ """
+ A profile which PROPFINDs all collection in a home
+ """
+
+ def setParameters(
+ self,
+ enabled=True,
+ interval=25,
+ ):
+ self.enabled = enabled
+ self._interval = interval
+
+
+ def run(self):
+ self._call = LoopingCall(self._deepRefresh)
+ self._call.clock = self._reactor
+ return self._call.start(self._interval)
+
+
+ def _deepRefresh(self):
+ # Don't perform any operations until the client is up and running
+ if not self._client.started:
+ return succeed(None)
+
+ return self._client.deepRefresh()
+
+
+
</ins><span class="cx"> class Resetter(ProfileBase):
</span><span class="cx"> """
</span><span class="cx"> A Calendar user who resets their account and re-downloads everything.
</span></span></pre>
</div>
</div>
</body>
</html>