[CalendarServer-changes] [2920] CalendarServer/branches/users/cdaboo/staggerstart-2918/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 29 20:31:09 PDT 2008


Revision: 2920
          http://trac.macosforge.org/projects/calendarserver/changeset/2920
Author:   cdaboo at apple.com
Date:     2008-08-29 20:31:08 -0700 (Fri, 29 Aug 2008)
Log Message:
-----------
Provide option to stagger the startup of the caldavd processes.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/staggerstart-2918/twistedcaldav/cluster.py
    CalendarServer/branches/users/cdaboo/staggerstart-2918/twistedcaldav/config.py

Modified: CalendarServer/branches/users/cdaboo/staggerstart-2918/twistedcaldav/cluster.py
===================================================================
--- CalendarServer/branches/users/cdaboo/staggerstart-2918/twistedcaldav/cluster.py	2008-08-30 03:11:35 UTC (rev 2919)
+++ CalendarServer/branches/users/cdaboo/staggerstart-2918/twistedcaldav/cluster.py	2008-08-30 03:31:08 UTC (rev 2920)
@@ -20,6 +20,7 @@
 
 from twisted.runner import procmon
 from twisted.application import internet, service
+from twisted.internet import reactor
 
 from twistedcaldav.accesslog import AMPLoggingFactory, RotatingFileAccessLoggingObserver
 from twistedcaldav.config import config, ConfigurationError
@@ -141,9 +142,24 @@
                                'bindAddress': '127.0.0.1'}
 
 
+class DelayedStartupProcessMonitor(procmon.ProcessMonitor):
+
+    def startService(self):
+        service.Service.startService(self)
+        self.active = 1
+        delay = 0
+        delay_interval = config.MultiProcess['StaggeredStartup']['Interval'] if config.MultiProcess['StaggeredStartup']['Enabled'] else 0 
+        for name in self.processes.keys():
+            reactor.callLater(delay if name.startswith("caldav") else 0, self.startProcess, name)
+            if name.startswith("caldav"):
+                delay += delay_interval
+        self.consistency = reactor.callLater(self.consistencyDelay,
+                                             self._checkConsistency)
+
+
 def makeService_Combined(self, options):
     s = service.MultiService()
-    monitor = procmon.ProcessMonitor()
+    monitor = DelayedStartupProcessMonitor()
     monitor.setServiceParent(s)
 
     parentEnv = {

Modified: CalendarServer/branches/users/cdaboo/staggerstart-2918/twistedcaldav/config.py
===================================================================
--- CalendarServer/branches/users/cdaboo/staggerstart-2918/twistedcaldav/config.py	2008-08-30 03:11:35 UTC (rev 2919)
+++ CalendarServer/branches/users/cdaboo/staggerstart-2918/twistedcaldav/config.py	2008-08-30 03:31:08 UTC (rev 2920)
@@ -161,6 +161,10 @@
             "Enabled": True,
             "Scheduler": "LeastConnections",
         },
+        "StaggeredStartup": {
+            "Enabled": False,
+            "Interval": 15,
+        },
     },
 
     #
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080829/8df4eb87/attachment.html 


More information about the calendarserver-changes mailing list