- 浏览: 111087 次
-
最新评论
SIP 负载均衡理解
ServerIron ADX Advanced Server Load Balancing Guide
ServerIron 是一个产品, SLB是Server Load Balancing的缩写.
Understanding SIP Server Load Balancing The Session Initiation Protocol (SIP) is a signaling protocol used by numerous IP communication products to create session-oriented connections between two or more endpoints in an IP network. SIP is emerging as the preferred technology for Voice over IP (VoIP) implementations. Application-aware network switches play a vital role in increasing the uptime and availability of IP based services such as VoIP. Many customers rely on this technology to meet mission-critical application requirements. Together with advanced SIP intelligence, ServerIron switches offer highly scalable, available, and secure load balancing infrastructure for SIP applications. SIP is an application-layer protocol that can establish, modify, and terminate multimedia sessions, such as Internet telephony. In this implementation, ServerIron SIP Server Load Balancing balances SIP requests and responses, based on a call-ID. SIP Server Load Balancing is based on a request and response transaction model that is similar to HTTP. Each transaction consists of a request that invokes a particular method on the server, and at least one response. The method is carried within the request message. Figure 2.1 demonstrates the basic operation of SIP signaling protocol; location of an end-point, signal of a desire to communicate, negotiation of session parameters to establish the session, and tear-down of the session after completion.
This example shows packet exchange between two SIP clients, also known as user agent clients (UAC). Each message is labeled with the letter "F" and a number for reference by the text. The session established between the two end clients is facilitated by the SIP proxy server. User1 "calls" User2 using his/her SIP identity, a type of Uniform Resource Identifier (URI) called a "SIP URI." The SIP URI is similar to an email address, typically containing a username and a host name. In this case, it is sip:user1@brocade.com, where brocade.com is the domain of User1's SIP service provider. SIP is based on an HTTP-like request and response transaction model. Each transaction consists of a request that invokes a particular method, or function, on the server, and at least one response. In this example, the transaction begins with User1's SIP phone sending an INVITE request addressed to User2's SIP URI. The INVITE request contains a number of header fields. The fields present in an INVITE include a unique identifier for the call (Call-ID), the destination address, User1's address, and information about the type of session that User1 wishes to establish with User2. The INVITE (message F1 in Figure 2.1) would look like this: INVITE sip:user2@brocade.com SIP/2.0 Via: SIP/2.0/UDP pcuser1.brocade.com;branch=dkDKdkDKdkDK1111 To: User2 <sip:user2@brocade.com> From: User1 <sip:user1@brocade.com>;tag=1122334455 Call-ID: 12341234123412@pcuser1.brocade.com Contact: <sip:user1@pcuser1.brocade.com> Since User1's SIP phone does not know the location of User2's SIP phone, it sends the INVITE message to the SIP proxy server that is serving the brocade.com domain. The address of the brocade.com proxy server is known to the SIP phone through static configuration or through DHCP. The proxy server receives the INVITE request and sends a 100 (Trying) response back to User1's SIP phone. This response contains the same To, From, Call-ID, CSeq and branch parameter in the Via as the INVITE, which allows User1's SIP phone to correlate this response to the previously sent INVITE. The proxy server consults a database, generally called a location service, that contains the current IP address of User2. It then forwards (or proxies) the INVITE request there. Before forwarding the request, the proxy server adds an additional Via header field value with its own address (the INVITE already contains User1's address in the first Via). User2's SIP phone receives the INVITE and alerts User2 of the incoming call from User1, that is, User2's phone rings. User2's SIP phone indicates this by a 180 (Ringing) response, which is routed back through the SIP proxy server in the reverse direction. When User1's SIP phone receives the 180 (Ringing) response, it passes this information to User1, using an audio ringback tone. If User2 decides to answer the call (User2 picks up the handset), the SIP phone sends a 200 OK response to indicate that the call has been answered. The 200 OK contains the Via, To, From, Call-ID, and Casque header fields that are copied from the INVITE request, and a message body with the SDP media description of the type of session that User2 is willing to establish with User1. The 200 OK (message F6 in Figure 2.1) would look like this: Via: SIP/2.0/UDP pcproxy.brocade.com ;branch= dkDKdkDKdkDK2222;received=172.1.1.2 Via: SIP/2.0/UDP pcuser1.brocade.com ;branch= dkDKdkDKdkDK1111;received=172.1.1.1 To: User2 <sip:user2@brocade.com>;tag=dkdkdk1 From: User1 <sip:user1@brocade.com>;tag=1122334455 Call-ID: 12341234123412@pcuser1.brocade.com Contact: <sip:user2@172.1.1.3> The 200 OK message is routed back through the SIP proxy server to the User1's SIP phone, which then stops the ringback tone and indicates that the call has been answered. Finally, User1's SIP phone sends an acknowledgement message, ACK, to User2's SIP phone to confirm the reception of the final response (200 OK). This ACK is sent directly from User1's SIP phone to User2's SIP phone, bypassing the SIP proxy server. This occurs because the endpoints have now learned each other's IP address from the Contact header fields through the INVITE/200 OK exchange, which was not known when the initial INVITE was sent. This completes the INVITE/200/ACK three-way handshake used to establish SIP sessions. User1 and User2's media exchange now begins using the format that they have agreed upon through SDP. In general, the end-to-end media packets take a different path from the SIP signaling messages. At the end of the call, User2 disconnects (hangs up) the phone and generates a BYE message. This BYE is routed directly to User1's SIP phone, again bypassing the SIP proxy. User1 confirms receipt of the BYE with a 200 OK response, which terminates the session and the BYE transaction. No ACK is sent. (An ACK is only sent in response to an INVITE request.) Registration is another common SIP operation. Registration is the means through which the SIP domain's registrar server learns the current location of SIP clients (UAC). Upon initialization, and at periodic intervals, the SIP clients send REGISTER messages to domain's SIP registrar server. The REGISTER messages associate an individual SIP URI (sip:user@brocade.com) with the machine (IP address) into which the user is currently logged. The registrar server writes this association to a database, called the location service, where it can be used by the SIP proxy server of the domain. Often, a registrar server and the location service for a domain are co-located with the proxy server for that domain. SIP Server Load Balancing on ServerIron Figure 2.2 shows an overview of a ServerIron SIP Server Load Balancing implementation.
There are three kinds of SIP servers: proxy server, redirect server, and registrar server. In Figure 2.2, the ServerIron SIP load balancer (SIP Server Load Balancing) uses the Domain-1 VIP to load balance SIP requests from Client A or Client B among Domain 1 proxy servers and registrar servers. The SIP Server Load Balancing uses the Domain-2 VIP to load balance SIP requests from Client A (user1) or Client B (user2) among Domain 2 poxy servers and registrar servers. The ServerIron offers support for the following SIP servers in accordance with RFC 3261:
The ServerIron supports the following methods in accordance with RFC 3261:
Additionally, the following methods are supported:
The SIP Server Load Balancing feature has the following specifications:
NOTE: The ServerIron SIP SLB is not implemented as a SIP proxy server, but rather as a load balancer of proxy or registrar traffic. NOTE: The ServerIron does not modify any of the SIP headers. It also does not perform SIP-aware NAT. This section describes terms and concepts that you might find useful when configuring SIP-LB. Every SIP user has a URI. One SIP user calls another by setting the SIP URI of the latter in the request message, (also called request-URI), which appears before all message headers. A User Agent Client (UAC) is a logical entity that creates a new request. The role of UAC lasts only for the duration of the transaction. A User Agent Server (UAS) is a logical entity that generates a response to a SIP request. The response accepts, rejects, or redirects the request. An intermediary entity that acts as both a server and a client for the purpose of making requests on behalf of other clients. A proxy server is primarily a router, which means its job is to ensure that a request is sent to another entity nearer to the targeted user. A proxy interprets and, if necessary, rewrites specific parts of a request message before forwarding it. A redirect server is a user agent server that generates 3xx responses to requests it receives, directing the client to contact an alternate set of URIs. A registrar server accepts REGISTER requests and places the information it receives in those requests into the location service for the domain it handles. This section describes SIP message headers that you might find useful when making decisions about SIPServer Load Balancing. The call-ID is a header field that appears in all SIP requests and responses. This header field acts as a unique identifier to group together a series of messages. It must be the same for all requests and responses sent by either UAC or UAS in a dialog. Call-ID is generated by the combination of a random string and the host name or IP address of a particular UAC. There is no length restriction on call-ID. in the first implementation, real server is selected based on hash value of call-ID. The Record-Route header field is inserted by a proxy in a request to force future requests in the dialog to be routed through the proxy. Example: Record-Route: <sip: server10.Biloxi.com; 1r> The From header field indicates the LOGICAL identity of the initiator of the request. It contains a URI and, optionally, a display name. This field MUST contain a "tag" parameter, chosen by the UAC. From: "Alice" <sip: alice@xyz.com> ; tag=a48s or From: "Alice" <sip: alice@xyz.com> ; tag=a48s The To header field specifies the desired logical recipient of the request. This might not be the ultimate recipient of the request. Normally, the initial To field is set to be the value of the Request-URI. One exception is the REGISTER method. To: Alice <sip: alice@xyz.com > or To: Alice <sip: alice@xyz.com > The Via header field indicates the path taken by the request so far and indicates the path that should be followed in routing responses. A Via header field value contains the transport protocol used to send the message, the client's host name or network address, and possibly the port number at which it wishes to receive responses. It is a mandatory field for the UAC or UAS SIP proxies, and guarantees that the responses traverse through the same route as the requests. For example: Via: SIP/2.0/UDP erlang.bell-telephone.com:5060; branch=z9hGbK87asdks7 The branch ID parameter in the Via header field values serve as a transaction identifier, and is used by proxies to detect loops. The Max-Forwards header field must be used with any SIP method to limit the number of proxies or gateways that can forward the request to the next downstream server. The Max-Forwards value is an integer in the range 1-255 indicating the remaining number of times that a request message is allowed to be forwarded. The recommended initial value is 70. SIP Server Load Balancing and Persistence ServerIron switches offer application-aware advanced intelligence for UDP based SIP server load balancing. The following sections describe some SIP Server Load Balancing scenerios. Design #1: SIP Server Load Balancing with DSR Mode Figure 2.3 shows an SIP server farm built around ServerIron application switches for higher availability, accelerated performance, on-demand scalability, and robust security.
The ServerIron application switch provides hash-based, stateless implementation for UDP-based SIP server load balancing. The Call-ID attribute that uniquely identifies a SIP call is used to maintain session persistence. Due to the unique call flow requirements of SIP, most SIP implementations require you to enable direct server return (DSR) mode on the ServerIron switch. Since User1's SIP phone does not know the location of User2's SIP phone, it initiates a new SIP session by sending INVITE request to SIP Proxy server. It also generates a unique identifier (Call-ID) for the call. Because the SIP proxy server used by User1's SIP phone is actually the virtual IP address hosted on the ServerIron switch, the ServerIron switch receives the INVITE request and, using a hash-based mechanism, identifies the best available SIP server for this INVITE. The ServerIron uses the call-ID attribute value to hash to one of the SIP servers. For all SIP transactions within a dialog that use same call-ID, the ServerIron hashes to same SIP server. A new INVITE message with a different call-ID is again subjected to Server Load Balancing and may be forwarded to a different SIP server. The proxy server receives the INVITE request and sends 100 (Trying) message to User1's SIP phone. Since the ServerIron switch is configured in DSR mode, the response message that is sourced from the virtual IP address flows directly to User1's SIP phone, bypassing the ServerIron. The proxy server then consults the location service and forwards the INVITE request directly to User2's SIP phone, again bypassing the ServerIron and is sourced from the proxy server's own IP address. NOTE: The proxy server's IP address must be reachable from all SIP clients. User2's SIP phone receives the INVITE and alerts User2 of an incoming call. User2 replies with a Ringing message to the proxy server. if User2 answers the call, a 200 OK message is sent to the proxy server. The proxy server forwards this message to User1's SIP phone. Upon receiving the 200 OK message, User1's SIP phone sends an acknowledgement (ACK) message directly to User2's SIP phone, bypassing the proxy server. User1 and User2 SIP phones now begin media exchange and upon completion, a BYE message closes the call. Some SIP servers may be configured to use virtual IP address (VIP) as the source address for all communications. Figure 2.4 shows SIP packet flows in this type of configuration.
In this implementation, the SIP proxy server must use same call-ID for both legs of communication (the same call-ID for message exchange with both SIP clients within a given SIP dialog). Session persistence and transaction integrity can only be achieved if the proxy server uses same call-ID. Design #2: SIP Server Load Balancing with ServerIron non-DSR Mode Figure 2.5 shows a SIP server farm with proxy servers connected inline (non-DSR mode) with the ServerIron switch.
To maintain session persistence and transaction integrity, this implementation has the following requirements:
NOTE: If the proxy server uses a source port other than the one used as the destination port for inbound communications, then these packets arriving from proxy server go untranslated by the ServerIron. The proxy server IP address must be reachable from all SIP clients in such cases. There are two types of SIP servers of particular importance — SIP proxy servers and SIP registrar servers. The ServerIron supports advanced layer-7 application health checks for both server types. ServerIron switches can be enabled to send REGISTER or OPTION messages to SIP servers to track their health. When an error-free response status (default is 200 OK) is received, then the ServerIron marks the SIP server as being available, and starts assigning new SIP sessions to the available servers. The switches can also be configured to send health monitoring messages at user-defined frequency and retrial attempts. Our unique system architecture allows a dedicated processor for health monitoring and device management, which significantly increases the reliability and efficiency of health monitoring and therefore improves the overall service availability. By default, 200 OK is considered a valid response code. Optionally, you can configure the switch to accept other response codes that indicate a healthy and available server. SIP messages with specific SIP methods are switched to the appropriate SIP server. As an example, REGISTER messages are forwarded only to the SIP registrar server; whereas INVITE messages are distributed among SIP proxy servers.
|
http://www.brocade.com/support/Product_Manuals/ServerIron_AdvSLBGuide/sip.2.2.html
相关推荐
在构建大型VoIP系统时,负载均衡是至关重要的,它能确保服务的高可用性和可扩展性。"opensips与两台freeswitch负载均衡"的主题聚焦于如何使用OpenSIPS作为负载均衡器来管理两台Freeswitch服务器,以实现Freeswitch的...
5. **代理服务器和重定向服务器**:SIP网络中的这些组件帮助路由请求,实现负载均衡和会话控制。 6. **SIP安全**:理解如何使用TLS(Transport Layer Security)加密通信,以及如何防止中间人攻击和骚扰电话。 7. ...
6. **负载均衡**:如果部署在大型环境中,可能需要考虑负载均衡,以防止单点故障并提高服务可用性。 7. **故障转移和冗余**:配置备份SIP Proxy服务器,以防主服务器出现故障,保证服务连续性。 8. **计费和策略**:...
随着用户数量的增长,代理服务器的性能和负载均衡变得至关重要。论文可能涵盖如何通过缓存策略、多代理协作等技术来提高SIP系统的可扩展性和效率。 10. **SIP故障恢复与容错机制**: 网络故障可能导致SIP会话中断...
SIP Proxy在SIP架构中扮演着重要角色,它处理SIP消息,执行策略,如负载均衡和认证,以及维护会话状态。 压缩包内的文件包括: 1. `sipua.c`:这是SIP用户代理的源代码,可能包含了处理注册、呼叫、消息等SIP事务的...
华为作为通信设备供应商,其SIP实现可能包含特定的企业级功能和优化,如QoS(服务质量)、安全策略、负载均衡等。这些通常涉及到与华为设备配合使用的SIP配置和管理实践。 **SIP协议应用与挑战:** 1. **安全性**:...
最后,为了实现完整的SIP Proxy功能,我们还需要考虑其他一些方面,如认证和授权机制、会话管理、重定向服务、负载均衡以及错误处理等。这些都是构建一个健壮且实用的SIP Proxy所必不可少的组成部分。 总之,使用C#...
- **扩展性**:为了支持大量并发用户,服务器端可能需要采用分布式架构,通过负载均衡和集群技术提高处理能力。 总的来说,【sipservlet_demo_chatroom】项目提供了一个实践SIP协议和SIP Servlets的实例,对学习和...
3. **重定向服务器**:接收请求并返回指向其他服务器的响应,用于处理用户的移动性或负载均衡。 4. **注册服务器**:用于存储用户代理的位置信息,帮助请求找到正确的目的地。 5. **SIP消息**:SIP协议通过请求和...
它们可以执行多种功能,如负载均衡、认证和计费。 3. **重定向服务器**:重定向服务器接收请求,然后返回一个或多个新的目标地址,指示请求应发送到何处。 4. **注册服务器**:用户通过注册服务器更新他们的位置...
3. **负载均衡与扩展性**:OpenSIPS支持负载均衡,可以在多台服务器之间分配负载,确保系统在高流量下仍能稳定运行。此外,它的模块化设计允许轻松扩展,适应未来可能出现的新功能或服务需求。 OpenSIPS的应用广泛...
一个实际的SIP服务器部署可能涉及负载均衡、高可用性集群、防火墙配置、证书管理以及与其他通信系统的集成,如IMS(IP Multimedia Subsystem)或PBX(Private Branch Exchange)系统。 总结来说,“SIP服务器代码...
- **性能**:优化包括负载均衡、缓存策略、高效的路由算法等,以确保高并发下的稳定性和低延迟。 ### 总结 SIP服务器作为VoIP架构的关键部分,负责管理和路由SIP会话。理解SIP信令过程和服务器类型是部署和维护...
7. **负载均衡与高可用性**:通过集群和负载均衡策略,提高系统的稳定性和可用性。 在对FreeSwitch的SIP模块进行分析时,我们需要理解SIP协议的工作流程,熟悉各种SIP消息的结构和含义,同时关注FreeSwitch如何将...
同时,为了提高SIP系统的鲁棒性,还需要考虑故障恢复、负载均衡和冗余设计等方面。 ### SIP与传统通信的融合 SIP不仅可以与现有的IP电话系统集成,还能与传统的电话网络(PSTN)进行桥接,实现混合通信环境下的...
- **Call-leg High Availability Functions**:这部分涉及 SIP 协议栈如何实现高可用性,包括负载均衡、故障转移等机制。 - **Call-leg Server Authentication Functions**:这部分讲述了 SIP 服务器认证的功能,...
1. **高可用性**:Sipsoft SIP Server 2008具备高容错性和负载均衡能力,确保即使在高流量情况下也能稳定运行,避免单点故障。 2. **灵活性**:支持多种信令协议,如SIP、H.323等,同时兼容多种VoIP设备和软电话,...
2. 代理服务器(Proxy Server):用于转发SIP请求,可以执行策略决策,如认证、授权、负载均衡等。 3. 注册服务器(Registrar):处理用户的注册请求,存储用户的联系信息,帮助其他用户找到通话目标。 4. 重定向...
综上所述,`ip_vs_pe_sip.rar_Always`可能是一个与SIP协议处理相关的项目,重点关注了SIP头的正确终止,并可能涉及IPVS负载均衡的实现。深入理解SIP协议、IPVS的工作原理以及C编程是理解这个代码库的关键。