Chapter 3 Adaptive Load Balance Architecture
3.2 System Scheme
3.2.1 System Architecture
The master SIP proxy is the entrance of our system, providing both peer to peer and client-server mode, according to user’s situation, the service mode will be changed dynamically. Relying on the integration of the slave servers, the capability to distribute the server load and the RTP flow, and other telephony functions are provided.
Like in figure 14 when both users are in public network, the master proxy will let both user connect as peer to peer, letting RTP flow transmit in peer to peer mode, to reduce server’s load.
Figure 14 Peer to peer mode
In figure 15 when any end user is in the private network, the master proxy will change it’s mode to client-server, letting both user transmit under client-server mode, so that the problem caused by users behind NAT can be easily solved.
Figure 15 Client server mode
The slave cluster can be discussed in two parts, one is single slave cluster, another is multi-slave cluster.
1. Single Slave Cluster
We integrate several SIP servers into one group to provide RTP transmission or other services, like in figure 16, master server will relay the SIP message to the servers in the slaves group, cause the servers in the slaves group become the middleware of the media transmission, this way, the load of the server can balance to every server in the group, and achieve load balance distribution.
Figure 16 Master and slave
2. Multi-group Slave Cluster
The group is define as below to divide slave cluster into several groups, each group starts with a different number, every server in the group is an individual SIP proxy, providing the service of which group it is divided in. Master server will send the task to the appropriate group which the UA requested, and then the task will be process by the server in that group.
This way the same service task’s load will be distributed.
Table 11 Example of slave groups # RTP load sharing
1 sip:s1.voip.nuk.edu.tw:5060 1 sip:s2.voip.nuk.edu.tw:5060 1 sip:s3.voip.nuk.edu.tw:5060
# PSTN Gateways
2 sip:gw.voip.nuk.edu.tw:5060 2 sip:192.168.1.42:5060
# Voice Mail
3 sip:vm1.voip.nuk.edu.tw:5070
3 sip:vm2.voip.nuk.edu.tw:5070
# Lawful Intercept
4 sip:li1.voip.nuk.edu.tw:5080 4 sip:li2.voip.nuk.edu.tw:5080
Because all the SIP massage passes through master server like in figure 17, so the slave can be a SIP IP PBX, which has the ability of call relay、voicemail same as tradition telephone, or integrate PSTN into the system by considering the slave as PSTN gateway, or consider as any other service provided by SIP, this is all planed by the master routing rule.
The system can distribute the load to the servers in the slave cluster group, and reduce the load of each server.
The reason of separating the slave servers into several groups, is to consider providing the same service servers as a group, for example table , slave servers used just for distributing RTP flows, this kind of group is used to balance the load of two user’s internet connection.
Furthermore, other groups of service such as voicemail、conference、recording, can also be set up for the usage, and to balance the load for the server.
Figure 17 System integration
3.2.2 Master Rout Rule Pseudo Code
Shown in table 12, Every SIP request will be routed to the master SIP proxy for registration and redirection, afterwards, the master SIP proxy will decide where and how to redirect the SIP message by the environment of the caller and calle, the pseudo code of the master server is shown below. The redirection process can be divided into three part. First of all, in a period of time, the master server will query the slave servers to report there status, and than save and change in the dispatcher list. Second, see if the UA has been set with a specific flag, or if RURI(Request Uniform Resource Identifier) has been assigned as special number, for example, some GSM proprietor set 123 as for entering voicemail, when any terms mentioned above is true, this means UA must be send to a slave server for further service arrangement, Second, check the environment of the UA, according to the SIP package which received, the master server will compare the IP address with the IP address in the SIP layer, if the information are different, it will add a rport and information in t he receiver field to notify UA is behind NAT, at this time, the master server will pick a server from the cluster server to deal with the task. If both doesn’t happens, this means both UA does not require addition service, and both are in a public network, at this time, the master server will only relay the message, and let both UA communicate in peer to peer mode.
Table 12 Route Rule Pseudo code Period of time master calls for slaves status
PROCEDURE Update slave’s status
IF slave doesn’t report, we assume such server is out of service THEN don’t add such server’s IP into dispatcher table
END IF
WHILE server all reports status THEN
input the lowest load server on the first line of dispatcher table
PROCEDURE Select_Slave
IF special flag is unset AND NAT flag is unset THEN:
Authorize user Transaction relay END IF