Apache Software Foundation | Jakarta Project | Apache Tomcat
Intro

Each component instance has a name, that is used for configuration and at runtime. Each component has a number of configurable properties. The following rules are used:

  • The name is composed from the type and a local part, separated with a ':' ( example: channel.unixsocket:/tmp/jk.socket )
  • The 'type' consist of '.' and ascii characters. It is mapped to a JMX 'domain'.
  • The local part consists of ascii characters and .:/;
  • The property is a simple name, with no dots.
  • A simple form of substitution is used in values, where $(property) will be replaced with a previously defined setting. If the property has ':' in it, it'll take the value from the object, if not it'll take the value from a global map.


Common properties

Common properties for all components

Property name Default Description
disabled 0 (false) "disabled" state for the component, 1=true 0=false
debug 0 (false) Debug level for the component, 0=disabled, 1..10 enabled. Higher levels generate more debug.
version 0 'Generation' of the component config. Important for runtime reconfiguration. If you edit the config file or set the shmem properties, you need to also upgrade the version of the modified component. The config layer will detect the change and call the setter method.


workerEnv

This component represent the core jk2, it has the default logger for all other components. Is the central controller, it controls global properties and provides access to all other objects

Property name Default Description
logger logger Default loger used by jk2 components, can be changed in the config file, normally it defaults to "logger" the Alias for the default logger for the Server/platform.
timing 0 Will jk2 get request timing (needs APR?)


config

The config component, hold the detail of the conifg system, such config file name, create global defines

Property name Default Description
file ${serverRoot}/conf/workers2.properties Location of the workers2.properties file
debug 0 Set the debug level of the config component
debugEnv 0 Set the debug level of the hidden env component


uriMap

shm

Shared memory descriptor

Property name Default Description
file No default value Name of the file that will be mmapped to use as shared memory.
size No default value Size of the file.


uri

A uri stores a pattern that is used to match requests to workers, and asociated properties

If the uri name doesn't have a slash then it is considered as a virtual host directive. Uri name can have a virtual host name and(or) port associated with. Format of such a name is hostname or hostname:port where hostname is virtual server name and the port is vitual server port number. The port number is used only for the non default server ports.

Special case is a default server named as [uri:*] that is used when the virtual host cannot be found inside the configuration. All the uri directives not containing host name belongs to this default server making global mappings.

Addition wild char scheme id [uri:*:port] that is used when you wish to match any virtual host having specified (non-default) port number, like [uri:*:443]. This will map all the virtual hosts no mather what is their name but that have port number 443.

The order how the host names are resolved is :

  • Exact host name and optional non default port number
  • Alias matching host name and port number
  • *:port if the port is other then default
  • Default server

Property name Default Description
group lb:0 (The default loadbalancer) Name of the tomcat group or worker that will process the request corresponding to the uri. This used to be called 'worker'
context the context path for this uri component (webapp style).
servlet Servlet path for this mapping
alias server name alias. This setting should only be used for host uris like [uri:myHost:myPort] ( i.e. no /)


vm

Represents the JVM when used as inprocess container

Property name Default Description
JVM (Autoguess) JVM to use for this vm
OPT Option to pass to this vm, this is a multivalued property
classpath -Djava.class.path 0ption to pass to this vm, this is a multivalued property


channels

A channel represents a transport protocol, connecting 2 sides for RPC communication. The most common and standard is the tcp socket. Other important channels are unix socket and jni

channel.un

AF_UNIX socket. Only on UNIX like platform. These sockets are faster than "normal" sockets but they are limited to the machine.

Property name Default Description
file Name of socket Name of the socket file (It is created by the Tomcat ChannelUn)


channel.socket

Defines a communication transport to a remote Servlet Engine.

The name of the channels should be: channel.socket:HOST:PORT, where HOST and PORT are the tomcat Ajp location. You could use other names and explicitely set HOST and PORT, but this is discouraged. In most cases, you don't need to set any other config - just add a line like [channel.socket:localhost:8009] and all other things will have good defaults.

Tomcat Engine must be set with jvmRoute="HOST:PORT", to match the default tomcatId of the channel.

