[CalendarServer-changes] [4563] CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/ twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Tue Sep 29 21:37:09 PDT 2009
Revision: 4563
http://trac.macosforge.org/projects/calendarserver/changeset/4563
Author: sagen at apple.com
Date: 2009-09-29 21:37:05 -0700 (Tue, 29 Sep 2009)
Log Message:
-----------
Adds "ResumeRequests" plist key for specifying at what point a process will resume taking new requests after hitting the MaxRequests limit.
Modified Paths:
--------------
CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/config.py
CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/httpfactory.py
CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/tap.py
Modified: CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/config.py
===================================================================
--- CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/config.py 2009-09-29 23:34:57 UTC (rev 4562)
+++ CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/config.py 2009-09-30 04:37:05 UTC (rev 4563)
@@ -263,6 +263,7 @@
# Set the maximum number of outstanding requests to this server.
"MaxRequests": 600,
+ "ResumeRequests": 550,
"ListenBacklog": 50,
"IdleConnectionTimeOut": 15,
Modified: CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/httpfactory.py
===================================================================
--- CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/httpfactory.py 2009-09-29 23:34:57 UTC (rev 4562)
+++ CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/httpfactory.py 2009-09-30 04:37:05 UTC (rev 4563)
@@ -68,14 +68,26 @@
def connectionMade(self):
HTTPChannel.connectionMade(self)
if self.factory.outstandingRequests >= self.factory.maxRequests:
- log.msg("Overload")
+ # log.msg("Overloaded")
self.factory.myServer.myPort.stopReading()
def connectionLost(self, reason):
HTTPChannel.connectionLost(self, reason)
- if self.factory.outstandingRequests < self.factory.maxRequests:
+ if self.factory.outstandingRequests < self.factory.resumeRequests:
+ # log.msg("Resuming")
self.factory.myServer.myPort.startReading()
class LimitingHTTPFactory(HTTPFactory):
protocol = LimitingHTTPChannel
+ def __init__(self, requestFactory, maxRequests=600, resumeRequests=550,
+ **kwargs):
+ HTTPFactory.__init__(self, requestFactory, maxRequests, **kwargs)
+ self.resumeRequests = resumeRequests
+
+ def buildProtocol(self, addr):
+
+ p = protocol.ServerFactory.buildProtocol(self, addr)
+ for arg, value in self.protocolArgs.iteritems():
+ setattr(p, arg, value)
+ return p
Modified: CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/tap.py
===================================================================
--- CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/tap.py 2009-09-29 23:34:57 UTC (rev 4562)
+++ CalendarServer/branches/users/sagen/deployment-inherit-fds-4549/twistedcaldav/tap.py 2009-09-30 04:37:05 UTC (rev 4563)
@@ -720,6 +720,7 @@
channel = LimitingHTTPFactory(
site,
maxRequests=config.MaxRequests,
+ resumeRequests=config.ResumeRequests,
betweenRequestsTimeOut=config.IdleConnectionTimeOut)
for fd in config.InheritFDs:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090929/bd5fb008/attachment-0001.html>
More information about the calendarserver-changes
mailing list