On 14.09.2009 09:22, [email protected] wrote:
> - Will the access log contain an entry for each request that is seen in
> the jk log?I can see a corresponding entry in the accesslog for an entry
> in the jk log in my local setup.But I coulnt interpret the same from my
> prod log.I hope getting this will provide some direction on what element
> is creating the timeout as from the prod log I can see one entry haing
> the a timeout in the same time perios as that of the other requests.Pl
> let me know how to interpret the files.I have sent you the prod log file
> in my prev mail.Pl let me know if you would like to resend the same or
> any other details.I too the all entries around 13:44:08 from both logs
> from prod.
Yes, all requests handled by mod_jk will be logged as usual in the
Apache access log (after finishing the request). If mod_jk needs to do
retries or a failover, you still get only one entry in the access log.
The duration logged is the full duration from beginning working on the
request until logging.
You should add a couple of interesting data to your httpd LogFormat:
%d: duration in microsenconds
%P %{tid}P: process and thread id. Those get logged in the mod_jk log
file to, so your can do correlations between access log and mod_jk log.
Maybe the Session Cookie (incoming and outgoing):
%{JSESSIONID}C %{Set-Cookie}o
and a couple of JK notes (details on
http://tomcat.apache.org/connectors-doc/reference/apache.html):
%{JK_LB_FIRST_NAME}n
%{JK_LB_FIRST_STATE}n
%{JK_LB_LAST_NAME}n
%{JK_LB_LAST_ACCESSED}n
%{JK_LB_LAST_ERRORS}n
%{JK_LB_LAST_BUSY}n
%{JK_LB_LAST_ACTIVATION}n
%{JK_LB_LAST_STATE}n
> # Define list of workers that will be used
> # for mapping requests
> # The configuration directives are valid
> # for the mod_jk version 1.2.18 and later
> #
> worker.list=loadbalancer,status
>
>
> # Define Node1
> # modify the host as your host IP or DNS name.
> worker.node1.port=8109
> worker.node1.host=localhost
> worker.node1.type=ajp13
> worker.node1.lbfactor=1
> #worker.node1.prepost_timeout=10000 #Not required if using ping_mode=A
> #worker.node1.connect_timeout=80000 #Not required if using ping_mode=A
> worker.node1.ping_mode=A #As of mod_jk 1.2.27
> #worker.node1.activation=a
> #worker.node1.connection_pool_size=55
Let mod_jk decide on the connection_pool_size (when using Apache), do
not activate this line.
> worker.node1.socket_keepalive=True
> worker.node1.socket_timeout=5
I would not use a socket_timeout (personal preference).
> #worker.node1.connection_pool_timeout=30
> #worker.node1.recovery_options=7
> #worker.node1.ping_timeout=80000
> #worker.node1.prepost_timeout=80000
> #worker.node1.max_packet_size=65536
> #worker.node1.reply_timeout=5000
> worker.node1.retries=2
I would add the following (also to node2):
worker.node1.recovery_options=7
worker.node1.ping_timeout=10000
worker.node1.socket_connect_timeout=2000
worker.node1.connection_pool_minsize=0
worker.node1.connection_pool_timeout=600
# CAUTION: you need to set connectionTimeout in your Tomcat
# or JBoss connector to the same value
# as connection_pool_timeout. But for mod_jk it is in
# seconds, for Tomcat or JBoss in milliseconds.
# So add connectionTimeout="600000" to your AJP connectors.
Personally I would also add a reply timeout, but that depends on the
application:
worker.node1.reply_timeout=300000
and then in order to not make nodes fail because of few reply timeouts:
worker.loadbalancer.max_reply_timeouts=20
Finally I would add the following to the balancer,
which was introduced in 1.2.28:
worker.loadbalancer.error_escalation_time=0
> # Define Node2
> # modify the host as your host IP or DNS name.
> worker.node2.port=8209
> worker.node2.host= localhost
> worker.node2.type=ajp13
> worker.node2.lbfactor=1
> #worker.node2.prepost_timeout=10000 #Not required if using ping_mode=A
> #worker.node2.connect_timeout=80000 #Not required if using ping_mode=A
> worker.node2.ping_mode=A #As of mod_jk 1.2.27
> #worker.node2.activation=a
> #worker.node2.connection_pool_size=55
> worker.node2.socket_keepalive=True
> worker.node2.socket_timeout=5
> #worker.node2.connection_pool_timeout=30
> #worker.node2.recovery_options=7
> #worker.node2.ping_timeout=80000
> #worker.node2.prepost_timeout=80000
> #worker.node2.max_packet_size=65536
> #worker.node2.reply_timeout=5000
> worker.node2.retries=2
>
>
>
> # Load-balancing behaviour
> worker.loadbalancer.type=lb
> worker.loadbalancer.method=B
> worker.loadbalancer.balance_workers=node1,node2
>
> # Status worker for managing load balancer
> worker.status.type=status
>
>
>
> #worker.node1.fail_on_status=304
> #worker.node2.fail_on_status=304
>
> #worker.node1.socket_connect_timeout=2000
> #worker.node2.socket_connect_timeout=2000
You might also want to use a template like this:
worker.template.host=localhost
worker.template.type=ajp13
worker.template.lbfactor=1
worker.template.ping_mode=A #As of mod_jk 1.2.27
worker.template.socket_keepalive=True
worker.template.retries=2
...
and then remove all of the above attributes form node1 and node2 and
instead use
worker.node1.reference=worker.template
worker.node1.port=8109
worker.node2.reference=worker.template
worker.node2.port=8209
That way you save a couple of lines and it gets easier to keep node1 and
node2 consistent.
> # Load mod_jk module
> # Specify the filename of the mod_jk lib
> LoadModule jk_module modules/mod_jk.so
>
> # Where to find workers.properties
> JkWorkersFile conf/workers.properties
>
> # Where to put jk logs
> JkLogFile logs/mod_jk.log
Maybe you want to use rotatelogs here, like
JkLogFile "|/my/path/to/apache/bin/rotatelogs
/my/path/to/apache/logs/mod_jk.log_%Y%m%d%H%M%S
> # Set the jk log level [debug/error/info]
> #JkLogLevel info
> JkLogLevel debug
> #JkLogLevel error
"info" for production
> # Select the log format
> JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
Remoce this one.
> # JkOptions indicates to send SSK KEY SIZE
> # Notes:
> # 1) Changed from +ForwardURICompat.
> # 2) For mod_rewrite compatibility, use +ForwardURIProxy (default since
> 1.2.24)
> # See http://tomcat.apache.org/security-jk.html
> JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
Remove "+ForwardURICompatUnparsed" unless you know what you do.
Use the other ones also only if you need them.
> # JkRequestLogFormat
> JkRequestLogFormat "%w %V %T %m %q %s"
Remove that one and use the above tips for improving your access log
logging.
> # Mount your applications
> #JkMount /__application__/* loadbalancer
> # Let Apache serve the images
> #JkUnMount /__application__/images/* loadbalancer
>
> # You can use external file for mount points.
> # It will be checked for updates each 60 seconds.
> # The format of the file is: /url=worker
> # /examples/*=loadbalancer
> JkMountFile conf/uriworkermap.properties
I hope that file is fine.
> # Add shared memory.
> # This directive is present with 1.2.10 and
> # later versions of mod_jk, and is needed for
> # for load balancing to work properly
> # Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to
> # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452
> JkShmFile run/jk.shm
>
>
>
> # Add the jkstatus mount point
> JkMount /jkstatus/* status
> JkMount /test/* loadbalancer
> JkMount /PioneerCycling/* loadbalancer
If you are using VirtualHosts in Apache, and your JkMount are not
working, add "JkMountCopy All".
> # Add jkstatus for managing runtime data
> <Location /jkstatus>
> JkMount status
This JkMount line here is somewhat duplicate, because you already
mounted /jkstatus/*.
> Order deny,allow
> Deny from all
> Allow from 127.0.0.1
> </Location>
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]