speedup startup by delaying binding of ports
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Fix Released
|
Medium
|
Tres Seaver |
Bug Description
we found the early binding of ports when starting up zope is problematic in our load balanced (behind a pound) setup. if a backend restarts and binds its ports, pound almost immediately thinks it's back in business and starts sending request. obviously, the server needs some more time to finish its startup; meanwhile, those requests are being unanswered (at least delayed for quite a while), and users need to wait for the response (if any). we only use high ports for the servers, so there's no real need for us to bind the ports with root privileges (of course it would be cleaner to check if low ports are configured, and only delay the binding if not).
last not least: the late binding seems to have a huge impact on the startup time (although this is no hard fact, just a feeling).
our solution is rather simple:
in lib/python/
Index: __init__.py
=======
--- __init__.py (revision 30421)
+++ __init__.py (working copy)
@@ -88,8 +88,8 @@
# Start ZServer servers before we drop privileges so we can bind to
# "low" ports:
- self.setupZServer()
- self.setupServers()
+ #self.setupZSer
+ #self.setupServ
# drop privileges after setting up servers
@@ -100,6 +100,10 @@
# emit a "ready" message in order to prevent the kinds of emails
# to the Zope maillist in which people claim that Zope has "frozen"
# after it has emitted ZServer messages.
+
+ self.setupZServer()
+ self.setupServers()
+
Cheers,
Sascha
> = Request - Entry #1 by alzhimer on Jun 6, 2005 6:32 am
>
> we found the early binding of ports when starting up zope is problematic
> in our load balanced (behind a pound) setup. if a backend restarts and
> binds its ports, pound almost immediately thinks it's back in business
> and starts sending request. obviously, the server needs some more time to
> finish its startup; meanwhile, those requests are being unanswered (at
> least delayed for quite a while), and users need to wait for the response
> (if any). we only use high ports for the servers, so there's no real need
> for us to bind the ports with root privileges (of course it would be
> cleaner to check if low ports are configured, and only delay the binding
> if not).
Yep. Probably any patch that is meant to go into mainline Zope to bind late will need to do this. Really the only reason we bind the ports so early is to be able to drop privileges for further steps.
For what it's worth, using ZEO with Zope can reduce startup time by quite a bit. You didn't mention whether you use ZEO or not but if you don't, you might consider it.