HTTP Connectors Load Balancing Guide
HTTP load balancing for JBoss Enterprise Application Platform and Red Hat JBoss Web Server
Edition 1.0.2
Abstract
Preface
1. File Name Conventions Copy linkLink copied to clipboard!
- JBOSS_EAP_DIST
- The installation root of the JBoss Enterprise Application Platform instance. This folder contains the main folders that comprise the server such as
/jboss-as,/seam, and/resteasy. - JBOSS_EwP_DIST
- The installation root of the JBoss Enterprise Web Platform instance. This folder contains the main folders that comprise the server such as
/jboss-as-web,/seam, and/resteasy. - JBOSS_EWS_DIST
- The installation root of the JBoss Enterprise Web Server instance. This folder contains the main folders that comprise the server such as
/extras,/httpd, and the/tomcat6folders. - NATIVE
- The installation root of the JBoss Native zip, extracted to the same directory level as JBOSS_EAP_DIST.
- SJWS
- The installation root of the Sun Java Web Server instance. The default file locations for this naming convention are:
- for Solaris 9 x86 or SPARC 64:
/opt/SUNWwbsrv61/ - for Solaris 10 x86 or SPARC 64:
/opt/SUNWwbsrv70/
- HTTPD_DIST
- The installation root of the Apache httpd Server. This folder contains the main folders that comprise the server such as
/conf,/webapps, and/bin. The JBoss Enterprise Web Server JBOSS_EWS_DIST directory contains the root installation of HTTPD_DIST. - PROFILE
- The name of the JBoss server profile you use as part of your testing or production configuration. The server profiles reside in
JBOSS_EAP_DIST/jboss-as/serverorJBOSS_EWS_DIST/jboss-as-web/server.
Part I. Apache Tomcat Connector Copy linkLink copied to clipboard!
Chapter 1. Overview Copy linkLink copied to clipboard!
- Session state replication
- Load-balancing HTTP Requests
Chapter 2. Download and Install Copy linkLink copied to clipboard!
Chapter 3. Configure load balancing using Apache and mod_jk Copy linkLink copied to clipboard!
Task: Configure Apache to Load mod_jk
Prerequisites
- Apache and mod_jk installed (Refer to Chapter 2, Download and Install).
- Open
HTTPD_DIST/conf/httpd.confand add a single line at the end of the file.Include mod_jk's specific configuration file
# Include mod_jk's specific configuration file Include conf/mod-jk.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new file named
HTTPD_DIST/conf/mod-jk.conf - Add the following configuration to the
mod-jk.conffile.Important
TheLoadModuledirective must reference the mod_jk library directory location applicable to the native binary you installed.Note
TheJkMountdirective specifies which URLs Apache should forward to the mod_jk module. Based on the directive's configuration, mod_jk forwards the received URL onto the correct Servlet containers.To enable Apache to serve static content (or PHP content) directly, and only use the load balancer for Java applications, the suggested configuration specifies all requests with URL path/application/*are sent to the mod_jk load-balancer.If you only use mod_jk as a load balancer, forward all URLs to mod_jk by specifying/*in the directive.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: JKMountFile Directive
In addition to theJkMountdirective, you can use theJkMountFiledirective to specify a mount points configuration file. The configuration file contains multiple Tomcat forwarding URL mappings.- Navigate to
HTTPD_DIST/conf. - Create a file named
uriworkermap.properties. - Specify the URL to forward and the worker name using the following syntax example as a guide.The example block will configure mod_jk to forward requests to
/jmx-consoleand/web-consoleto Apache.The syntax required takes the form/url=worker_name.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In
HTTPD_DIST/conf/mod-jk.conf, append the following directive.You can use external file for mount points. It will be checked for updates each 60 seconds. The format of the file is: /url=worker /examples/*=loadbalancer
# You can use external file for mount points. # It will be checked for updates each 60 seconds. # The format of the file is: /url=worker # /examples/*=loadbalancer JkMountFile conf/uriworkermap.propertiesCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1. Configure Worker Nodes in mod_jk Copy linkLink copied to clipboard!
Task: Configure mod_jk Worker Nodes
Prerequisites
- Understand the format of the
workers.propertiesdirectives, as specified in Appendix A, workers.properties Reference.
- Navigate to
HTTPD_DIST/conf/. - Create a file named
workers.properties. - Append the following information into the
workers.propertiesfile.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2. Configuring JBoss to work with mod_jk Copy linkLink copied to clipboard!
Task: Configure JBoss Enterprise Application Platform to Operate Using mod_jk
Prerequisites
- Complete Task: Configure mod_jk Worker Nodes.
- Navigate to the location of the clustered server instance.
- Open
JBOSS_EAP_DIST/jboss-as/server/PROFILE/deploy/jbossweb.sar/server.xml. - Specify the node name by appending the jvmRoute attribute to the <Engine> element in
server.xml. The jvmRoute attribute value is the node name defined inHTTPD_DIST/conf/workers.properties.<!--Preceeding syntax removed for readability --> <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1"> <!--Proceeding syntax removed for readability --> </Engine>
<!--Preceeding syntax removed for readability --> <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1"> <!--Proceeding syntax removed for readability --> </Engine>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Important
If you intend to configure more than one server node in a cluster, ensure you change the jvmRoute attribute value to a unique name each time you repeat this step. - In
server.xml, ensure the AJP protocol <connector> element is enabled (uncommented). The element is uncommented by default in new installations.<Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}" redirectPort="8443" /><Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}" redirectPort="8443" />Copy to Clipboard Copied! Toggle word wrap Toggle overflow - You now have a correctly configured Apache httpd Server with
mod_jkload balancer, which balances calls to the servlet containers in the cluster, and ensures clients will always use the same servlet container (sticky sessions).
Note
Part II. JBoss HTTP Connector Copy linkLink copied to clipboard!
Chapter 4. Overview Copy linkLink copied to clipboard!
4.1. Key Features Copy linkLink copied to clipboard!
- Apache HTTP Server-based
- The JBoss HTTP Connector mod-cluster uses Apache as the proxy server.
- Real-time load-balancing calculation
- The JBoss HTTP Connector mod_cluster creates a feedback network between the worker nodes and the proxy server. The mod_cluster service is deployed on each of the worker nodes. This service feeds real-time load information to the proxy server. The proxy server then makes intelligent decisions on where to allocate work, based on the current load on each worker node. This real-time adaptive load distribution results in increased optimization of resources.The information that is reported by the worker nodes and the load-balancing policy used by the proxy are both customizable.
- Routing based on real-time application life cycle
- The JBoss HTTP Connector mod_cluster service deployed on the worker nodes relays application lifecycle events to the proxy server. This allows the server to dynamically update its routing table. When an application is undeployed on a node, the proxy server no longer routes traffic for that application to that node.
- Automatic Proxy Discovery
- The proxy server can be configured to announce its presence via UDP multicast. New worker nodes discover the proxy server and add themselves to the load-balancing cluster automatically. This greatly reduces the configuration and maintenance needed. When UDP multicast is not available or is undesirable, worker nodes are configured with a static list of proxies.
- Multiple Protocol Support
- The JBoss HTTP Connector mod_cluster can use HTTP, HTTPS, or Apache JServ Protocol (AJP) for communication between the proxy and the worker nodes.
4.2. Components Copy linkLink copied to clipboard!
Proxy Server
- Shared Memory Manager:
mod_slotmem.so - The Shared Memory Manager module, mod_slotmem, makes the real-time worker node information available to multiple Apache server processes.
- Cluster Manager Module:
mod_manager.so - The Cluster Manager module, mod_manager, receives and acknowledges messages from nodes, including worker node registrations, worker node load data, and worker node application life cycle events.
- Proxy Balancer Module:
mod_proxy_cluster.so - The Proxy Balancer Module, mod_proxy_cluster, handles the routing of requests to cluster nodes. The Proxy Balancer selects the appropriate node to forward the request to, based on application location in the cluster, current state of each of the cluster nodes, and the Session ID (if a request is part of an established session).
- Proxy Advertisement Module:
mod_advertise.so - The Proxy Advertisement Module, mod_advertise.so, broadcasts the existence of the proxy server via UDP multicast messages. The server advertisement messages contain the IP address and port number where the proxy is listening for responses from nodes that wish to join the load-balancing cluster.
Note
Worker Node Components
- Worker node service:
mod-cluster.sar - The JBoss HTTP Connector client service
mod-cluster.saris deployed on each worker node. This service provides the proxy with real-time information on the worker node's state and sends notification of application life cycle events; as well as allowing the node to discover and register itself with any proxies running on the same network.
Chapter 5. Install Proxy Server Components Copy linkLink copied to clipboard!
5.1. Apache Modules Copy linkLink copied to clipboard!
5.1.1. mod_manager.so Copy linkLink copied to clipboard!
LoadModule manager_module modules/mod_manager.so
LoadModule manager_module modules/mod_manager.so
<VirtualHost> element:
- MemManagerFile
- Defines the location for the files in which mod_manager stores configuration details. mod_manager also uses this location for generated keys for shared memory and lock files. This must be an absolute path name. It is recommended that this path be on a local drive, and not a NFS share. The default value is
/logs/. - Maxcontext
- The maximum number of contexts JBoss mod_cluster will use. The default value is
100. - Maxnode
- The maximum number of worker nodes JBoss mod_cluster will use. The default value is
20. - Maxhost
- The maximum number of hosts (aliases) JBoss mod_cluster will use. This is also the maximum number of load balancers. The default value is
10. - Maxsessionid
- The maximum number of active session identifiers stored. A session is considered inactive when no information is received from that session within five minutes. The default value is
0, which disables this logic. - ManagerBalancerName
- The name of the load balancer to use when the worker node does not provide a load balancer name. The default value is
mycluster. - PersistSlots
- When set to
on, nodes, aliases and contexts are persisted in files. The default value isoff. - CheckNonce
- When set to
on, session identifiers are checked to ensure that they are unique, and have not occurred before. The default ison.Warning
Setting this directive tooffcan leave your server vulnerable to replay attacks. - SetHandler
- Defines a handler to display information about worker nodes in the cluster. This is defined in the
Locationelement:Copy to Clipboard Copied! Toggle word wrap Toggle overflow When accessing the $LOCATION defined in theLocationelement in your browser, you will see something like the following. (In this case, $LOCATION was also defined asmod_cluster-handler.)
Maxsessionid is 0.
5.1.2. mod_proxy_cluster.so Copy linkLink copied to clipboard!
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
<VirtualHost> element to change load balancing behavior.
mod_proxy_cluster directives
- CreateBalancers
- Defines how load balancers are created in the Apache HTTP Server virtual hosts. The following values are valid in
CreateBalancers:- 0
- Create load balancers in all virtual hosts defined in Apache HTTP Server. Remember to configure the load balancers in the
ProxyPassdirective. - 1
- Do not create balancers. When using this value, you must also define the load balancer name in the
ProxyPassorProxyPassMatch. - 2
- Create only the main server. This is the default value for
CreateBalancers.
- UseAlias
- Defines whether to check that the defined
Aliascorresponds to theServerName. The following values are valid forUseAlias:- 0
- Ignore Alias information from worker nodes. This is the default value for
UseAlias. - 1
- Verify that the defined alias corresponds to a worker node's server name.
- LBstatusRecalTime
- Defines the interval in seconds between the proxy calculating the status of a worker node. The default interval is 5 seconds.
- ProxyPassMatch; ProxyPass
ProxyPassmaps remote servers into the local server namespace. If the local server has an addresshttp://local.com/, then the followingProxyPassdirective would convert a local request forhttp://local.com/requested/file1into a proxy request forhttp://worker.local.com/file1.ProxyPass /requested/ http://worker.local.com/
ProxyPass /requested/ http://worker.local.com/Copy to Clipboard Copied! Toggle word wrap Toggle overflow ProxyPassMatchuses Regular Expressions to match local paths to which the proxied URL should apply.For either directive,!indicates that a specified path is local, and a request for that path should not be routed to a remote server. For example, the following directive specifies that.giffiles should be served locally.ProxyPassMatch ^(/.*\.gif)$ !
ProxyPassMatch ^(/.*\.gif)$ !Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.1.3. mod_advertise.so Copy linkLink copied to clipboard!
VirtualHost element. Its identifier in the following code snippet is advertise_module.
LoadModule advertise_module modules/mod_advertise.so
LoadModule advertise_module modules/mod_advertise.so
- ServerAdvertise
- Defines how the advertising mechanism is used.When set to
On, the advertising mechanism is used to tell worker nodes to send status information to this proxy. You can also specify a hostname and port with the following syntax:ServerAdvertise On http://hostname:port/. This is only required when using a name-based virtual host, or when a virtual host is not defined.The default value isOff. When set tooff, the proxy does not advertise its location. - AdvertiseGroup
- Defines the multicast address to advertise on. The syntax is
AdvertiseGroup address:port, where address should correspond toAdvertiseGroupAddress, and port should correspond toAdvertisePortin your worker nodes.If your worker node is JBoss Enterprise Application Platform-based, and the-uswitch is used at startup, the defaultAdvertiseGroupAddressis the value passed via the-uswitch.The default value is224.0.1.105:23364. If port is not specified, the default port specified is23364. - AdvertiseFrequency
- The interval (in seconds) between multicast messages advertising the IP address and port. The default value is
10. - AdvertiseSecurityKey
- Defines a string used to identify the JBoss HTTP Connector mod_cluster in JBoss Web. By default this directive is not set and no information is sent.
- AdvertiseManagerUrl
- Defines the URL that the worker node should use to send information to the proxy server. By default this directive is not set and no information is sent.
- AdvertiseBindAddress
- Defines the address and port over which to send multicast messages. The syntax is
AdvertiseBindAddress address:port. This allows an address to be specified on machines with multiple IP addresses. The default value is0.0.0.0:23364.
5.2. Install Proxy Server Components Copy linkLink copied to clipboard!
Task: Install Proxy Server Components
Prerequisites
- JBoss Enterprise Web Server v1.0.1 or later installed.
- JBoss Enterprise Application Platform 5 Native components downloaded.
Extract Apache modules from Native Components download
Extract the four modulesmod_advertise.so,mod_manager.so,mod_proxy_cluster.so,mod_slotmem.sofrom the appropriate Native Components package directory for your processor architecture: eithernative/lib/httpd/modulesornative/lib64/httpd/modules.Copy Apache modules to JBoss Enterprise Web Server
Copy the JBoss HTTP Connector modules to theJBOSS_EWS_DIST/httpd/modulesdirectory of the JBoss Enterprise Web Server.Disable the mod_proxy_balancer module
Edit the JBoss Enterprise Web Server Apache configuration fileJBOSS_EWS_DIST/httpd/conf/httpd.confand comment out the following line by adding an initial#:LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.soCopy to Clipboard Copied! Toggle word wrap Toggle overflow This module is incompatible with the JBoss HTTP Connector.Configure the server to load the JBoss HTTP Connector modules
- Create the file
JBOSS_EWS_DIST/httpd/conf.d/JBoss_HTTP.conf. - Add the following lines to the file
JBOSS_EWS_DIST/httpd/conf.d/JBoss_HTTP.conf:LoadModule slotmem_module JBOSS_EWS_DIST/modules/mod_slotmem.so LoadModule manager_module JBOSS_EWS_DIST/modules/mod_manager.so LoadModule proxy_cluster_module JBOSS_EWS_DIST/modules/mod_proxy_cluster.so LoadModule advertise_module JBOSS_EWS_DIST/modules/mod_advertise.so
LoadModule slotmem_module JBOSS_EWS_DIST/modules/mod_slotmem.so LoadModule manager_module JBOSS_EWS_DIST/modules/mod_manager.so LoadModule proxy_cluster_module JBOSS_EWS_DIST/modules/mod_proxy_cluster.so LoadModule advertise_module JBOSS_EWS_DIST/modules/mod_advertise.soCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Restart the JBoss Enterprise Web Server Apache service
Refer to the JBoss Enterprise Web Server documentation for detailed instructions.
Chapter 6. Configure Basic Proxy Server Copy linkLink copied to clipboard!
6.1. Basic Proxy Configuration Overview Copy linkLink copied to clipboard!
- Configure a Proxy Server listener to receive worker node connection requests and worker node feedback.
- Optional: Disable server advertisement.
The proxy server can advertise itself using UDP multicast. When UDP multicast is available on the network between the proxy server and the worker nodes Server Advertisement allows you to add worker nodes with no further configuration required on the proxy server, and minimal configuration on the worker nodes.
6.2. Configure a Load-balancing Proxy Using the HTTP Connector Copy linkLink copied to clipboard!
Task: Configure a Proxy Server Listener
Prerequisites
- Install JBoss Enterprise Web Server. Refer to JBoss Enterprise Web Server Installation Guide for details.
- Install JBoss HTTP Connector modules. Refer to Chapter 5, Install Proxy Server Components for details.
Create a listen directive for the proxy server
Edit the configuration fileJBOSS_EWS_DIST/httpd/conf.d/JBoss_HTTP.confand add the following:Listen IP_ADDRESS:PORT_NUMBER
Listen IP_ADDRESS:PORT_NUMBERCopy to Clipboard Copied! Toggle word wrap Toggle overflow Where IP_ADDRESS is the IP address of a server network interface to communicate with the worker nodes, and PORT_NUMBER is the port on that interface to listen on.Note
The port PORT_NUMBER must be open on the server firewall for incoming TCP connections.Example 6.1. Example Listen Directive
Listen 10.33.144.3:6666
Listen 10.33.144.3:6666Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create Virtual Host
Add the following to the fileJBOSS_EWS_DIST/httpd/conf.d/JBoss_HTTP.conf:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Where IP_ADDRESS and PORT_NUMBER are the values from the Listen directive.Optional: Disable Server Advertisement
The presence of theAdvertiseFrequencydirective, which is set to five seconds here, causes the server to periodically send server advertisement messages via UDP multicast.These server advertisement messages contain the IP_ADDRESS and PORT_NUMBER specified in the VirtualHost definition. Worker nodes that are configured to respond to server advertisements use this information to register themselves with the proxy server.To disable server advertisement, add the following directive to theVirtualHostdefinition:ServerAdvertise Off
ServerAdvertise OffCopy to Clipboard Copied! Toggle word wrap Toggle overflow If server advertisements are disabled, or UDP multicast is not available on the network between the proxy server and the worker nodes, you must configure worker nodes with a static list of proxy servers. Refer to Section 9.1, “Static Proxy Configuration” for directions.Restart the JBoss Enterprise Web Server Apache service
Refer to the JBoss Enterprise Web Server documentation for detailed directions.
Chapter 7. Install Node with Basic Configuration Copy linkLink copied to clipboard!
7.1. Worker Node Requirements Copy linkLink copied to clipboard!
Supported Worker Node types
- JBoss Enterprise Platform 5 JBoss Web component
- JBoss Enterprise Web Server Tomcat service
Note
JBoss HTTP Connector Enterprise Web Server Node Limitations
- Non-clustered mode only.
- Only one load metric can be used at a time when calculating the load balance factor.
7.2. Install and Configure a Worker Node Copy linkLink copied to clipboard!
Task: Install and Configure a JBoss Enterprise Application Platform Worker Node
Prerequisites
- Install a supported JBoss Enterprise Application Platform.
Deploy the worker node service
Copymod-cluster.sarfrom theJBOSS_EAP_DIST/mod_clusterdirectory tojboss-as/server/PROFILE/deploy.Add a Listener to JBoss Web
Add the followingListenerelement beneath the other Listeners inJBOSS_EAP_DIST/jboss-as/server/PROFILE/deploy/jbossweb.sar/server.xml:<Listener className="org.jboss.web.tomcat.service.deployers.MicrocontainerIntegrationLifecycleListener" delegateBeanName="ModClusterService"/>
<Listener className="org.jboss.web.tomcat.service.deployers.MicrocontainerIntegrationLifecycleListener" delegateBeanName="ModClusterService"/>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the service dependency
Add the followingdependselement beneath the other depends elements inJBOSS_EAP_DIST/jboss-as/server/PROFILE/deploy/jbossweb.sar/META-INF/jboss-beans.xml:<depends>ModClusterService</depends>
<depends>ModClusterService</depends>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Give the worker a unique identity
Edit the fileJBOSS_EAP_DIST/jboss-as/server/PROFILE/deploy/jbossweb.sar/server.xmland add ajvmRouteattribute and value to theEngineelement, as shown:<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker01">
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker01">Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use a unique jvmRoute value for each node.Optional: Configure firewall to receive multicast Proxy Server advertisements
A proxy server using the JBoss HTTP Connector can advertise itself via UDP multicast. To enable the worker node to dynamically discover proxy servers, open port 23364 for UDP connections on the worker node's firewall.For Linux users:/sbin/iptables -A INPUT -m state --state NEW -m udp -p udp --dport 23364 -j ACCEPT -m comment --comment "receive mod_cluster proxy server advertisements" /sbin/iptables save
/sbin/iptables -A INPUT -m state --state NEW -m udp -p udp --dport 23364 -j ACCEPT -m comment --comment "receive mod_cluster proxy server advertisements" /sbin/iptables saveCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you are not using Automatic Proxy Discovery (see Automatic Proxy Discovery), configure worker nodes with a static list of proxies. Refer to Section 9.1, “Static Proxy Configuration” for directions. In this case you can safely ignore the following warning message:[warning] mod_advertise: ServerAdvertise Address or Port not defined, Advertise disabled!!!
[warning] mod_advertise: ServerAdvertise Address or Port not defined, Advertise disabled!!!Copy to Clipboard Copied! Toggle word wrap Toggle overflow Important
If your nodes are on different machines that run Red Hat Enterpise Linux, they may not acknowledge each other automatically. JBoss Clustering relies on the UDP (User Datagram Protocol) multi-casting provided by jGroups.The SELinux configuration that ships with Red Hat Enterprise Linux blocks these packets by default. To allow the packets, modify the iptables rules (as root). The following commands apply to an IP address that matches 192.168.1.x:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Task: Install and Configure a JBoss Enterprise Web Server Worker Node
Prerequisites
- Install a supported JBoss Enterprise Web Server.
- Understand the Proxy Configuration parameters discussed in Appendix B, Java Properties Reference
Deploy worker node service
Copy all of the library files in theJBOSS_EAP_DIST/mod_cluster/JBossWeb-Tomcat/libdirectory. Move these files toJBOSS_EWS_DIST/tomcat6/lib/Add a Listener to Tomcat
Add the followingListenerelement beneath the other Listener elements inJBOSS_EWS_DIST/tomcat6/conf/server.xml.<Listener className="org.jboss.modcluster.ModClusterListener" advertise="true" stickySession="true" stickySessionForce="false" stickySessionRemove="true"/>
<Listener className="org.jboss.modcluster.ModClusterListener" advertise="true" stickySession="true" stickySessionForce="false" stickySessionRemove="true"/>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Give this worker a unique identity
EditJBOSS_EWS_DIST/tomcat6/conf/server.xmland add ajvmRouteattribute and value to theEngineelement, as shown:<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker01">
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker01">Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Configure firewall to receive Proxy Server advertisements
A proxy server using the JBoss HTTP Connector can advertise itself via UDP multicast. To receive these multicast messages, open port 23364 for UDP connections on the worker node's firewall.For Linux users:/sbin/iptables -A INPUT -m state --state NEW -m udp -p udp --dport 23364 -j ACCEPT -m comment -comment "receive mod_cluster proxy server advertisements"
/sbin/iptables -A INPUT -m state --state NEW -m udp -p udp --dport 23364 -j ACCEPT -m comment -comment "receive mod_cluster proxy server advertisements"Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you are not using Automatic Proxy Discovery (see Automatic Proxy Discovery), configure worker nodes with a static list of proxies. Refer to Section 9.1, “Static Proxy Configuration” for directions. In this case you can safely ignore the following warning message:[warning] mod_advertise: ServerAdvertise Address or Port not defined, Advertise disabled!!!
[warning] mod_advertise: ServerAdvertise Address or Port not defined, Advertise disabled!!!Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 8. Further Server Configuration Copy linkLink copied to clipboard!
8.1. Apache Server Directives Copy linkLink copied to clipboard!
8.1.1. CreateBalancers Copy linkLink copied to clipboard!
CreateBalancers values
- 0
- Create a balancer in all VirtualHosts.
- 1
- Do not create balancers.
- 2
- Create a balancer for the main server only.
Chapter 9. Advanced Configuration Copy linkLink copied to clipboard!
9.1. Static Proxy Configuration Copy linkLink copied to clipboard!
Task: Configure Application Platform Worker Node with Static Proxy List
Prerequisites
- JBoss Enterprise Application Platform worker node configured. Refer to Chapter 7, Install Node with Basic Configuration for directions.
Disable dynamic proxy discovery
Edit the fileJBOSS_EAP_DIST/jboss-as/server/PROFILE/mod-cluster.sar/META-INF/mod-cluster-jboss-beans.xmland set theadvertiseproperty to false:<property name="advertise">false</property>
<property name="advertise">false</property>Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Choose, and implement, one of the following static proxy options:
Option 1: Create a static proxy server list
Edit the fileJBOSS_EAP_DIST/jboss-as/server/PROFILE/mod-cluster.sar/META-INF/mod-cluster-jboss-beans.xmland add a comma separated list of proxies in the form of IP_ADDRESS:PORT in theproxyListproperty.Example 9.1. Example Static Proxy List
<property name="proxyList">10.33.144.3:6666,10.33.144.1:6666</property>
<property name="proxyList">10.33.144.3:6666,10.33.144.1:6666</property>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Option 2: Start the worker node with a static proxy list as a parameter
- Edit
JBOSS_EAP_DIST/server/PROFILE/mod-cluster.sar/META-INF/mod-cluster-jboss-beans.xml - Add the following line:
<property name="proxyList">${jboss.modcluster.proxyList:}</property><property name="proxyList">${jboss.modcluster.proxyList:}</property>Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add a comma separated list of proxies in the form of IP_ADDRESS:PORT as the
jboss.modcluster.proxyListparameter when starting the node.Example 9.2. Example Static Proxy List Parameter
-Djboss.modcluster.proxyList=10.33.144.3:6666,10.33.144.1:6666
-Djboss.modcluster.proxyList=10.33.144.3:6666,10.33.144.1:6666Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Task: Configure Web Server Worker Node with Static Proxy List
Prerequisites
- JBoss Enterprise Web Server worker node configured. Refer to Chapter 7, Install Node with Basic Configuration for directions.
- Understand the Proxy Configuration parameters discussed in Appendix B, Java Properties Reference
Disable dynamic proxy discovery
Edit the fileJBOSS_EWS_DIST/tomcat6/conf/server.xml. and set theadvertiseproperty of the ModClusterListener to false:Define a mod_cluster listener
Add a <Listener> element to theserver.xmlfile .<Listener className="org.jboss.modcluster.ModClusterListener" advertise="false" stickySession="true" stickySessionForce="false" stickySessionRemove="true"/>
<Listener className="org.jboss.modcluster.ModClusterListener" advertise="false" stickySession="true" stickySessionForce="false" stickySessionRemove="true"/>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a static proxy server list
Add a comma separated list of proxies in the form of IP_ADDRESS:PORT as theproxyListproperty of the ModClusterListener <Listener> element.Example 9.3. Example Static Proxy List
<Listener className="org.jboss.modcluster.ModClusterListener" advertise="false" stickySession="true" stickySessionForce="false" stickySessionRemove="true" proxyList="10.33.144.3:6666,10.33.144.1:6666"/>
<Listener className="org.jboss.modcluster.ModClusterListener" advertise="false" stickySession="true" stickySessionForce="false" stickySessionRemove="true" proxyList="10.33.144.3:6666,10.33.144.1:6666"/>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
9.2. Clustered Node Operation Copy linkLink copied to clipboard!
Note
- JBoss HTTP Connector non-clustered operation
- In non-clustered mode each worker node communicates directly with the proxy.
- JBoss HTTP Connector clustered operation
- In clustered mode multiple worker nodes form a JBoss HA (High Availability) cluster domain. A single worker node communicates with the proxy on behalf of the other nodes in the cluster domain.
Chapter 10. Load Balancing Demonstration Copy linkLink copied to clipboard!
jboss-eap-5.1/mod_cluster/demo directory.
-
/server/load-demo.war - A WAR file to be deployed in JBoss Enterprise Application Platform or JBoss Enterprise Web Server. This WAR includes a number of servlets.
-
/client/lib/mod-cluster-demo.jar - A web application that lets users launch a pool of threads, which send requests through the load balancer to
load-demo.war's primary servlet. The application displays information about which servers are handling the requests. It can also send separate requests toload-demo.war's load generation servlets, allowing the user to see how certain load conditions affect request load balancing.
Note
10.1. Set up the Demonstration Copy linkLink copied to clipboard!
Task: Start the Demo
Prerequisites
- Install and Configure the Worker Node. Refer to Section 7.2, “Install and Configure a Worker Node”
- Install and Configure the Proxy Server. Refer to Section 9.1, “Static Proxy Configuration”
Start the Proxy Server
Navigate toHTTPD_DIST/sbinand start the proxy server.apachectl start
[sbin]$ apachectl startCopy to Clipboard Copied! Toggle word wrap Toggle overflow Start the Worker Node
In a terminal, execute the following command:- For JBoss Enterprise Web Server:
./JBOSS_EWS_DIST/tomcat6/bin/startup.sh
[home]$ ./JBOSS_EWS_DIST/tomcat6/bin/startup.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow - For JBoss Enterprise Application Platform:
./JBOSS_EAP_DIST/bin/run.sh
[home]$ ./JBOSS_EAP_DIST/bin/run.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Specify the Catalina Service Name
AWAITING CONFIRMATON ON JBPAPP-6550Deploy Demo Web Archive to Worker Node
Copyload-demo.warfromJBOSS-EAP_DIST/mod_cluster/demo/serverinto one of the following directories:- For JBoss Enterprise Web Server:
JBOSS_EWS_DIST/tomcat6/webapps - For JBoss Enterprise Application Platform:
JBOSS_EAP_DIST/jboss-as/server/PROFILE/deploy
Start the Demonstration
Navigate toJBOSS_EAP_DIST/mod_cluster/demo/client/, and start the demonstration../run-demo.sh
[client]$ ./run-demo.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow ResultThe demonstration starts, and the Load Balancing Demonstration window opens. Proceed to Task: Configure Client Control Tab Fields
10.2. Configure the Demo Client Copy linkLink copied to clipboard!
Task: Configure Client Control Tab Fields
Prerequisites
- Click the Client Control tab.
- Based on the following field definitions, supply values for all fields on the Client Control tab.
- Proxy Hostname
- Hostname of the load-balancing proxy server, or the IP address on which the proxy server is listening for requests. The default value for this field is
localhost, or determined by themod_cluster.proxy.hostsystem property, if set.Edit the-Dmod_cluster.proxy.host=localhostvalue inrun-demo.shto avoid re-setting this value each time you use the demo. - Proxy Port
- Port on which the load-balancing proxy server listens for requests. The default value is
8000, or determined by themod_cluster.proxy.portproperty, if set.Edit the-Dmod_cluster.proxy.port=8000value inrun-demo.shto avoid re-setting this value each time you use the demo. - Context Path
- The part of the request URL that specifies the request is for
load-demo.war. - Session Life
- Number of seconds a client thread should use a session before invalidating or abandoning it. This should be a small value, or session stickiness can prevent changes in server load from affecting the proxy server's routing decisions. When sticky sessions are enabled (strongly recommended), the creation of new sessions allows the proxy to balance the workload.
- Invalidate
- When checked, specifies that a session is invalidated by the client thread when the thread stops using a session. When unchecked, the session is abandoned, and exists on the worker node until the session timeout expires.
- Session Timeout
- The number of seconds a session can remain unused before the worker node can expire and remove the session.Deselecting
Invalidateand setting a high value relative to session life causes a significant number of unused sessions to accumulate on the server. - Num Threads
- Number of client threads to launch. Each thread repeatedly makes requests until the button is pressed, or a request receives a response other than HTTP 200.
- Sleep Time
- Number of milliseconds that client threads should sleep between requests.
- Startup Time
- Number of seconds over which the application should stagger client thread start-up. Staggering the start time of sessions avoids the unrealistic situation where all sessions start and end almost simultaneously. Staggering the start time allows the proxy to continually see new sessions and decide how to route them.
- Once you have specified the values, proceed to Task: Interact with the Demonstration.
10.3. Interact with the Demonstration Copy linkLink copied to clipboard!
Terms
- Active Sessions
- A session is considered active if a client thread will ever send a request associated with the session. When client threads stop using a session, they can either send a request to invalidate it, or abandon it by no longer including its session cookie in requests.Once a session has been abandoned, it is no longer reflected in the Session Balancing chart, but will continue to exist on the worker node until it is removed based on session timeout values.
- Total Clients
- The number of client threads created since the last time the Start button was clicked.
- Live Clients
- The number of client threads currently running.
- Failed Clients
- The number of clients threads that terminated abnormally, for example, a request that resulted in something other than a HTTP 200 response.
Task: Interact with the Demonstration
Task Prerequesites
- Complete Task: Start the Demo.
- Click on the Request Balancing tab to see how many requests are going to each of your worker nodes.
- Click on the Session Balancing tab to see how many active sessions are being hosted by each of your worker nodes.
- Stop some of the worker nodes, or undeploy
load-demo.war, and observe the effect that this has on request and session balancing. - Restart some of your worker nodes, or re-deploy the
load-demo.warto some of your workers, and observe the effect that this has on request and session balancing. - Experiment with adding artificial load to one or more worker nodes and observe the effects on load and session balancing. (See Section 10.3.1, “Generating Artificial Load” for details.)
10.3.1. Generating Artificial Load Copy linkLink copied to clipboard!
- Target Hostname, Target Port
- The hostname and port number of the server on which to generate load. There are two strategies for setting these values:
- Use the hostname and port of the proxy server. The proxy will route the load to a worker node. However, the client does not maintain a session cookie for these requests, so subsequent generated load will not necessarily be routed to the same worker.
- If your worker nodes are running the HttpConnector and the AJP connector, you can specify the IP address and port on which a worker's HttpConnector is listening. (The default is
8080.)
- Load Creation Action
- Specifies the type of load the worker node should generate.
Available Actions
- Active Sessions
- Generates server load by causing session creation on the target server.
- Datasource Use
- Generates server load by taking connections from the
java:DefaultDSdatasource for a set time. - Connection Pool Use
- Generates server load by blocking threads in the webserver connections pool for a set time.
- Heap Memory Pool Use
- Generates server load by filling 50% of free heap memory for a set time.
- CPU Use
- Generates server CPU load by initiating a tight loop in a thread.
- Server Receive Traffic
- Generates server traffic receipt load by POSTing a large byte array to the server once per second for a set time.
- Server Send Traffic
- Generates server traffic send load by making a request once per second, to which the server responds with a large byte array.
- Request Count
- Generates server load by making numerous requests, increasing the request count on the target server.
- Params
- Zero or more parameters to pass to the specified load creation servlet, for example, Number of Connections and Duration, as seen in the screenshot. The parameters displayed, their name, and their meaning depend on the selected Load Creation Action. The label for each parameter includes a tooltip that explains its use.
Part III. Internet Server API Copy linkLink copied to clipboard!
Chapter 11. Overview Copy linkLink copied to clipboard!
11.1. What is Internet Server API Copy linkLink copied to clipboard!
- Extensions (full applications that run on IIS)
- Filters (applications that modify or enhance IIS functionality by constantly filtering for requests relevant to their functionality).
Chapter 12. Configuring the ISAPI connector on Windows Copy linkLink copied to clipboard!
12.1. Prerequisites and Configuration Assumptions Copy linkLink copied to clipboard!
Important
-b switch to bind your instance of JBoss Enterprise Platform to a public IP address. Ensure you edit the workers.properties file on the IIS machine to reflect the IP address changes.
- Configure the master node by installing any of the technology combinations, and the appropriate Native binary for its operating system and architecture.
- Windows Server 2003 (32-bit) with Microsoft IIS 6
- Windows Server 2003 (64-bit) with Microsoft IIS 6
- Windows Server 2008 (32-bit) with Microsoft IIS 7.0
- Windows Server 2008 (64-bit) with Microsoft IIS 7.0
- Configure worker nodes by installing JBoss Enterprise Application Platform 5.1.0 or later. The Native components are optional for worker nodes.
Note
12.2. Configure Server Instance as a Worker Node Copy linkLink copied to clipboard!
Task: Configure Server Instance as a Worker Node
Create a server profile for each worker node
Make a copy of thedefaultserver profile you want to configure as a worker node, and rename it todefault-01.Give each instance a unique name
Edit the following line in thedeploy\jbossweb.sar\server.xmlfile of each new worker instance:<Engine name="jboss.web" defaultHost="localhost">
<Engine name="jboss.web" defaultHost="localhost">Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add a uniquejvmRoutevalue, as shown. This value is the identifier for this node in the cluster.For thedefault-01server profile:<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker01">
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker01">Copy to Clipboard Copied! Toggle word wrap Toggle overflow For thedefault-02server profile:<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker02">
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker02">Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable session handling
Uncomment the following line in thedeployers\jbossweb.deployer\META-INF\war-deployers-jboss-beans.xmlfile of each worker node:<property name="useJK">false</property>
<property name="useJK">false</property>Copy to Clipboard Copied! Toggle word wrap Toggle overflow This property controls whether special session handling is used to coordinate with mod_jk and other connector variants. Set this property totruein both worker nodes:<property name="useJK">true</property>
<property name="useJK">true</property>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start worker nodes
Start each worker node in a separate command line interface. Ensure that each node is bound to a different IP address with the--hostswitch.JBOSS_EAP_DIST\bin\run.bat --host=127.0.0.1 -c default-01
JBOSS_EAP_DIST\bin\run.bat --host=127.0.0.1 -c default-01Copy to Clipboard Copied! Toggle word wrap Toggle overflow JBOSS_EAP_DIST\bin\run.bat --host=127.0.0.100 -c default
JBOSS_EAP_DIST\bin\run.bat --host=127.0.0.100 -c defaultCopy to Clipboard Copied! Toggle word wrap Toggle overflow
12.3. Microsoft IIS 6 Initial Clustering Configuration Copy linkLink copied to clipboard!
Task: Define ISAPI Filter
- On the Master server, open IIS Manager:
- → , then type
inetmgr. - → → →
The IIS 6 Manager window opens. - In the tree view pane, expand .
- Right click on Default Web Site, and then click .The Properties window opens.
- Click the ISAPI Filters tab.
- Click the button, and specify the following values in the Add/Edit Filter Properties window:
- Filter name:
- Specify
jboss(exactly as written) - Executable:
- Specify
C:\connectors\jboss-ep-5.1\native\sbin\isapi_redirect.dll
- Click to save the values, and close the Add/Edit Filter Properties dialog.
Note
The ISAPI Filters tab now displays thejbossfilter status and priority as Unknown because IIS has not yet received requests for the resource. The status and priority will change to Loaded and High respectively once a request is executed.
Task: Define ISAPI Virtual Directory
- Right click on Default Web Site, and then click → .The Add Virtual Directory window opens
- Specify the following values in the Add Virtual Directory window:
- Alias:
- Specify
jboss(exactly as written) - Physical path:
- Specify
C:\connectors\jboss-ep-5.1\native\sbin\
- Click to save the values and close the Add Virtual Directory window.
- In the tree view pane, expand →
- Right click on the
jbossvirtual directory, and then click . - Click the Virtual Directory tab, and make the following changes:
- Execute Permissions:
- Select
Scrips and Executables - Read check box:
- Select to activate Read access
- Click OK to save the values and close the jboss Properties window.
Task: Define ISAPI Web Service Extension
- Click Web Service Extensions, and in the Tasks group select .The New Web Service Extension window opens.
- Add the following values to the New Web Service Extension window:
- Extension name:
- Specify
jboss - Required files:
- Specify the path
C:\connectors\jboss-ep-5.1\native\sbin\isapi_redirect.dll - Set extension status to Allowed:
- Select the check box.
- Click OK to save the values and close the New Web Service Extension window.
- Confirm the
jbossWeb Service Extension displays in the list.
12.4. Microsoft IIS 7 Initial Clustering Configuration Copy linkLink copied to clipboard!
APPCMD.EXE command tool.
Terms
- ISAPI and CGI Restrictions
- ISAPI and CGI restrictions are request handlers that allow dynamic content to execute on a server. These restrictions are either CGI files (
.exe) or ISAPI extensions (.dll). You can add custom ISAPI or CGI restrictions if the IIS configuration system allows this. [http://technet.microsoft.com/en-us/library/cc730912(WS.10).aspx].
Task: Define a JBoss Native ISAPI Restriction
- On the Master server, open IIS Manager:
- → , then type
inetmgr. - → → →
The IIS 7 Manager window opens. - In the tree view pane, select (referred to as Server Home).The IIS 7 Home Features View opens in the
- Double-click ISAPI and CGI Restrictions.The ISAPI and CGI Restrictions Features View opens.
- In the Actions pane, click .The Add ISAPI or CGI Restriction window opens.
- Specify the following values in the Add ISAPI or CGI Restriction window:
- ISAPI or CGI Path:
- Specify
c:\connectors\jboss-ep-5.1\native\sbin\isapi_redirect.dll - Description:
- Specify
(exactly as written).jboss - Allow extension path to execute
- Select the check box.
- Click to save the values, and close the Add ISAPI or CGI Restriction window.
Note
The ISAPI and CGI Restrictions Features View now displays thejbossrestriction and path.
Task: Define an JBoss Native Virtual Directory
- Right click on Default Web Site, and then click .The Add Virtual Directory window opens
- Specify the following values in the Add Virtual Directory window:
- Alias:
- Specify
jboss(exactly as written) - Physical path:
- Specify
C:\connectors\jboss-ep-5.1\native\sbin\
- Click to save the values and close the Add Virtual Directory window.
Task: Define a JBoss Native ISAPI Redirect Filter
- In the tree view pane, expand → .
- Double-click ISAPI Filters.The ISAPI Filters Features View opens.
- In the Actions pane, click .The Add ISAPI Filter window opens.
- Specify the following values in the Add ISAPI Filter window:
- Filter name:
- Specify
jboss(exactly as written) - Executable:
- Specify
C:\connectors\jboss-ep-5.1\native\sbin\isapi_redirect.dll
- Click to save the values and close the Add ISAPI Filters window.
Task: Enable the ISAPI-dll Handler
- In the tree view pane, select (referred to as Server Home).The IIS 7 Home Features View opens in the
- Double-click Handler Mappings.The Handler Mappings Features View opens.
- In the Group by drop down box, select .The Handler Mappings are displayed in Enabled and Disabled groups.
- If
ISAPI-dllis in the Disabled group, right mouse click and select - Ensure the , , and check boxes are selected.
- Click to save the values and close the Edit Feature Permissions window.
12.5. Configure a Basic Cluster with ISAPI Copy linkLink copied to clipboard!
Task: Configure ISAPI to serve a Basic Cluster
Note
Prerequisites
- Complete the relevant Microsoft IIS clustering setup procedure. Refer to Section 12.3, “Microsoft IIS 6 Initial Clustering Configuration” or Section 12.4, “Microsoft IIS 7 Initial Clustering Configuration” for more information.
- The following steps assume that the
C:\connectorsdirectory is used to store logs, properties files, and NSAPI locks.
Create isapi_redirect.properties file
Create a new file namedisapi_redirect.propertiesin thedirectory.C:\connectors\jboss-ep-5.1\native\sbin\Important
Theisapi_redirect.propertiesfile must be in the same directory as theisapi_redirect.dllfile.Append the following configuration lines into the file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Create rewrite.properties file
Therewrite.propertiesfile allows you to specify simple URL rewrites specific to an application. This configuration file is optional, and can be excluded from theisapi_redirect.propertiesfile if URL rewrites are not required.The functionality offered is similar to Apache mod_rewrite, but is less powerful. You specify the rewrite path using name-value pairs. A simple example is where the app_01 application has an abstract directory name containing images, and you want to remap that directory to something more intuitive.#Simple example, images are accessible under abc path /app-01/abc/=/app-01/images/
#Simple example, images are accessible under abc path /app-01/abc/=/app-01/images/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create uriworkermap.properties file
Theuriworkermap.propertiesfile contains deployed application mapping configuration information. Append the following lines into the file.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create workers.properties file
Theworker.propertiesfile contains mapping definitions between worker labels and server instances. Append the following lines into the file.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart IIS
Restart your IIS server to implement the changes. Execute the following commands for the IIS version you are running:- IIS 6
net stop iisadmin /Y net start w3svc
C:\> net stop iisadmin /Y C:\> net start w3svcCopy to Clipboard Copied! Toggle word wrap Toggle overflow - IIS 7
net stop was /Y net start w3svc
C:\> net stop was /Y C:\> net start w3svcCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verify the Logs
Ensure you check the ISAPI logs once IIS has restarted. The logs are saved to the file location specified in the log_file property inisapi_redirect.properties. You should also check IIS logs and the Event Viewer for other events.
12.6. Configure a Load-balancing Cluster with ISAPI Copy linkLink copied to clipboard!
Task: Configure ISAPI to serve a Load Balancing Cluster
Prerequisites
- Complete the relevant Microsoft IIS clustering setup procedure. Refer to Section 12.3, “Microsoft IIS 6 Initial Clustering Configuration” or Section 12.4, “Microsoft IIS 7 Initial Clustering Configuration” for more information.
- The following steps assume that the
C:\connectorsdirectory is used to store logs, properties files, and NSAPI locks.
Create isapi_redirect.properties file
Create a new file namedisapi_redirect.propertiesin thedirectory.C:\connectors\jboss-ep-5.1\native\sbin\Important
Theisapi_redirect.propertiesfile must be in the same directory as theisapi_redirect.dllfile.Append the following configuration lines into the file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Create rewrite.properties file
Therewrite.propertiesfile allows you to specify simple URL rewrites specific to an application. This configuration file is optional, and can be excluded from theisapi_redirect.propertiesfile if URL rewrites are not required.The functionality offered is similar to Apache mod_rewrite, but is less powerful. You specify the rewrite path using name-value pairs. A simple example is where the app_01 application has an abstract directory name containing images, and you want to remap that directory to something more intuitive.#Simple example, images are accessible under abc path /app-01/abc/=/app-01/images/
#Simple example, images are accessible under abc path /app-01/abc/=/app-01/images/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create uriworkermap.properties file
Theuriworkermap.propertiesfile contains deployed application mapping configuration information. Append the following lines into the file.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create workers.properties file
Theworker.propertiesfile contains mapping definitions between worker labels and server instances. Append the following lines into the file.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
For an explanation ofworkers.propertiesdirectives, refer to Appendix A, workers.properties Reference.Restart IIS
Restart your IIS server to implement the changes. Execute the following commands for the IIS version you are running:- IIS 6
net stop iisadmin /Y net start w3svc
C:\> net stop iisadmin /Y C:\> net start w3svcCopy to Clipboard Copied! Toggle word wrap Toggle overflow - IIS 7
net stop was /Y net start w3svc
C:\> net stop was /Y C:\> net start w3svcCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verify the Logs
Ensure you check the ISAPI logs once IIS has restarted. The logs are saved to the file location specified in the log_file property inisapi_redirect.properties. You should also check IIS logs and the Event Viewer for other events.
Part IV. Netscape Server API Copy linkLink copied to clipboard!
Chapter 13. What Is Netscape Server API Copy linkLink copied to clipboard!
- Authorization translation
- Name translation
- Path checks
- Object type
- Request response
- Log transaction.
Chapter 14. Configuring the NSAPI Connector on Solaris Copy linkLink copied to clipboard!
Note
-b switch to bind your instance of JBoss Enterprise Platform to a public IP address. Remember to edit the workers.properties file on the SJWS machine to reflect these changes in IP address.
14.1. Prerequisites and Configuration Assumptions Copy linkLink copied to clipboard!
- Worker nodes are already installed with a JBoss Enterprise Platform 5.1 or later. The Native components are not a requirement of the NSAPI connector. Refer to the Installation Guide for assistance with this prerequisite.
- The master node is already installed with one of the following technology combinations, and the appropriate Native binary for its operating system and architecture. Refer to the Installation Guide for assistance with this installation prerequisite.
- Solaris 9 x86 with Sun Java System Web Server 6.1 SP12
- Solaris 9 SPARC 64 with Sun Java System Web Server 6.1 SP12
- Solaris 10 x86 with Sun Java System Web Server 7.0 U8
- Solaris 10 SPARC 64 with Sun Java System Web Server 7.0 U8
14.2. Configure Server Instance as a Worker Node Copy linkLink copied to clipboard!
Task: Configure a JBoss Enterprise Application Platform Worker Node
Create a server profile for each worker node
Make a copy of the server profile that you wish to configure as a worker node. (This procedure uses thedefaultserver profile.)cp -r default/ default-01 cp -r default/ default-02
[user@workstation jboss-ep-5.1]$ cd jboss-as/server [user@workstation server]$ cp -r default/ default-01 [user@workstation server]$ cp -r default/ default-02Copy to Clipboard Copied! Toggle word wrap Toggle overflow Give each instance a unique name
Edit the following line in thedeploy/jbossweb.sar/server.xmlfile of each new worker instance:<Engine name="jboss.web" defaultHost="localhost">
<Engine name="jboss.web" defaultHost="localhost">Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add a uniquejvmRoutevalue, as shown. This value is the identifier for this node in the cluster.For thedefault-01server profile:<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker01">
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker01">Copy to Clipboard Copied! Toggle word wrap Toggle overflow For thedefault-02server profile:<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker02">
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker02">Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable session handling
Uncomment the following line in thedeployers/jbossweb.deployer/META-INF/war-deployers-jboss-beans.xmlfile of each worker node:<property name="useJK">false</property>
<property name="useJK">false</property>Copy to Clipboard Copied! Toggle word wrap Toggle overflow This property controls whether special session handling is used to coordinate with mod_jk and other connector variants. Set this property totruein both worker nodes:<property name="useJK">true</property>
<property name="useJK">true</property>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start your worker nodes
Start each worker node in a separate command line interface. Ensure that each node is bound to a different IP address with the-bswitch.[user@workstation jboss-eap-5.1]$ ./jboss-as/bin/run.sh -b 127.0.0.1 -c default-01
[user@workstation jboss-eap-5.1]$ ./jboss-as/bin/run.sh -b 127.0.0.1 -c default-01Copy to Clipboard Copied! Toggle word wrap Toggle overflow [user@workstation jboss-eap-5.1]$ ./jboss-as/bin/run.sh -b 127.0.0.100 -c default-02
[user@workstation jboss-eap-5.1]$ ./jboss-as/bin/run.sh -b 127.0.0.100 -c default-02Copy to Clipboard Copied! Toggle word wrap Toggle overflow
14.3. Initial Clustering Configuration Copy linkLink copied to clipboard!
Task: Configure Initial Clustering Behavior
Prerequisites
- Native Zip extracted to
/tmp/connectors/jboss-ep-native-5.1/. This path is referred to as NATIVE in this procedure. - The directory
/tmp/connectorsis used as the storage location for logs, properties files, and NSAPI locks. - SJWS is installed in one of the locations specified in the SJWS file path abbreviation in Section 1, “File Name Conventions”.
Disable servlet mappings
Under Built In Servlet Mappings in theSJWS/PROFILE/config/default-web.xmlfile, disable the mappings for the following servlets, as shown in the code sample:- default
- invoker
- jsp
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Load the required modules and properties
Append the following lines to theSJWS/PROFILE/config/magnus.conffile:Init fn="load-modules" funcs="jk_init,jk_service" shlib="NATIVE/lib/nsapi_redirector.so" shlib_flags="(global|now)" Init fn="jk_init" worker_file="/tmp/connectors/workers.properties" log_level="debug" log_file="/tmp/connectors/nsapi.log" shm_file="/tmp/connectors/jk_shm"
Init fn="load-modules" funcs="jk_init,jk_service" shlib="NATIVE/lib/nsapi_redirector.so" shlib_flags="(global|now)" Init fn="jk_init" worker_file="/tmp/connectors/workers.properties" log_level="debug" log_file="/tmp/connectors/nsapi.log" shm_file="/tmp/connectors/jk_shm"Copy to Clipboard Copied! Toggle word wrap Toggle overflow These lines define the location of thensapi_redirector.somodule used by thejk_initandjk_servicefunctions, and the location of theworkers.propertiesfile, which defines the worker nodes and their attributes.Note
Thelibdirectory in theNATIVE/lib/nsapi_redirector.sopath applies only to 32-bit machines. On 64-bit machines, this directory is calledlib64.
14.4. Configure a Basic Cluster with NSAPI Copy linkLink copied to clipboard!
Task: Configure a Basic Cluster with NSAPI
/nc path, while worker01 serves /status and all other paths defined in the first part of the obj.conf file.
Prerequisites
- SJWS is installed in one of the locations specified in the SJWS file path abbreviation in Section 1, “File Name Conventions”.
Define the paths to serve via NSAPI
Edit theSJWS/PROFILE/config/obj.conffile. Define paths that should be served via NSAPI at the end of thedefaultObject definition, as shown:Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can map the path of any application deployed on your JBoss Enterprise Platform instance in thisobj.conffile. In the example code, the/ncpath is mapped to an application deployed under the namenc.Define the worker that serves each path
Edit theSJWS/PROFILE/config/obj.conffile and add the followingjknsapiObject definition after thedefaultObject definition.Copy to Clipboard Copied! Toggle word wrap Toggle overflow ThisjknsapiObject defines the worker nodes used to serve each path that was assigned toname="jknsapi"in thedefaultObject.In the example code, the third Service definition does not specify apathvalue, so the worker node defined (worker01) serves all of the paths assigned tojknsapiby default. In this case, the first Service definition in the example code, which assigns the/statuspath toworker01, is superfluous.Define the workers and their attributes
Create aworkers.propertiesfile in the location you defined in Step 2.Define the list of worker nodes and each worker node's properties in this file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the server
Once your Sun Java System Web Server instance is configured, restart it so that your changes take effect.For Sun Java System Web Server 6.1:SJWS/PROFILE/stop SJWS/PROFILE/start
SJWS/PROFILE/stop SJWS/PROFILE/startCopy to Clipboard Copied! Toggle word wrap Toggle overflow For Sun Java System Web Server 7.0:SJWS/PROFILE/bin/stopserv SJWS/PROFILE/bin/startserv
SJWS/PROFILE/bin/stopserv SJWS/PROFILE/bin/startservCopy to Clipboard Copied! Toggle word wrap Toggle overflow
14.5. Configure a Load-balanced Cluster with NSAPI Copy linkLink copied to clipboard!
Task: Configure a Load-balanced Cluster with NSAPI
Prerequisites
- SJWS is installed in one of the locations specified in the SJWS file path abbreviation in Section 1, “File Name Conventions”.
Define the paths to serve via NSAPI
OpenSJWS/PROFILE/config/obj.confand define paths that should be served through NSAPI at the end of thedefaultObject definition, as shown:Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can map the path of any application deployed on your JBoss Enterprise Platform instance in thisobj.conffile. In the example code, the/ncpath is mapped to an application deployed under the namenc.Define the worker that serves each path
OpenSJWS/PROFILE/config/obj.confand add the followingjknsapiObject definition after thedefaultObject definition.<Object name="jknsapi"> ObjectType fn=force-type type=text/plain Service fn="jk_service" worker="status" path="/jkmanager(/*)" Service fn="jk_service" worker="router" </Object>
<Object name="jknsapi"> ObjectType fn=force-type type=text/plain Service fn="jk_service" worker="status" path="/jkmanager(/*)" Service fn="jk_service" worker="router" </Object>Copy to Clipboard Copied! Toggle word wrap Toggle overflow ThisjknsapiObject defines the worker nodes used to serve each path that was assigned toname="jknsapi"in thedefaultObject.Define the workers and their attributes
CreateSJWS/PROFILE/config/workers.properties.Define the list of worker nodes and each worker node's properties in this file:Note
For an explanation ofworkers.propertiesdirectives, refer to Appendix A, workers.properties ReferenceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the server
Once your Sun Java System Web Server instance is configured, restart it so that your changes take effect.For Sun Java System Web Server 6.1:SJWS/PROFILE/stop SJWS/PROFILE/start
SJWS/PROFILE/stop SJWS/PROFILE/startCopy to Clipboard Copied! Toggle word wrap Toggle overflow For Sun Java System Web Server 7.0:SJWS/PROFILE/bin/stopserv SJWS/PROFILE/bin/startserv
SJWS/PROFILE/bin/stopserv SJWS/PROFILE/bin/startservCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Part V. Common Load Balancing Tasks Copy linkLink copied to clipboard!
Chapter 15. HTTP Session State Replication Copy linkLink copied to clipboard!
A dedicated software-based service designed to distribute HTTP client session requests across multiple computer servers (cluster). The primary directive of a software load balancer is to maximize resource utilization, reduce request response times, and prevent server overload. The load balancer forwards client session requests to a server cluster, based on server load and availability.
A semi-permanent connection between the client (an application) and the server. The load balancer determines whether the client session is created with persistence, or whether a client session is redistributed based on server load and availability.
A client session that is exclusively allocated to a single server instance. The load balancer routes all HTTP requests associated with the client session to the allocated server instance only. Session persistence is commonly referred to as a sticky session.
See Session Persistence.
15.1. Enabling session replication in your application Copy linkLink copied to clipboard!
web.xml descriptor. Here's an example:
replication-config element in the jboss-web.xml file. However, the replication-config element only needs to be set if one or more of the default values described below is unacceptable. Here is an example:
setAttribute call the container has no clear way to know if the object (and hence the session state) has been modified and needs to be replicated. This element has 3 valid values:
- SET_AND_GET is conservative but not optimal (performance-wise): it will always replicate session data even if its content has not been modified but simply accessed. This setting made (a little) sense in JBoss Enterprise Application Platform 4 since using it was a way to ensure that every request triggered replication of the session's timestamp. Since setting
max_unreplicated_intervalto 0 accomplishes the same thing at much lower cost, usingSET_AND_GETmakes no sense with Enterprise Application Platform 5. - SET_AND_NON_PRIMITIVE_GET is conservative but will only replicate if an object of a non-primitive type has been accessed (i.e. the object is not of a well-known immutable JDK type such as
Integer,Long,String, etc.) This is the default value. - SET assumes that the developer will explicitly call
setAttributeon the session if the data needs to be replicated. This setting prevents unnecessary replication and can have a major beneficial impact on performance, but requires very good coding practices to ensuresetAttributeis always called whenever a mutable object stored in the session is modified.
setAttribute marks the session as needing replication.
- SESSION
- Specifies the entire session attribute map should be replicated when any attribute is considered modified. Replication occurs at request end. This option replicates the most data and thus incurs the highest replication cost, but since all attributes values are always replicated together it ensures that any references between attribute values will not be broken when the session is deserialized. For this reason it is the default setting.
- ATTRIBUTE
- Specifies only attributes that the session considers to be potentially modified are replicated. Replication occurs at request end. For sessions carrying large amounts of data, parts of which are infrequently updated, this option can significantly increase replication performance. However, it is not suitable for applications that store objects in different attributes that share references with each other (e.g. a
Personobject in the "husband" attribute sharing with anotherPersonin the "wife" attribute a reference to anAddressobject). This is because if the attributes are separately replicated, when the session is deserialized on remote nodes the shared references will be broken.
replication-config element are much less frequently used.
- <cacheName>
- Specifies the name of the JBoss Cache configuration that should be used for storing distributable sessions and replicating them around the cluster. This element lets web applications that require different caching characteristics specify the use of separate, differently configured, JBoss Cache instances. In JBoss Enterprise Application Platform 4 the cache to use was a server-wide configuration that could not be changed per web application. The default value is
standard-session-cacheSee Section 15.3, “Configuring the JBoss Cache instance used for session state replication” for more details on JBoss Cache configuration for web tier clustering. - <replication-field-batch-mode>
- Specifies whether all replication messages associated with a request will be batched into one message. This is applicable only if
replication-granularityisFIELD. Ifreplication-field-batch-modeis set totrue, fine-grained changes made to objects stored in the session attribute map will replicate only when the HTTP request is finished; otherwise they replicate as they occur. Setting this tofalseis not advised. Default istrue. - <useJK>
- Specifies whether the container should assume that a JK-based software load balancer (e.g. mod_jk, mod_proxy, mod_cluster) is being used for load balancing for this web application. If set to
true, the container will examine the session ID associated with every request and replace thejvmRouteportion of the session ID if it detects a failover.You need only set this tofalsefor web applications whose URL cannot be handled by the JK load balancer. - <max-unreplicated-interval>
- Specifies the maximum interval between requests, in seconds, after which a request will trigger replication of the session's timestamp regardless of whether the request has otherwise made the session dirty. Such replication ensures that other nodes in the cluster are aware of the most recent value for the session's timestamp and won't incorrectly expire an unreplicated session upon failover. It also results in correct values for
HttpSession.getLastAccessedTime()calls following failover.The default value isnull(i.e. unspecified). In this case the session manager will use the presence or absence of ajvmRouteconfiguration on its enclosing JBoss WebEngine(see Section 3.2, “Configuring JBoss to work with mod_jk”) to determine whether JK is used.A value of0means the timestamp will be replicated whenever the session is accessed. A value of-1means the timestamp will be replicated only if some other activity during the request (e.g. modifying an attribute) has resulted in other replication work involving the session. A positive value greater than theHttpSession.getMaxInactiveInterval()value will be treated as probable misconfiguration and converted to0; i.e. replicate the metadata on every request. Default value is60. - <snapshot-mode>
- Specifies when sessions are replicated to the other nodes. Possible values are
INSTANT(the default) andINTERVAL.The typical value,INSTANT, replicates changes to the other nodes at the end of requests, using the request processing thread to perform the replication. In this case, thesnapshot-intervalproperty is ignored.WithINTERVALmode, a background task is created that runs everysnapshot-intervalmilliseconds, checking for modified sessions and replicating them.Note that this property has no effect ifreplication-granularityis set toFIELD. If it isFIELD,instantmode will be used. - <snapshot-interval>
- Specifies how often (in milliseconds) the background task that replicates modified sessions should be started for this web application. Only meaningful if
snapshot-modeis set tointerval. - <session-notification-policy>
- Specifies the fully qualified class name of the implementation of the
ClusteredSessionNotificationPolicyinterface that should be used to govern whether servlet specification notifications should be emitted to any registeredHttpSessionListener,HttpSessionAttributeListenerand/orHttpSessionBindingListener.Important
Event notifications that may be appropriate in non-clustered environment may not necessarily be appropriate in a clustered environment; see https://jira.jboss.org/jira/browse/JBAS-5778 for an example of why a notification may not be desired. Configuring an appropriateClusteredSessionNotificationPolicygives the application author fine-grained control over what notifications are issued.
15.2. HttpSession Passivation and Activation Copy linkLink copied to clipboard!
The process of controlling memory usage by removing relatively unused sessions from memory while storing them in persistent storage.
web.xml file includes the distributable directive.
- When the container requests the creation of a new session. If the number of currently active sessions exceeds a configurable limit, an attempt is made to passivate sessions to make room in memory.
- Periodically (by default every ten seconds) as the JBoss Web background task thread runs.
- When the web application is deployed and a backup copy of sessions active on other servers is acquired by the newly deploying web application's session manager.
- The session has not been in use for longer than a configurable maximum idle time.
- The number of active sessions exceeds a configurable maximum and the session has not been in use for longer than a configurable minimum idle time.
15.2.1. Configuring HttpSession Passivation Copy linkLink copied to clipboard!
jboss-web.xml deployment descriptor in your web application's WEB-INF directory.
- max-active-sessionDetermines the maximum number of active sessions allowed. If the number of sessions managed by the the session manager exceeds this value and passivation is enabled, the excess will be passivated based on the configured
passivation-min-idle-time. If after passivation is completed (or if passivation is disabled), the number of active sessions still exceeds this limit, attempts to create new sessions will be rejected. If set to-1(the default), there is no limit. - use-session-passivationDetermines whether session passivation will be enabled for the web application. Default is
false. - passivation-min-idle-timeDetermines the minimum time (in seconds) that a session must have been inactive before the container will consider passivating it in order to reduce the active session count to obey the value defined by
max-active-sessions. A value of-1(the default) disables passivating sessions beforepassivation-max-idle-time. Neither a value of-1nor a high value are recommended ifmax-active-sessionsis set. - passivation-max-idle-timeDetermines the maximum time (in seconds) that a session can be inactive before the container should attempt to passivate it to save memory. Passivation of such sessions will take place regardless of whether the active session count exceeds
max-active-sessions. Should be less than theweb.xmlsession-timeoutsetting. A value of-1(the default) disables passivation based on maximum inactivity.
max-active-sessions. The number of sessions replicated from other nodes will also depend on whether buddy replication is enabled.
numBuddies setting (1), each node will store 200 sessions in memory.
15.3. Configuring the JBoss Cache instance used for session state replication Copy linkLink copied to clipboard!
cacheName element in the application's jboss-web.xml (see Section 15.1, “Enabling session replication in your application”). In most cases this does not need to be set because the default value of standard-session-cache is appropriate.
CacheManager service expose a number of options.
Note
standard-session-cache configuration is already optimized for the web session replication use case, and most of the settings should not be altered. Administrators may be interested in altering the following settings:
- cacheModeThe default is
REPL_ASYNC, which specifies that a session replication message sent to the cluster does not wait for responses from other cluster nodes confirming that the message has been received and processed. The alternative mode,REPL_SYNC, offers a greater degree of confirmation that session state has been received, but reduces performance significantly.Note
For more information about the other available parameters for cacheMode, refer to the Cache Mode section in the Administration and Configuration Guide. - enabled property in the buddyReplicationConfig sectionSet to
trueto enable buddy replication. Default isfalse.Note
For more information about the other available parameters for cacheMode, refer to the Buddy Replication section in the Administration and Configuration Guide. - numBuddies property in the buddyReplicationConfig sectionSet to a value greater than the default (
1) to increase the number of backup nodes onto which sessions are replicated. Only relevant if buddy replication is enabled.Note
For more information about the other available parameters for cacheMode, refer to the Buddy Replication section in the Administration and Configuration Guide. - buddyPoolName property in the buddyReplicationConfig sectionA way to specify a preferred replication group when buddy replication is enabled. JBoss Cache tries to pick a buddy who shares the same pool name (falling back to other buddies if not available). Only relevant if buddy replication is enabled.
Note
For more information about the other available parameters for cacheMode, refer to the Buddy Replication section in the Administration and Configuration Guide. - multiplexerStackName of the JGroups protocol stack the cache should use.
Note
For more information about the other available parameters for cacheMode, refer to The Channel Factory Service section in the Administration and Configuration Guide. - clusterNameIdentifying name JGroups will use for this cache's channel. Only change this if you create a new cache configuration, in which case this property should have a different value from all other cache configurations.
Chapter 16. Using Clustered Single Sign-on Copy linkLink copied to clipboard!
org.apache.catalina.authenticator.SingleSignOn valve that is a standard part of Tomcat and JBoss Web.
16.1. Configuration Copy linkLink copied to clipboard!
ClusteredSingleSignOn valve to the appropriate Host elements of the JBOSS_HOME/server/PROFILE/deploy/jbossweb.sar/server.xml file. The valve element is already included in the standard file; you just need to uncomment it. The valve configuration is shown here:
<Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn" />
<Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn" />
- className is a required attribute to set the Java class name of the valve implementation to use. This must be set to
org.jboss.web.tomcat.service.sso.ClusteredSingleSign. - cacheConfig is the name of the cache configuration to use for the clustered SSO cache. Default is
clustered-sso.Note
For more information about cache configuration, refer to The JBoss Enterprise Application Platform CacheManager Service section in the Administration and Configuration Guide. - treeCacheName is deprecated; use
cacheConfig. Specifies a JMX ObjectName of the JBoss Cache MBean to use for the clustered SSO cache. If no cache can be located from the CacheManager service using the value ofcacheConfig, an attempt to locate an mbean registered in JMX under this ObjectName will be made. Default value isjboss.cache:service=TomcatClusteringCache. - cookieDomain is used to set the host domain to be used for SSO cookies. See Section 16.4, “Configuring the Cookie Domain” for more. Default is
"/". - maxEmptyLife is the maximum number of seconds an SSO with no active sessions will be usable by a request. The clustered SSO valve tracks what cluster nodes are managing sessions related to an SSO. A positive value for this attribute allows proper handling of shutdown of a node that is the only one that had handled any of the sessions associated with an SSO. The shutdown invalidates the local copy of the sessions, eliminating all sessions from the SSO. If maxEmptyLife were zero, the SSO would terminate along with the local session copies. But, backup copies of the sessions (if they are from clustered webapps) are available on other cluster nodes. Allowing the SSO to live beyond the life of its managed sessions gives the user time to make another request which can fail over to a different cluster node, where it activates the the backup copy of the session. Default is
1800, i.e. 30 minutes. - processExpiresInterval is the minimum number of seconds between efforts by the valve to find and invalidate SSO's that have exceeded their 'maxEmptyLife'. Does not imply effort will be spent on such cleanup every 'processExpiresInterval', just that it won't occur more frequently than that. Default is
60. - requireReauthentication is a flag to determine whether each request needs to be reauthenticated to the security Realm. If "true", this Valve uses cached security credentials (username and password) to reauthenticate to the JBoss Web security Realm each request associated with an SSO session. If
false, the valve can itself authenticate requests based on the presence of a valid SSO cookie, without rechecking with the Realm. Setting totruecan allow web applications with differentsecurity-domainconfigurations to share an SSO. Default isfalse.
16.2. SSO Behavior Copy linkLink copied to clipboard!
javax.servlet.http.HttpSession.invalidate() method), the user's sessions in all web applications will be invalidated.
16.3. Limitations Copy linkLink copied to clipboard!
- Only useful within a cluster of JBoss servers; SSO does not propagate to other resources.
- Requires use of container managed authentication (via
<login-config>element inweb.xml) - Requires cookies. SSO is maintained via a cookie and URL rewriting is not supported.
- Unless
requireReauthenticationis set totrue, all web applications configured for the same SSO valve must share the same JBoss WebRealmand JBoss Securitysecurity-domain. This means:- In
server.xmlyou can nest theRealmelement inside theHostelement (or the surroundingEngineelement), but not inside acontext.xmlpackaged with one of the involved web applications. - The
security-domainconfigured injboss-web.xmlorjboss-app.xmlmust be consistent for all of the web applications. - Even if you set
requireReauthenticationtotrueand use a differentsecurity-domain(or, less likely, a differentRealm) for different webapps, the varying security integrations must all accept the same credentials (e.g. username and password).
16.4. Configuring the Cookie Domain Copy linkLink copied to clipboard!
cookieDomain configuration attribute. This attribute allows configuration of the SSO cookie's domain (the set of hosts to which the browser will present the cookie). By default the domain is "/", meaning the browser will only present the cookie to the host that issued it. The cookieDomain attribute allows the cookie to be scoped to a wider domain.
http://app1.xyz.com and http://app2.xyz.com, that wish to share an SSO context. These apps could be running on different servers in a cluster or the virtual host with which they are associated could have multiple aliases. This can be supported with the following configuration:
<Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn"
cookieDomain="xyz.com" />
<Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn"
cookieDomain="xyz.com" />
Chapter 17. Complete Working Example Copy linkLink copied to clipboard!
A proxy server listening on localhost:
Following are the listener definitions for JBOSS_EAP_DIST/server/PROFILE/deploy/jbossweb.sar/server.xml.
<!-- Non-clustered mode --> <Listener className="org.jboss.web.tomcat.service.deployers.MicrocontainerIntegrationLifecycleListener" delegateBeanName="ModClusterService"/> <!-- Clustered mode Listener className="org.jboss.web.tomcat.service.deployers.MicrocontainerIntegrationLifecycleListener" delegateBeanName="HAModClusterService"/-->
<!-- Non-clustered mode -->
<Listener className="org.jboss.web.tomcat.service.deployers.MicrocontainerIntegrationLifecycleListener" delegateBeanName="ModClusterService"/>
<!-- Clustered mode
Listener className="org.jboss.web.tomcat.service.deployers.MicrocontainerIntegrationLifecycleListener" delegateBeanName="HAModClusterService"/-->
Following are the required dependencies for the WebServer bean in JBOSS_EAP_DIST/server/PROFILE/deploy/jbossweb.sar/META-INF/jboss-beans.xml. Add them to the existing dependencies.
Following are a set of example firewall rules using iptables, for a cluster node on the 192.168.1.0/24 subnet.
/sbin/iptables -I INPUT 5 -p udp -d 224.0.1.0/24 -j ACCEPT -m comment --comment "mod_cluster traffic" /sbin/iptables -I INPUT 6 -p udp -d 224.0.0.0/4 -j ACCEPT -m comment --comment "JBoss Cluster traffic" /sbin/iptables -I INPUT 9 -p udp -s 192.168.1.0/24 -j ACCEPT -m comment --comment "cluster subnet for inter-node communication" /sbin/iptables -I INPUT 10 -p tcp -s 192.168.1.0/24 -j ACCEPT -m comment --comment "cluster subnet for inter-node communication" /etc/init.d/iptables save
/sbin/iptables -I INPUT 5 -p udp -d 224.0.1.0/24 -j ACCEPT -m comment --comment "mod_cluster traffic"
/sbin/iptables -I INPUT 6 -p udp -d 224.0.0.0/4 -j ACCEPT -m comment --comment "JBoss Cluster traffic"
/sbin/iptables -I INPUT 9 -p udp -s 192.168.1.0/24 -j ACCEPT -m comment --comment "cluster subnet for inter-node communication"
/sbin/iptables -I INPUT 10 -p tcp -s 192.168.1.0/24 -j ACCEPT -m comment --comment "cluster subnet for inter-node communication"
/etc/init.d/iptables save
Appendix A. workers.properties Reference Copy linkLink copied to clipboard!
HTTPD_DIST/conf/workers.properties. This file specifies where the different Servlet containers are located, and how calls should be load-balanced across them.
workers.properties file contains two sections:
- Global Properties
- This section contains directives that apply to all workers.
- Worker Properties
- This section contains directives that apply to each individual worker.
worker.worker_name.directive
- worker
- The constant prefix for all worker properties.
- worker_name
- The arbitrary name given to the worker. For example: node1, node_01, Node_1.
- directive
- The specific directive required.
Note
worker.properties configuration directives, refer directly to the Apache Tomcat Connector - Reference Guide
worker.properties Global Directives
- worker.list
- Specifies the list of worker names used by mod_jk. The workers in this list are available to map requests to.
Note
A single node configuration, which is not managed by a load balancer, must be set toworker.list=[worker name].
workers.properties Mandatory Directives
- type
- Specifies the type of worker, which determines the directives applicable to the worker. The default value is
ajp13, which is the preferred worker type to select for communication between the web server and Apache httpd Server.Other values includeajp14,lb,status.For detailed information about ajp13, refer to The Apache Tomcat Connector - AJP Protocol Reference
workers.properties Connection Directives
- host
- The hostname or IP address of the worker. The worker node must support the ajp13 protocol stack. The default value is
localhost.You can specify theportdirective as part of the host directive by appending the port number after the hostname or IP address. For example:worker.node1.host=192.168.2.1:8009orworker.node1.host=node1.example.com:8009 - port
- The port number of the remote server instance listening for defined protocol requests. The default value is
8009, which is the default listen port for AJP13 workers. If you are using AJP14 workers, this value must be set to8011. - ping_mode
- Specifies the conditions under which connections are probed for their current network health.The probe uses an empty AJP13 packet for the CPing, and expects a CPong in return, within a specified timeout.You specify the conditions by using a combination of the directive flags. The flags are not comma-separated. For example, a correct directive flag set is
worker.node1.ping_mode=CI- C (connect)
- Specifies the connection is probed once after connecting to the server. You specify the timeout using the
connect_timeoutdirective, otherwise the value forping_timeoutis used. - P (prepost)
- Specifies the connection is probed before sending each request to the server. You specify the timeout using the
prepost_timeoutdirective, otherwise the value forping_timeoutis used. - I (interval)
- Specifies the connection is probed during regular internal maintenance cycles. You specify the idle time between each interval using the
connection_ping_intervaldirective, otherwise the value forping_timeoutis used. - A (all)
- The most common setting, which specifies all directive flags are applied. For information about the
*_timeoutadvanced directives, refer directly to Apache Tomcat Connector - Reference Guide.
- ping_timeout
- Specifies the time to wait for CPong answers to a CPing connection probe (refer to
ping_mode). The default value is 10000 (milliseconds).
worker.properties Load Balancing Directives
- lbfactor
- Specifies the load-balancing factor for an individual worker, and is only specified for a member worker of a load balancer.This directive defines the relative amount of HTTP request load distributed to the worker compared to other workers in the cluster.A common example where this directive applies is where you want to differentiate servers with greater processing power than others in the cluster. For example, if you require a worker to take three times the load than other workers, specify
worker.worker name.lbfactor=3 - balance_workers
- Specifies the worker nodes that the load balancer must manage. The directive can be used multiple times for the same load balancer, and consists of a comma-separated list of worker names as specified in the workers.properties file.
- sticky_session
- Specifies whether requests for workers with SESSION IDs are routed back to the same worker. The default is
0(false). When set to1(true), load balancer persistence is enabled.For example, if you specifyworker.loadbalancer.sticky_session=0, each request is load balanced between each node in the cluster. In other words, different requests for the same session will go to different servers based on server load.Ifworker.loadbalancer.sticky_session=1, each session is persisted (locked) to one server until the session is terminated, providing that server is available.
Appendix B. Java Properties Reference Copy linkLink copied to clipboard!
B.1. Proxy Configuration Copy linkLink copied to clipboard!
- During server startup
- When a proxy is detected through the advertise mechanism
- During error recovery, when a proxy's configuration is reset.
Proxy Configuration Values
- stickySession (defaults to
true) - Specifies whether subsequent requests for a given session should be routed to the same node, if possible.
- stickySessionRemove (defaults to
false) - Specifies whether the httpd proxy should remove session stickiness if the balancer is unable to route a request to the node to which it is stuck. This property is ignored if
stickySessionisfalse. - stickySessionForce (defaults to
true) - Specifies whether the httpd proxy should return an error if the balancer is unable to route a request to the node to which it is stuck. This property is ignored if
stickySessionisfalse. - workerTimeout (defaults to
-1) - Specifies the number of seconds to wait for a worker to become available to handle a request. When all the workers of a balancer are usable, mod_cluster will retry after a while (workerTimeout/100) to find an usable worker.A value of
-1indicates that the httpd will not wait for a worker to be available and will return an error if no workers are available. - maxAttempts (defaults to
1) - Specifies the number of times the httpd proxy will attempt to send a given request to a worker before aborting. The minimum value is 1: try once before aborting.
- flushPackets (defaults to
false) - Specifies whether packet flushing is enabled or disabled.
- flushWait (defaults to
-1) - Specifies the time to wait before flushing packets. A value of
-1means wait forever. - ping (defaults to
10) - Time to wait (in seconds) for a pong answer to a ping.
- smax
- Specifies the soft maximum idle connection count. The maximum value is determined by the httpd thread configuration (
ThreadsPerChildor1). - ttl (defaults to
60) - Specifies the time (in seconds) idle connections persist, above the
smaxthreshold. - nodeTimeout (defaults to
-1) - Specifies the time (in seconds) mod_cluster waits for the back-end server response before returning an error.mod_cluster always uses a cping/cpong before forwarding a request. The
connectiontimeoutvalue used by mod_cluster is the ping value. - balancer (defaults to
mycluster) - Specifies the name of the load-balancer.
- domain (no default)
- Optional parameter, which specifies how load is balanced across jvmRoutes within the same domain.
domainis used in conjunction with partitioned session replication (for example, buddy replication).
B.2. Load Configuration Copy linkLink copied to clipboard!
Appendix C. Revision History Copy linkLink copied to clipboard!
| Revision History | |||
|---|---|---|---|
| Revision 1.0.2-22.1 | Wed Feb 11 2015 | ||
| |||
| Revision 1.0.2-22 | Thu Sep 05 2013 | ||
| |||