Rolf,
The DNS round-robin approach has some serious issues. Let me explain.
I did a project that required load balancing among 60 sip servers from one SER front end. Each server was designed with a balance point of about 100 calls per server. The fullly loaded capacity was thousands of simultaneous calls running through the SER. By design, a few of the remote SIP gateways had lower call-capacity..
A couple of years ago when first deployed, I put a flat round-robin list of remote sip IPs into the edge-access SER. Worked quite well. Except that when we had wide variations in call duration times, the actual loads on the gateway was skewed. Some gateways were carrying 200+ calls while others were carrying only 75 calls when they had the same call capacity. The load balance skew was due to flat list (either random or round-robin).
I needed actual capacity and current load information on a per-gateway basis. Because Asterisk was used for the remote sip servers, it was fairly easy to poll each gateway on a recurring cycle to determine how many calls were active. We also knew the exact capacities for all of the gateways.
The fun work came when we integrated an intelligent feed-back loop into SER.
The key statements that is used in ser.cfg are as follows:
$remote_gwip = "xx.yy.xx.nn" ; # Set attr to next IP in list of IPs $attr2uri( "$remote_gwip" , "domain");
if (!trelay()) { sl_reply_error(); }
These statements & techniques are well known from several public SER.cfg examples.
At first, a simple random hash on the orignation/destination numbers was used to select the gateways in IF-THEN-ELSE code logic. This spread the load nicely over a small number of IPs. For the next version, we used a simple DOMAIN attribute to contain the list of IPs and and capacity for a larger number of IPs. Later, a separate MYSQL updates and query() was used to manage the capacity-sensitive list of IPs and the current-load feedback information.
So far, all of this work is private. I am now writing yet another SER module to put all of this inside the SER in order to keep all the load related feed-back information in shared memory for highest performance and to run without any DB at all in SER. When I get it completed, I plan to submit a version of the module as a candidate for the SER Out-Of-Box sub-project.
I hope this gives you more ideal on how to get load balancing with a per-server feed-back information loop.
Regards, ..mike..
At 07:38 AM 4/22/2008, Rolf Unger wrote:
As far as I know there are different options for load-balancing. I even saw some modules for load balancing. But it is a bit tricky to get this sorted out, because many of the load-balancing options think of load balancing between several ser servers or in other words having the ser servers as target of the load balancing process.
While I am looking for a load balancing of requests to a remote sip server.
I thought that the SRV feature of the DNS system is quite old and long time established, so I expected that ser would be able to send and evaluate such a request to the DNS. There would be nothing special to do for ser, all would be done in the DNS with the same roud-robin mechanism that works for MX or A records.
You will read between the lines that I am more familiar with DNS than with ser, so I tend for this kind of solution. But it seems that I have to look into the source code of ser, to figure out in which way the dns lookup is done (or maybe I run a tcpdump on the dns port 53, to check what's happening).
Thanks anyway, Rolf.
On Tue, 22 Apr 2008, Miklos Tirpak wrote:
I think load-balancing was introduced in version 2.0, so there is no way to configure it in 0.9.x.
In 2.x, you need to enable it explicitly: dns_srv_lb=1
Regards, Miklos
On 04/18/2008 06:06 PM, Rolf Unger wrote:
Hello list users,
i want to use ser as a load balancing proxy for some PSTN gateways that I have in use. My idea is to use the rewritehost() core function and DNS SRV entries to accomplish this. But it seems that ser is doing a A record lookup if I simply replace the host with my domain "mynet.interx":
if ( ... ) { rewritehost("mynet.interx"); t_relay(); }
Ser is running on the same host (89.49.16.54) as the authorative nameserver for the mynet.interx domain.
dig shows that the DNS files are configured in the right way for load balancing, but I just can't find a way to make ser as a dns client work like dig.
If I use "_sip._udp.mynet.interx" it will complain about a bad name. Well he is partly right, underscores are not allowed in domain names.
And if I use only the domain in the rewrite command it will contact the IP of the nameserver of this domain. Or in other words it will send the messages to itself.
Using directly rewritehost("sip1.mynet.interx") doesn't help me, because it wouldn't do load balancing.
How can I convince ser (version 0.9.6) to use the correct lookup method for the DNS?
Any hints are appreciated ...
Thanks, Rolf.
; <<>> DiG 9.2.4 <<>> -t SRV _sip._udp.mynet.interx
;; QUESTION SECTION: ;_sip._udp.mynet.interx. IN SRV
;; ANSWER SECTION: _sip._udp.mynet.interx. 21600 IN SRV 0 50 5060 sip3.mynet.interx. _sip._udp.mynet.interx. 21600 IN SRV 0 50 5060 sip1.mynet.interx.
;; AUTHORITY SECTION: mynet.interx. 21600 IN NS mynet.interx.
;; ADDITIONAL SECTION: sip1.mynet.interx. 21600 IN A 89.49.16.50 sip3.mynet.interx. 21600 IN A 89.49.16.51 mynet.interx. 21600 IN A 89.49.16.54
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
-- CoolSwitchIP wins Best Product of Show Award in Los Angeles! (Sept 2007)
Rolf Unger ._---_; Systems Engineer /( )\ +49 (0)721 7839312 CTI Labs GmbH '---' Am Sandfeld 18 eMail: rolf.unger@ctilabs.de D-76149 Karlsruhe
-- GERMANY --
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers