JBoss Enterprise Application Platform-5-HTTP Connectors Load Balancing Guide-En-US
JBoss Enterprise Application Platform-5-HTTP Connectors Load Balancing Guide-En-US
Platform 5
HTTP Connectors Load Balancing
Guide
HTTP load-balancing for JBoss Enterprise Application Platform
Edition 5.2.0
Jared Morgan
Samuel Mendenhall
Joshua Wulf
James Livingston
Laura Bailey
Jim Tyrell
Jared Mo rgan
Jo shua Wulf
Laura Bailey
Samuel Mendenhall
James Livingsto n
Jim Tyrell
Edited by
Eva Ko palo va
Petr Penicka
Russell Dickenso n
Sco tt Mumfo rd
Legal Notice
Copyright 2012 Red Hat, Inc.
T his document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported
License. If you distribute this document, or a modified version of it, you must provide attribution to Red
Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be
removed.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section
4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo,
and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux is the registered trademark of Linus T orvalds in the United States and other countries.
Java is a registered trademark of Oracle and/or its affiliates.
XFS is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL is a registered trademark of MySQL AB in the United States, the European Union and other
countries.
Node.js is an official trademark of Joyent. Red Hat Software Collections is not formally related to or
endorsed by the official Joyent Node.js open source or commercial project.
T he OpenStack Word Mark and OpenStack Logo are either registered trademarks/service marks or
trademarks/service marks of the OpenStack Foundation, in the United States and other countries and
are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or
sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Abstract
Read this guide to install and configure the supported HT T P connectors for use with JBoss Enterprise
Application Platform and JBoss Enterprise Web Server. T his guide covers the Apache T omcat
Connector (mod_jk), JBoss HT T P Connector (mod_cluster), Internet Server API (ISAPI) and Netscape
Server API (NSAPI), and discusses clustering and load-balancing with regard to each.
Table of Contents
Table of Contents
.Preface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5. . . . . . . . . .
1. File Name Conventions
5
2. Document Conventions
5
2.1. T ypographic Conventions
6
2.2. Pull-quote Conventions
7
2.3. Notes and Warnings
8
3. Getting Help and Giving Feedback
8
3.1. Do You Need Help?
8
3.2. Give us Feedback
8
. . . . . I.
Part
. . Apache
........T
. .omcat
. . . . . . .Connector
. . . . . . . . . . . (mod_jk)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
............
. . . . . . . . . 1.
Chapter
. . .Overview
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
............
. . . . . . . . . 2.
Chapter
. . .Download
. . . . . . . . . . .and
. . . .install
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
............
.Chapter
. . . . . . . . 3.
. . .Configure
. . . . . . . . . . load
. . . . . balancing
. . . . . . . . . . .using
. . . . . . Apache
. . . . . . . . HT
. . .T
. .P. .Server
. . . . . . . and
. . . . .mod_jk
. . . . . . . . . . . . . . . . . . . .13
...........
3.1. Configure worker nodes in mod_jk
15
3.2. Configuring JBoss to work with mod_jk
16
.Chapter
........4
. ...T. roubleshooting
. . . . . . . . . . . . . . . . .and
. . . .optimizing
. . . . . . . . . . . mod_jk
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
............
4.1. Common Problems
18
4.2. General Diagnostics
23
4.3. Getting Further Help
24
. . . . . II.
Part
. . .JBoss
. . . . . . .HT
..T
. .P. .Connector
. . . . . . . . . . . (mod_cluster)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
............
.Chapter
. . . . . . . . 5.
. . .Overview
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
............
5.1. Key features
26
5.2. Components
26
5.3. Limitations
27
.Chapter
. . . . . . . . 6.
. . .Install
. . . . . . .proxy
. . . . . .server
. . . . . . . components
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
............
6.1. Apache HT T P Server modules
29
6.1.1. mod_manager.so
29
6.1.2. mod_proxy_cluster.so
31
6.1.3. mod_advertise.so
32
6.2. Install proxy server components
33
.Chapter
. . . . . . . . 7.
. . .Configure
. . . . . . . . . . .basic
. . . . . .proxy
. . . . . .server
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
...........
7.1. Basic proxy configuration overview
35
7.2. Configure a load-balancing proxy using the HT T P Connector
35
.Chapter
. . . . . . . . 8.
. . .Install
. . . . . . .node
. . . . . with
. . . . . basic
. . . . . . configuration
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
...........
8.1. Worker node requirements
37
8.2. Install and configure a worker node
37
.Chapter
. . . . . . . . 9.
. . .Advanced
. . . . . . . . . . .configuration
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4. .1. . . . . . . . . .
9.1. Static proxy configuration
41
9.2. Clustered node operation
42
.Chapter
. . . . . . . . 10.
. . . . Java
. . . . . .Properties
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4. .4. . . . . . . . . .
10.1. Configuration Properties
44
10.1.1. Proxy Discovery Configuration
44
46
48
49
50
.Chapter
. . . . . . . . 11.
. . . . Load
. . . . . .Metrics
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
............
11.1. Server-Side Load Metrics
51
11.2. Web Container metrics
52
11.3. System/JVM metrics
54
11.4. Other metrics
55
.Chapter
. . . . . . . . 12.
. . . . Load
. . . . . .balancing
. . . . . . . . . . demonstration
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
............
12.1. Set up the demonstration
56
12.2. Configure the demo client
58
12.3. Interact with the demonstration
59
12.3.1. Generate artificial load
60
. . . . . III.
Part
. . . Internet
. . . . . . . . . Server
. . . . . . . .API
. . . .(ISAPI)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63
...........
.Chapter
. . . . . . . . 13.
. . . .Overview
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
............
13.1. What is Internet Server API
64
.Chapter
. . . . . . . . 14
. . . .. Configuring
. . . . . . . . . . . . .the
. . . .ISAPI
. . . . . .connector
. . . . . . . . . . .on
. . .Windows
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
............
14.1. Prerequisites and configuration assumptions
65
14.2. Configure server instance as a worker node
65
14.3. Microsoft IIS 6 initial clustering configuration
66
14.4. Microsoft IIS 7 initial clustering configuration
67
14.5. Configure a basic cluster with ISAPI
69
14.6. Configure a load-balancing cluster with ISAPI
72
. . . . . IV.
Part
. . . Netscape
. . . . . . . . . . .Server
. . . . . . . API
. . . . (NSAPI)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
............
. . . . . . . . . 15.
Chapter
. . . . What
. . . . . .is
. . Netscape
. . . . . . . . . . .Server
. . . . . . .API?
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
............
.Chapter
. . . . . . . . 16.
. . . . Configuring
. . . . . . . . . . . . .the
. . . .NSAPI
. . . . . . .connector
. . . . . . . . . . .on
. . .Solaris
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
............
16.1. Prerequisites and configuration assumptions
78
16.2. Configure server instance as a worker node
78
16.3. Initial clustering configuration
79
16.4. Configure a basic cluster with NSAPI
80
16.5. Configure a load-balanced cluster with NSAPI
82
. . . . . V.
Part
. . .Common
. . . . . . . . . load
. . . . . balancing
. . . . . . . . . . .tasks
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
............
.Chapter
. . . . . . . . 17.
. . . . HT
. . .T. P
. . session
. . . . . . . . .state
. . . . . .replication
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
............
17.1. Enabling session replication in your application
86
17.2. HttpSession passivation and activation
90
17.2.1. Configuring HttpSession passivation
90
17.3. Configure the JBoss Cache instance used for session state replication
91
.Chapter
. . . . . . . . 18.
. . . . High-Availability
. . . . . . . . . . . . . . . . . Web
. . . . . Sessions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93
...........
18.1. DataSourcePersistentManager Configuration Attributes
95
.Chapter
. . . . . . . . 19.
. . . . Using
. . . . . . clustered
. . . . . . . . . . .Single
. . . . . . .Sign-on
. . . . . . . . (SSO)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
............
19.1. Configuration
99
19.2. SSO behavior
100
19.3. Limitations
100
19.4. Configuring the cookie domain
100
Table of Contents
. . . . . . . . . 20.
Chapter
. . . . Complete
. . . . . . . . . . .working
. . . . . . . . example
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
.............
. . . . . . . . . . . . workers.properties
Reference:
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104
.............
.Reference:
. . . . . . . . . . . Java
. . . . . .properties
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
.............
B.1. Proxy configuration
108
. . . . . . . . . .history
Revision
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
.............
Preface
Preface
1. File Name Conventions
T he following naming conventions are used in file paths for readability. Each convention is styled so that
it stands out from the rest of text:
JBOSS_EAP_DIST
T he installation root of the JBoss Enterprise Application Platform instance. T his folder contains
the main folders that comprise the server such as /jboss-as, /seam , and /resteasy.
JBOSS_EWP_DIST
T he installation root of the JBoss Enterprise Web Platform instance. T his folder contains the
main folders that comprise the server such as /jboss-as-web, /seam , and /resteasy.
JBOSS_EWS_DIST
T he installation root of the JBoss Enterprise Web Server instance. T his folder contains the
main folders that comprise the server such as /extras, /httpd, and the /tom cat6 folders.
NATIVE
T he installation root of the JBoss Native zip, extracted to the same directory level as
JBOSS_EAP_DIST.
SJWS
T he installation root of the Sun Java Web Server instance. T he default file locations for this
naming convention are:
for Solaris 10 x86 or SPARC 64: /opt/SUNWwbsrv70/
HTTPD_DIST
T he installation root of the Apache HT T P Server. T his folder contains the main folders that
comprise the server such as /conf, /webapps, and /bin. T he JBoss Enterprise Web Server
JBOSS_EWS_DIST directory contains the root installation of HTTPD_DIST.
PROFILE
T he name of the server profile you use as part of your testing or production configuration. T he
server profiles reside in JBOSS_EAP_DIST/jboss-as/server or JBOSS_EWP_DIST/jbossas-web/server.
2. Document Conventions
T his manual uses several conventions to highlight certain words and phrases and draw attention to
specific pieces of information.
In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. T he
Liberation Fonts set is also used in HT ML editions if the set is installed on your system. If not, alternative
but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later include the Liberation
Fonts set by default.
Preface
distinguishable by context.
Mono-spaced Bold Italic or Proportional Bold Italic
Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or variable
text. Italics denotes text you do not input literally or displayed text that changes depending on
circumstance. For example:
T o connect to a remote machine using ssh, type ssh username@ domain.name at a shell
prompt. If the remote machine is exam ple.com and your username on that machine is
john, type ssh john@ exam ple.com .
T he m ount -o rem ount file-system command remounts the named file system. For
example, to remount the /hom e file system, the command is m ount -o rem ount /hom e.
T o see the version of a currently installed package, use the rpm -q package command. It
will return a result as follows: package-version-release.
Note the words in bold italics above username, domain.name, file-system, package, version and
release. Each word is a placeholder, either for text you enter when issuing a command or for text
displayed by the system.
Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and
important term. For example:
Publican is a DocBook publishing system.
Desktop
Desktop1
documentation
downloads
drafts
images
mss
notes
photos
scripts
stuff
svgs
svn
Source-code listings are also set in m ono-spaced rom an but add syntax highlighting as follows:
package org.jboss.book.jca.ex1;
import javax.naming.InitialContext;
public class ExClient
{
public static void main(String args[])
throws Exception
{
InitialContext iniCtx = new InitialContext();
Object
ref
= iniCtx.lookup("EchoBean");
EchoHome
home
= (EchoHome) ref;
Echo
echo
= home.create();
System.out.println("Created Echo");
System.out.println("Echo.echo('Hello') = " + echo.echo("Hello"));
}
}
Note
Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should
have no negative consequences, but you might miss out on a trick that makes your life easier.
Important
Important boxes detail things that are easily missed: configuration changes that only apply to the
current session, or services that need restarting before an update will apply. Ignoring a box
labeled 'Important' will not cause data loss but may cause irritation and frustration.
Warning
Warnings should not be ignored. Ignoring warnings will most likely cause data loss.
Preface
Document URL:
Additional information:
Be sure to give us your name so that you can receive full credit for reporting the issue.
10
Chapter 1. Overview
Chapter 1. Overview
Apache HT T P Server ("Apache") is a well-known web server which can be extended using plug-ins. T he
Apache T omcat Connector mod_jk is a plug-in designed to allow request forwarding from Apache HT T P
Server to a servlet container. T he module also supports load-balancing HT T P calls to a set of servlet
containers while maintaining sticky sessions.
HT T P session replication is used to replicate the state associated with web client sessions to other
nodes in a cluster. If one node becomes unavailable, another node in the cluster continues to service the
failed node's requests. T his involves two distinct operations:
Session state replication
Load-balancing HT T P Requests
Session state replication is handled by JBoss per application, providing the application is configured to
make use of this feature (refer to Section 17.1, Enabling session replication in your application).
Load balancing must be handled externally to JBoss, via either hardware or software. A cost-effective
way of enabling load balancing is to set up a software load balancer using Apache HT T P Server and the
Apache T omcat Connector (mod_jk).
11
12
Chapter 3. Configure load balancing using Apache HTTP Server and mod_jk
1. Open HTTPD_DIST/conf/httpd.conf and add the following text at the end of the file.
# Include mod_jk's specific configuration file
Include conf/mod-jk.conf
13
4. Confirm that the LoadModule directive references the right path for the mod_jk library. If not, edit
the path.
5. T he default configuration specifies that static content is served directly by Apache HT T P Server
and all requests with URL path /application/* are sent to the load balancer. If mod_jk is only
to be used as a load balancer, change the directive to /* .
6. Optional: JKMountFile Directive
In addition to the JkMount directive, you can use the JkMountFile directive to specify a mount
point's configuration file. T he configuration file contains multiple T omcat forwarding URL mappings.
a. Navigate to HTTPD_DIST/conf.
b. Create a file named uriworkerm ap.properties.
c. Specify the URL whose requests are to be forwarded and the name of the worker node to
which they are to be forwarded, using the following syntax example as a guide.
T he example block will configure mod_jk to forward requests to /jm x-console and
/web-console to Apache HT T P Server.
T he syntax required takes the form /url=worker_nam e.
14
Chapter 3. Configure load balancing using Apache HTTP Server and mod_jk
1. Navigate to HTTPD_DIST/conf/.
2. Create a file named workers.properties.
3. Append the following information to workers.properties.
15
16
Chapter 3. Configure load balancing using Apache HTTP Server and mod_jk
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.
4. In server.xm l, ensure the AJP protocol <connector> element is enabled (uncommented). T he
element is uncommented by default in new installations.
<Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}"
redirectPort="8443" />
5. You now have a correctly configured Apache HT T P Server with m od_jk load balancer, which
balances calls to the servlet containers in the cluster, and ensures clients will always use the
same servlet container (sticky sessions).
Note
For supplementary information about using mod_jk with JBoss, refer to the JBoss wiki page at
https://community.jboss.org/wiki/UsingModjk12WithJBoss.
17
18
All of the problems listed above are typically resolved after optimizing the configuration in Apache HT T P
Server, mod_jk, and JBoss.
Common Errors
"CPing/CPong" Errors
Presents with errors like the following:
[info] ajp_handle_cping_cpong::jk_ajp_common.c (865): timeout in reply
cpong
...
[error] ajp_connect_to_endpoint::jk_ajp_common.c (957): (nodeA) cping/cpong
after connecting to the backend server failed (errno=110)
[error] ajp_send_request::jk_ajp_common.c (1507): (nodeA) connecting to
backend failed. Tomcat is probably not started or is listening on the
wrong port (errno=110)
T hese CPing/CPong messages do not indicate a problem with mod_jk at all, they indicate that
JBoss did not respond in the defined CPing/CPong time.
T his is seen many times when there is high load on the JVM JBoss is running on causing high
garbage collection or potentially thread contention. It could also be that the JBoss instance is
overloaded, or even that a firewall is blocking the connection or there are network issues.
T he following workflow may assist to correct these type of issues:
Procedure 4 .1. Resolving "CPing/CPong" Errors
1. Optimize your Apache HT T P Server and JBoss Enterprise Application Platform
configuration. You can contact Red Hat's Global Support Services for assistance with
this.
If this does not resolve the issue, proceed to Step 2
2. Confirm that there is no firewall blocking or dropping the AJP connections.
"T omcat is down" Errors
Presents with errors like the following:
19
1.
T he above error means that JBoss did not respond in the configured reply_timeout time.
T he solution can be one (or both) of the following:
a. Increase the reply_timeout.
b. Verify there are no garbage collection issues/long pause times in JBoss that may
prevent the request from responding thus causing that error.
2.
T he above error likely means that JBoss Enterprise Application Platform did not respond
within the configured core Apache HT T P Server timeout period.
Note that with these messages the [11159:30864 20192] portion of the message
serves as an identifier for the connection/request in question. T herefore tracing back
from the point of the error in logs can help clarify the activity around the
connection/request that lead to the error.
In this case, that helps clarify that the error was experienced five minutes after the
response was sent to JBoss, which likely points to a five minute timeout (this is Apache
HT T P Server's T imeout directive default if not specified). If the T imeout is interrupting
mod_jk requests, then it should be increased from the current value to allow for the
maximum acceptable response time.
Procedure 4 .2. Resolving "T omcat is down" Errors
a. Optimize your Apache HT T P Server and JBoss Enterprise Application Platform
configuration. You can contact Red Hat's Global Support Services for assistance
with this.
If this does not resolve the issue, proceed to Step 2
b. Confirm that there is no firewall blocking or dropping the AJP connections.
General Performance Issues
Presents with errors like the following:
ERROR [org.apache.coyote.ajp.AjpMessage] (ajp-192.168.0.101-8001-13)
Invalid message received with signature 12336
20
T he above exception when using mod_jk in JBoss Web typically indicates a non AJP request
sent to the AJP connector.
Workflows that may assist in resolving these kinds of issues is below:
Procedure 4 .3. General Performance Problems
1. Optimize your Apache HT T P Server and JBoss Enterprise Application Platform
configuration. You can contact Red Hat's Global Support Services for assistance with
this.
If this does not resolve the issue, proceed to Step 2
2. Gather garbage collection logs for analysis.
If the logs show long garbage collection pause times then you should optimize the Java
Virtual Machine to reduce the garbage collection pauses and gather/recheck updated
logs. Refer to https://access.redhat.com/knowledge/solutions/19932 (Red Hat account
required) for more information.
If this is not the case, or did not resolve the issue, try Step 3, Step 4 and/or Step 5 until
your issue is resolved.
3. Determine how long the longest request should take. Factor in transaction times. You
may need to increase the reply_timeout to resolve the problem.
If this does not resolve the issue, continue to Step 4 .
4. Determine if your current environment can handle the given load. If not, you may need to
upgrade or add more machines.
If this does not resolve the issue, continue to Step 5.
5. Confirm that there is no firewall blocking or dropping the AJP connections.
Procedure 4 .4 . 503 Errors
1. Optimize your Apache HT T P Server and JBoss Enterprise Application Platform
configuration. You can contact Red Hat's Global Support Services for assistance with
this.
If this does not resolve the issue, proceed to Step 2
2. Gather garbage collection logs for analysis.
If the logs show long garbage collection pause times then you should optimize the Java
Virtual Machine to reduce the garbage collection pauses and gather/recheck updated
logs. Refer to https://access.redhat.com/knowledge/solutions/19932 (Red Hat account
required) for more information.
If this is not the case, or does not resolve the issue, continue to Step 3
3. Determine how long the longest request should take. Factor in transaction times. You
may need to increase the reply_timeout to resolve the issue.
If this does not resolve the issue, move on to Step 4 .
4. Determine if your current environment can handle the given load. If not, you may need to
upgrade or add more machines.
JBoss/JVM-related Issues
May present with errors like:
[error] service::jk_lb_worker.c (1473): All tomcat instances failed, no
more workers left
21
If Apache HT T P Server and JBoss Enterprise Application Platform are optimized and you still
receive "no more workers left" this typically indicates an issue on the JBoss/JVM side. A
number of JVM-related problems could lead to mod_jk not being able to get a connection to
JBoss in the configured timeouts, thus causing the worker to go into the error state and
producing this message.
Procedure 4 .5. JBoss/JVM Problems
1. Enable garbage collection logging.
a. For UNIX based systems, the options should be placed in run.conf, not run.sh.
T he run.conf in the server configuration directory (e.g.
<JBOSS_HOME>/server/<PROFILE>/run.conf) takes precedence over the
run.conf in the <JBOSS_HOME>/bin directory (except in JBoss EAP 5.0.0 due to
a regression fixed in version 5.0.1).
b. For Windows, the options need to be added to run.bat, as it does not read
run.conf.
c. Check boot.log to see the value of the user.dir environment variable (e.g.
<JBOSS_HOME>/bin), the default location for garbage collection logging when no
path is provided. If you are running multiple instances of JBoss against the same
directory like so:
./run.sh -c node1 -b 127.0.0.1 -Djboss.messaging.ServerPeerID=1
./run.sh -c node2 -b 127.0.0.1 -Djboss.messaging.ServerPeerID=2 Djboss.service.binding.set=ports-01
d. T hen for the gc.log files to be properly separated you will need to make sure
each <PROFILE> has a unique run.conf with the JVM_OPT S specific to that
<PROFILE>.
For example node1 will contain a <JBOSS_HOME>/server/node1/run.conf with
contents:
JAVA_OPTS="$JAVA_OPTS -verbose:gc -Xloggc:gc_node1.log XX:+PrintGCDetails -XX:+PrintGCDateStamps"
Important
gc.log is recreated every time JBoss starts.
Be sure to back up gc.log if you are restarting the server. Alternatively
you may be able to add a timestamp to the file name depending on the OS
and/or shell. For example, with OpenJDK or Oracle/Sun JDK on Linux: Xloggc:gc.log.`date +%Y%m%d%H%M%S`.
f. On Windows, you can use
22
2. For the time period when there are slowdowns, hangs, or errors, gather the following
data:
Garbage collection logs. Follow Procedure 4.5, JBoss/JVM Problems.
High CPU data coupled with thread dumps (depending upon platform):
T he links below can assist in gathering Java thread data. A Red Hat subscription is
required.
CPU utilization by Java threads on Linux/Solaris:
https://access.redhat.com/knowledge/node/46596.
CPU utilization by Java threads on Windows:
https://access.redhat.com/knowledge/node/46598.
For cases where the Java application is an application server, gather log files:
In JBoss:
<JBOSS_HOME>/server/<PROFILE>/log/server.log
<JBOSS_HOME>/server/<PROFILE>/log/boot.log
In T omcat:
catalina.out
3. Determine if the CPU utilization is caused by the JVM (Java application). Here, you want
to validate that a Java process is indeed using an unexpected amount of CPU.
T he Java thread data gathered in the first step should help identify this.
4. Assuming a Java process is identified as the cause of high CPU, the most common
cause is java Garbage collection. Determine if the high CPU is caused by Java garbage
collection by analyzing the garbage collection for long pause times and/or low throughput
overall at the time of the issue.
T o find the garbage collection logging related to the issue, it is necessary to determine
the number of seconds after JVM startup that the issue happens (that is the typical
format of garbage collection logging timestamps). T o determine the time elapsed, you can
use the first timestamp in the high CPU data gathered and the first timestamp in the
console log, boot.log (JBoss), server.log (JBoss), or catalina.out (T omcat.)
If you see long pause times and/or low throughput overall, refer to the following
Knowledge Base article (Red Hat subscription required)
https://access.redhat.com/knowledge/node/19932.
5. If Garbage collection is not responsible for the high CPU, use the thread dump
information gathered when validating CPU information to identify the threads.
One area that is not a direct consequence of an unoptimized mod_jk configuration but can still cause
issues with mod_jk is JVM and garbage collection related problems. When there are high pause times
and the JVM is not optimized for the app server, the pause times can cause mod_jk issues even when
mod_jk is tuned.
1. Verify the back end server is responsive by making a direct request to it.
2. Monitor high load using one of the following methods:
T widdle
a. Locate the appropriate T widdle script for your environment (twiddle.sh,
twiddle.bat or twiddle.jar) in the <JBOSS_HOME>/bin/ directory.
b. Run the following command:
<TWIDDLE> -u admin -p password get "jboss.web:name=ajp-127.0.0.18009,type=ThreadPool"
24
25
Chapter 5. Overview
T he JBoss HT T P Connector mod_cluster is a reduced-configuration, intelligent load-balancing solution
for JBoss Enterprise Application Platform, based on technology originally developed by the JBoss
mod_cluster community project.
T he JBoss HT T P connector load-balances HT T P requests to JBoss Enterprise Application Platform
and JBoss Enterprise Web Server worker nodes, using Apache HT T P Server as the proxy server.
5.2. Components
Proxy Server
On the proxy server, the JBoss HT T P Connector, mod-cluster, consists of four Apache HT T P Server
modules.
26
Chapter 5. Overview
Note
Refer to Section 6.1, Apache HT T P Server modules for detailed information about the available
modules including user-configurable parameters.
Worker Node Components
T he JBoss HT T P Connector client service, m od-cluster.sar, is deployed on each worker node.
Worker node service: m od-cluster.sar
T his 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.
5.3. Limitations
T he JBoss HT T P Connector mod_cluster uses shared memory to keep the nodes description, the
shared memory is created at the startup of httpd and the structure of each item is fixed. T herefore,
when defining proxy server and worker node properties, make sure to follow these character limits:
Maximum Alias length: 100 characters (Alias corresponds to the network name of the respective
virtual host; the name is defined in the Host element)
Maximum context length: 40 characters (for example, if myapp.war is deployed in /m yapp, then
/m yapp is the context)
27
28
6.1.1. mod_manager.so
T he 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.
LoadModule manager_module modules/mod_manager.so
You can also define the following related directives in the <VirtualHost> element:
MemManagerFile
Defines the location for the files in which mod_manager stores configuration details.
mod_manager also uses this location to store generated keys for shared memory and lock files.
This must be an absolute path name.
It is recommended that this path be set explicitly and on a local drive, not an NFS share. T he
default value is platform/httpd specific.
Valid paths are:
HP-UX: HTTPD_HOME/cache/m od_cluster
Red Hat Enterprise Linux: /var/cache/m od_cluster
Maxcontext
T he maximum number of contexts JBoss mod_cluster will use. T he default value is 100.
Maxnode
T he maximum number of worker nodes JBoss mod_cluster will use. T he default value is 20.
Maxhost
T he maximum number of hosts (aliases) JBoss mod_cluster will use. T his is also the maximum
number of load balancers. T he default value is 10.
Maxsessionid
T he maximum number of active session identifiers stored. A session is considered inactive
when no information is received from that session within five minutes. T he default value is 0,
which disables this logic.
ManagerBalancerName
T he name of the load balancer to use when the worker node does not provide a load balancer
29
Warning
Setting this directive to off can leave your server vulnerable to replay attacks.
SetHandler
Defines a handler to display information about worker nodes in the cluster. T his is defined in
the Location element:
<Location $LOCATION>
SetHandler mod_cluster-manager
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
When accessing the $LOCATION defined in the Location element in your browser, you will see
something like the following. (In this case, $LOCATION was also defined as m od_clusterhandler.)
Transferred corresponds to the POST data sent to the worker node. Connected corresponds to the
number of requests that had been processed when this status page was requested. Sessions
corresponds to the number of active sessions. T his field is not present when Maxsessionid is 0.
30
6.1.2. mod_proxy_cluster.so
T he Proxy Balancer module, mod_proxy_cluster, handles the routing of requests to cluster nodes.
T he 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).
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
You can also define the following related directives in the <VirtualHost> element to change loadbalancing behavior.
mod_proxy_cluster directives
CreateBalancers
Defines how load balancers are created in the Apache HT T P Server virtual hosts. T he following
values are valid in CreateBalancers :
0
Create load balancers in all virtual hosts defined in Apache HT T P Server. Remember
to configure the load balancers in the ProxyPass directive.
1
Do not create balancers. When using this value, you must also define the load
balancer name in the ProxyPass or ProxyPassMatch .
2
Create only the main server. T his is the default value for CreateBalancers .
UseAlias
Defines whether to check that the defined Alias corresponds to the ServerNam e . T he
following values are valid for UseAlias :
0
Ignore Alias information from worker nodes. T his is the default value for UseAlias .
1
Verify that the defined alias corresponds to a worker node's server name.
LBstatusRecalT ime
Defines the interval in seconds between the proxy calculating the status of a worker node. T he
default interval is 5 seconds.
ProxyPassMatch; ProxyPass
ProxyPass maps remote servers into the local server namespace. If the local server has an
31
ProxyPassMatch uses 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 .gif files
should be served locally.
ProxyPassMatch ^(/.*\.gif)$ !
6.1.3. mod_advertise.so
T he Proxy Advertisement module, mod_advertise.so, broadcasts the existence of the proxy server via
UDP multicast messages. T he 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.
T his module must be defined alongside mod_manager in the VirtualHost element. Its identifier in
the following code snippet is advertise_m odule.
LoadModule advertise_module modules/mod_advertise.so
32
AdvertiseFrequency
T he interval (in seconds) between multicast messages advertising the IP address and port.
T he default value is 10.
AdvertiseSecurityKey
Defines a string used to identify the JBoss HT T P 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. T he syntax is
AdvertiseBindAddress address:port. T his allows an address to be specified on
machines with multiple IP addresses. T he default value is 0.0.0.0:23364 .
33
slotmem_module HTTPD_HOME/modules/mod_slotmem.so
manager_module HTTPD_HOME/modules/mod_manager.so
proxy_cluster_module HTTPD_HOME/modules/mod_proxy_cluster.so
advertise_module HTTPD_HOME/modules/mod_advertise.so
34
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
T he port PORT_NUMBER must be open on the server firewall for incoming T CP connections.
35
IP_ADDRESS and PORT_NUMBER match the values from the Listen directive.
PARTIAL_IP_ADDRESS is the first 1 to 3 bytes of an IP address, to restrict access to a specific
subnet - 10.33.144, for example.
3. Configure SELinux to allow proxy traffic
Enter the following commands as a root-equivalent user to modify the SELinux configuration to
allow the proxy traffic:
#semanage port -a -t http_port_t -p tcp 8079 #add port to the Apache port
list to enable the next command to work
#setsebool -P httpd_can_network_relay 1 #for mod_proxy to work
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.
5. Restart the JBoss Enterprise Web Server Apache service
Refer to HT T PD-specific documentation for detailed instructions.
36
Note
JBoss Enterprise Platform worker nodes support all JBoss HT T P Connector functionality. JBoss
Enterprise Web Server T omcat worker nodes support a subset of JBoss HT T P Connector
functionality.
JBoss HT T P 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.
T ask: Install and Configure a JBoss Enterprise Application Platform Worker Node
Follow this procedure to install JBoss HT T P Connector on a JBoss Enterprise Application Platform
instance and configure it for non-clustered operation.
Prerequisites
Install a supported JBoss Enterprise Application Platform.
Understand the Proxy Configuration parameters discussed in Appendix B, Reference: Java
properties
37
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!!!
38
Important
If your nodes are on different machines that run Red Hat Enterprise Linux, they may not
acknowledge each other automatically. JBoss Clustering relies on the UDP (User Datagram
Protocol) multicasting provided by jGroups. Red Hat Enterprise Linux blocks these packets
by default.
T o allow the packets, modify the iptables rules (as root). T he following commands apply to
an IP address that matches 192.168.1.x:
/sbin/iptables -I RH-Firewall-1-INPUT
ACCEPT
/sbin/iptables -I RH-Firewall-1-INPUT
/sbin/iptables -I RH-Firewall-1-INPUT
ACCEPT
/sbin/iptables -I RH-Firewall-1-INPUT
ACCEPT
/etc/init.d/iptables save
5 -p udp -d 224.0.1.0/24 -j
5 -p udp -d 224.0.0.0/4 -j ACCEPT
9 -p udp -s 192.168.1.0/24 -j
10 -p tcp -s 192.168.1.0/24 -j
T ask: Install and Configure a JBoss Enterprise Web Server Worker Node
Follow this procedure to install the JBoss HT T P Connector on a JBoss Enterprise Web Server node and
configure it for non-clustered operation.
Prerequisites
Install a supported JBoss Enterprise Web Server.
Understand the Proxy Configuration parameters discussed in Appendix B, Reference: Java
properties
39
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!!!
40
T ask: Configure Application Platform Worker Node with Static Proxy List
Follow this task to configure a JBoss Enterprise Application Platform worker node to operate with a static
list of proxy servers.
Prerequisites
JBoss Enterprise Application Platform worker node configured. Refer to Chapter 8, Install node with
basic configuration for directions.
B. Option 2: Start the worker node with a static proxy list as a parameter
a. Edit JBOSS_EAP_DIST/server/PROFILE/m od-cluster.sar/MET A-INF/m odcluster-jboss-beans.xm l
41
T ask: Configure Web Server Worker Node with Static Proxy List
Follow this procedure to configure a JBoss Enterprise Web Server worker node to operate with a static
list of proxy servers.
Prerequisites
JBoss Enterprise Web Server worker node configured. Refer to Chapter 8, Install node with basic
configuration for directions.
Understand the Proxy Configuration parameters discussed in Appendix B, Reference: Java
properties
42
Note
Only JBoss Enterprise Application Platform nodes support clustered operation with the JBoss
HT T P Connector. JBoss Enterprise Web Server nodes support non-clustered operation only.
JBoss HT T P Connector non-clustered operation
In non-clustered mode each worker node communicates directly with the proxy.
43
44
Default
Description
proxyList
None
excludedContexts
ROOT ,adminconsole,invoker,jbossws,jmxconsole,juddi,web-console
autoEnableContexts
T rue
stopContextTimeout
10
proxyURL
None
socketTimeout
20000
45
advertise
advertiseGroupAddress
224 .0.1.105
advertisePort
23364
advertiseSecurityKey
None
46
Default
Description
stickySession
true
stickySessionRemove
false
stickySessionForce
true
workerTimeout
-1
maxAttempts
flushPackets
false
Enables/disables packet
flushing.
flushWait
-1
ping
10 seconds
smax
Determined by httpd
configuration.
47
mod_proxy documentation). T he
maximum value depends on the
httpd thread configuration
(T hreadsPerChild or 1).
ttl
60 seconds
nodeTimeout
-1 (none)
balancer
m ycluster
T he balancer name.
domain
None
Note: When nodeT imeout is not defined the ProxyT imeout directive Proxy is used. If
ProxyT imeout is not defined the server timeout (T imeout) is used (default 300 seconds).
nodeT imeout, ProxyT imeout or T imeout is set at the socket level.
48
Default
Description
ssl
false
sslCiphers
sslProtocol
T LS
sslCertificateEncodingAlg
orithm
sslKeyStore
System .getProperty("user
.hom e") + "/.keystore"
sslKeyStorePass
changeit
sslKeyStoreType
JKS
sslKeyStoreProvider
sslTrustAlgorithm
sslKeyAlias
sslCrlFile
sslTrustMaxCertLength
T he maximum length of a
certificate held in the trust store.
sslTrustStore
System .getProperty("jav
ax.net.ssl.trustStorePas
sword")
sslTrustStorePassword
System .getProperty("jav
ax.net.ssl.trustStore")
sslTrustStoreType
System .getProperty("jav
ax.net.ssl.trustStoreT yp
e")
sslTrustStoreProvider
System .getProperty("jav
ax.net.ssl.trustStorePro
vider")
10.1.4. HA Configuration
Additional configuration properties when mod_cluster is configured in clustered mode.
49
Default
Description
masterPerDomain
false
Default
Description
loadMetricClass
org.jboss.modcluster.load
.metric.impl.BusyConnecto
rsLoadMetric
loadMetricCapacity
loadHistory
loadDecayFactor
50
Di
51
Setting history = 0 effectively disables the time decay function and only the current load for each
metric will be considered in the load balance factor computation.
T he mod_cluster proxy module expects the load factor to be an integer between 0 and 100, where 0
indicates max load and 100 indicates zero load. T herefore, the final load balance factor sent to the
proxy is:
100 - (L 100)
While you are free to write your own load metrics, the following LoadMetrics are available out of the
box:
2. BusyConnectorsLoadMetric
Returns the percentage of connector threads from the thread pool that are busy servicing
requests
Uses T hreadPoolLoadMetricSource to query connector thread pools
Analogous to method=B in mod_jk
For example:
52
3. ReceiveT rafficLoadMetric
Returns the incoming request traffic in KB/sec
Requires an explicit capacity
Uses RequestProcessorLoadMetricSource to query request processors
Analogous to method=T in mod_jk
For example:
<bean name="ReceiveTrafficLoadMetric" class="org.jboss.modcluster.load.metric
.impl.ReceiveTrafficLoadMetric" mode="On Demand">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:se
rvice=ReceiveTrafficLoadMetric",exposedInterface=org.jboss.modcluster.load.me
tric.LoadMetricMBean.class)</annotation>
<constructor>
<parameter class="org.jboss.modcluster.load.metric.impl.RequestProcessorL
oadMetricSource"><inject bean="RequestProcessorLoadMetricSource"/></parameter
>
</constructor>
<property name="capacity">1024</property>
</bean>
<bean name="RequestProcessorLoadMetricSource" class="org.jboss.modcluster.loa
d.metric.impl.RequestProcessorLoadMetricSource" mode="On Demand">
<constructor>
<parameter class="javax.management.MBeanServer"><inject bean="JMXKernel"
property="mbeanServer"/></parameter>
</constructor>
</bean>
4. SendT rafficLoadMetric
Returns the outgoing request traffic in KB/sec
Requires an explicit capacity
Uses RequestProcessorLoadMetricSource to query request processors
Analogous to method=T in mod_jk
For example:
53
5. RequestCountLoadMetric
Returns the number of requests/sec
Requires an explicit capacity
Uses RequestProcessorLoadMetricSource to query request processors
Analogous to method=R in mod_jk
For example:
<bean name="RequestCountLoadMetric" class="org.jboss.modcluster.load.metric.i
mpl.RequestCountLoadMetric" mode="On Demand">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:se
rvice=RequestCountLoadMetric",exposedInterface=org.jboss.modcluster.load.metr
ic.LoadMetricMBean.class)</annotation>
<constructor>
<parameter class="org.jboss.modcluster.load.metric.impl.RequestProcessorL
oadMetricSource"><inject bean="RequestProcessorLoadMetricSource"/></parameter
>
</constructor>
<property name="capacity">1000</property>
</bean>
54
2. SystemMemoryUsageLoadMetric
Returns system memory usage
Requires com.sun.management.OperatingSystemMXBean (available in Sun's JDK or
OpenJDK)
Uses OperatingSystemLoadMetricSource to generically read attributes
For example:
<bean name="SystemMemoryUsageLoadMetric" class="org.jboss.modcluster.load.met
ric.impl.SystemMemoryUsageLoadMetric" mode="On Demand">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:se
rvice=SystemMemoryUsageLoadMetric",exposedInterface=org.jboss.modcluster.load
.metric.LoadMetricMBean.class)</annotation>
<constructor>
<parameter><inject bean="OperatingSystemLoadMetricSource"/></parameter>
</constructor>
</bean>
3. HeapMemoryUsageLoadMetric
Returns the heap memory usage as a percentage of max heap size
For example:
<bean name="HeapMemoryUsageLoadMetric" class="org.jboss.modcluster.load.metri
c.impl.HeapMemoryUsageLoadMetric" mode="On Demand">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:se
rvice=HeapMemoryUsageLoadMetric",exposedInterface=org.jboss.modcluster.load.m
etric.LoadMetricMBean.class)</annotation>
</bean>
55
T his application can be used to demonstrate how different worker-side scenarios impact the routing
decisions of the proxy server.
56
Result
T he demonstration starts, and the Load Balancing Demonstration window opens. Proceed to
T ask: Configure Client Control T ab Fields
57
58
Session Life
Number of seconds a client thread should use a session before invalidating or abandoning it.
T his 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 T imeout
T he number of seconds a session can remain unused before the worker node can expire and
remove the session.
Deselecting Invalidate and setting a high value relative to session life causes a
significant number of unused sessions to accumulate on the server.
Num T hreads
Number of client threads to launch. Each thread repeatedly makes requests until the Stop
button is pressed, or a request receives a response other than HT T P 200.
Sleep T ime
Number of milliseconds that client threads should sleep between requests.
Startup T ime
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.
Prerequisites
Complete T ask: Start the Demo before continuing with this task.
59
T his section shows you how to configure and start using the demo.
T ask: Interact with the Demonstration
Complete this task to test the effects of changing load-balancing parameters.
Prerequisites
Complete T ask: Start the Demo.
Complete T ask: Configure Client Control T ab Fields.
1. Click on the Request Balancing tab to see how many requests are going to each of the
worker nodes.
2. Click on the Session Balancing tab to see how many active sessions are being hosted by
each of the worker nodes.
3. Stop some of the worker nodes, or undeploy load-dem o.war, and observe the effect that this
has on request and session balancing.
4. Restart some of the worker nodes, or re-deploy the load-dem o.war to some of the workers,
and observe the effect that this has on request and session balancing.
5. Experiment with adding artificial load to one or more worker nodes and observe the effects on load
and session balancing. (See Section 12.3.1, Generate artificial load for details.)
60
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.
2. If the 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. (T he
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:DefaultDS datasource
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 T raffic
Generates server traffic receipt load by POST ing a large byte array to the server once
per second for a set time.
Server Send T raffic
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
Z ero or more parameters to pass to the specified load creation servlet, for example, Number of
Connections and Duration, as seen in the screenshot. T he parameters displayed, their name,
and their meaning depend on the selected Load Creation Action. T he label for each parameter
includes a tooltip that explains its use.
61
62
63
64
Add a unique jvm Route value, as shown. T his value is the identifier for this node in the
cluster.
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="worker-01">
65
T his property controls whether special session handling is used to coordinate with mod_jk and
other connector variants. Set this property to true in both worker nodes:
<property name="useJK">true</property>
Note
T he ISAPI Filters tab now displays the jboss filter status and priority as Unknown
because IIS has not yet received requests for the resource. T he status and priority will
change to Loaded and High respectively once a request is executed.
T ask: Define ISAPI Virtual Directory
Complete this task to define the ISAPI virtual directory using the IIS management console.
66
1. Right click on Default Web Site, and then click New Add Virtual Directory .
T he Add Virtual Directory window opens.
2. Specify the following values in the Add Virtual Directory window:
Alias:
Specify jboss (exactly as written).
Physical path:
Specify NATIVE\sbin\ .
3. Click OK to save the values and close the Add Virtual Directory window.
4. In the tree view pane, expand Web Sites Default Web Site .
5. Right click on the jboss virtual directory, and then click Properties .
6. Click the Virtual Directory tab, and make the following changes:
Execute Permissions:
Select Scripts and Executables .
Read check box:
Select to activate Read access.
7. Click OK to save the values and close the jboss Properties window.
T ask: Define ISAPI Web Service Extension
Complete this task to define the ISAPI web service extension using the management console.
1. Click Web Service Extensions, and in the T asks group select Add a new Web service
extension.
T he New Web Service Extension window opens.
2. Add the following values to the New Web Service Extension window:
Extension name:
Specify jboss (exactly as written).
Required files:
Specify the path NATIVE\sbin\isapi_redirect.dll .
Set extension status to Allowed:
Select the check box.
3. Click OK to save the values and close the New Web Service Extension window.
4. Confirm the jboss Web Service Extension displays in the list.
67
Note
T he ISAPI and CGI Restrictions Features View now displays the jboss restriction
and path.
T ask: Define a JBoss Native Virtual Directory
Complete this task to define a virtual directory for the JBoss Native binary using the management
console.
1. Right click on Default Web Site, and then click Add Virtual Directory .
T he Add Virtual Directory window opens
2. Specify the following values in the Add Virtual Directory window:
Alias:
68
69
Note
T his task does not provide instructions for load-balancing or server outage fail over. Refer to
Section 14.6, Configure a load-balancing cluster with ISAPI for configuration instructions.
Prerequisites
Complete the relevant Microsoft IIS clustering setup procedure. Refer to Section 14.3, Microsoft IIS 6
initial clustering configuration or Section 14.4, Microsoft IIS 7 initial clustering configuration for more
information.
T he following steps assume that the C:\connectors directory is used to store logs, properties
files, and NSAPI locks.
Important
T he isapi_redirect.properties file must be in the same directory as the
isapi_redirect.dll file.
Append the following configuration block to isapi_redirect.properties:
# Configuration file for the ISAPI Redirector
# Extension uri definition
extension_uri=/jboss/isapi_redirect.dll
# Full path to the log file for the ISAPI Redirector
log_file=c:\connectors\isapi_redirect.log
# Log level (debug, info, warn, error or trace)
# Use debug only testing phase, for production switch to info
log_level=debug
# Full path to the workers.properties file
worker_file=c:\connectors\workers.properties
# Full path to the uriworkermap.properties file
worker_mount_file=c:\connectors\uriworkermap.properties
#Full path to the rewrite.properties file
rewrite_rule_file=c:\connectors\rewrite.properties
70
5. Restart IIS
Restart your IIS server to implement the changes. Execute the following commands for the IIS
version you are running:
IIS 6
C:\> net stop iisadmin /Y
C:\> net start w3svc
71
IIS 7
C:\> net stop was /Y
C:\> net start w3svc
Important
T he isapi_redirect.properties file must be in the same directory as the
isapi_redirect.dll file.
Append the following configuration block to the file:
72
73
T he worker.properties file contains mapping definitions between worker labels and server
instances. Append the following lines to the file.
# The advanced router LB worker
worker.list=router,status
#
#
#
#
#
#
#
First EAP server definition, port 8009 is standard port for AJP in EAP
lbfactor defines how much the worker will be used.
The higher the number, the more requests are served
lbfactor is useful when one machine is more powerful
ping_mode=A all possible probes will be used to determine that
connections are still working
worker.worker01.port=8009
worker.worker01.host=127.0.0.1
worker.worker01.type=ajp13
worker.worker01.ping_mode=A
worker.worker01.socket_timeout=10
worker.worker01.lbfactor=3
# Second EAP server definition
worker.worker02.port=8009
worker.worker02.host= 127.0.0.100
worker.worker02.type=ajp13
worker.worker02.ping_mode=A
worker.worker02.socket_timeout=10
worker.worker02.lbfactor=1
# Define the LB worker
worker.router.type=lb
worker.router.balance_workers=worker01,worker02
# Define the status worker for jkmanager
worker.status.type=status
Note
For an explanation of workers.properties directives, refer to Appendix A, Reference:
workers.properties.
5. Restart IIS
Restart your IIS server to implement the changes. Execute the following commands for the IIS
version you are running:
IIS 6
C:\> net stop iisadmin /Y
C:\> net start w3svc
IIS 7
C:\> net stop was /Y
C:\> net start w3svc
74
75
76
77
Add a unique jvm Route value, as shown. T his value is the identifier for this node in the
cluster.
78
T his property controls whether special session handling is used to coordinate with mod_jk and
other connector variants. Set this property to true in both worker nodes:
<property name="useJK">true</property>
79
invoker
jsp
<!-- ==================== Built In Servlet Mappings ===================== ->
<!-- The servlet mappings for the built in servlets defined above. -->
<!-- The mapping for the default servlet -->
<!--servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping-->
<!-- The mapping for the invoker servlet -->
<!--servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping-->
<!-- The mapping for the JSP servlet -->
<!--servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping-->
T hese lines define the location of the nsapi_redirector.so module used by the jk_init
and jk_service functions, and the location of the workers.properties file, which defines the
worker nodes and their attributes.
Note
T he lib directory in the NATIVE/lib/nsapi_redirector.so path applies only to 32bit machines. On 64-bit machines, this directory is called lib64 .
80
from="/status" name="jknsapi"
from="/images(|/*)" name="jknsapi"
from="/css(|/*)" name="jknsapi"
from="/nc(|/*)" name="jknsapi"
from="/jmx-console(|/*)" name="jknsapi"
You can map the path of any application deployed on your JBoss Enterprise Platform instance in
this obj.conf file. In the example code, the /nc path is mapped to an application deployed under
the name nc.
2. Define the worker that serves each path
Edit the SJWS/PROFILE/config/obj.conf file and add the following jknsapi Object definition
after the default Object definition.
<Object name="jknsapi">
ObjectType fn=force-type type=text/plain
Service fn="jk_service" worker="worker01" path="/status"
Service fn="jk_service" worker="worker02" path="/nc(/*)"
Service fn="jk_service" worker="worker01"
</Object>
T his jknsapi Object defines the worker nodes used to serve each path that was assigned to
nam e="jknsapi" in the default Object.
In the example code, the third Service definition does not specify a path value, so the worker
node defined (worker01) serves all of the paths assigned to jknsapi by default. In this case,
the first Service definition in the example code, which assigns the /status path to worker01, is
superfluous.
3. Define the workers and their attributes
Create a workers.properties file in the location you defined in Step 2.
Define the list of worker nodes and each worker node's properties in this file:
81
from="/status" name="jknsapi"
from="/images(|/*)" name="jknsapi"
from="/css(|/*)" name="jknsapi"
from="/nc(|/*)" name="jknsapi"
from="/jmx-console(|/*)" name="jknsapi"
from="/jkmanager/*" name="jknsapi"
You can map the path of any application deployed on your JBoss Enterprise Platform instance in
this obj.conf file. In the example code, the /nc path is mapped to an application deployed under
82
this obj.conf file. In the example code, the /nc path is mapped to an application deployed under
the name nc.
2. Define the worker that serves each path
Open SJWS/PROFILE/config/obj.conf and add the following jknsapi Object definition after
the default Object 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>
T his jknsapi Object defines the worker nodes used to serve each path that was assigned to
nam e="jknsapi" in the default Object.
3. Define the workers and their attributes
Create SJWS/PROFILE/config/workers.properties.
Define the list of worker nodes and each worker node's properties in this file:
Note
For an explanation of workers.properties directives, refer to Appendix A, Reference:
workers.properties
83
84
85
86
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<distributable/>
</web-app>
You can further configure session replication using the replication-config element in the jbossweb.xm l file. However, the replication-config element only needs to be set if one or more of the
default values described below is unacceptable. All of the configuration elements are optional, and can
be omitted if the default value is acceptable.
Here is an example:
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<replication-config>
<cache-name>custom-session-cache</cache-name>
<replication-trigger>SET</replication-trigger>
<replication-granularity>ATTRIBUTE</replication-granularity>
<replication-field-batch-mode>true</replication-field-batch-mode>
<use-jk>false</use-jk>
<max-unreplicated-interval>30</max-unreplicated-interval>
<snapshot-mode>INSTANT</snapshot-mode>
<snapshot-interval>1000</snapshot-interval>
<session-notificationpolicy>com.example.CustomSessionNotificationPolicy</session-notification-policy>
</replication-config>
</jboss-web>
<replication-trigger>
element determines when the container should consider that session data must be replicated
across the cluster. T he rationale for this setting is that after a mutable object stored as a
session attribute is accessed from the session, in the absence of a 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. T his 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 only been accessed and not modified. T his 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
m ax_unreplicated_interval to 0 accomplishes the same thing at much lower cost, using
SET _AND_GET makes no sense with JBoss Enterprise Application Platform 5 or JBoss
Enterprise Web Platform 5.
SET _AND_NON_PRIMIT IVE_GET is conservative but will only replicate if an object of a nonprimitive type has been accessed (in effect, the object is not of a well-known immutable JDK
87
type such as Integer, Long, String, etc.) T his is the default value.
SET assumes that the developer will explicitly call setAttribute on the session if the data
needs to be replicated. T his setting prevents unnecessary replication and can have a major
beneficial impact on performance, but requires very good coding practices to ensure
setAttribute is always called whenever a mutable object stored in the session is modified.
In all cases, calling setAttribute marks the session as needing replication.
<cacheName>
Specifies the name of the JBoss Cache configuration that should be used for storing
distributable sessions and replicating them around the cluster. T his 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. T he default
value is standard-session-cache. See Section 17.3, Configure 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. T his is applicable only if replication-granularity is FIELD. If
replication-field-batch-m ode is set to true, fine-grained changes made to objects
stored in the session attribute map will replicate only when the HT T P request is finished;
otherwise they replicate as they occur. Setting this to false is not advised because it
increases the number of replication requests and the chance of session state being out of
sync. Default is true.
FIELD Deprecated
T he FIELD granularity option is now deprecated as JBoss Cache, which provides this
feature, is to be subsituted by Infinispan (Infinispan does not support this granularity).
<useJK>
Specifies whether the container should assume that a JK-based software load balancer (for
example,. 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 the jvm Route portion of the session ID if it detects a failover.
You need only set this to false for 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 will not incorrectly expire an unreplicated
session upon failover. It also results in correct values for
88
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 appropriate ClusteredSessionNotificationPolicy
gives the application author fine-grained control over what notifications are issued.
89
</jboss-web>
max-active-sessions
Determines the maximum number of active sessions allowed. If the number of sessions managed by
the session manager exceeds this value and passivation is enabled, the excess will be passivated
based on the configured passivation-m in-idle-tim e. 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.
90
T he total number of sessions in memory includes sessions replicated from other cluster nodes that
are not being accessed on this node. T ake this into account when setting m ax-active-sessions.
Whether or not buddy replication is enabled will also affect the number of sessions replicated from
other nodes.
Say, for example, that you have an eight node cluster, and each node handles requests from 100
users. With total replication, each node would store 800 sessions in memory. With buddy replication
enabled, and the default num Buddies setting (1), each node will store 200 sessions in memory.
use-session-passivation
Determines whether session passivation will be enabled for the web application. Default is false.
passivation-min-idle-time
Determines 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 m ax-active-sessions. A value of -1 (the default) disables passivating sessions
before passivation-m ax-idle-tim e. Neither a value of -1 nor a high value are recommended if
m ax-active-sessions is set.
passivation-max-idle-time
Determines 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 m ax-active-sessions. Should be less
than the session-tim eout setting in web.xm l . A value of -1 (the default) disables passivation
based on maximum inactivity.
17.3. Configure the JBoss Cache instance used for session state
replication
T he container for a distributable web application makes use of JBoss Cache to provide HT T P session
replication services around the cluster. It integrates with the CacheManager service to obtain a
reference to a JBoss Cache instance. For more information, refer to the Distributed Caching with JBoss
Cache and JBoss Cache Configuration and Deployment chapters in the Administration and Configuration
Guide
T he name of the JBoss Cache configuration to use is controlled by the cacheNam e element in the
application's jboss-web.xm l (see Section 17.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.
T he JBoss Cache configurations in the CacheManager service expose a number of options.
T he 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:
cacheMode
T he 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. T he alternative mode, REPL_SYNC, offers a greater degree of confirmation
that session state has been received, but reduces performance significantly.
enabled property in the buddyReplicationConfig section
Set to true to enable buddy replication. Default is false.
numBuddies property in the buddyReplicationConfig section
91
Set 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.
buddyPoolName property in the buddyReplicationConfig section
A 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.
multiplexerStack
Name of the JGroups protocol stack the cache should use.
clusterName
Identifying 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.
If you wish to use a completely new JBoss Cache configuration rather than editing one of the existing
ones, refer to Deployment via the CacheManager Service section in the Administration and Configuration
Guide .
92
93
Important
Note that it is not recommended to add the manager definition to the jboss-web.xm l file,
although it is the standard web application deployment descriptor. T he goal of using the
context.xm l file instead is to avoid any unnecessary changes to the existing JBoss
Application Server code.
2. In the context.xm l file, add the Manager element and its attributes:
className
fully-qualified class name of the session manager implementation
dataSourceJndiName
datasource that allows the session manager to communicate with the database that
stores the web sessions
Note
T he className and dataSourceJndiName are compulsory attributes. You can also define
further Context and Manager attributes (refer to Section 18.1,
DataSourcePersistentManager Configuration Attributes.
Configuring Database and Datasource
Create the database session table, which will hold the web session data and then create the respective
datasource:
1. Create the web session ( httpsessions ) database table:
You can change the name of the table and of the columns; however, make sure to configure the
DataSourcePersistentManager attributes appropriately.
Individual columns must be able to store values of particular datatypes:
creationtime and lastaccess : java long values
maxinactive and version : java int value
metadata : serialized java objects (currently not used)
attributes : serialized java objects (stores the session attributes map; should be large enough
to store your largest sessions)
primary key : synthetic primary key (optional, make sure there is a UNIQUE INDEX on app + id).
T he following command creates the table with default settings in the most common databases
(MySQL, IBM DB2, Oracle Database):
94
95
sessionIdCol
name of the column with the core, immutable part of a session ID (by default id; this and the
sessionAppCol columns form the unique index for the table)
sessionFullIdCol
name of the column with the full session ID (including any mutable element added to the core
session ID, for example a jvmRoute; by default fullid)
sessionCreationT imeCol
name of the column with the time when the session was created (of the long datatype, by
default creationtim e)
sessionMaxInactiveCol
name of the column with the maximum number of milliseconds the session can remain
unaccessed before expiring (by default m axinactive)
sessionVersionCol
name of the column which stores the session's "version" (session version is incremented each
time the session is persisted; by default version)
sessionLastAccessedCol
name of the column with the timestamp of the last session access (take the long data type
value; by default lastaccess)
sessionNewCol
Name of the column with the flag indicating whether the session is new (session is considered
new if it was not yet joined by the client; by default isnew
sessionValidCol
name of the column with the flag indicating whether the session is valid (by default isvalid
sessionMetadataCol
name of the column which can store serialized metadata about the session (currently unused;
by default m etadata
sessionAttributeCol
name of the column with the serialized session attribute map (by default attributes)
96
A session is abandoned if the only server that was handling the session requests was shut
down before the session expired, no further requests for the session were received so that the
session did not fail over to another server. Such session do not expire on the normal session
expiration checks. T herefore a special process runs periodically to clean the session from the
database.
replicationT riggerString
activity executed during a request that makes the session database persistent (the activity with
the replication-trigger property SET )
maxUnreplicatedInterval
maximum interval between requests, in seconds, after which the session's timestamp is
persisted regardless of whether the request caused the session to become dirty in any other
way
useJK
flag determining whether the container assumes a JK-based software load balancer is used for
load balancing (if set to true, the container examines the session ID associated with every
request and replace the jvmRoute portion of the session ID if it detects a failover)
maxActiveAllowed
maximum number of active sessions
useSessionPassivation
flag for enabling/disabling session passivation (session is removed from memory but remains
always in the persistent store)
passivationMinIdleT ime
minimum time, in seconds, a session must be inactive before passivated
passivationMaxIdleT ime
maximum time, in seconds, a session can be inactive before passivated
processExpiresFrequency
frequency at which the background process thread calls the session manager to perform
background processes (for example, expire or passivate sessions; (by default, every 10
seconds)
T his configuration is defined as value N with the background cleanup process called 1 in N
callings to the session manager. Default is 1, that is, the cleanup process is performed every
time the manager is called by the background process, that is cleanup is performed every 10
seconds. For example, if set to 6, the manager performs the cleanup once a minute (1/6, that is
once in 60 seconds).
sessionNotificationPolicy
fully qualified class name of the implementation of the ClusteredSessionNotificationPolicy
97
interface that is used to govern whether servlet specification notifications is emitted to any
registered HttpSessionListener, HttpSessionAttributeListener or HttpSessionBindingListener.
98
19.1. Configuration
T o enable clustered single sign-on, you must add the ClusteredSingleSignOn valve to the
appropriate Host elements of the
JBOSS_HOME/server/PROFILE/deploy/jbossweb.sar/server.xm l file. T he valve element is
already included in the standard file; you just need to uncomment it. T he valve configuration is shown
here:
Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn" /
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 of cacheConfig, an attempt to locate an MBean registered
in JMX under this ObjectName will be made. Default value is
jboss.cache:service=T om catClusteringCache.
cookieDomain is used to set the host domain to be used for SSO cookies. See Section 19.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. T he clustered SSO valve tracks which cluster nodes are managing sessions related to
an SSO. When a node is shutdown, all local copies of a session are invalidated. If a further user
request is made within the time specified by maxEmptyLife, the request will fail over to another
cluster node, activating the backup copy of the session. If maxEmptyLife is set to 0, the SSO valve
terminates together with the local session copies. Default is 1800, (30 minutes).
processExpiresInterval is the minimum number of seconds between efforts by the valve to find
and invalidate SSOs that have exceeded their maxEmptyLife. Does not imply effort will be spent on
such cleanup every processExpiresInterval, just that it will not 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)
99
to the security
. If true, this valve uses cached security credentials (username and password)
to reauthenticate to the JBoss Web security Realm for 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 to true can allow web applications with different
security-dom ain configurations to share an SSO. Default is false.
19.3. Limitations
T here are a number of known limitations to this T omcat valve-based SSO implementation:
Only useful within a cluster of EAP instances; SSO does not propagate to other resources.
Requires use of container-managed authentication (via login-config element in web.xm l).
Requires cookies. SSO is maintained via a cookie and URL rewriting is not supported.
Unless requireReauthentication is set to true, all web applications configured for the same
SSO valve must share the same JBoss Web Realm and JBoss Security security-dom ain. T his
means:
In server.xm l you can nest the Realm element inside the Host element (or the surrounding
Engine element), but not inside a context.xm l packaged with one of the involved web
applications.
T he security-dom ain configured in jboss-web.xm l or jboss-app.xm l must be
consistent for all of the web applications.
Even if you set requireReauthentication to true and use a different security-dom ain
(or, less likely, a different Realm ) for different webapps, the varying security integrations must all
accept the same credentials (for example,. username and password).
100
servers in a cluster or the virtual host with which they are associated could have multiple aliases. T his
can be supported with the following configuration:
Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn"
cookieDomain="xyz.com" /
101
slotmem_module modules/mod_slotmem.so
manager_module modules/mod_manager.so
proxy_cluster_module modules/mod_proxy_cluster.so
advertise_module modules/mod_advertise.so
Listen 127.0.0.1:6666
<VirtualHost 127.0.0.1:6666>
<Directory />
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
KeepAliveTimeout 60
MaxKeepAliveRequests 0
ManagerBalancerName mycluster
ServerAdvertise On
AdvertiseFrequency 5
</VirtualHost>
<Location /mod_cluster-manager>
SetHandler mod_cluster-manager
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
102
<bean name="WebServer"
class="org.jboss.web.tomcat.service.deployers.TomcatService">
<!-- ... -->
<depends>ModClusterService</depends><!-- Non-clustered mode -->
<!--depends>HAModClusterService</depends--><!-- Clustered mode -->
<!-- ... -->
</bean>
103
Reference: workers.properties
Apache HT T P Server worker nodes are Servlet containers that are mapped to the mod_jk load
balancer. T he worker nodes are defined in HTTPD_DIST/conf/workers.properties. T his file
specifies where the different Servlet containers are located, and how calls should be load-balanced
across them.
T he workers.properties file contains two sections:
Global Properties
T his section contains directives that apply to all workers.
Worker Properties
T his section contains directives that apply to each individual worker.
Each node is defined using the Worker Properties naming convention. T he worker name can only
contain alphanumeric characters, limited to [a-z][A-Z ][0-9][_\-].
T he structure of a Worker Property is worker.worker_name.directive.
worker
T he constant prefix for all worker properties.
worker_name
T he arbitrary name given to the worker. For example: node1, node_01, Node_1.
directive
T he specific directive required.
Note
For the full list of worker.properties configuration directives, refer directly to the Apache
T omcat Connector - Reference Guide
worker.properties Global Directives
worker.list
Specifies the list of worker names used by mod_jk. T he workers in this list are available to map
requests to.
104
Reference: workers.properties
Note
A single node configuration, which is not managed by a load balancer, must be set to
worker.list=[worker name].
105
P (prepost)
Specifies the connection is probed before sending each request to the server. You
specify the timeout using the prepost_timeout directive, otherwise the value for
ping_timeout is 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_interval
directive, otherwise the value for ping_timeout is used.
A (all)
T he most common setting, which specifies all directive flags are applied. For
information about the *_timeout advanced directives, refer directly to Apache T omcat
Connector - Reference Guide.
ping_timeout
Specifies the time to wait for CPong answers to a CPing connection probe (refer to ping_mode).
T he default value is 10000 (milliseconds).
106
Reference: workers.properties
107
108
ping
T ime to wait (in seconds) for a pong answer to a ping. Default is 10.
smax
Specifies the soft maximum idle connection count. T he maximum value is determined by the
httpd thread configuration ( T hreadsPerChild or 1 ).
ttl
Specifies the time (in seconds) idle connections persist, above the sm ax threshold. Default is
60.
nodeT imeout
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. T he
connectiontim eout value used by mod_cluster is the ping value. Default is -1.
balancer
Specifies the name of the load-balancer. Default is m ycluster.
domain
Optional parameter, which specifies how load is balanced across jvmRoutes within the same
domain. dom ain is used in conjunction with partitioned session replication (for example,
buddy replication).
109
Revision history
Revision 5.2.0-103.4 00
Rebuild with publican 4.0.0
2013-10-30
Rdiger Landmann
Revision 5.2.0-103
T hu Jul 12 2013
Russell Dickenson
Incorporated changes for JBoss Enterprise Application Platform 5.2.0 GA. For information about
documentation changes to this guide, refer to Release Notes 5.2.0.
Revision 5.1.2-100
T hu Dec 8 2011
Jared Morgan
Incorporated changes for JBoss Enterprise Application Platform 5.1.2 GA. For information about
documentation changes to this guide, refer to Release Notes 5.1.2 .
Revision 5.1.1-100
Mon Jul 18 2011
Jared Morgan
Incorporated changes for JBoss Enterprise Application Platform 5.1.1 GA. For information about
documentation changes to this guide, refer to Release Notes 5.1.1 .
110