Re: [5] Proposal: webapp startup

2002-08-20 Thread Alex Chaffee / Purple Technology


On Tue, Aug 20, 2002 at 09:59:11AM -0700, [EMAIL PROTECTED] wrote:
 There are several possible use cases, and I think we should try to
 provide options to support each one.

Agreed.

 Regardless of the startup timing, in all cases no request will
 be served from an webapp until all initialization is done, including
 load on startup servlets. There are 2 options here:
  1. Wait. The request will be delayed until the initialization completes.
 The user will just see a slow request.
  2. 503. A response page with 'application is temporarily unavilable' or
   'starting' or 'refreshing' - eventually with a meta reload.

Options are good, but I vote for wait to be the default behavior.
(Supporting use cases are below.)

There is a third option, by the way:

3. Wait with timeout.  The request is queued, but if it takes longer
than a specified time to process (say, 20 seconds), then it returns a
503.

The third case actually subsumes the first two, since case 1 is
enabled by setting the timeout very high, and case 2 is enabled by
setting it very low (like 0).  So I think this might be the best
design choice: only one algorithm to implement, only one setting to
configure.

If I wanted to make a patch proposal, what source file(s) should I
look at?  It's been a while...

---

Why I think Wait should be the default:

Use cases:

* Human UI: most naive users will tolerate a pause (of up to, say, 30
seconds) much better than they will understand that the proper
response to a 503 is to wait a moment and then click reload.  Instead,
they will think this site is down and go to your competitor's :-)

* Scripts: my test scripts launch Tomcat, then send a bunch of test
requests and verify the results.  A 503 will cause the tests to fail
(unless I write special code to handle that case).  

Behavior seems to be mixed now -- there's a window where requests will
fail, following which they will wait.  There's also a condition where
a request at just the wrong time will corrupt the webapp, causing all
future requests to fail, but since I haven't been able to reproduce it
I haven't reported it.


-- 
Alex Chaffee   mailto:[EMAIL PROTECTED]
jGuru - Java News and FAQs http://www.jguru.com/alex/
Creator of Gamelan http://www.gamelan.com/
Founder of Purple Technology   http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Modified stop-script for Linux

2002-08-19 Thread Alex Chaffee / Purple Technology

Thanks!  I added it to the recently-posted Bug 11754.  You may want to
add yourself as a CC on this to track its progress.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11754

 - A

On Mon, Aug 19, 2002 at 09:57:31AM +0200, Golden Planet Support wrote:
 Hello All
 
 I have noticed that the /etc/init.d/tomcat4 script still contains 
 what is described as an Ugly hack - a short two second pause when 
 restarting the service instead of something that confirms that all 
 threads have been shut down.
 
 A while ago I modified my own script to conatain the following lines -
  perhaps they could be of some use for others, I don't know. I am by 
 no means an experienced coder so please bear with me if this is not 
 the most elegant solution - it just works for me... ;-)
 
 stop() {
 echo -n Stopping $TOMCAT_PROG: 
 if [ -x /etc/rc.d/init.d/functions ]; then
 daemon --user $TOMCAT_USER $TOMCAT_SCRIPT stop
 else
 su - $TOMCAT_USER -c $TOMCAT_SCRIPT stop
 fi
 RETVAL=$?
 echo
 
 echo 'Waiting for java threads to finish...'
 threads=1
 until [ $threads = '0' ]
   do
   ps -aux | grep $TOMCAT_USER -c  /tmp/threads
   read threads  /tmp/threads
 done
 rm -f /tmp/threads
 echo 'Java threads cleaned up - shutdown complete.'
 
 [ $RETVAL = 0 ]  rm -f /var/lock/subsys/tomcat4 
 /var/run/tomcat4.pid
 }
 
 The above works on a x86 RedHat 7.1 - I don't know if things may work 
 differently on other systems.
 
 --
 Med venlig hilsen / Best regards
 
 Anders C. Madsen
 
 Golden Planet  Tel.: +45 7020 9594
 Dalbygade 40   Fax.: +45 7020 9592
 DK-6000  Kolding   http://www.goldenplanet.dk
 --
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 

-- 
Alex Chaffee   mailto:[EMAIL PROTECTED]
jGuru - Java News and FAQs http://www.jguru.com/alex/
Creator of Gamelan http://www.gamelan.com/
Founder of Purple Technology   http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]