Re: svn commit: r427172 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c

2006-08-02 Thread Ruediger Pluem


On 08/01/2006 01:48 PM, Jim Jagielski wrote:
 =?iso-8859-1?Q?Pl=FCm=2C_R=FCdiger=2C_VF_EITO?= wrote:
 


-Urspr=FCngliche Nachricht-
Von: Ruediger Pluem=20
=20
BTW: Don't we need to reset checked_standby and=20
checking_standby to zero in
 the outer while loop?

What about this? I guess we don't enter the inner while loop a second =
time
because checked_standby  0 once we have checked for the standby workers
during the first time.

 
 
 That's right. We are guaranteed to go through the full list as least
 once, and it's during that time that we determine what the
 max lbset was/is.

Thats correct, but we start the second iteration of the while loop with
checked_standby and checking_standby set to the values of the first iteration.
This seems wrong to me. I think they both should be zero before *each* start
of the inner while loop. If checked_standby is not zero we do not even enter
the inner while loop.

Regards

Rüdiger



Re: svn commit: r427172 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c

2006-08-01 Thread Plüm , Rüdiger , VF EITO


 -Ursprüngliche Nachricht-
 Von: Ruediger Pluem 
 
 BTW: Don't we need to reset checked_standby and 
 checking_standby to zero in
  the outer while loop?

What about this? I guess we don't enter the inner while loop a second time
because checked_standby  0 once we have checked for the standby workers
during the first time.

Regards

Rüdiger



Re: svn commit: r427172 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c

2006-08-01 Thread Jim Jagielski
=?iso-8859-1?Q?Pl=FCm=2C_R=FCdiger=2C_VF_EITO?= wrote:
 
 
 
  -Urspr=FCngliche Nachricht-
  Von: Ruediger Pluem=20
 =20
  BTW: Don't we need to reset checked_standby and=20
  checking_standby to zero in
   the outer while loop?
 
 What about this? I guess we don't enter the inner while loop a second =
 time
 because checked_standby  0 once we have checked for the standby workers
 during the first time.
 

That's right. We are guaranteed to go through the full list as least
once, and it's during that time that we determine what the
max lbset was/is.

-- 
===
   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
If you can dodge a wrench, you can dodge a ball.


Re: svn commit: r427172 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c

2006-07-31 Thread Jim Jagielski
Mladen Turk wrote:
 
 [EMAIL PROTECTED] wrote:
  Author: jim
  Compiles/builds clean: passes test framework as well
  as more normal usage tests ;)
  
  -chartimeout_set;
  +chartimeout_set;
  -characquire_set;
  -apr_size_t  recv_buffer_size;
  -charrecv_buffer_size_set;
  -apr_size_t  io_buffer_size;
  -chario_buffer_size_set;
  -charkeepalive;
  -charkeepalive_set;
  +characquire_set;
  +apr_size_t  recv_buffer_size;
  +charrecv_buffer_size_set;
  +apr_size_t  io_buffer_size;
  +chario_buffer_size_set;
  +charkeepalive;
  +charkeepalive_set;
 
 
 Any particular reason for this formatting :) ?
 

just lining up with the ones above it... Check out the elements
above that and you'll see that after some longer ones were pushed
to the right, we forgot to reset to the left.

-- 
===
   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
If you can dodge a wrench, you can dodge a ball.


Re: svn commit: r427172 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h modules/proxy/mod_proxy_balancer.c

2006-07-31 Thread Ruediger Pluem


On 07/31/2006 07:01 PM, [EMAIL PROTECTED] wrote:
 Author: jim
 Date: Mon Jul 31 10:01:40 2006
 New Revision: 427172
 
 URL: http://svn.apache.org/viewvc?rev=427172view=rev
 Log:
 Add in a very simple balancer set concept, which allows
 for members to be assigned to a particular cluster set
 such that members in lower-numbered sets are checked/used
 before those in higher ones.
 
 Also bundled in this are some HTML cleanups for the balancer
 manager UI. Sorry for the mixins :)
 
 Compiles/builds clean: passes test framework as well
 as more normal usage tests ;)
 

 +do {
 +while (!mycandidate  !checked_standby) {
 +worker = (proxy_worker *)balancer-workers-elts;
 +for (i = 0; i  balancer-workers-nelts; i++, worker++) {
 +if (!checking_standby) {/* first time through */
 +if (worker-s-lbset  max_lbset)
 +max_lbset = worker-s-lbset;
 +}
 +if (worker-s-lbset  cur_lbset)
 +continue;
 +if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : 
 PROXY_WORKER_IS_STANDBY(worker)) )
 +continue;
 +/* If the worker is in error state run
 + * retry on that worker. It will be marked as
 + * operational if the retry timeout is elapsed.
 + * The worker might still be unusable, but we try
 + * anyway.
 + */
 +if (!PROXY_WORKER_IS_USABLE(worker))
 +ap_proxy_retry_worker(BALANCER, worker, r-server);
 +/* Take into calculation only the workers that are
 + * not in error state or not disabled.
 + */
 +if (PROXY_WORKER_IS_USABLE(worker)) {
 +mytraffic = (worker-s-transferred/worker-s-lbfactor) 
 +
 +(worker-s-read/worker-s-lbfactor);
 +if (!mycandidate || mytraffic  curmin) {
 +mycandidate = worker;
 +curmin = mytraffic;
 +}
  }
  }
 +checked_standby = checking_standby++;
  }
 -checked_standby = checking_standby++;
 -}
 +cur_lbset++;
 +} while (cur_lbset  max_lbset  !mycandidate);

