This table lists more advanced configuration options. Most of them only apply to
some types of workers. We use the abbreviations AJP for ajp13/ajp14 workers
used directly via the workers.list, LB for load balancer workers,
and SUB for the workers used indirectly in a load balancer worker
as a sub worker or member.
Directive | Worker Type | Default | Description |
---|
connect_timeout | AJP,SUB | 0 |
Connect timeout property told web server to send a PING request on ajp13 connection after
connection is established. The parameter is the delay in milliseconds to wait for the PONG reply.
The default value zero disables the timeout (infinite timeout).
This features has been added in jk 1.2.6 to avoid problem with hung Tomcat's and require ajp13
ping/pong support which has been implemented on Tomcat 3.3.2+, 4.1.28+ and 5.0.13+.
Disabled by default.
|
prepost_timeout | AJP,SUB | 0 |
Prepost timeout property told web server to send a PING request on ajp13 connection before
forwarding to it a request. The parameter is the delay in milliseconds to wait for the PONG reply.
The default value zero disables the timeout (infinite timeout).
This features has been added in jk 1.2.6 to avoid problem with hung Tomcat's and require ajp13
ping/pong support which has been implemented on Tomcat 3.3.2+, 4.1.28+ and 5.0.13+.
Disabled by default.
|
reply_timeout | AJP,SUB | 0 |
The parameter is the number of milliseconds to wait for success during a read event.
So this is not a timeout for the complete answer time of a request, but only
for the maximum time between two packets received from Tomcat. Usually the longest
pause is between sending the request and getting the first packet of the response.
If the timeout passes without any data received from Tomcat, the web server will
no longer wait for the rest of the response and send an error to the client (browser).
Usually this does not mean, that the request is also aborted on the Tomcat backend.
If the worker is a member of a load balancer, the load balancer might place the
worker into an error state and retry the request on another member.
See also max_reply_timeouts, retries and recovery_options.
By default (value zero) the web server will wait forever which could be an issue for you.
If you set a reply_timeout, adjust it carefully if you have long running servlets.
The reply_timeout can be overwritten using the Apache HTTP Server environment variable
JK_REPLY_TIMEOUT and the worker map extension for reply_timeout.
This features has been added in jk 1.2.6 to avoid problem with hung Tomcat's and
works on all servlet engines supporting ajp13.
The variable JK_REPLY_TIMEOUT and the worker map
extension have been added in version 1.2.27.
|
retries | AJP,SUB | 2 |
This directive also exists for load balancer workers.
For those it has a different meaning.
The maximum number of times that the worker will send a request to Tomcat
in case of a communication error. Each retry will be done over another
connection. The first time already gets counted, so retries=2 means
one retry after error. Before a retry, the worker waits for a configurable
sleeping time.
See also the attribute recovery_options for a more fine-grained control
of retries and retry_interval for the sleep time configuration.
Until version 1.2.16 the default value was 3.
|
retry_interval | AJP,SUB | 100 |
The amount of time in milliseconds the worker sleeps before doing any retry.
This features has been added in jk 1.2.27.
|
recovery_options | AJP,SUB | 0 |
Recovery options influence, how we should handle retries,
in case we detect a problem with Tomcat.
How often we will retry is controlled by the attribute retries.
This attribute is a bit mask. The following bits are allowed:
1: don't recover if Tomcat failed after getting the request
2: don't recover if Tomcat failed after sending the headers to client
4: close the connection to Tomcat, if we detect an error when writing back
the answer to the client (browser)
8: always recover requests for HTTP method HEAD (even if Bits 1 or 2 are set)
16: always recover requests for HTTP method GET (even if Bits 1 or 2 are set)
This features has been added in jk 1.2.6.
Option 4 has been added in version 1.2.16,
options 8 and 16 in version 1.2.24.
|
fail_on_status | AJP,SUB | 0 |
Set this value to the HTTP status code that will cause a worker to fail
if returned from Servlet container. Use this directive to deal with
cases when the servlet container can temporary return non-200 responses
for a short amount of time, e.g during redeployment.
The error page, headers and status codes of the original response will not be send back
to the client. Instead the request will result in a 503 response.
If the worker is a member of a load balancer, the member will
be put into an error state. Request failover and worker recovery will be handled
with the usual load balancer procedures.
This feature has been added in jk 1.2.20.
Starting with jk 1.2.22 it is possible to define multiple
status codes separated by space or comma characters.
For example: worker.xxx.fail_on_status=500,503
Starting with jk 1.2.25 you can also tell the load
balancer to not put a member into an error state, if a
response returned with one of the status codes in
fail_on_status. This feature gets enabled, by putting a minus sign in
front of those status codes.
For example: worker.xxx.fail_on_status=-404,-500,503
|
busy_limit | AJP,SUB | 0 |
If set to a positive number, the worker will only be used for a request,
if it is currently working on less than this number of concurrent requests.
Note that this is not related to the Busyness load balancing
method.
This feature is experimental and has been added in jk 1.2.41.
|
max_packet_size | AJP,SUB | 8192 |
This attribute sets the maximal AJP packet size in Bytes. It should be a
multiple of 1024. Configuration values that are not a multiple of 1024 will be
aligned to the next multiple of 1024. The maximum value is 65536. If you change
it from the default, you must also change the packetSize attribute of
your AJP connector on the Tomcat side! The attribute packetSize is available in
Tomcat 6.0.2 onwards.
Normally it is not necessary to change the maximum packet size. Problems
with the default value have been reported when sending certificates or
certificate chains.
This feature has been added in jk 1.2.19.
|
prefer_ipv6 | AJP,SUB | false |
When compiled with IPV6 support, this directive forces IPV6 address
resolution for host names which have both IPV6 and IPV4 addresses. In case there is
no IPV6 address defined for the given hostname this directive in ineffective. This directive will
be also ineffective if there is only IPV6 address defined or if IP address is used for "host",
either in IPV4 or IPV6 notation.
This feature has been added in jk 1.2.38.
|
secret | AJP,SUB,LB | - |
You can set a secret keyword on the Tomcat AJP Connector. Then only requests
from workers with the same secret keyword will be accepted.
Use attribute secret="secret key word" in your Tomcat AJP Connector configuration.
(Historical note: the attribute name was requiredSecret in Tomcat
9.0, 8.x, 7.0 versions released earlier than February 2020,
request.secret in Tomcat 6.0 and earlier.)
If you set a secret on a load balancer, all its members will inherit this secret.
This feature has been added in jk 1.2.12.
|
mount | AJP,LB | - |
Space delimited list of uri maps the worker should handle. It is only used,
if the worker is included in worker.list.
This directive can be used multiple times for the same worker.
|
max_reply_timeouts | LB | 0 |
If you use a reply_timeout for the members of a load balancer worker,
and you want to tolerate a few requests taking longer than reply_timeout,
you can set this attribute to some positive value.
Long running requests will still time out after reply_timeout milliseconds waiting for
data, but the corresponding member worker will only be put into an error state,
if more than max_reply_timeouts requests have timed out.
More precisely, the counter for those bad requests will be divided by two,
whenever the load balancer does its internal maintenance (by default every 60
seconds).
This features has been added in jk 1.2.24 to make reply_timeout less
sensitive for sporadic long running requests.
|
recover_time | LB | 60 |
The recover time is the time in seconds the load balancer will not try
to use a worker, after it went into error state. Only after this time has passed,
a worker in error state will be marked as in recovering, so that it will be
tried for new requests.
This interval is not checked every time a request is being processed.
Instead it is being checked during global maintenance. The time between two
runs of global maintenance is controlled by worker.maintain.
Do not set recover_time to a very short time unless you understand the implications.
Every recovery attempt for a worker in error is done by a real request!
|
error_escalation_time | LB | recover_time / 2 |
Setting a member of a load balancer into an error state is quite serious. E.g.
it means that if you need stickyness, all access to the sessions of the
respective node is blocked.
Some types of error detection do not provide a precise information, whether
a node is completely broken or not. In those cases an LB will not immediately
put the node into the error state. Only when there have been no successful
responses for error_escalation_time seconds after such an error,
will the node be put into error state.
This features has been added in jk 1.2.28.
|
session_cookie | LB | JSESSIONID |
The name of the cookie that contains the routing identifier needed for session stickyness.
The routing identifier is everything after a "." character in the value of the cookie.
This feature has been added in jk 1.2.27.
|
session_path | LB | ;jsessionid |
The name of the path parameter that contains the routing identifier needed for
session stickyness. The routing identifier is everything after a "." character in the value
of the path parameter.
This feature has been added in jk 1.2.27.
|
set_session_cookie | LB | false |
Activates generation of session stickyness cookies. Typically you don't need this.
Some web frameworks replace Tomcat session management and use a different way
of generating session IDs. As a consequence the routing ID added by Tomcat to the
end of the session ID is lost and we no longer can do sticky load balancing.
As a workaround you can use the following steps:
- Choose a non-standard cookie name using the "session_cookie" attribute.
- Activate cookie sending by setting the attribute "set_session_cookie" to true.
- Set the attribute "session_cookie_path" to the correct application URI, like
e.g. "/myapp/".
The cookie will only be send if the request does not already contain
a cookie of the same name, or that cookie does not contain a routing
ID which the load balancer can fulfill. Especially after a node failover
we will send a new cookie to switch stickyness to the new node.
This feature has been added in jk 1.2.38.
|
session_cookie_path | LB | - |
This attribute is only used if "set_session_cookie" is set to true.
See "set_session_cookie" for a description. If the value of "session_cookie_path"
is empty (default), then the send cookie will not contain a PATH information.
This feature has been added in jk 1.2.38.
|
activation | SUB | Active |
Using this directive, a balanced worker of a load balancer
can be configured as disabled or stopped. A disabled worker only gets
requests, which belong to sessions for that worker. A stopped
worker does not get any requests. Users of a stopped worker will
lose their sessions, unless session replication via clustering is used.
Use d or D to disable and s or S to stop.
If this directive is not present the deprecated directives
"disabled" or "stopped" are used.
This flag can be changed at runtime using status worker.
This feature has been added in jk 1.2.19.
|
route | SUB | worker name |
Normally the name of a balanced worker in a load balancer is equal to the jvmRoute
of the corresponding Tomcat instance. If you want to include a worker corresponding
to a Tomcat instance into several load balancers with different balancing configuration
(e.g. disabled, stopped) you can use this attribute.
Define a separate worker per lb and per Tomcat instance with an arbitrary worker name and
set the route attribute of the worker equal to the jvmRoute of the target Tomcat instance.
If this attribute is left empty, the name of the worker will be used.
This attribute can be changed at runtime using status worker.
If the route name contains a period, the part before the first period will be
used as domain name, unless domain is set explicitly.
This feature has been added in jk 1.2.16.
The automatic domain rule has been added in jk 1.2.20.
The attribute has been renamed from jvm_route to route in jk 1.2.20.
|
distance | SUB | 0 |
An integer number to express preferences between
the balanced workers of an lb worker.
A load balancer will never choose some balanced worker
in case there is another usable worker with lower distance.
Only in case all workers below a given distance are in error, disabled or stopped,
workers of a larger distance are eligible for balancing.
This feature has been added in jk 1.2.16.
|
domain | SUB | - |
Domain directive can be used only when the worker is a member of the load balancer.
Workers that share the same domain name are treated as single worker. If sticky_session
is used, then the domain name is used as session route.
This directive is used for large system with more then 6 Tomcats, to be able
to cluster the Tomcats in two groups and thus lowering the session replication
transfer between them.
This feature has been added in jk 1.2.8.
|
redirect | SUB | - |
Set to the name of the preferred failover worker. If worker matching
SESSION ID is in error state then the redirect worker will be used instead.
It will be used even if being disabled, thus offering hot standby.
If you explicitly set a route via the "route" attribute, you must set "redirect"
to this route of the preferred failover worker and not to its name.
This feature has been added in jk 1.2.9.
|