Mladen,

I appreciate you addressing this issue. But isn't this fix just delaying the problem? An IEEE double has 52 bits of mantissa versus 32 bits for size_t. So the problem will now occur at 4 PB (petabytes). Sure, that's a lot of bytes and my webservers would never see this kind of load. But there might be some sites serving lots of large files that could have a problem with this ... maybe ... sometime.

So, perhaps it's something that can be overlooked for now. But maybe you should consider doing it like the Request method. In that method it adds the lbfactor from each worker's value and subtracts the total from the worker that is used. For the Traffic method I imaging adding and adding/subtracting the lbfactor*bytes_read (or lbfactor*bytes_transferred) might accomplish the same thing.

~Tom

On Jun 13, 2005, at 1:55 AM, [EMAIL PROTECTED] wrote:

mturk       2005/06/13 00:55:51

  Modified:    jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
  Log:
  Use double instead size_t for trensferred/read, so that lb doesn't
  break on trnasferred mode when 2G of data has been send/read.

  Revision  Changes    Path
1.90 +5 -5 jakarta-tomcat-connectors/jk/native/common/ jk_lb_worker.c

  Index: jk_lb_worker.c
  ===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/ jk_lb_worker.c,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- jk_lb_worker.c    15 May 2005 16:33:47 -0000    1.89
  +++ jk_lb_worker.c    13 Jun 2005 07:55:51 -0000    1.90
  @@ -225,8 +225,8 @@
   {
       unsigned int i;
       int total_factor = 0;
  -    size_t mytraffic = 0;
  -    size_t curmin = 0;
  +    double mytraffic = 0;
  +    double curmin = 0;

       worker_record_t *candidate = NULL;
       if (p->lblock == JK_LB_LOCK_PESSIMISTIC)
  @@ -313,8 +313,8 @@
                                                jk_logger_t *l)
   {
       unsigned int i;
  -    size_t mytraffic = 0;
  -    size_t curmin = 0;
  +    double mytraffic = 0;
  +    double curmin = 0;
       worker_record_t *candidate = NULL;

       if (p->lblock == JK_LB_LOCK_PESSIMISTIC)



1.21 +3 -3 jakarta-tomcat-connectors/jk/native/common/ jk_shm.h

  Index: jk_shm.h
  ===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/ jk_shm.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- jk_shm.h    15 May 2005 11:23:50 -0000    1.20
  +++ jk_shm.h    13 Jun 2005 07:55:51 -0000    1.21
  @@ -81,9 +81,9 @@
       /* Statistical data */
       volatile time_t  error_time;
       /* Number of bytes read from remote */
  -    volatile size_t  readed;
  +    volatile double  readed;
       /* Number of bytes transferred to remote */
  -    volatile size_t  transferred;
  +    volatile double  transferred;
       /* Number of times the worker was elected */
       volatile size_t  elected;
       /* Number of non 200 responses */



1.42 +4 -15 jakarta-tomcat-connectors/jk/native/common/ jk_status.c

  Index: jk_status.c
  ===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/ jk_status.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- jk_status.c    15 May 2005 15:22:05 -0000    1.41
  +++ jk_status.c    13 Jun 2005 07:55:51 -0000    1.42
  @@ -166,11 +166,10 @@
   }

   /* Actually APR's apr_strfsize */
  -static char *status_strfsize(size_t size, char *buf)
  +static char *status_strfsize(double size, char *buf)
   {
       const char ord[] = "KMGTPE";
       const char *o = ord;
  -    int remain;

       if (size < 0) {
           return strcpy(buf, "  - ");
  @@ -181,22 +180,12 @@
           return buf;
       }
       do {
  -        remain = (int)(size & 1023);
  -        size >>= 10;
  +        size /= 1024;
           if (size >= 973) {
               ++o;
               continue;
           }
  -        if (size < 9 || (size == 9 && remain < 973)) {
  -            if ((remain = ((remain * 5) + 256) / 512) >= 10)
  -                ++size, remain = 0;
- if (sprintf(buf, "%d.%d%c", (int) size, remain, *o) < 0)
  -                return strcpy(buf, "****");
  -            return buf;
  -        }
  -        if (remain >= 512)
  -            ++size;
  -        if (sprintf(buf, "%3d%c", (int) size, *o) < 0)
  +        if (sprintf(buf, "%.2f%c", size, *o) < 0)
               return strcpy(buf, "****");
           return buf;
       } while (1);




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





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

Reply via email to