[OpenSIPS-Users] Load balancer ORed resource types
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Wed Dec 9 18:25:41 CET 2009
Hi Taner,
Why do you have only one record per group in the LB table ? there is no
LB if you have only one destination ;). It simply makes no sense.
Better put both destinations in the same group and LB over them both,
with failover too:
+----+----------+-----------------------+-----------+------------+-------------+
| id | group_id | dst_uri | resources | probe_mode |
description |
+----+----------+-----------------------+-----------+------------+-------------+
| 1 | 8080 | sip:service at host1.net <mailto:sip%3Aservice at host1.net>
| sip=1 | 2 | |
| 2 | 8080 | sip:service at host2.net <mailto:sip%3Aservice at host2.net>
| sip=1 | 2 | |
+----+----------+-----------------------+-----------+------------+-------------+
route[3] {
if (is_method("INVITE")) {
load_balance("8080", "sip");
if ($retcode < 0) {
xlog("L_INFO", "load_balancer: Insufficient resource to
balance request from $fu to $tu !\n");
send_reply("500","no resources available");
exit;
}
t_on_failure("2");
}
# send request
if (!t_relay()) {
sl_reply_error();
}
exit;
}
failure_route[2] {
if (t_was_cancelled()) {
exit;
}
if (t_check_status("486|408")) {
xlog("L_INFO", "load_balancer: Request from $fu to $tu
failed. Re-balancing!\n");
lb_disable();
load_balance("8080", "sip");
if ($retcode < 0) {
xlog("L_INFO", "load_balancer: Insufficient resource to
balance request from $fu to $tu \n");
send_reply("500","no resources available");
exit;
}
t_on_failure("2");
t_relay();
}
}
Regards,
Bogdan
Taner Sener wrote:
> Hi Bogdan,
>
> I used your approach and defined the same resource name "sip" for both
> definitions. It is working now as expected but another requirement
> raised for my scenario.
>
> When all destinations for a specific group id are busy I want to re
> load-balance the request to a different group id. I expect this to run
> with the following configuration but it is not possible to re
> load_balance the request. I hope you can help me to find a solution.
>
> I'm testing this the following configuration. I'm making a call to
> 8080. If service at host1.net <mailto:service at host1.net> is busy or if it
> receives timeout I expect call to be re load-balanced to a destination
> from group id 9090. But it is not.
>
> load_balancer
> +----+----------+-----------------------+-----------+------------+-------------+
> | id | group_id | dst_uri | resources | probe_mode |
> description |
> +----+----------+-----------------------+-----------+------------+-------------+
> | 1 | 8080 | sip:service at host1.net
> <mailto:sip%3Aservice at host1.net> | sip=1 | 2
> | |
> | 2 | 9090 | sip:service at host2.net
> <mailto:sip%3Aservice at host2.net> | sip=1 | 2
> | |
> +----+----------+-----------------------+-----------+------------+-------------+
>
> opensips.cfg
> ....
> route {
> ...
> route(3);
> }
>
> route[3] {
> if (is_method("INVITE")) {
>
> load_balance("8080", "sip");
> if ($retcode < 0) {
> xlog("L_INFO", "load_balancer: Insufficient resource
> to balance request from $fu to $tu . Re-balancing to route 4!\n");
> route(4);
> }
> }
>
> t_on_failure("2");
>
> # send request
> if (!t_relay()) {
> sl_reply_error();
> }
> exit;
> }
>
> route[4] {
> if (is_method("INVITE")) {
>
> load_balance("9090", "sip");
> if ($retcode < 0) {
> xlog("L_INFO", "load_balancer: Insufficient resource
> to balance request from $fu to $tu . Sending error!\n");
> sl_send_reply("500", "Service full");
> exit;
> }
> }
>
> t_on_failure("2");
>
> # send request
> if (!t_relay()) {
> sl_reply_error();
> }
> exit;
> }
>
> failure_route[2] {
> if (t_was_cancelled()) {
> exit;
> }
>
> if (t_check_status("486|408")) {
> xlog("L_INFO", "load_balancer: Request from $fu to $tu
> failed. Re-balancing to 8080!\n");
> lb_disable();
> load_balance("8080", "sip");
>
> if ($retcode < 0) {
> xlog("L_INFO", "load_balancer: Insufficient resource
> to balance request from $fu to $tu . Re-balancing to route 4!\n");
> route(4);
> }
> t_on_failure("2");
> t_relay();
> }
> }
>
> opensips.log
> ...
> Dec 8 10:56:57 sipproxy /sbin/opensips[11299]: load_balancer: Request
> from sip:test at 10.10.5.10 <mailto:sip%3Atest at 10.10.5.10> to
> sip:8080 at 10.10.6.6:5060 <http://sip:8080@10.10.6.6:5060> failed.
> Re-balancing to 8080!
> Dec 8 10:56:57 sipproxy /sbin/opensips[11299]: load_balancer:
> Insufficient resource to balance request from sip:test at 10.10.5.10
> <mailto:sip%3Atest at 10.10.5.10> to sip:8080 at 10.10.6.6:5060
> <http://sip:8080@10.10.6.6:5060> . Re-balancing to route 4!
> Dec 8 10:56:57 sipproxy /sbin/opensips[11299]: load_balancer:
> Insufficient resource to balance request from sip:test at 10.10.5.10
> <mailto:sip%3Atest at 10.10.5.10> to sip:8080 at 10.10.6.6:5060
> <http://sip:8080@10.10.6.6:5060> . Sending error!
>
>
> Thanks,
> Taner
>
>
> On Sun, Nov 15, 2009 at 10:12 PM, Bogdan-Andrei Iancu
> <bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>> wrote:
>
> Hi Taner,
>
> I would suggest a different approach - as from LB point of view you do
> not care too much if it VM or CONF - what is important is that each of
> your box has only on channel, so I would define a resource the
> number of
> channels each box can handle .
>
> +----+----------+------------------------+---------------------------------+
> | id | group_id | dst_uri | resources
> |
> +----+----------+------------------------+---------------------------------+
>
> | 1 | 555 | sip:service at host1.net
> <mailto:sip%3Aservice at host1.net> <mailto:sip%3Aservice at host1.net
> <mailto:sip%253Aservice at host1.net>> | channel=1
> |
> | 2 | 555 | sip:service at host2.net
> <mailto:sip%3Aservice at host2.net> <mailto:sip%3Aservice at host2.net
> <mailto:sip%253Aservice at host2.net>> | channel=1
> |
>
> +----+----------+------------------------+---------------------------------+
>
>
> and do (when routing a VM or conference call) :
> 'load_balance(.., "channel");'
>
> Regards,
> Bogdan
>
>
> Taner Sener wrote:
> > Hi,
> >
> > I'm using load balancer module on 1.6.0-notls (i386/linux) to
> balance
> > incoming sip calls to sip clients. The case is; my sip clients are
> > capable of serving multiple types of calls. But not in the same time
> > like in the definition "vm=1;conf=1". Only one of them is
> available at
> > that moment. They can process either a vm call, either a conf call;
> > not one vm call and one conf call. Is there a way to define it?
> >
> >
> +----+----------+------------------------+---------------------------------+
> > | id | group_id | dst_uri | resources
> |
> >
> +----+----------+------------------------+---------------------------------+
> >
> > | 1 | 555 | sip:service at host1.net
> <mailto:sip%3Aservice at host1.net> <mailto:sip%3Aservice at host1.net
> <mailto:sip%253Aservice at host1.net>> | vm=1; conf=1
> |
> > | 2 | 555 | sip:service at host2.net
> <mailto:sip%3Aservice at host2.net> <mailto:sip%3Aservice at host2.net
> <mailto:sip%253Aservice at host2.net>> | vm=1; conf=1
> |
> >
> >
> +----+----------+------------------------+---------------------------------+
> >
> > Current 'resources' field of load_balancer table ANDs resource types
> > given with semi-colon and I when I invoke
> >
> > 'load_balance(.., "vm")'
> >
> > and
> >
> > 'load_balance(.., "conf")'
> >
> > second load balanced call receives busy and balancing fails there
> > because that client is serving to vm call. How can I configure
> > load_balanced module to select it right?
> >
> > Thanks,
> > Taner
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.opensips.org <mailto:Users at lists.opensips.org>
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
--
Bogdan-Andrei Iancu
www.voice-system.ro
More information about the Users
mailing list