You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by jean-frederic clere <jf...@gmail.com> on 2010/04/07 15:31:35 UTC

Arranging mod_proxy_balancer in trunk

Hi,

In mod_proxy_balancer after
runtime = find_session_route(*balancer, r, &route, &sticky, url);

There is a logic that belongs to the LB implementation, my idea is to add a
apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
*elected, server_rec *s);
in the proxy_balancer_method (mod_proxy.h) and call the LB implementation.

Comments?

Cheers

Jean-Frederic

Re: Arranging mod_proxy_balancer in trunk

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Apr 14, 2010, at 1:31 PM, jean-frederic clere wrote:

> On 04/14/2010 07:26 PM, Jim Jagielski wrote:
>> 
>> On Apr 14, 2010, at 1:10 PM, jean-frederic clere wrote:
>>>>>> You should also likely pass a int * (or something) to handle
>>>>>> the requirement to also "know" total_factor outside of that
>>>>>> call... Of course, lbstatus is something that outside code
>>>>>> shouldn't really know about, but that's a whole 'nother
>>>>>> point ;)
>>>>> 
>>>>> total_factor in fact depends on the LB implementation I don't think it
>>>>> should go outside it.
>>>>> 
>>>> 
>>>> I agree... So elected == runtime then??
>>> 
>>> Well you meant we don't need runtime and could use *worker instead don't
>>> you?
>>> 
>> 
>> Well, looking at:
>> 
>>       runtime->s->lbstatus -= total_factor;
>>       runtime->s->elected++;
>> 
>> we need to have that section of code (either within the
>> new function or externally) update lbstatus and
>> elected. If 'total_factor' isn't exposed, then that
>> implies that runtime needs to be passed, right?
>> So I'm assuming that in
>> 
>>    apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker *elected, server_rec *s);
>> 
>> that you're using elected to pass runtime??
> 
> Sure, should I rename elected to runtime in the prototype?
> 

No need... I just wasn't sure that was what it was being used for,
hence by orig comments about needing to "expose" total_factor.

Re: Arranging mod_proxy_balancer in trunk

Posted by jean-frederic clere <jf...@gmail.com>.
On 04/14/2010 07:26 PM, Jim Jagielski wrote:
> 
> On Apr 14, 2010, at 1:10 PM, jean-frederic clere wrote:
>>>>> You should also likely pass a int * (or something) to handle
>>>>> the requirement to also "know" total_factor outside of that
>>>>> call... Of course, lbstatus is something that outside code
>>>>> shouldn't really know about, but that's a whole 'nother
>>>>> point ;)
>>>>
>>>> total_factor in fact depends on the LB implementation I don't think it
>>>> should go outside it.
>>>>
>>>
>>> I agree... So elected == runtime then??
>>
>> Well you meant we don't need runtime and could use *worker instead don't
>> you?
>>
> 
> Well, looking at:
> 
>        runtime->s->lbstatus -= total_factor;
>        runtime->s->elected++;
> 
> we need to have that section of code (either within the
> new function or externally) update lbstatus and
> elected. If 'total_factor' isn't exposed, then that
> implies that runtime needs to be passed, right?
> So I'm assuming that in
> 
>     apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker *elected, server_rec *s);
> 
> that you're using elected to pass runtime??

Sure, should I rename elected to runtime in the prototype?

> If so, +1 otherwise I'm
> not sure what it's used for.

Cheers

Jean-Frederic

Re: Arranging mod_proxy_balancer in trunk

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Apr 14, 2010, at 1:10 PM, jean-frederic clere wrote:
>>>> You should also likely pass a int * (or something) to handle
>>>> the requirement to also "know" total_factor outside of that
>>>> call... Of course, lbstatus is something that outside code
>>>> shouldn't really know about, but that's a whole 'nother
>>>> point ;)
>>> 
>>> total_factor in fact depends on the LB implementation I don't think it
>>> should go outside it.
>>> 
>> 
>> I agree... So elected == runtime then??
> 
> Well you meant we don't need runtime and could use *worker instead don't
> you?
> 

Well, looking at:

       runtime->s->lbstatus -= total_factor;
       runtime->s->elected++;

we need to have that section of code (either within the
new function or externally) update lbstatus and
elected. If 'total_factor' isn't exposed, then that
implies that runtime needs to be passed, right?
So I'm assuming that in

    apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker *elected, server_rec *s);

that you're using elected to pass runtime?? If so, +1 otherwise I'm
not sure what it's used for.

