You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2002/05/09 22:58:13 UTC

cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

costin      02/05/09 13:58:13

  Modified:    jk/native2/include jk_worker.h
  Log:
  Switch the lb_factor/lb_value to int. For now we'll just use a small int ( 0..255 )
  to represent the lb_value, and roll back to 0. The only role of lb_value
  is to make sure all workers get a similar amount of requests - with lb_factor
  giving more priority to some workers. There is little benefit on using floats
  for that, and a small int avoids the need for atomic operations.
  
  Note that we can still enhance the model to use the number of 'active connections'
  and favor the tomcat instances that have fewer active connections. We
  can also use the average response time ( after we add this info :-)
  
  Add multiple 'levels' - a genaralization of the 'local worker concept.
  At init time the channels are sorted by level in different tables
  ( currently we have 4 levels only, hardcoded - but I doubt we need more than 2 ).
  If all workers in a lower level are in error state, we move to the next.
  That removes the sepcial meaning of '0',
  
  Revision  Changes    Path
  1.19      +18 -16    jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- jk_worker.h	8 May 2002 23:47:27 -0000	1.18
  +++ jk_worker.h	9 May 2002 20:58:13 -0000	1.19
  @@ -58,7 +58,7 @@
   /***************************************************************************
    * Description: Workers controller header file                             *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           * 
  - * Version:     $Revision: 1.18 $                                           *
  + * Version:     $Revision: 1.19 $                                           *
    ***************************************************************************/
   
   #ifndef JK_WORKER_H
  @@ -87,6 +87,13 @@
   struct jk_map;
   typedef struct jk_worker jk_worker_t;
   
  +/* Number of lb levels/priorities. Workers are grouped by the level,
  +   lower levels will allways be prefered. If all workers in a level are
  +   in error state, we move to the next leve.
  +*/
  +#define JK_LB_LEVELS 4
  +#define JK_LB_MAX_WORKERS 256
  +
   /*
    * The worker 'class', which represents something to which the web server
    * can delegate requests. 
  @@ -181,8 +188,8 @@
        * The information can be accessed by other components -
        * for example to report status, etc.
        */
  -    double  lb_factor;
  -    double  lb_value;
  +    int  lb_factor;
  +    int  lb_value;
   
       /* Time when the last error occured on this worker */
       time_t  error_time;
  @@ -191,19 +198,14 @@
        *  ( number of requests or time ), if no other worker is active
        *  or when the configuration changes.
        */
  -    int     in_error_state;
  +    int in_error_state;
       
       /* Worker priority.
        * Workers with lower priority are allways preffered - regardless of lb_value
        * This is user to represent 'local' workers ( we can call it 'proximity' or 'distance' )
        */
  -    int priority;
  +    int level;
       
  -    /* I have no idea what it means... */
  -    int     in_recovering;
  -    /* I have no idea why we need this */
  -    int     retry_count;
  -
       /* -------------------- Information for reconfiguration -------------------- */
       
       /* Only one thread can update the config
  @@ -215,15 +217,15 @@
   
       /* -------------------- Information specific to the lb worker -------------------- */
   
  -    /** For load balancing workers
  +    /** Load balanced workers. Maps name->worker, used at config time.
  +     *  When the worker is initialized or refreshed it'll set the runtime
  +     *  tables.
        */
       struct jk_map *lbWorkerMap;
  -    
  -    /* Cache for fast access. Do we need it ? XXX Move to a private structure */
  -    jk_worker_t **lb_workers;
  -    int lb_workers_size;
  -    int num_of_workers;
   
  +    int workerCnt[JK_LB_LEVELS];
  +    jk_worker_t *workerTables[JK_LB_LEVELS][JK_LB_MAX_WORKERS];
  +    
       /* -------------------- Methods supported by all workers -------------------- */
       /*
        * Do whatever initialization needs to be done to start this worker up.
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>