Shouldn't that be while (cur_lbset = max_lbset  !mycandidate);
(same question also for the other algorithm)?
I guess otherwise we would not check for the workers with the lbset max_lbset.

Regards

Rüdiger




Re: svn commit: r427172 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c

2006-07-31 Thread Jim Jagielski
Ruediger Pluem wrote:
 
 
 Shouldn't that be while (cur_lbset = max_lbset  !mycandidate);
 (same question also for the other algorithm)?
 I guess otherwise we would not check for the workers with the lbset max_lbset.
 

No, since we do the test at the end, after we've incremented.
If the current set is 3 and the max is 3, we want to stop.

-- 
===
   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
If you can dodge a wrench, you can dodge a ball.


Re: svn commit: r427172 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c

2006-07-31 Thread Ruediger Pluem


On 07/31/2006 09:53 PM, Jim Jagielski wrote:
 Ruediger Pluem wrote:
 

Shouldn't that be while (cur_lbset = max_lbset  !mycandidate);
(same question also for the other algorithm)?
I guess otherwise we would not check for the workers with the lbset max_lbset.

 
 
 No, since we do the test at the end, after we've incremented.
 If the current set is 3 and the max is 3, we want to stop.

Maybe I am confused, but we have not run the loop with current set 3 as we have 
just incremented
at at the end.

So I try an example (maybe I prove myself wrong and make a fool out of me, but 
that would help also :-)

Let's assume the maximum lbset is 1

1. We start the outer while loop with cur_lbset and max_lbset 0
2. In the inner while loop
   1. we iterate over all workers of the balancer, but consider only those
  who are not standby and who have an lbset of 0
   2. we iterate over all workers of the balancer, but consider only those
  who are standby and who have an lbset of 0
3. Now we leave the inner while loop and lets assume that we found no candidate
4. Now we increase cur_lbset to 1
5. Now we have to leave the outer while loop, because cur_lbset  max_lbset is
   not true because cur_lbset = max_lbset

So we did not check for the workers with lbset 1.

BTW: Don't we need to reset checked_standby and checking_standby to zero in
 the outer while loop?



+do {
+while (!mycandidate  !checked_standby) {
+worker = (proxy_worker *)balancer-workers-elts;
+for (i = 0; i  balancer-workers-nelts; i++, worker++) {
+if (!checking_standby) {/* first time through */
+if (worker-s-lbset  max_lbset)
+max_lbset = worker-s-lbset;
+}
+if (worker-s-lbset  cur_lbset)
+continue;
+if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : 
PROXY_WORKER_IS_STANDBY(worker)) )
+continue;
+/* If the worker is in error state run
+ * retry on that worker. It will be marked as
+ * operational if the retry timeout is elapsed.
+ * The worker might still be unusable, but we try
+ * anyway.
+ */
+if (!PROXY_WORKER_IS_USABLE(worker))
+ap_proxy_retry_worker(BALANCER, worker, r-server);
+/* Take into calculation only the workers that are
+ * not in error state or not disabled.
+ */
+if (PROXY_WORKER_IS_USABLE(worker)) {
+mytraffic = (worker-s-transferred/worker-s-lbfactor) +
+(worker-s-read/worker-s-lbfactor);
+if (!mycandidate || mytraffic  curmin) {
+mycandidate = worker;
+curmin = mytraffic;
+}
 }
 }
+checked_standby = checking_standby++;
 }
-checked_standby = checking_standby++;
-}
+cur_lbset++;
+} while (cur_lbset  max_lbset  !mycandidate);

Regards

Rüdiger


Re: svn commit: r427172 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c

2006-07-31 Thread Jim Jagielski

Let me double check...

-- 
===
   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
If you can dodge a wrench, you can dodge a ball.


Re: svn commit: r427172 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c

2006-07-31 Thread Jim Jagielski
Good catch by Ruediger. Fixed.

Jim Jagielski wrote:
 
 
 Let me double check...
 

-- 
===
   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
If you can dodge a wrench, you can dodge a ball.