Re: Arranging mod_proxy_balancer in trunk

Posted by jean-frederic clere <jf...@gmail.com>.
On 04/14/2010 05:45 PM, Jim Jagielski wrote:
> 
> On Apr 14, 2010, at 3:38 AM, jean-frederic clere wrote:
> 
>> On 04/13/2010 10:35 PM, Jim Jagielski wrote:
>>>
>>> On Apr 13, 2010, at 4:29 PM, Jim Jagielski wrote:
>>>
>>>>
>>>> On Apr 8, 2010, at 3:58 AM, jean-frederic clere wrote:
>>>>
>>>>> On 04/07/2010 03:40 PM, "Plüm, Rüdiger, VF-Group" wrote:
>>>>>>
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: jean-frederic clere [mailto:jfclere@gmail.com] 
>>>>>>> Sent: Mittwoch, 7. April 2010 15:32
>>>>>>> To: dev@httpd.apache.org
>>>>>>> Subject: Arranging mod_proxy_balancer in trunk
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> In mod_proxy_balancer after
>>>>>>> runtime = find_session_route(*balancer, r, &route, &sticky, url);
>>>>>>>
>>>>>>> There is a logic that belongs to the LB implementation, my 
>>>>>>> idea is to add a
>>>>>>> apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
>>>>>>> *elected, server_rec *s);
>>>>>>> in the proxy_balancer_method (mod_proxy.h) and call the LB 
>>>>>>> implementation.
>>>>>>>
>>>>>>> Comments?
>>>>>>
>>>
>>> You should also likely pass a int * (or something) to handle
>>> the requirement to also "know" total_factor outside of that
>>> call... Of course, lbstatus is something that outside code
>>> shouldn't really know about, but that's a whole 'nother
>>> point ;)
>>
>> total_factor in fact depends on the LB implementation I don't think it
>> should go outside it.
>>
> 
> I agree... So elected == runtime then??

Well you meant we don't need runtime and could use *worker instead don't
you?

Cheers

Jean-Frederic

Re: Arranging mod_proxy_balancer in trunk

Posted by Jim Jagielski <ji...@apache.org>.
On Apr 14, 2010, at 3:38 AM, jean-frederic clere wrote:

> On 04/13/2010 10:35 PM, Jim Jagielski wrote:
>> 
>> On Apr 13, 2010, at 4:29 PM, Jim Jagielski wrote:
>> 
>>> 
>>> On Apr 8, 2010, at 3:58 AM, jean-frederic clere wrote:
>>> 
>>>> On 04/07/2010 03:40 PM, "Plüm, Rüdiger, VF-Group" wrote:
>>>>> 
>>>>> 
>>>>>> -----Original Message-----
>>>>>> From: jean-frederic clere [mailto:jfclere@gmail.com] 
>>>>>> Sent: Mittwoch, 7. April 2010 15:32
>>>>>> To: dev@httpd.apache.org
>>>>>> Subject: Arranging mod_proxy_balancer in trunk
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> In mod_proxy_balancer after
>>>>>> runtime = find_session_route(*balancer, r, &route, &sticky, url);
>>>>>> 
>>>>>> There is a logic that belongs to the LB implementation, my 
>>>>>> idea is to add a
>>>>>> apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
>>>>>> *elected, server_rec *s);
>>>>>> in the proxy_balancer_method (mod_proxy.h) and call the LB 
>>>>>> implementation.
>>>>>> 
>>>>>> Comments?
>>>>> 
>> 
>> You should also likely pass a int * (or something) to handle
>> the requirement to also "know" total_factor outside of that
>> call... Of course, lbstatus is something that outside code
>> shouldn't really know about, but that's a whole 'nother
>> point ;)
> 
> total_factor in fact depends on the LB implementation I don't think it
> should go outside it.
> 

I agree... So elected == runtime then??

Re: Arranging mod_proxy_balancer in trunk

