Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 91239 invoked from network); 2 Mar 2009 17:59:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Mar 2009 17:59:12 -0000 Received: (qmail 20761 invoked by uid 500); 2 Mar 2009 17:59:10 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 20700 invoked by uid 500); 2 Mar 2009 17:59:10 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 20691 invoked by uid 99); 2 Mar 2009 17:59:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Mar 2009 09:59:10 -0800 X-ASF-Spam-Status: No, hits=-2.5 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.227.30.149] (HELO mailserver.kippdata.de) (195.227.30.149) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Mar 2009 17:59:04 +0000 Received: from [10.130.41.72] ([10.130.41.72]) by mailserver.kippdata.de (8.13.5/8.13.5) with ESMTP id n22HwZUt022927 for ; Mon, 2 Mar 2009 18:58:39 +0100 (CET) Message-ID: <49AC1E02.3090402@kippdata.de> Date: Mon, 02 Mar 2009 18:57:22 +0100 From: Rainer Jung User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2 MIME-Version: 1.0 To: dev@httpd.apache.org Subject: Re: additional lbmethods in mod_proxy_balancer References: <1236008089.7342.14.camel@localhost> <49AC0D4D.6010806@kippdata.de> <1236013362.6311.11.camel@localhost> In-Reply-To: <1236013362.6311.11.camel@localhost> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 02.03.2009 18:02, Florian S. wrote: > Hi, > > First, thanks for your reply. > Here the outline of my config: > > > # [...] > ProxyPass / balancer://lb/ > ProxyPassReverse / balancer://lb/ > > > > # That works fine: > ProxySet lbmethod=byrequests > > # This would lead to the error I mentioned: > #ProxySet lbmethod=byfoobar > > # And several members: > BalancerMember http://xxx.xxx.xxx.xxx loadfactor=1 > ProxyHTMLURLMap http://xxx.xxx.xxx.xxx http://yyy.yyy.yyy.yyy:1234 > Header edit Location ^http://xxx.xxx.xxx.xxx > http://yyy.yyy.yyy.yyy:1234 > > > It could look like that my changes were lost during the entire build > process. But I checked after the configuring that the patch had been > applied. Compiling runs without any issues. Indeed, it works for me (tested with 2.2.11 on Solaris using gcc). I used exactly your code lines: Here's a patch format: --- mod_proxy_balancer.c.orig 2008-12-07 19:06:34.000000000 +0100 +++ mod_proxy_balancer.c 2009-03-02 17:58:57.000000000 +0100 @@ -1210,6 +1210,89 @@ } +static proxy_worker *find_best_byfoobar(proxy_balancer *balancer, + request_rec *r) +{ ... now copied in the contents of find_best_bybusyness and replaced "busyness" by foobar in the log messages ... +} + /* * How to add additional lbmethods: * 1. Create func which determines "best" candidate worker @@ -1237,6 +1320,13 @@ NULL }; +static const proxy_balancer_method byfoobar = +{ + "byfoobar", + &find_best_byfoobar, + NULL +}; + static void ap_proxy_balancer_register_hook(apr_pool_t *p) { @@ -1255,6 +1345,7 @@ ap_register_provider(p, PROXY_LBMETHOD, "bytraffic", "0", &bytraffic); ap_register_provider(p, PROXY_LBMETHOD, "byrequests", "0", &byrequests); ap_register_provider(p, PROXY_LBMETHOD, "bybusyness", "0", &bybusyness); + ap_register_provider(p, PROXY_LBMETHOD, "byfoobar", "0", &byfoobar); } module AP_MODULE_DECLARE_DATA proxy_balancer_module = { It compiles and works, I can see in the DEBUG log line, that it is using the correct method. To check whether foobar is in the compiled module, I did: % nm ./.libs/mod_proxy_balancer.so|grep foobar [59] | 90348| 12|OBJT |LOCL |0 |23 |byfoobar [217] | 6696| 616|FUNC |LOCL |0 |12 |find_best_byfoobar So at least I can see, that the symbols are in there. You can check the same with your build result. Regards, Rainer > Am Montag, den 02.03.2009, 17:46 +0100 schrieb Rainer Jung: >> What's you balancer configuration leading to the cited error? >> >> On 02.03.2009 16:34, Florian S. wrote: >>> Hi everyone! >>> >>> I'm desperately trying to implement an additional loadbalancing >>> algorithm. Did anyone succeeded in declaring own methods? >>> >>> The httpd-users-list did not give any reply, so I'll try it here once >>> again. >>> >>> I'm not able to find the error since I adapted the major part from the >>> original. After patching and compiling my 2.2.11, the standard methods >>> still work fine, but mine does not seem to exist: >>> >>> My error is: >>> ProxySet: unknown lbmethod lbmethod=byfoobar >>> >>> I changed the mod_proxy_balancer.c three times, as required: >>> >>> I added my function: >>> static proxy_worker *find_best_byfoobar(proxy_balancer *balancer, >>> request_rec *r) >>> >>> I added the struct: >>> static const proxy_balancer_method byfoobar = >>> { >>> "byfoobar", >>> &find_best_byfoobar, >>> NULL >>> }; >>> >>> And I finally registered it by inserting: >>> ap_register_provider(p, PROXY_LBMETHOD, "byfoobar", "0",&byfoobar); >>> in the >>> static void ap_proxy_balancer_register_hook(apr_pool_t *p) >>> >>> Very strange, since I did everything exactly in the same way as it had >>> been done for the built-in methods. >>> >>> Hoping that I'm posting to the right list >>> and >>> Thanks in advance, >>> >>> Florian Schr�der