Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
William A. Rowe, Jr. wrote: Mladen; are you sure you weren't looking for 'long long', al la int64_t? Falling over to the FPU is rarely the best performance decision. A little more coding is needed, because I have a related error (on ReliantUnix): +++ /home/apache20/apache20/build/libtool --silent --mode=compile cc -I/home/apache20/apache20/include -g -DUSE_APACHE_MD5 -I ../common -I /include -I /include/unix -DSVR4 -g -DHAVE_APR -I/home/apache20/apache20/include -I/home/apache20/apache20/include -g -g -DSVR4 -c ../common/jk_ajp14.c ../common/jk_md5.h65: [error]: CFE1020 identifier uint32_t is undefined typedef uint32_t JK_UINT4; ^ +++ I am going to add in configure some code to check for long long and sizeof(short/int/long). Bill At 02:55 AM 6/13/2005, [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. -size_t mytraffic = 0; -size_t curmin = 0; +double mytraffic = 0; +double curmin = 0; - 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]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
jean-frederic clere wrote: William A. Rowe, Jr. wrote: Mladen; are you sure you weren't looking for 'long long', al la int64_t? Falling over to the FPU is rarely the best performance decision. A little more coding is needed, because I have a related error (on ReliantUnix): undefined typedef uint32_t JK_UINT4; ^ Seems that the uint32_t is not inside includes referenced by jk_global.h. Not sure what is the possible location for that type on all platforms. Perhaps u_int32_t would be more portable. Regards, Mladen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
Mladen Turk wrote: jean-frederic clere wrote: William A. Rowe, Jr. wrote: Mladen; are you sure you weren't looking for 'long long', al la int64_t? Falling over to the FPU is rarely the best performance decision. A little more coding is needed, because I have a related error (on ReliantUnix): undefined typedef uint32_t JK_UINT4; ^ Seems that the uint32_t is not inside includes referenced by jk_global.h. Not sure what is the possible location for that type on all platforms. Perhaps u_int32_t would be more portable. I would prefer to add in configure something like: +++ AC_CHECK_SIZEOF(char, 1) AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(long long, 8) +++ and testing $ac_cv_sizeof_WHATWETESTED makes sure we right one. Regards, Mladen. - 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]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
jean-frederic clere wrote: Mladen Turk wrote: Perhaps u_int32_t would be more portable. I would prefer to add in configure something like: +++ AC_CHECK_SIZEOF(char, 1) AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(long long, 8) +++ and testing $ac_cv_sizeof_WHATWETESTED makes sure we right one. Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? Regards, Mladen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
Mladen Turk wrote: jean-frederic clere wrote: Mladen Turk wrote: Perhaps u_int32_t would be more portable. I would prefer to add in configure something like: +++ AC_CHECK_SIZEOF(char, 1) AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(long long, 8) +++ and testing $ac_cv_sizeof_WHATWETESTED makes sure we right one. Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Regards, Mladen. - 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]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
jean-frederic clere wrote: Mladen Turk wrote: Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Right :) You will need the portable.in in that case, right? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
Mladen Turk wrote: jean-frederic clere wrote: Mladen Turk wrote: Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Right :) You will need the portable.in in that case, right? Yes and I will ask Henri to check AS400 see jk_global.h: +++ #if !defined(WIN32) !defined(AS400) #include portable.h #else +++ - 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]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
What do you need on iSeries ? 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Mladen Turk wrote: jean-frederic clere wrote: Mladen Turk wrote: Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Right :) You will need the portable.in in that case, right? Yes and I will ask Henri to check AS400 see jk_global.h: +++ #if !defined(WIN32) !defined(AS400) #include portable.h #else +++ - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
Henri Gomez wrote: What do you need on iSeries ? Just to know what to use to have: JK_UINT4 (unsigned long of 32 bits) and JK_UINT8 (unsigned long long of 64 bits) and to check status_strfsize(). 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Mladen Turk wrote: jean-frederic clere wrote: Mladen Turk wrote: Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Right :) You will need the portable.in in that case, right? Yes and I will ask Henri to check AS400 see jk_global.h: +++ #if !defined(WIN32) !defined(AS400) #include portable.h #else +++ - 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] - 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]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
status_strfsize ? APR ? 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Henri Gomez wrote: What do you need on iSeries ? Just to know what to use to have: JK_UINT4 (unsigned long of 32 bits) and JK_UINT8 (unsigned long long of 64 bits) and to check status_strfsize(). 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Mladen Turk wrote: jean-frederic clere wrote: Mladen Turk wrote: Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Right :) You will need the portable.in in that case, right? Yes and I will ask Henri to check AS400 see jk_global.h: +++ #if !defined(WIN32) !defined(AS400) #include portable.h #else +++ - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
Henri Gomez wrote: status_strfsize ? APR ? Nearly: jakarta-tomcat-connectors/jk/native/common/jk_status.c ;-) 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Henri Gomez wrote: What do you need on iSeries ? Just to know what to use to have: JK_UINT4 (unsigned long of 32 bits) and JK_UINT8 (unsigned long long of 64 bits) and to check status_strfsize(). 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Mladen Turk wrote: jean-frederic clere wrote: Mladen Turk wrote: Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Right :) You will need the portable.in in that case, right? Yes and I will ask Henri to check AS400 see jk_global.h: +++ #if !defined(WIN32) !defined(AS400) #include portable.h #else +++ - 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] - 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] - 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]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
unsigned long is 32 bits and unsigned long long is 64 bits on iSeries 2005/6/14, Henri Gomez [EMAIL PROTECTED]: status_strfsize ? APR ? 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Henri Gomez wrote: What do you need on iSeries ? Just to know what to use to have: JK_UINT4 (unsigned long of 32 bits) and JK_UINT8 (unsigned long long of 64 bits) and to check status_strfsize(). 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Mladen Turk wrote: jean-frederic clere wrote: Mladen Turk wrote: Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Right :) You will need the portable.in in that case, right? Yes and I will ask Henri to check AS400 see jk_global.h: +++ #if !defined(WIN32) !defined(AS400) #include portable.h #else +++ - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
ok, but couldn't build now from CVS, but it should works after jk_u64_t is defined as unsigned long long. Since we couldn't use portable.h on iSeries, it should be elsewhere ... 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Henri Gomez wrote: status_strfsize ? APR ? Nearly: jakarta-tomcat-connectors/jk/native/common/jk_status.c ;-) 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Henri Gomez wrote: What do you need on iSeries ? Just to know what to use to have: JK_UINT4 (unsigned long of 32 bits) and JK_UINT8 (unsigned long long of 64 bits) and to check status_strfsize(). 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Mladen Turk wrote: jean-frederic clere wrote: Mladen Turk wrote: Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Right :) You will need the portable.in in that case, right? Yes and I will ask Henri to check AS400 see jk_global.h: +++ #if !defined(WIN32) !defined(AS400) #include portable.h #else +++ - 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] - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
Henri Gomez wrote: ok, but couldn't build now from CVS, but it should works after jk_u64_t is defined as unsigned long long. Since we couldn't use portable.h on iSeries, it should be elsewhere ... Sure... I will add the need #if defined(AS400). 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Henri Gomez wrote: status_strfsize ? APR ? Nearly: jakarta-tomcat-connectors/jk/native/common/jk_status.c ;-) 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Henri Gomez wrote: What do you need on iSeries ? Just to know what to use to have: JK_UINT4 (unsigned long of 32 bits) and JK_UINT8 (unsigned long long of 64 bits) and to check status_strfsize(). 2005/6/14, jean-frederic clere [EMAIL PROTECTED]: Mladen Turk wrote: jean-frederic clere wrote: Mladen Turk wrote: Yes, but all that we need is 32 bit unsigned integer for JK_UINT4 What will you use if the int is 64 bits? a long ;-) Right :) You will need the portable.in in that case, right? Yes and I will ask Henri to check AS400 see jk_global.h: +++ #if !defined(WIN32) !defined(AS400) #include portable.h #else +++ - 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] - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
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 ChangesPath 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.c15 May 2005 16:33:47 - 1.89 +++ jk_lb_worker.c13 Jun 2005 07:55:51 - 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 - 1.20 +++ jk_shm.h 13 Jun 2005 07:55:51 - 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 - 1.41 +++ jk_status.c 13 Jun 2005 07:55:51 - 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]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
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 ChangesPath 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.c15 May 2005 16:33:47 -1.89 +++ jk_lb_worker.c13 Jun 2005 07:55:51 -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.h15 May 2005 11:23:50 -1.20 +++ jk_shm.h13 Jun 2005 07:55:51 -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.c15 May 2005 15:22:05 -1.41 +++ jk_status.c13 Jun 2005 07:55:51 -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:
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
Mladen; are you sure you weren't looking for 'long long', al la int64_t? Falling over to the FPU is rarely the best performance decision. Bill At 02:55 AM 6/13/2005, [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. -size_t mytraffic = 0; -size_t curmin = 0; +double mytraffic = 0; +double curmin = 0; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c jk_uri_worker_map.h jk_util.c jk_util.h
pero2005/04/26 08:28:18 Modified:jk/native/common jk_lb_worker.c jk_shm.h jk_status.c jk_uri_worker_map.h jk_util.c jk_util.h Log: Add stopped flag for better cluster support to worker. Many thanks to Mladen :- Revision ChangesPath 1.79 +11 -9 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.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- jk_lb_worker.c24 Apr 2005 09:54:47 - 1.78 +++ jk_lb_worker.c26 Apr 2005 15:28:18 - 1.79 @@ -40,8 +40,8 @@ /* * Time to wait before retry... */ -#define JK_WORKER_IN_ERROR(w) ((w)-in_error_state !(w)-is_disabled !(w)-is_busy) -#define JK_WORKER_USABLE(w) (!(w)-in_error_state !(w)-is_disabled !(w)-is_busy) +#define JK_WORKER_IN_ERROR(w) ((w)-in_error_state !(w)-is_disabled !(w)-is_busy) +#define JK_WORKER_USABLE(w) (!(w)-in_error_state !(w)-is_stopped !(w)-is_disabled !(w)-is_busy) struct lb_endpoint { @@ -235,7 +235,7 @@ strcmp(p-lb_workers[i].s-domain, domain)) continue; /* Take into calculation only the workers that are - * not in error state or not disabled. + * not in error state, stopped or not disabled. */ if (JK_WORKER_USABLE(p-lb_workers[i].s)) { if (p-lbmethod == JK_LB_BYREQUESTS) { @@ -252,7 +252,7 @@ curmin = mytraffic; } } -} +} } if (candidate) { @@ -284,7 +284,7 @@ retry_worker(p-lb_workers[i], p-s-recover_wait_time, l); } /* Take into calculation only the workers that are - * not in error state or not disabled. + * not in error state, stopped or not disabled. */ if (JK_WORKER_USABLE(p-lb_workers[i].s)) { p-lb_workers[i].s-lb_value += p-lb_workers[i].s-lb_factor; @@ -319,7 +319,7 @@ retry_worker(p-lb_workers[i], p-s-recover_wait_time, l); } /* Take into calculation only the workers that are - * not in error state or not disabled. + * not in error state, stopped or not disabled. */ if (JK_WORKER_USABLE(p-lb_workers[i].s)) { mytraffic = (p-lb_workers[i].s-transferred/p-lb_workers[i].s-lb_factor) + @@ -351,8 +351,8 @@ if (JK_WORKER_IN_ERROR(candidate-s)) { retry_worker(candidate, p-s-recover_wait_time, l); } -if (candidate-s-in_error_state) { -/* We have a worker that is error state. +if (candidate-s-in_error_state || candidate-s-is_stopped ) { +/* We have a worker that is error state or stopped. * If it has a redirection set use that redirection worker. * This enables to safely remove the member from the * balancer. Of course you will need a some kind of @@ -780,6 +780,8 @@ p-lb_workers[i].s-error_time = 0; /* Worker can be initaly disabled as hot standby */ p-lb_workers[i].s-is_disabled = jk_get_is_worker_disabled(props, worker_names[i]); +/* Worker can be initaly deactive as cold standby */ +p-lb_workers[i].s-is_stopped = jk_get_is_worker_stopped(props, worker_names[i]); if (!wc_create_worker(p-lb_workers[i].s-name, props, (p-lb_workers[i].w), 1.19 +2 -1 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.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- jk_shm.h 11 Apr 2005 06:36:02 - 1.18 +++ jk_shm.h 26 Apr 2005 15:28:18 - 1.19 @@ -64,6 +64,7 @@ charredirect[JK_SHM_STR_SIZ+1]; /* current status of the worker */ volatile int is_disabled; +volatile int is_stopped; volatile int is_busy; /* Current lb factor */ volatile int lb_factor; 1.38 +17 -6 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.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- jk_status.c 13 Apr 2005 11:03:37 - 1.37 +++ jk_status.c 26 Apr 2005 15:28:18 - 1.38
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.h jk_status.c
mturk 2005/02/19 00:12:30 Modified:jk/native/common jk_lb_worker.c jk_shm.h jk_status.c Log: Add worker is_busy runtime status flag. When we can not obtain a free endpoint, mark the worker as busy rather then in error, so that recovery is not needed. Revision ChangesPath 1.63 +44 -25jakarta-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.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- jk_lb_worker.c17 Feb 2005 13:48:47 - 1.62 +++ jk_lb_worker.c19 Feb 2005 08:12:29 - 1.63 @@ -42,6 +42,9 @@ #define WAIT_BEFORE_RECOVER (60*1) #define WORKER_RECOVER_TIME (recover_time) +#define JK_WORKER_IN_ERROR(w) ((w)-in_error_state !(w)-is_disabled !(w)-is_busy) +#define JK_WORKER_USABLE(w) (!(w)-in_error_state !(w)-is_disabled !(w)-is_busy) + struct lb_endpoint { jk_endpoint_t *e; @@ -183,6 +186,7 @@ w-s-name); w-s-in_recovering = JK_TRUE; w-s-in_error_state = JK_FALSE; +w-s-is_busy = JK_FALSE; } JK_TRACE_EXIT(l); @@ -225,8 +229,7 @@ /* Take into calculation only the workers that are * not in error state or not disabled. */ -if (!p-lb_workers[i].s-in_error_state -!p-lb_workers[i].s-is_disabled) { +if (JK_WORKER_USABLE(p-lb_workers[i].s)) { if (p-lbmethod == JK_LB_BYREQUESTS) { p-lb_workers[i].s-lb_value += p-lb_workers[i].s-lb_factor; total_factor += p-lb_workers[i].s-lb_factor; @@ -269,15 +272,13 @@ * The worker might still be unusable, but we try * anyway. */ -if (p-lb_workers[i].s-in_error_state -!p-lb_workers[i].s-is_disabled) { +if (JK_WORKER_IN_ERROR(p-lb_workers[i].s)) { retry_worker(p-lb_workers[i], p-s-recover_wait_time, l); } /* Take into calculation only the workers that are * not in error state or not disabled. */ -if (!p-lb_workers[i].s-in_error_state -!p-lb_workers[i].s-is_disabled) { +if (JK_WORKER_USABLE(p-lb_workers[i].s)) { p-lb_workers[i].s-lb_value += p-lb_workers[i].s-lb_factor; total_factor += p-lb_workers[i].s-lb_factor; if (!candidate || p-lb_workers[i].s-lb_value candidate-s-lb_value) @@ -309,15 +310,13 @@ * The worker might still be unusable, but we try * anyway. */ -if (p-lb_workers[i].s-in_error_state -!p-lb_workers[i].s-is_disabled) { +if (JK_WORKER_IN_ERROR(p-lb_workers[i].s)) { retry_worker(p-lb_workers[i], p-s-recover_wait_time, l); } /* Take into calculation only the workers that are * not in error state or not disabled. */ -if (!p-lb_workers[i].s-in_error_state -!p-lb_workers[i].s-is_disabled) { +if (JK_WORKER_USABLE(p-lb_workers[i].s)) { mytraffic = (p-lb_workers[i].s-transferred/p-lb_workers[i].s-lb_factor) + (p-lb_workers[i].s-readed/p-lb_workers[i].s-lb_factor); if (!candidate || mytraffic curmin) { @@ -346,9 +345,9 @@ return rc; } -static worker_record_t *find_session_route(lb_worker_t *p, - const char *name, - jk_logger_t *l) +static worker_record_t *find_bysession_route(lb_worker_t *p, + const char *name, + jk_logger_t *l) { unsigned int i; int total_factor = 0; @@ -361,13 +360,12 @@ candidate = find_best_bydomain(p, name, l); } if (candidate) { -if (candidate-s-in_error_state !candidate-s-is_disabled) { +if (JK_WORKER_IN_ERROR(candidate-s)) { retry_worker(candidate, p-s-recover_wait_time, l); } if (candidate-s-in_error_state) { -/* We have a worker that is unusable. - * It can be in error or disabled, but in case - * it has a redirection set use that redirection worker. +/* We have a worker that is error state. + * If it has a redirection set use that redirection worker. * This enables to safely remove the member from the * balancer. Of course you will need a some kind of * session replication between those two remote. @@ -384,8 +382,7 @@ } if (candidate !uses_domain) { for (i = 0; i