Tuesday Nov 03, 2009
Wednesday Oct 28, 2009
There are handful of features newly added for Converged Load-Balancer(CLB) in SailFin 2.0. These features are as follows :
- DCR plugin in JAVA
- CLB monitoring
- Increase load on recovered instance in periodic manner
- Reuse TCP connection between client to CLB front-end
DCR plugin in JAVA
In SailFin 1.5, user need to provide DCR plugin in propriety XML format. Developer found it difficult to write DCR as it was hard to understand propriety format. Also this format is very restrictive in nature, and difficult to enhance it to support new rules.
Hence in SailFin 2.0, we have introduced support for DCR plugin in JAVA. Please refer to my blog to get complete details on how to develop DCR plugin in JAVA.
CLB Monitoring
In SailFin 2.0, user can gather CLB monitoring data. CLB exposes both front-end and back-end statistics. Monitoring level is dynamically (re)configurable.
How to enable CLB monitoring
User can enable CLB monitoring by setting property converged-load-balancer under module-monitoring-levels to HIGH or
LOW. User can set it using admin CLI or GUI.
Front-end statistics
Front-end statistics are SIP and HTTP requests or responses
handled by CLB acting as front-end. The exposed statistics are as follows :
- Total number of http requests received
- Total number of http requests received to be serviced locally
- Total number of http requests proxied to remote back-end to be serviced
- Total number of http requests which resulted in error responses
- Total number of failed over http requests
- Total number of sip requests received
- Total number of sip requests received to be serviced locally
- Total number of sip requests proxied to remote back-end to be serviced
- Total number of failed over sip requests
- Total number of sip requests which resulted in error responses
- Total number of outgoing sip requests
- Total number of sip responses received
- Total number of sip responses received to be consumed locally
- Total number of sip responses proxied to remote back-end to be consumed
- Total number of sip responses discarded as they cannot be routed to its
consumer
Back-end statistics
Back-end statistics are SIP and HTTP requests or responses
handled by CLB acting as back-end. The exposed statistics are as follows :
- Total number of incoming sip requests
- Total number of incoming http requests
- Total number of incoming sip responses
- Total number of outgoing sip responses
- Total number of outgoing sip requests
Increase load on recovered instance in periodic manner
In SailFin 2.0, new properties are added to increase load on recovered instance in periodic manner. This feature is mainly introduced for Sip Session Replication(SSR).
These new properties are namely load-increase-factor and
load-factor-increase-period-in-seconds. These
properties can be defined under converged-clb-config and are dynamically
(re)configurable. Both of these properties will be used by
consistent-hash algorithm in CLB. When an instance recovers,
consistent-hash algorithm will not immediately include that instance for
load distribution. It will increase load, from 0 to factor of 1, on
recovered instance in a periodic manner. The load factor increases by
load-increase-factor every load-factor-increase-period-in-seconds seconds.
The default value of load-increase-factor is 1 and load-factor-increase-period-in-seconds is 0. User can set load-increase-factor to any decimal value between 0 and 1, and load-factor-increase-period-in-seconds to positive integer.
User can set using following asadmin commands:
- asadmin set domain.converged-lb-configs.<converged-lb-config-name>.property.load-factor-increase-period-in-seconds=120
- asadmin set domain.converged-lb-configs.<converged-lb-config-name>.property.load-increase-factor=.05
All requests which are distributed using consistent hash algorithm will
follow described load-distribution. Consistent hash algorithm is
applicable for
1. SIP requests
2. HTTP requests for converged application, only if dcr xml is provided.
This does not impact round-robin algorithm at all. Thus HTTP requests
belonging to pure web application(s) will have no impact in behavior
what-so-ever.
This will not impact load-distribution in case of cluster startup. It
will only come into effect in case of instance startup.
If load-factor-increase-period-in-seconds is set to 0, then
load-increase-factor will not have any impact. However if
load-factor-increase-period-in-seconds is set and load-increase-factor
is not set, then recovered instance will not get any load for period
specified by load-factor-increase-period-in-seconds. After period
load-factor-increase-period-in-seconds lapses, then load factor for
recovered instance will immediately become 1.
Let me explain how it will work with an example. Lets start with some assumptions :
=> There are two instances, instance1 and instance2, in cluster
=> Total Call Per Second(CPS) on system is 200, so per instance it is
100 CPS
=> load-factor-increase-period-in-seconds is set to 60
=> load-increase-factor is set to .1
Now instance1 goes down and then recovers, then load on instance1 will
increase in this manner :
0 - 60 : 0 CPS
60 - 120 : 10 CPS
120 - 180 : 20 CPS
180 - 240 : 30 CPS
240 - 300 : 40 CPS
300 - 360 : 50 CPS
360 - 420 : 60 CPS
420 - 480 : 70 CPS
480 - 540 : 80 CPS
540 - 600 : 90 CPS
600 - onward : 100 CPS
Reuse TCP connection between client to CLB front-end connection
In case client in behind a firewall, then SailFin cannot open new TCP connections to client. In such a scenario, SailFin must reuse existing TCP connections between client and SailFin instance.
New property defined to control this behavior is reuseClientFEConnection. The default value of this property is false. User need to set this property to true to enable this feature. User can set it using following asadmin command:
- asadmin set
domain.converged-lb-configs.<converged-lb-config-name>.property.reuseClientFEConnection=true
To achieve it, client to CLB Front-End(FE) mapping is maintained with-in CLB. However there are conditions to store client to CLB FE mapping, which are as follows :
- Request has to come over TCP
- Contact is a sip-uri
- Response has a request associated with it, implies SailFin instance is either acting as UAS or B2BUA
A new mapping of client to CLB FE is created for following cases :
- For all Register requests which result in 2xx response, a mapping is created for contact to CLB FE address mapping
- For all dialog creating requests which result in 2xx response, CLB FE address is added as an attribute in session
Mapping created by REGISTER requests are cleaned up either by timeout or REGISTER request with expires set to 0.
For all outgoing requests, we check whether we have a mapping for contact address in map created by REGISTER request, or attribute set in session. If either is found, we push a ROUTE header for CLB FE and use that to send request out to client.
Wednesday Jul 22, 2009
In SailFin 1.0, user can provide Data Centric Rules(DCR) as xml file. User found it is difficult to define rules in xml file. Also flexibility was a major concern.
To solve above issues, in SailFinv2 user can provide DCR plugin as a java implementation. User can define rules as per their requirement in a very flexible manner.
This blog provides detail on how to write a DCR plugin in Java.
Functional Specification
For deep-dive design details on DCR plugin as jar file, user can refer to functional specification. It provides introduction to DCR Plugin, configuration and design details.
Developing DCR Plugin jar
Writing DCR plugin implementation
User implementation for DCR plugin must implement interface org.glassfish.comms.api.datacentric.DcrPlugin. A sample implementation of DCR plugin is provided below :
package mydcr;
import org.glassfish.comms.api.datacentric.DcrPlugin;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.sip.SipFactory;
import javax.servlet.sip.SipServletRequest;
import javax.servlet.sip.SipURI;
import org.glassfish.comms.api.telurl.TelUrlResolver;
import org.glassfish.comms.api.uriutils.UriTools;
public class MyDcrPluginImpl implements DcrPlugin{
public String getKey(SipServletRequest request,
SipFactory sipFactory, UriTools uriTools,
TelUrlResolver telUrlResolver) {
String key = null;
String method = request.getMethod().toUpperCase();
if(method.equals( "PUBLISH" ) || method.equals( "INVITE" ) || method.equals( "CANCEL" )){
key = SipURI.class.cast(request.getTo().getURI()).getUser();
} else if (method.equals( "REGISTER" )
|| method.equals( "SUBSCRIBE" )){
key = SipURI.class.cast(request.getFrom().getURI()).getUser();
}
System.out.println("MY DCR PLUGIN - Key extracted from SIP request : " + key);
return key;
}
public String getKey(HttpServletRequest request,
SipFactory sipFactory, UriTools uriTools,
TelUrlResolver telUrlResolver) {
String key = request.getParameter( "j_username" );
System.out.println("MY DCR PLUGIN - Key extracted from HTTP request : " + key);
return key;
}
}
Compiling DCR plugin
User need three jars to compile DCR plugin. These jars are ssa-api.jar, javaee.jar and comms-appserv-api.jar. They are available in SailFin installation. Below is command to compile DCR plugin :
javac -classpath <SAILFIN_INSTALL_PATH>/lib/ssa-api.jar:<SAILFIN_INSTALL_PATH>/lib/javaee.jar:<SAILFIN_INSTALL_PATH>/lib/comms-appserv-api.jar -d classes src/mydcr/MyDcrPluginImpl.java
Note: classes directory must exist. Compiled classes will reside in classes directory.
Writing Manifest file
Below is sample manifest file :
Manifest-Version: 1.0
Dcr-Plugin-Class: mydcr.MyDcrPluginImpl
Lets call this file as mymanifest
Creating DCR plugin jar
Command to create jar file using above manifest and compiled dcr plugin implementation class is provided below :
jar -cvfm mydcrplugin.jar mymanifest -C classes mydcr/MyDcrPluginImpl.class
Command to set this jar as DCR file
User can set DCR file using asadmin set-dcr-file command. One example of the command is provided below :
<SAILFIN_INSTALL_PATH>/bin/asadmin set-dcr-file --host <host-name> --port <port-number> --clbconfig <clb-config-name> mydcrplugin.jar
User can set dcr file using admin GUI as well.
Tuesday Jul 21, 2009
In this blog we will try and provide references to all information available for GlassFish load-balancer plugin. We will put in continuous efforts to keep this blog up to date.
Contents
Latest Version
The latest version of load-balancer plugin is aslb-9.1.1-b11. User can download it from following download locations :
Official documentation
Latest documentation for load-balancer plugin is available under Sun GlassFish Enterprise Server 2.1's High Availability Administration Guide. The relevant information is in two chapters :
- Chapter 4 : Configuring HTTP Load Balancing
- Chapter 5 : Configuring Web Servers for HTTP Load Balancing
There is also an official white paper available on GlassFish load-balancer plugin.
Blogs
There are multiple blogs written on how to configure load-balancer plugin with various web-servers. Below are links for them :
Bugs fixed in a load-balancer plugin
- aslb- 9.1.1-b11.jar
Thursday Feb 26, 2009
In this blog, user will be provided with complete set of manual steps to configure load-balancer plugin on IIS.
Platform supported
- Windows 2003 Enterprise Edition
Currently the load-balancer plugin is well tested on above mentioned platform. It may work on other windows platform, even though it is not tested on those platform.
IIS Version supported
- IIS 6.0
- IIS 5.0
These are tested version of IIS with load-balancer plugin
Download Location
The load-balancer plugin library can be downloaded from http://download.java.net/javaee5/external/WINNT/aslb/jars
The latest version of load-balancer plugin available is aslb-9.1.1-b7.jar. User can download any other latest version compared to above version, if available.
Steps to configure load-balancer plugin on IIS
Let me first put down steps which is automatically taken care of by installer when using Sun GlassFish Enterprise Server :
- User has already installed IIS and directory C:\Inetpub\wwwroot(or equivalent) exists. Now create a directory sun-passthrough under C:\Inetpub\wwwroot. From now on directory C:\Inetpub\wwwroot\sun-passthrough will be referred to as <sun-passthrough-dir>.
- Download load-balancer plugin and unjar it. Then unzip SUNWaspx.zip and SUNWaslb.zip. This directory will be referred to as <lbplugin-unzip-dir>.
- Create directory
- <sun-passthrough-dir>\errorpages
- <sun-passthrough-dir>\resource
- <sun-passthrough-dir>\sec_db_files
- Copy file -
<lbplugin-unzip-dir>\lib\webserver-plugin\windows\iis\sun-passthrough.dll
to <sun-passthrough-dir>. Also change permission of the
file to executable for IIS run-as user(IIS_WPG).
- Copy file -
<lbplugin-unzip-dir>\lib\webserver-plugin\windows\iis\sun-passthrough.properties
to <sun-passthrough-dir>. Append following entries to the file :
- lb-config-file=<sun-passthrough-dir>\loadbalancer.xml
- log-file=<sun-passthrough-dir>\lb.log
- log-level=INFO
- Copy files - <lbplugin-unzip-dir>\lib\webserver-plugin\windows\iis\errorpages\default-error.html and <lbplugin-unzip-dir>\lib\webserver-plugin\windows\iis\errorpages\sun-http-lberror.html to <sun-passthrough-dir>\errorpages directory.
- Copy
files -
<lbplugin-unzip-dir>\lib\webserver-plugin\windows\iis\LBPluginDefault_root.res
and
<lbplugin-unzip-dir>\lib\webserver-plugin\windows\iis\LBPlugin_root.res
to <sun-passthrough-dir>\resource directory.
- Copy
files -
<lbplugin-unzip-dir>\lib\webserver-plugin\windows\iis\secmod.db,
<lbplugin-unzip-dir>\lib\webserver-plugin\windows\iis\cert8.db
and
<lbplugin-unzip-dir>\lib\webserver-plugin\windows\iis\key3.db
to <sun-passthrough-dir>\sec_db_files directory.
- Copy
file
<lbplugin-unzip-dir>\lib\install\templates\loadbalancer.xml.example
to <sun-passthrough-dir>\loadbalancer.xml directory.
- Copy files - <lbplugin-unzip-dir>\lib\dtds\sun-loadbalancer_1_1.dtd and <lbplugin-unzip-dir>\lib\dtds\sun-loadbalancer_1_2.dtd to <sun-passthrough-dir> directory.
Manual steps that are needed even when using installer are well documented and are available at http://docs.sun.com/app/docs/doc/819-4740/abdhq?a=view
Note: In step 6, use <lbplugin-unzip-dir>\lib instead of <application-server-install-dir\bin and <application-server-install-dir\lib as suggested in linked documentation.
User need to edit load-balancer xml(<sun-passthrough-dir>\loadbalancer.xml) to reflect their cluster configuration. User can export load-balancer xml in DAS and then copy it to above mentioned location using following instructions.
Tuesday Feb 10, 2009
Pankaj has written a whitepaper on Converged Load-Balancer(CLB). This whitepaper provides following details :
- Overview of CLB
- Deployment Topology
- Load-balancing algorithms
- Functional details of CLB
- Cluster health monitoring
Thursday Nov 20, 2008
Support for Apache 2.2 will be coming in GlassFish Server v2.1. Users can download this version of GlassFish server from GlassFish download page. The enterprise edition will even contain installer support for installing load-balancer plugin on Apache 2.2.
For the benefit of GlassFish user, steps to manually configure load-balancer plugin with Apache2.2 is provided in this blog.
Platform supported
- Solaris SPARC
- Solaris x86
- Linux
For exact version of the platform supported, please refer to release notes of GlassFish Server 2.1
NOTE : Apache 2.2 in not supported on windows right now. However Apache 2.0.x is supported on windows.
Download Location
The load-balancer plugin library can be downloaded from http://download.java.net/javaee5/external/<OS>/aslb/jars where OS can be SunOS, SunOS_X86 and Linux.
The latest version of load-balancer plugin available is aslb-9.1.1-b5.jar. User can download any other latest version compared to above version, if available.
Steps to configure load-balancer plugin on Apache2.2
-
Build Apache 2.2 and install it. If user wants to use auto-apply feature, then it should be build with openssl and server certificate must be installed. You can refer to Apache2.0 documentation for building Apache2.2 with ssl and installing certificate. Use --with-included-apr option when building Apache 2.2 to build bundled apr. Apache 2.2 install directory will be referred to as <apache2.2-install-dir>.
-
Download load-balancer plugin and unjar it. Then unzip SUNWaspx.zip and SUNWaslb.zip. This directory will be referred to as <lbplugin-unzip-dir>.
-
Create directory
- <apache2.2-install-dir>/modules/errorpages
- <apache2.2-install-dir>/modules/resource
- <apache2.2-install-dir>/sec_db_files
-
Copy file - <lbplugin-unzip-dir>/lib/webserver-plugin/<OS>/apache2.2/mod_loadbalancer.so to <apache2.2-install-dir>/modules. Also change permission of the file to executable.
-
Copy files - <lbplugin-unzip-dir>/lib/webserver-plugin/<OS>/apache2.2/errorpages/default-error.html and <lbplugin-unzip-dir>/lib/webserver-plugin/<OS>/apache2.2/errorpages/sun-http-lberror.html to <apache2.2-install-dir>/modules/errorpages directory.
-
Copy files - <lbplugin-unzip-dir>/lib/webserver-plugin/<OS>/apache2.2/LBPluginDefault_root.res and <lbplugin-unzip-dir>/lib/webserver-plugin/<OS>/apache2.2/LBPlugin_root.res to <apache2.2-install-dir>/modules/resource directory.
-
Copy files - <lbplugin-unzip-dir>/lib/webserver-plugin/<OS>/apache2.2/secmod.db, <lbplugin-unzip-dir>/lib/webserver-plugin/<OS>/apache2.2/cert8.db and <lbplugin-unzip-dir>/lib/webserver-plugin/<OS>/apache2.2/key3.db to <apache2.2-install-dir>/sec_db_files directory.
-
Copy file <lbplugin-unzip-dir>/lib/install/templates/loadbalancer.xml.example to <apache2.2-install-dir>/conf directory.
-
Copy files - <lbplugin-unzip-dir>/lib/dtds/sun-loadbalancer_1_1.dtd and <lbplugin-unzip-dir>/lib/dtds/sun-loadbalancer_1_2.dtd to <apache2.2-install-dir>/conf directory.
-
Changes in file <apache2.2-install-dir>/conf/httpd.conf
-
Change
FROM:
ServerName www.example.com:80
TO:
ServerName <host-name>:80 -
Change
FROM:
#Include conf/extra/httpd-mpm.conf
TO:
Include conf/extra/httpd-mpm.conf -
Change
FROM:
#Include conf/extra/httpd-vhosts.conf
TO:
Include conf/extra/httpd-vhosts.conf -
Change
FROM:
#Include conf/extra/httpd-ssl.conf
TO:
Include conf/extra/httpd-ssl.conf -
Append following entry
##BEGIN EE LB Plugin Parameters
LoadFile /usr/lib/libCstd.so.1 (THIS LINE IS ONLY NEEDED ON SOLARIS SPARC)
LoadModule apachelbplugin_module modules/mod_loadbalancer.so
#AddModule apachelbplugin_module
<IfModule apachelbplugin_module>
config-file <apache2.2-install-dir>/conf/loadbalancer.xml
locale en
</IfModule>
##END EE LB Plugin Parameters -
Changes in file <apache2.2-install-dir>/conf/extra/httpd-mpm.conf
-
Change prefork MPM settings
Set StartServers to 1
Set MaxClients to 1
-
-
Changes in file <apache2.2-install-dir>/conf/extra/httpd-vhosts.conf
-
Append
##BEGIN EE LB Plugin Parameters
<VirtualHost <machine-ip-address>>
ServerName <host-name>
DocumentRoot "<apache2.2-install-dir>/htdocs"
</VirtualHost>
##END EE LB Plugin Parameters -
User can remove other existing VirtualHost entries from this file
-
-
Changes in file <apache2.2-install-dir>/conf/extra/httpd-ssl.conf
-
Change
FROM:
<VirtualHost _default_:443>
TO:
<VirtualHost <machine-ip-address>:443>
b)Change
FROM:
ServerName www.example.com:443
TO:
ServerName <host-name>:443
-
-
If user want to use feature auto-apply feature
-
Export DAS certificate using command : certutil -L -d <application-server-DAS-dir>/config -n s1as -a -o sjsas.crt
-
Copy certificate file(sjsas.crt) to <apache2.2-install-dir>/conf/ssl.crt directory. If directory does not exist, create one.
-
Append in file <apache2.2-install-dir>/conf/extra/httpd-ssl.conf
##BEGIN EE LB Plugin Parameters
<Location /lbconfigupdate >
SSLVerifyClient require
SSLVerifyDepth 1
SSLRequireSSL
SSLCACertificateFile <apache2.2-install-dir>/conf/ssl.crt/sjsas.crt
SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)-/ \
and %{SSL_CLIENT_S_DN_O} eq "Sun Microsystems" \
and %{SSL_CLIENT_S_DN_OU} eq "Sun Java System Application Server" \
and %{SSL_CLIENT_M_SERIAL} eq "<Cert-Serial-Number>" )
</Location>
<Location /getmonitordata >
SSLVerifyClient require
SSLVerifyDepth 1
SSLRequireSSL
SSLCACertificateFile <apache2.2-install-dir>/conf/ssl.crt/sjsas.crt
SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)-/ \
and %{SSL_CLIENT_S_DN_O} eq "Sun Microsystems" \
and %{SSL_CLIENT_S_DN_OU} eq "Sun Java System Application Server" \
and %{SSL_CLIENT_M_SERIAL} eq "<Cert-Serial-Number>" )
</Location>
##END EE LB Plugin Parameters
NOTE:- Cert-Serial-Number need to be generated from provided DAS certificate file(sjsas.crt). Command for that is : keytool -printcert -file sjsas.crt. Note Serial number from output of above command. Take its value and change all lower case characters to upper case.
- Application Server name is assumed to be Sun Java System Application Server. If it is different, then it needs to be reflected here as well. Above command will print that as well.
-
-
Changes in file <apache2.2-install-dir>/bin/envvars
-
Suffix <lbplugin-unzip-dir>/lib and <apache2.2-install-dir>/modules directory to LD_LIBRARY_PATH on unix platform
-
-
For auto-apply feature to work, the run-as user for apache must have writable permission for <apache2.2-install-dir>/conf directory. If security is not an issue, user can even set <apache2.2-install-dir>/conf directory permission to 777.
Tuesday Apr 01, 2008
Are you looking for load-balancer to handle SIP requests
? If yes, you have come to right place
.
Brief history : Sun Communication Application Server, aka sailfin, is built over glassfish. Glassfish is Java EE 5 based application server. And sailfin provides SIP Servlet Container based on JSR 289 over and above what is offered by Glassfish.
Sailfin not only provide containers to deploy SIP and JAVA EE 5 based applications. It is complete package with high-availability features like load-balancing and session-replication required by enterprise systems.
To learn more about load-balancer available with sailfin, please refer to my blogs on Converged Load Balancer.
Tuesday Mar 25, 2008
Brief Overview of Converged Load-Balancer
Converged Load-Balancer, is designed to provide high-availability to applications deployed on Sun Communication Application Server, aka sailfin. It will distribute requests across the instances in cluster to increase throughput of the system. It will also fail-over request from unhealthy/inaccessible instances to healthy and available instances.Features of Converged Load-Balancer
- It can handle both SIP(S) and HTTP(S) requests.
- It can load-balance converged application (application having web and sip components) and pure web applications
- It will distribute the load across healthy and available instances in cluster, thus enabling a higher throughput from the system
- It maintains stickiness of requests in a session to single instance till serving instance is healthy, available and enabled
- It will fail-over request from unhealthy/unavailable/disabled instances to instances which are healthy, available and enabled
- It supports round-robin and consistent-hash algorithm for load-balancing
- It supports Data-Centric-Rule(DCR) to extract hash-key used in consistent-hash algorithm
Deployment Topology
Converged load-balancer currently supports only self load-balancing cluster. Below figure illustrates self load-balancing topology.
The above deployment contains:
- Hardware IP sprayer : This distributes request evenly across all instances in sailfin cluster.
- Sailfin Cluster : Sailfin cluster having converged load-balancer component.
Note : Sailfin does not support two-tier deployment as of now. However there is no such restriction put on admin commands. User can still create two tier deployment using admin commands. Two-tier deployment may not function correctly.
Functioning of Converged Load-Balancer
Below illustration depicts the functioning of converged load-balancer

