Hi all,

This message:
http://openacs.org/forums/message-view?message_id=4027670
tapped into something I've been thinking about for a while.

I have a server that takes around 5 minutes to start or restart.  The 
major reason for this is that it's a slow $2/mo openvz VPS and you get 
what you pay for, but it seems that other people have similar issues 
although not as bad.

In any case, the underlying problem is that the server can't start 
serving requests until after startup is complete and since startup can 
do arbitrary things, it can take arbitrarily long.

My ideas here aren't completely baked, so I'd like to bounce the 
concepts off people before I attempt to implement them.

One thought I had is to have a sort of "pre-startup" server running that 
can answer http requests and just respond "server starting, please 
wait".  That would be an improvement over the current situation where 
you get a connection refused. (or it may stay in a "connecting" state 
until the server actually starts if the listen socket is prebound) 
However, restarts would still lead to a period of time where no content 
is being served.

Another thought is to enhance the pre-bind mechanism to tell the server 
to not just bind particular sockets before dropping privileges, but to 
pass in already-opened descriptors and tell the server what they are. 
Then when restarting, the currently running server would pass its own 
open listen socket fds to the new server to prebind and then keep 
running until the new server signals that it is ready to start (e.g., by 
a signal).  So the timeline looks like;

parent server:                     child server:
start
serve requests ...
ns_server_restart
   fork()
   exec("nsd -b 0.0.0.0:80:@5")     starts, notes that fd 5 is its listen
signal(SIGUSR2, cleanup and exit)   socket
keeps running                      runs startup scripts
serve requests ...                 ...
...                                kill(getppid(), SIGUSR2)
cleanup and exit                   serve requests


There's various ways this could be made to work, but the core idea is to 
keep the old server running until the new one is ready.  This approach 
wouldn't work so well with daemontools where the server is typically 
restarted by just having the current one exit, but it would be a 
possible alternative.

Does anyone else think this is worth pursuing?

-J

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to