Posted by jean-frederic clere <jf...@gmail.com>.
On 04/13/2010 10:35 PM, Jim Jagielski wrote:
> 
> On Apr 13, 2010, at 4:29 PM, Jim Jagielski wrote:
> 
>>
>> On Apr 8, 2010, at 3:58 AM, jean-frederic clere wrote:
>>
>>> On 04/07/2010 03:40 PM, "Plüm, Rüdiger, VF-Group" wrote:
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: jean-frederic clere [mailto:jfclere@gmail.com] 
>>>>> Sent: Mittwoch, 7. April 2010 15:32
>>>>> To: dev@httpd.apache.org
>>>>> Subject: Arranging mod_proxy_balancer in trunk
>>>>>
>>>>> Hi,
>>>>>
>>>>> In mod_proxy_balancer after
>>>>> runtime = find_session_route(*balancer, r, &route, &sticky, url);
>>>>>
>>>>> There is a logic that belongs to the LB implementation, my 
>>>>> idea is to add a
>>>>> apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
>>>>> *elected, server_rec *s);
>>>>> in the proxy_balancer_method (mod_proxy.h) and call the LB 
>>>>> implementation.
>>>>>
>>>>> Comments?
>>>>
> 
> You should also likely pass a int * (or something) to handle
> the requirement to also "know" total_factor outside of that
> call... Of course, lbstatus is something that outside code
> shouldn't really know about, but that's a whole 'nother
> point ;)

total_factor in fact depends on the LB implementation I don't think it
should go outside it.

Cheers

Jean-Frederic


Re: Arranging mod_proxy_balancer in trunk

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Apr 13, 2010, at 4:29 PM, Jim Jagielski wrote:

> 
> On Apr 8, 2010, at 3:58 AM, jean-frederic clere wrote:
> 
>> On 04/07/2010 03:40 PM, "Plüm, Rüdiger, VF-Group" wrote:
>>> 
>>> 
>>>> -----Original Message-----
>>>> From: jean-frederic clere [mailto:jfclere@gmail.com] 
>>>> Sent: Mittwoch, 7. April 2010 15:32
>>>> To: dev@httpd.apache.org
>>>> Subject: Arranging mod_proxy_balancer in trunk
>>>> 
>>>> Hi,
>>>> 
>>>> In mod_proxy_balancer after
>>>> runtime = find_session_route(*balancer, r, &route, &sticky, url);
>>>> 
>>>> There is a logic that belongs to the LB implementation, my 
>>>> idea is to add a
>>>> apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
>>>> *elected, server_rec *s);
>>>> in the proxy_balancer_method (mod_proxy.h) and call the LB 
>>>> implementation.
>>>> 
>>>> Comments?
>>> 

You should also likely pass a int * (or something) to handle
the requirement to also "know" total_factor outside of that
call... Of course, lbstatus is something that outside code
shouldn't really know about, but that's a whole 'nother
point ;)

Re: Arranging mod_proxy_balancer in trunk

Posted by Jim Jagielski <ji...@apache.org>.
On Apr 8, 2010, at 3:58 AM, jean-frederic clere wrote:

> On 04/07/2010 03:40 PM, "Plüm, Rüdiger, VF-Group" wrote:
>> 
>> 
>>> -----Original Message-----
>>> From: jean-frederic clere [mailto:jfclere@gmail.com] 
>>> Sent: Mittwoch, 7. April 2010 15:32
>>> To: dev@httpd.apache.org
>>> Subject: Arranging mod_proxy_balancer in trunk
>>> 
>>> Hi,
>>> 
>>> In mod_proxy_balancer after
>>> runtime = find_session_route(*balancer, r, &route, &sticky, url);
>>> 
>>> There is a logic that belongs to the LB implementation, my 
>>> idea is to add a
>>> apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
>>> *elected, server_rec *s);
>>> in the proxy_balancer_method (mod_proxy.h) and call the LB 
>>> implementation.
>>> 
>>> Comments?
>> 
>> You are talking about replacing this
>> 
>>        int i, total_factor = 0;
>>        proxy_worker **workers;
>>        /* We have a sticky load balancer
>>         * Update the workers status
>>         * so that even session routes get
>>         * into account.
>>         */
>>        workers = (proxy_worker **)(*balancer)->workers->elts;
>>        for (i = 0; i < (*balancer)->workers->nelts; i++) {
>>            /* Take into calculation only the workers that are
>>             * not in error state or not disabled.
>>             *
>>             * TODO: Abstract the below, since this is dependent
>>             *       on the LB implementation
>>             */
>>            if (PROXY_WORKER_IS_USABLE(*workers)) {
>>                (*workers)->s->lbstatus += (*workers)->s->lbfactor;
>>                total_factor += (*workers)->s->lbfactor;
>>            }
>>            workers++;
>>        }
>>        runtime->s->lbstatus -= total_factor;
>>        runtime->s->elected++;
>> 
>>        *worker = runtime;
>> 
>> 
>> with
>> 
>> apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
>> *elected, server_rec *s);
>> 
>> , correct?
> 
> Yes :-)
> 

