tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hans Schmid" <h...@mega-schmid.de>
Subject AW: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common Shm.java
Date Thu, 02 May 2002 06:29:41 GMT
Please see questions on shm and lb worker intermixed,

> -----Urspr√ľngliche Nachricht-----
> Von: costin@apache.org [mailto:costin@apache.org]
> Gesendet: Donnerstag, 2. Mai 2002 05:18
> An: jakarta-tomcat-connectors-cvs@apache.org
> Betreff: cvs commit:
> jakarta-tomcat-connectors/jk/java/org/apache/jk/common Shm.java
>
>
> costin      02/05/01 20:18:01
>
>   Modified:    jk/java/org/apache/jk/common Shm.java
>   Log:
>   Few more features. I think the sending part works fine now (
> but we should
>   still do more tunning ).
>
>   For each tomcat instance we create a shm slot in the scoreboard. The
>   slot is named TOMCAT:host:port ( host:port is used as instance ID ), and
>   contains a ( ajp13-encoded ) structure with informations about
> the channels
>   ( currently the socket and unix channel - jni is special ). It'll also
>   include the groups where the instance belongs, and possibly other
>   informations.
>
>   If the number of channels is 0, the lb worker is supposed to stop
>   sending new requests to the instance ( but keep forwarding the
>   existing sessions ). That'll implement 'gracefull shutdown'.
>

I hope the current 'lbfactor' functionality mod_jk from TC3.3.1 will still
be working
(or an equivilent strategy):

Scenario:
We have two Tomcats in a lb group. Only one is running at a time with
lbfactor=1,
the other has lbfactor=0 assinged but is not running -> all requests go to
TC1

When we upgrade our system we update the classes/jars and start the second
Tomcat TC2 in the group,
switch the lbfactor of TC1 to 0 and the lbfactor fo TC2 to 1 and do a
graceful
restart of apache. This way old sessions still go to TC1 whereas new
sessions go to TC2.

After all sessions on TC1 have ended, we shutdown TC1 and TC2 serves
everything.

Next update goes in the oposit direction (start TC1, switch lbfactors, wait
for the end of all
sessions on TC2 and finally shutdown TC2.


Thanks,
Hans



>   Still to add:
>   - display ( nicely ) the information in the shm
>   - read info from shm ( like slots owned by apache processes with
>   statistics - in a future release )
>
>   Revision  Changes    Path
>   1.9       +27 -0
> jakarta-tomcat-connectors/jk/java/org/apache/jk/common/Shm.java
>
>   Index: Shm.java
>   ===================================================================
>   RCS file:
> /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/S
> hm.java,v
>   retrieving revision 1.8
>   retrieving revision 1.9
>   diff -u -r1.8 -r1.9
>   --- Shm.java	1 May 2002 22:40:17 -0000	1.8
>   +++ Shm.java	2 May 2002 03:18:01 -0000	1.9
>   @@ -95,6 +95,7 @@
>
>        boolean unregister=false;
>        boolean reset=false;
>   +    String dumpFile=null;
>
>        // Will be dynamic ( getMethodId() ) after things are stable
>        static final int SHM_SET_ATTRIBUTE=0;
>   @@ -102,6 +103,8 @@
>        static final int SHM_ATTACH=3;
>        static final int SHM_DETACH=4;
>        static final int SHM_RESET=5;
>   +    static final int SHM_DUMP=6;
>   +    static final int SHM_DESTROY=7;
>
>        public Shm() {
>        }
>   @@ -112,6 +115,13 @@
>            file=f;
>        }
>
>   +    /** Copy the scoreboard in a file for debugging
>   +     *  Will also log a lot of information about what's in the
> scoreboard.
>   +     */
>   +    public void setDump( String dumpFile ) {
>   +        this.dumpFile=dumpFile;
>   +    }
>   +
>        /** Size. Used only if the scoreboard is to be created.
>         */
>        public void setSize( int size ) {
>   @@ -199,6 +209,20 @@
>            this.invoke( msg, mCtx );
>        }
>
>   +    public void dumpScoreboard(String fname) throws IOException {
>   +        if( apr==null ) return;
>   +        MsgContext mCtx=createMsgContext();
>   +        Msg msg=(Msg)mCtx.getMsg(0);
>   +        C2BConverter c2b=(C2BConverter)mCtx.getNote(C2B_NOTE);
>   +        msg.reset();
>   +
>   +        msg.appendByte( SHM_DUMP );
>   +
>   +        appendString( msg, fname, c2b);
>   +
>   +        this.invoke( msg, mCtx );
>   +    }
>   +
>        public void setNativeAttribute(String name, String val)
> throws IOException {
>            if( apr==null ) return;
>            MsgContext mCtx=createMsgContext();
>   @@ -315,8 +339,11 @@
>                    return;
>                }
>                init();
>   +
>                if( reset ) {
>                    resetScoreboard();
>   +            } else if( dumpFile!=null ) {
>   +                dumpScoreboard(dumpFile);
>                } else if( unregister ) {
>                    unRegisterTomcat( host, port );
>                } else {
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:tomcat-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message