- Step 1 : Client request comes to IP Sprayer
- Step 2 : IP sprayer selects any of the sailfin instances in the cluster and forwards request to that instance, which in above illustration is instance X.
- Step 3 : CLB on Instance X based on configured algorithm selects an instance to service the request. Then it forward the request to that instance, which in above illustration is instance Y. This can be same instance, i.e. instance X, as well. In such case Step 3 and 4 are bypassed.
- Step 4 : CLB on Instance Y receives the request. It finds out that request is already proxied from another instance. Without any further processing, it passes the request to the container so that it can be serviced. CLB then sends the response back to CLB on Instance X.
- Step 5 : CLB on Instance X in turn sends the response back to IP sprayer
- Step 6 : IP sprayer sends the response back to the client
Algorithms
Converged load-balancer currently supports two load-balancing algorithm- Round-robin : Instance to service new request are selected in a round robin fashion.
- Consistent-hash : Instance to service new request is selected based on hash-key extracted from request.
In
both cases, once a session is established, sticky information is set on
response. Subsequent requests will have that sticky information. Thus
subsequent requests part of same session will stick to same instance.
There are two possible configuration:
- Configuration 1: This should be used when only pure web applications are deployed. The user does not provide a dcr-file.
- Round-robin algorithm for all http requests
- Consistent-hash algorithm for all sip requests, in case converged/pure-sip applications are deployed. The hash-key used to select instance is extracted using from-tag,to-tag,call-id parameters of the request.
- Configuration 2: This should be used when converged/pure-sip applications are deployed on the application server. The user must provide a dcr-file in this case, to extract hash key from sip and http requests. If dcr-file is not provided, sip and http requests part of same session may be serviced by different instances.
- Round-robin algorithm for http requests belonging to pure web applications
- Consistent-hash algorithm for http requests belonging to converged applications
- If any dcr rule matches http request, hash-key is extracted using that rule
- If none of the rules matches http request, hash key is extracted using remote host and port of the http request
- Consistent-hash algorithm for sip request belonging to converged/pure-sip applications
- If any dcr rule matches sip request, hash-key is extracted using that rule
- If none of the rules matches sip request, hash key is extracted using from-tag,to-tag,call-id parameters of the sip request
Note : For complete details of converged load-balancer, please go through functional specifications of converged load-balancer.
How to configure converged load-balancer
Some common points to remember before a user start with configuration of converged load-balancer- The converged load-balancer uses xml file converged load-balancer xml to get cluster information. If this file is not present, CLB will not initialize and will return error. The request will not be serviced.
- The converged load-balancer xml is generated when auto-commit attribute of converged-load-balancer element under availability-service is set to true. Till it set to false, no xml file is generated.
- It is recommended that attribute auto-commit should be set to true, once user is done with complete configuration of cluster. This includes instances creation and application deployment. Otherwise it will result in unnecessary reconfiguration with any change to cluster.
- It is recommended to start cluster after auto-commit is set to true and all cluster configuration is done. Please refer to point 1 above to understand why this is recommended.
- Only instances with lb-enabled attribute set to true will participate in load-balancing. The disabled instances are not considered for load-balancing. The command to enable/disable instance is still not available. It will be provided shortly. Till then user can do it using set command. Any new instance created in cluster will have lb-enabled set to false. User has to set this attribute to true.
- The cluster heartbeat-enabled attribute must be set to true. This is set to true by default, when user creates a cluster.
Using default-cluster
A default-cluster already exists in the domain created using cluster profile. The default-cluster is pre-configured as self load-balancing cluster. User has to just create instances and deploy applications and a self load-balancing cluster is ready for use. Please follow steps below :- User must ensure that all instances are created in cluster and all applications are deployed to cluster. This is not a mandatory step. However this is a recommended step.
- Set lb-enabled attribute for all instances of default-cluster to true
- Command : asadmin> enable-converged-lb-server default-cluster
- Set auto-commit attribute to true
- Command : asadmin > set default-cluster.availability-service.converged-load-balancer.auto-commit=true
- Start default-cluster. If it was already running, it will now have working converged load-balancer. There is no need to restart the cluster
Creating converged-load-balancer on already existing cluster
The converged-load-balancer element does not exist under cluster config and user is starting afresh with converged load-balancer configuration. Please follow steps below :Option 1 : A single step process
- User must ensure that all instances are created in cluster and all applications are deployed to cluster. This is not a mandatory step. However this is a recommended step.
- Create converged load-balancer using a single command
- Command : asadmin > create-converged-lb --target <cluster-name> --autocommit=true --selfloadbalance=true --lbenableallinstances=true --configfile <converged-load-balancer-xml> <converged-load-balancer-name>
- Start the cluster. If cluster was already running, please restart the cluster.
- User must ensure that all instances are created in cluster and all applications are deployed to cluster. This is not a mandatory step. However this is a recommended step.
- Create a converged load-balancer config
- Command : asadmin> create-converged-lb-config <clb-config-name>
- For example : asadmin> create-converged-lb-config test-clb-config
- Create a converged load-balancer reference to the cluster
- Command : asadmin> create-converged-lb-ref --clbconfig <clb-config-name> --selfloadbalance=true --lbenableallinstances=true <cluster-name>
- For example : asadmin> create-converged-lb-ref --clbconfig test-clb-config --selfloadbalance=true --lbenableallinstances=true test-cluster
- Create converged load-balancer for the cluster
- Command : asadmin> create-converged-lb --clbconfig <clb-config-name> --configfile <converged-load-balancer-xml-for-cluster> --autocommit=true --target <cluster-name> <converged-load-balancer-name>
- For example : asadmin> create-converged-lb --clbconfig test-clb-config --configfile converged-load-balancer.xml --autocommit=true --target test-cluster test-cluster-clb
- Start the cluster. If cluster was already running, please restart the cluster.
- The above command does not show the default options to be provided with each command, for example user name, password file etc.
- Above mentioned way of configuration is just one way of configuring converged load-balancer. The used commands has many more options. Please look at man page of each command for all possible options.
Data Centric Rules(DCR)
Data centric rules are used extract the hash-key from the request. The extracted hash-key is used to select an instance to service the request under consistent-hash algorithm.Sample DCR file
Below is a sample DCR file :<user-centric-rules>
<sip-rules>
<if>
<session-case>
<equal>ORIGINATING</equal>
<if>
<header name="ConferenceName"
return="request.ConferenceName">
<exist/>
</header>
</if>
</session-case>
</if>
</sip-rules>
<http-rules>
<request-uri parameter="ConferenceName" return="parameter.ConferenceName">
<exist/>
</request-uri>
</http-rules>
</user-centric-rules>
Above sample DCR file define following rules :
- For SIP(S) request, for an originating request look for header named ConferenceName, and value of that header will be used as hash key.
- For HTTP(S) request, look for parameter named ConferenceName, and value of that parameter will be used as hash key.
Configuring DCR
A user can setup DCR in following manner :- At the time of converged load-balancer creation using a single command.
- Command : asadmin > create-converged-lb --target <cluster-name> --autocommit=true --selfloadbalance=true --lbenableallinstances=true --configfile <converged-load-balancer-xml> --dcrfile <dcr-file-name> <converged-load-balancer-name>
- At the time of converged load-balancer config creation
- Command : asadmin> create-converged-lb-config --dcrfile <dcr-file-name> <clb-config-name>
- After creation of converged load-balancer config
- Command : asadmin> set-dcr-file --dcrfile <dcr-file-name> <clb-config-name>
- The above command does not show the default options to be provided with each command, for example user name, password file etc.
Tuesday Apr 10, 2007
. Ever wondered what is eating up all the connections. Unable to figure out whether it is your application or someone-else's
. Now you have an option in glassfish v2 to trace out all such cases of connection leaks
. The new connection leak tracing feature not only provides information of connection leaks, it also allows a user to reclaim leaking connections to make it available for other applications. Now on a more technical front a brief description of the feature is provided, and how to configure, monitor and view the connection leaks.
Brief Description
An additional feature of connection reclaim is also provided with connection leak tracing. This can only be enabled when connection leak tracing is turned on. If enabled, the leaking connection with be reclaimed by application server and made available to other applications accessing the connection pool. This feature should be used responsibly. The feature should not be enabled if user's application caches connection. In such cases, enabling this feature will result in unexpected behavior.
For more detailed description, please refer to the one pager.
This feature is not enabled by default. The user need to configure his/her connection pools in order to enable connection leak tracing. The steps to achieve this is provided in the next section.
How to Configure
Using GUI
Using CLI
1.
Set a non-zero connection leak timeout
value for connection pool
|
2.
Enable connection leak reclaim if desired
|
Monitoring stats for connection leak tracing
- JDBC connection pool, set monitoring level for JDBC connection pool component to
HIGH.
- Connector connection pool, set monitoring level for JMS/Connector Service component to HIGH.
Using GUI
| 1.
Browse to Monitor tab. Now click on Resources tab. Select your connection pool from the drop down box. |
![]() |
| 2.
Scroll down the page and you will find connection leak stats |
![]() |
Using CLI
- For jdbc/connector connection pool
- asadmin> get -m server.resources.<pool-name>.numpotentialconnleak*
- The stats will look like
- server.resources.<pool-name>.numpotentialconnleak-count = 3
- server.resources.<pool-name>.numpotentialconnleak-description = Provides a count value reflecting the number of potential connection leaks
- server.resources.<pool-name>.numpotentialconnleak-lastsampletime = 1175495050536
- server.resources.<pool-name>.numpotentialconnleak-name = NumPotentialConnLeak
- server.resources.<pool-name>.numpotentialconnleak-starttime = 1175494865525
- server.resources.<pool-name>.numpotentialconnleak-unit = Count
Viewing potential connection leak traces
It is cumbersome to search through server logs manually. A utility is already provided in application server GUI to search through logs. The steps are provided below to get connection leak traces using this utility.
This blog copyright 2009 by kshitiz