+1... it's an obvious TODO :)

Re: Arranging mod_proxy_balancer in trunk

Posted by jean-frederic clere <jf...@gmail.com>.
On 04/07/2010 03:40 PM, "Plüm, Rüdiger, VF-Group" wrote:
>  
> 
>> -----Original Message-----
>> From: jean-frederic clere [mailto:jfclere@gmail.com] 
>> Sent: Mittwoch, 7. April 2010 15:32
>> To: dev@httpd.apache.org
>> Subject: Arranging mod_proxy_balancer in trunk
>>
>> Hi,
>>
>> In mod_proxy_balancer after
>> runtime = find_session_route(*balancer, r, &route, &sticky, url);
>>
>> There is a logic that belongs to the LB implementation, my 
>> idea is to add a
>> apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
>> *elected, server_rec *s);
>> in the proxy_balancer_method (mod_proxy.h) and call the LB 
>> implementation.
>>
>> Comments?
> 
> You are talking about replacing this
> 
>         int i, total_factor = 0;
>         proxy_worker **workers;
>         /* We have a sticky load balancer
>          * Update the workers status
>          * so that even session routes get
>          * into account.
>          */
>         workers = (proxy_worker **)(*balancer)->workers->elts;
>         for (i = 0; i < (*balancer)->workers->nelts; i++) {
>             /* Take into calculation only the workers that are
>              * not in error state or not disabled.
>              *
>              * TODO: Abstract the below, since this is dependent
>              *       on the LB implementation
>              */
>             if (PROXY_WORKER_IS_USABLE(*workers)) {
>                 (*workers)->s->lbstatus += (*workers)->s->lbfactor;
>                 total_factor += (*workers)->s->lbfactor;
>             }
>             workers++;
>         }
>         runtime->s->lbstatus -= total_factor;
>         runtime->s->elected++;
> 
>         *worker = runtime;
> 
> 
> with
> 
>  apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
> *elected, server_rec *s);
> 
> , correct?

Yes :-)

Cheers

Jean-Frederic

RE: Arranging mod_proxy_balancer in trunk

Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.
 

> -----Original Message-----
> From: jean-frederic clere [mailto:jfclere@gmail.com] 
> Sent: Mittwoch, 7. April 2010 15:32
> To: dev@httpd.apache.org
> Subject: Arranging mod_proxy_balancer in trunk
> 
> Hi,
> 
> In mod_proxy_balancer after
> runtime = find_session_route(*balancer, r, &route, &sticky, url);
> 
> There is a logic that belongs to the LB implementation, my 
> idea is to add a
> apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
> *elected, server_rec *s);
> in the proxy_balancer_method (mod_proxy.h) and call the LB 
> implementation.
> 
> Comments?

You are talking about replacing this

        int i, total_factor = 0;
        proxy_worker **workers;
        /* We have a sticky load balancer
         * Update the workers status
         * so that even session routes get
         * into account.
         */
        workers = (proxy_worker **)(*balancer)->workers->elts;
        for (i = 0; i < (*balancer)->workers->nelts; i++) {
            /* Take into calculation only the workers that are
             * not in error state or not disabled.
             *
             * TODO: Abstract the below, since this is dependent
             *       on the LB implementation
             */
            if (PROXY_WORKER_IS_USABLE(*workers)) {
                (*workers)->s->lbstatus += (*workers)->s->lbfactor;
                total_factor += (*workers)->s->lbfactor;
            }
            workers++;
        }
        runtime->s->lbstatus -= total_factor;
        runtime->s->elected++;

        *worker = runtime;


with

 apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
*elected, server_rec *s);

, correct?
IMHO this would make sense.

Regards

Rüdiger
 

Re: Arranging mod_proxy_balancer in trunk

Posted by Mladen Turk <mt...@apache.org>.
On 04/07/2010 03:31 PM, jean-frederic clere wrote:
> Hi,
>
> In mod_proxy_balancer after
> runtime = find_session_route(*balancer, r,&route,&sticky, url);
>
> There is a logic that belongs to the LB implementation, my idea is to add a
> apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker
> *elected, server_rec *s);
> in the proxy_balancer_method (mod_proxy.h) and call the LB implementation.
>
> Comments?
>

+1

However if the balancer doesn't implement his own session
affinity determination logic, default one should be used thought,
so that we don't duplicate the code inside each balancer

Regards
-- 
^TM