summaryrefslogtreecommitdiffstats
path: root/src/lib/Component.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-03-15 23:21:36 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-03-15 23:21:36 +0000
commit9cb2c10c25ddb5e50a0be7734419db788cf723ce (patch)
treec742c48138882cdcb02efa7df6c73d9ca0b39cea /src/lib/Component.py
parentfaa2138a6cf796fe84a1a5d8381f6e83a30be2b0 (diff)
downloadbcfg2-9cb2c10c25ddb5e50a0be7734419db788cf723ce.tar.gz
bcfg2-9cb2c10c25ddb5e50a0be7734419db788cf723ce.tar.bz2
bcfg2-9cb2c10c25ddb5e50a0be7734419db788cf723ce.zip
Improve scaling behavior for non-forked handlers. Basically,
once a handler (ie GetConfig) is executed synchronously, fork of a child process in order to get more parallelism out of the server. This will help in the case that some clients are slow (no m2crypto, etc) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4420 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Component.py')
-rw-r--r--src/lib/Component.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/Component.py b/src/lib/Component.py
index 645c2d5b1..b70e76e05 100644
--- a/src/lib/Component.py
+++ b/src/lib/Component.py
@@ -25,6 +25,7 @@ class ForkedChild(Exception):
class CobaltXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
'''CobaltXMLRPCRequestHandler takes care of ssl xmlrpc requests'''
+ masterpid = os.getpid()
def do_POST(self):
'''Overload do_POST to pass through client address information'''
@@ -59,6 +60,11 @@ class CobaltXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
self.end_headers()
else:
# got a valid XML RPC response
+ if os.getpid() != self.masterpid:
+ pid = os.fork()
+ if pid:
+ self.cleanup = False
+ return
try:
self.send_response(200)
self.send_header("Content-type", "text/xml")