Re: load balancer workers
thanks you all for the feedback. I will give a try on these alternatives... :) best, Vinicius
Re: load balancer workers
On 10/08/2008 11:21 PM, Vinicius Petrucci wrote: Hi, ok. but if I cannot change the assignment of workers to balancer during runtime, how do I duplicate the workers at startup? where should I write the code for duplication? I've tried using the httpd.conf, e.g., Proxy balancer://webapp1 BalancerMember http://ampere:81 route=ampere loadfactor=20 BalancerMember http://coulomb:81 route=coulomb loadfactor=10 BalancerMember http://hertz:81 route=hertz loadfactor=10 ProxySet lbmethod=byrequests /Proxy Proxy balancer://webapp2 BalancerMember http://ampere:81 route=ampere loadfactor=20 BalancerMember http://coulomb:81 route=coulomb loadfactor=10 BalancerMember http://hertz:81 route=hertz loadfactor=10 ProxySet lbmethod=byrequests /Proxy but when Apache starts it outputs the following warning: [Wed Oct 08 18:14:48 2008] [warn] worker http://ampere:81 already used by another worker [Wed Oct 08 18:14:48 2008] [warn] worker http://coulomb:81 already used by another worker [Wed Oct 08 18:14:48 2008] [warn] worker http://hertz:81 already used by another worker Is there any problem using this approach? The workers in your second balancer are not copies, but are the *same* workers as in your first balancer. So what can you do to create copies? If you web applications have context pathes do something like Proxy balancer://webapp1/webapp1 BalancerMember http://ampere:81/webapp1 route=ampere loadfactor=20 BalancerMember http://coulomb:81/webapp1 route=coulomb loadfactor=10 BalancerMember http://hertz:81/webapp1 route=hertz loadfactor=10 ProxySet lbmethod=byrequests /Proxy Proxy balancer://webapp2/webapp2 BalancerMember http://ampere:81/webapp2 route=ampere loadfactor=20 BalancerMember http://coulomb:81/webapp2 route=coulomb loadfactor=10 BalancerMember http://hertz:81/webapp2 route=hertz loadfactor=10 ProxySet lbmethod=byrequests /Proxy If not use different hostnames for your backend that point to the same IP addresses, e.g. ampere-webapp1 and ampere-webapp2 BTW: I'm planing to support multiple services (or applications) associated to different (dynamic) group of servers. My cluster configuration needs to be dynamic because the workload for the different running applications varies according to the time. The point is to change the overall cluster configuration (increase/decrease servers on balancer X) depending the their loads. As Paul said, the best approach here is to setup a configuration like you did (with the small modifications I proposed) and let your module do some kind of virtual operator of the mod_proxy_balancer web interface by dynamically enabling and disabling the workers you like. Regards RĂ¼diger
Re: load balancer workers
On Oct 8, 2008, at 5:26 PM, Vinicius Petrucci wrote: I don't think the approach you are suggesting will work. I would suggest duplicating the workers at startup, enable/disable in each balancer to 'move' them. Correct. So you cannot change the assignment of workers to a balancer during runtime. BTW: What is the goal that rises the need for you to change the assignment of workers to balancers during runtime? Hi, ok. but if I cannot change the assignment of workers to balancer during runtime, how do I duplicate the workers at startup? where should I write the code for duplication? Off the top of my head: create a shared memory segment that recreates both the shared and non-shared LB parameters. This will allow you change the assignments at runtime since those assignments will be now me shared among all processes. Then, have your module run before mod_proxy, so that your assignments are used and mod_proxy is pretty much bypassed. In other words, just have your module be a fork of mod_proxy et.al. with all aspects shared.
load balancer workers
hi, I'm writing a module that needs to modify the elements (workers) of load balancers. That is, to move workers between different balancers. for example, suppose we have two balancers b1 and b2. also, we have a worker w to be moved from b1 to b2 basically, I do a push in b2-workers array: new_worker = apr_array_push(b2-workers); memcpy(new_worker, w, sizeof(proxy_worker)); then, I decrement by one the elements from b1 --- we still need to guarantee that the positions of b1-workers array are fixed (shifted): proxy_worker *tmp_w = w++; for (j = i; j b1-workers-nelts-1; j++, tmp_w = w, w++) { memcpy(tmp_w, w, sizeof(proxy_worker)); } b1-workers-nelts--; the problem is that in my module these changes are made. but when I use the balancer-manager interface to list the balancer and respective workers' settings, nothing has changed. this information isn't shared between the modules? I'm using the following piece of code to get the configuration so that I can get balancer and worker data structures references to be modified: conf = (proxy_server_conf *) ap_get_module_config(frontend_info-s-module_config, proxy_module); balancer = (proxy_balancer *) conf-balancers-elts; thanks in advance, Vinicius
Re: load balancer workers
I don't think the approach you are suggesting will work. I would suggest duplicating the workers at startup, enable/disable in each balancer to 'move' them. -Paul Vinicius Petrucci wrote: hi, I'm writing a module that needs to modify the elements (workers) of load balancers. That is, to move workers between different balancers. for example, suppose we have two balancers b1 and b2. also, we have a worker w to be moved from b1 to b2 basically, I do a push in b2-workers array: new_worker = apr_array_push(b2-workers); memcpy(new_worker, w, sizeof(proxy_worker)); then, I decrement by one the elements from b1 --- we still need to guarantee that the positions of b1-workers array are fixed (shifted): proxy_worker *tmp_w = w++; for (j = i; j b1-workers-nelts-1; j++, tmp_w = w, w++) { memcpy(tmp_w, w, sizeof(proxy_worker)); } b1-workers-nelts--; the problem is that in my module these changes are made. but when I use the balancer-manager interface to list the balancer and respective workers' settings, nothing has changed. this information isn't shared between the modules? I'm using the following piece of code to get the configuration so that I can get balancer and worker data structures references to be modified: conf = (proxy_server_conf *) ap_get_module_config(frontend_info-s-module_config, proxy_module); balancer = (proxy_balancer *) conf-balancers-elts; thanks in advance, Vinicius
Re: load balancer workers
On 10/08/2008 09:54 PM, Vinicius Petrucci wrote: hi, I'm writing a module that needs to modify the elements (workers) of load balancers. That is, to move workers between different balancers. for example, suppose we have two balancers b1 and b2. also, we have a worker w to be moved from b1 to b2 basically, I do a push in b2-workers array: new_worker = apr_array_push(b2-workers); memcpy(new_worker, w, sizeof(proxy_worker)); then, I decrement by one the elements from b1 --- we still need to guarantee that the positions of b1-workers array are fixed (shifted): proxy_worker *tmp_w = w++; for (j = i; j b1-workers-nelts-1; j++, tmp_w = w, w++) { memcpy(tmp_w, w, sizeof(proxy_worker)); } b1-workers-nelts--; the problem is that in my module these changes are made. but when I use the balancer-manager interface to list the balancer and respective workers' settings, nothing has changed. this information isn't shared between the modules? Correct. So you cannot change the assignment of workers to a balancer during runtime. BTW: What is the goal that rises the need for you to change the assignment of workers to balancers during runtime? Regards RĂ¼diger
Re: load balancer workers
On 10/8/08 4:06 PM, Paul Querna [EMAIL PROTECTED] wrote: I don't think the approach you are suggesting will work. I would suggest duplicating the workers at startup, enable/disable in each balancer to 'move' them. +1. Do graceful restarts work correctly with the stock load balancer? If so, they are usually very cheap and non disruptive if you need this functionality. -- Brian Akins Chief Operations Engineer Turner Digital Media Technologies
Re: load balancer workers
On 10/8/08 4:06 PM, Paul Querna [EMAIL PROTECTED] wrote: I don't think the approach you are suggesting will work. I would suggest duplicating the workers at startup, enable/disable in each balancer to 'move' them. On 10/8/08 4:06 PM, Paul Querna [EMAIL PROTECTED] wrote: Correct. So you cannot change the assignment of workers to a balancer during runtime. BTW: What is the goal that rises the need for you to change the assignment of workers to balancers during runtime? Hi, ok. but if I cannot change the assignment of workers to balancer during runtime, how do I duplicate the workers at startup? where should I write the code for duplication? I've tried using the httpd.conf, e.g., Proxy balancer://webapp1 BalancerMember http://ampere:81 route=ampere loadfactor=20 BalancerMember http://coulomb:81 route=coulomb loadfactor=10 BalancerMember http://hertz:81 route=hertz loadfactor=10 ProxySet lbmethod=byrequests /Proxy Proxy balancer://webapp2 BalancerMember http://ampere:81 route=ampere loadfactor=20 BalancerMember http://coulomb:81 route=coulomb loadfactor=10 BalancerMember http://hertz:81 route=hertz loadfactor=10 ProxySet lbmethod=byrequests /Proxy but when Apache starts it outputs the following warning: [Wed Oct 08 18:14:48 2008] [warn] worker http://ampere:81 already used by another worker [Wed Oct 08 18:14:48 2008] [warn] worker http://coulomb:81 already used by another worker [Wed Oct 08 18:14:48 2008] [warn] worker http://hertz:81 already used by another worker Is there any problem using this approach? BTW: I'm planing to support multiple services (or applications) associated to different (dynamic) group of servers. My cluster configuration needs to be dynamic because the workload for the different running applications varies according to the time. The point is to change the overall cluster configuration (increase/decrease servers on balancer X) depending the their loads. thanks very much! Vinicius
Re: load balancer workers
I don't think the approach you are suggesting will work. I would suggest duplicating the workers at startup, enable/disable in each balancer to 'move' them. Correct. So you cannot change the assignment of workers to a balancer during runtime. BTW: What is the goal that rises the need for you to change the assignment of workers to balancers during runtime? Hi, ok. but if I cannot change the assignment of workers to balancer during runtime, how do I duplicate the workers at startup? where should I write the code for duplication? I've tried using the httpd.conf, e.g., Proxy balancer://webapp1 BalancerMember http://ampere:81 route=ampere loadfactor=20 BalancerMember http://coulomb:81 route=coulomb loadfactor=10 BalancerMember http://hertz:81 route=hertz loadfactor=10 ProxySet lbmethod=byrequests /Proxy Proxy balancer://webapp2 BalancerMember http://ampere:81 route=ampere loadfactor=20 BalancerMember http://coulomb:81 route=coulomb loadfactor=10 BalancerMember http://hertz:81 route=hertz loadfactor=10 ProxySet lbmethod=byrequests /Proxy but when Apache starts it outputs the following warning: [Wed Oct 08 18:14:48 2008] [warn] worker http://ampere:81 already used by another worker [Wed Oct 08 18:14:48 2008] [warn] worker http://coulomb:81 already used by another worker [Wed Oct 08 18:14:48 2008] [warn] worker http://hertz:81 already used by another worker Is there any problem using this approach? BTW: I'm planing to support multiple services (or applications) associated to different (dynamic) group of servers. My cluster configuration needs to be dynamic because the workload for the different running applications varies according to the time. The point is to change the overall cluster configuration (increase/decrease servers on balancer X) depending on their current load. thanks very much! Vinicius