On 02.03.2009 18:02, Florian S. wrote:
Hi,

First, thanks for your reply.
Here the outline of my config:

<VirtualHost *:1234>
   # [...]
   ProxyPass / balancer://lb/
   ProxyPassReverse / balancer://lb/
</VirtualHost>

<Proxy 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
</Proxy>

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

Reply via email to