[CalendarServer-changes] [13858] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 8 12:39:14 PDT 2014
Revision: 13858
http://trac.calendarserver.org//changeset/13858
Author: cdaboo at apple.com
Date: 2014-08-08 12:39:14 -0700 (Fri, 08 Aug 2014)
Log Message:
-----------
Use a thread pool for LDAP connections to avoid internal python-ldap locking issues when doing concurrent LDAP requests.
Expose thread pool usage via the dashboard.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/dashboard.py
CalendarServer/trunk/requirements-stable.txt
CalendarServer/trunk/txdav/who/augment.py
Modified: CalendarServer/trunk/calendarserver/tools/dashboard.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dashboard.py 2014-08-08 19:36:13 UTC (rev 13857)
+++ CalendarServer/trunk/calendarserver/tools/dashboard.py 2014-08-08 19:39:14 UTC (rev 13858)
@@ -982,15 +982,22 @@
y += 2
overallCount = 0
+ overallCountRatio = 0
overallCountCached = 0
overallCountUncached = 0
overallTimeSpent = 0.0
- for methodName, (count, timeSpent) in sorted(records.items(), key=lambda x: x[0]):
+ for methodName, result in sorted(records.items(), key=lambda x: x[0]):
+ if isinstance(result, int):
+ count, timeSpent = result, 0.0
+ else:
+ count, timeSpent = result
overallCount += count
if methodName.endswith("-hit"):
+ overallCountRatio += count
overallCountCached += count
if "-" not in methodName:
+ overallCountRatio += count
overallCountUncached += count
overallTimeSpent += timeSpent
@@ -1018,13 +1025,13 @@
s_cached = " {:<40}{:>15d}{:>14.1f}%{:>15s} ".format(
"Total Cached:",
overallCountCached,
- safeDivision(overallCountCached, overallCount, 100.0),
+ safeDivision(overallCountCached, overallCountRatio, 100.0),
"",
)
s_uncached = " {:<40}{:>15d}{:>14.1f}%{:>15s} ".format(
"Total Uncached:",
overallCountUncached,
- safeDivision(overallCountUncached, overallCount, 100.0),
+ safeDivision(overallCountUncached, overallCountRatio, 100.0),
"",
)
if self.usesCurses:
Modified: CalendarServer/trunk/requirements-stable.txt
===================================================================
--- CalendarServer/trunk/requirements-stable.txt 2014-08-08 19:36:13 UTC (rev 13857)
+++ CalendarServer/trunk/requirements-stable.txt 2014-08-08 19:39:14 UTC (rev 13858)
@@ -5,7 +5,7 @@
# For CalendarServer development, don't try to get these projects from PyPI; use svn.
-e .
--e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13851#egg=twextpy
+-e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13857#egg=twextpy
-e svn+http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk@13420#egg=kerberos
-e svn+http://svn.calendarserver.org/repository/calendarserver/PyCalendar/trunk@13802#egg=pycalendar
Modified: CalendarServer/trunk/txdav/who/augment.py
===================================================================
--- CalendarServer/trunk/txdav/who/augment.py 2014-08-08 19:36:13 UTC (rev 13857)
+++ CalendarServer/trunk/txdav/who/augment.py 2014-08-08 19:39:14 UTC (rev 13858)
@@ -110,7 +110,14 @@
self._store = store
self._augmentDB = augmentDB
+ # Look for an LDAP DS with extra info to expose to the dashboard
+ self._ldapDS = None
+ for ds in self._directory._services:
+ if hasattr(ds, "poolStats"):
+ self._ldapDS = ds
+ break
+
@classmethod
def _addTiming(cls, key, duration):
if key not in cls._timings:
@@ -122,9 +129,16 @@
def stats(self):
- return succeed(self._timings)
+ results = {}
+ results.update(self._timings)
+
+ # An LDAP DS has extra info to expose via the dashboard
+ if self._ldapDS is not None:
+ results.update(self._ldapDS.poolStats)
+ return succeed(results)
+
@property
def recordType(self):
# Defer to the directory service we're augmenting
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140808/efc7ed50/attachment.html>
More information about the calendarserver-changes
mailing list