Property name Default Description
port extracted from the component name Port where Tomcat is listening. It is automatically extracted from the name - you shouldn't have to specify it explicitely.
host extracted from the component name Remote host. You should use the name, no need to override it
graceful 0 If 1, only requests for existing sessions will be forwarded
keepalive 0 ?
lbfactor 1 Load balancing factor to use. At this moment, it'll be set on the worker, but in future it should be possible to use lb on a channel level.
group lb loadbalanced groups to which this channel and the associated worker will be added, multivalued. You need to set it only if you have an advanced setup with multiple clusters.
tomcatId Automatically set to the localname ( host:port ) Must match the JVM route on tomcat Engine, for load balancing


channel.apr

A communication transport to a remote Engine using APR library Magic: The local part of the name will be the Engine name, to use when defining the uri mappings. For example channel.apr.local_9009 will automatically define an engine named local_9009, and if no other setting is set ajp13 will be used for communication. Magic: If no channel is defined in the config, a default channel will be constructed with port=8009, engine=DEFAULT, worker=ajp13 - named 'channel.apr.DEFAULT'

Property name Default Description
port 8009 Port where Tomcat is listening
host localhost Remote host
keepalive 0 (disabled) If set to 1 then it enables the use of keep-alive packets on TCP connection
timeout 0 (infinite) Socket timeout for sending and receiving
ndelay 0 If set to 1 Disables the Nagle algorithm for send coalescing
lbfactor 1 Load balancing factor to use. At this moment, it'll be set on the worker, but in future it should be possible to use lb on a channel level.
group lb:0 loadbalanced groups to which this channel and the associated worker will be added, multivalued


channel.jni

The jni channel, used if tomcat is started inprocess



workers

For the moment 4 worker types are supported: worker.jni,ajp13,status,lb.

worker.jni

worker used in inprocess, holds the details of the Tomcat class to startup, and parameters to pass

There are two predefined jni workers onStartup and onShutdown . Those two workers are executed during startup and shutdown phase of the connector. Both must exists in the configuration to be able to start and shutdown Tomcat.

Property name Default Description
class org/apache/jk/apr/TomcatStarter class that holds the main method called to start tomcat
ARG Arguments to pass to main method when called
stdout NULL file to redirect Standard output from the java process
stderr NULL file to redirect Standard output from the java process


ajp13

Default worker

Property name Default Description
secretkey NULL Magic: The secret key will be set automatically on the associated worker.
tomcatId
route
group
level
channel
max_connections 0 (unlimited) Maximum number of currently used endpoints. If the specified number is reached then the load balancer has the chance to try another worker. This is very useful in situations when having multiple servers and you wish to finer grade the lb_factor.


status

Worker that outputs a page with usefull information to monitor JK2

To use it add a uri component assigned to this worker


lb

Loadbalanced worker

Property name Default Description
worker
noWorkerMsg
noWorkerCode 503
hwBalanceErr
timeout 0 (disabled) If all the workers are in the error state, probably by Tomcat refusing any new connections due to the overload, you can set the timeout forcing lb to wait that some worker becomes available, instead of immediately returning error to the client. This is very useful in situations with high peek load. The timeout should be set to the maximum application call time, but not less then 1 second.
attempts 3 Number of attempts that lb will try on each worker before giving up.
recovery 60 (seconds) Time to wait before retrying to see if the worker came out of the error state.
stickySession 1 (true) Sessions stick to the same worker, 1=true 0=false



loggers

Any connector based on jk2, at least has a default logger, that can be reached using the "logger" alias, the logger used is the more appropiate for the plataform/server combination, Apache2 under in any platform has logger.apache2 as default, IIS on his only platform uses logger.win32, and Any apache 1 install uses logger.file as default.., the config file lets you change that defaults, you can end using logger.file in IIs i.e

The properties shared by all loggers are:

Property name Default Description
level INFO Log level. Supported: EMERG, ERROR, INFO, DEBUG

logger.file

Property name Default Description
file ${serverRoot}/logs/jk2.log Log file. XXX you may be able to change this at runtime, to implement rolling.


logger.win32

logger used in the IIS server by default, it ends at native Application Event Log.


logger.apache2

Logger used in Apache2 servers, it normally in ends in error.log