tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allistair Crossley" <Allistair.Cross...@QAS.com>
Subject RE: Tomcat configuration tuning
Date Thu, 08 Apr 2004 16:33:17 GMT
Hey

Yes our struts uses the tiles plugin also. And the page load times are as a result of running
on the server itself unfortunately. I am using the JTDS driver which apparently is one of
the fastest SQL Server 2000 implementations for db connectivity.

One of the things about our system is that every click the user makes is a search to the CMS
for content that belongs to that page. This could be considered sub-optimal. For instance,
I could cache results per 15 minutes or something, but content changes often so I thought
I would leave it dynamic. 

I spent some time running JProfiler against the app. The accumulated CPU and memory seemed
to ultimately come down to these search calls to the CMS especially under load. Per request
I have to instantiate the vendors' bean which is an interface to the CMS server socket and
is responsible for giving back all the data from the calls. I then simply package up what
I need in data transfer objects and ship them to the JSPs. The JSPs are highly configurable
in terms of skinning and so on and have calls to the file system to check if images are present
and so on. I think I could cache that too. In fact looking at timings in the logs shows the
page start to end is sub 1 second, the rest (user click -> page process start) I think
is caught up at the search but even so that is generally about 0.8s. Pages are taking about
0.1 and my cached implementation of nav takes 0.06 or so to load. But overall the pages under
load feel like they take about 2 seconds and also I get the feeling tomcat is recompiling
something it really doesn't need to - that was why I was interested in the development flag
in server.conf and whether I should turn that to false.

A fair amount of CPU and memory was going to Log4J also. I removed a lot of our unnecessary
debugging statements and this too helped. 

I guess it comes down to the CMS load but any tips from others on the list are so very welcome,

Cheers, ADC

-----Original Message-----
From: LILES, DAVID (CONTRACTOR) [mailto:DAVID.LILES@DFAS.MIL]
Sent: 08 April 2004 17:22
To: Allistair Crossley
Subject: RE: Tomcat configuration tuning


I have seen a couple postings regarding poor performance with Tomcat recently and thought
I'd respond because we are using IIS5 with Tomcat 5 and SQL 2000 as well.

We have a Struts site but our difference is that we are using Tiles for our presentation...
haven't really looked into the performance differences between Tiles and non-Tiles display
rates....

As for our database connectivity... we are using an internally developed connection pooling
class (no JNDI), but have recently started migrating to Hibernate.

It is interesting hearing how long it is taking for the pages to be displayed considering
we are on a similar set-up and have not noticed this type of problem. We have not made any
special optimization setting changes, we basically did an out of the box set-up.... 

Is this occurring when running the app locally or on the server? I would be curious to know
what is the resource load on the box running the app, how is the connectivity (bandwidth)
to the box, has any sort of optimization tools been run against the code to check for bottle-necks?

Not sure that I can provide much value technically, but feel free to ask....

-Dave



 -----Original Message-----
From: 	Allistair Crossley [mailto:Allistair.Crossley@QAS.com] 
Sent:	Thursday, April 08, 2004 11:00 AM
To:	Tomcat Users List
Cc:	mwoodings@austin.rr.com
Subject:	RE: Tomcat configuration tuning

Hi Matt,

Welcome to the list from me. It's funny because you have just listed precisely the same server
setup as we are launching our new tomcat based app to this weekend and I have been having
nightmares about performance. 

We have a system like this;


user -> 
  IIS -> 
    JK2 ISAPI -> 
      Tomcat 5.0.19 -> 
        --> Content Management System Bean
          --> SQL Server 2000
        --> SQL Server 2000 via JNDI resource setup

Our application is built on Struts. 

We found performance to be very poor under a load of 20 users of 3 iterators of 20 page requests
(13 secs per page) avg pages per secon 1.1!! Looking into it revealed too much XML, too much
database connectivity and too much dynamic rending on the pages. 


I came up with a caching strategy for our navigation as well as removing all XML to database
calls instead (you may have seen my last post)

Along with other things I have managed 10 pages per seconds and 1.5 seconds per page under
the same load test. I'm still not entirely happy and wonder if I am missing any confoguration
type stuff to make my app run faster either in tomcat, jk2, iis and so fourth. I run tomcat
as a service with -Xms128 -Xmx384.

I would be very interested if you have time to hear of any useful quick tips you found can
optimise via configuration - maybe even seeing your server.conf and anything else, perhaps
any ideas about code optimisation and also how complex your system is (db accesses or other
system integration). 

What are your page response times under load and so on.

It's a big ask but you have a very similar hardware setup and I would like to maximise my
use of it.

Cheers! ADC


-----Original Message-----
From: Matt Woodings [mailto:mwoodings@austin.rr.com]
Sent: 08 April 2004 16:50
To: tomcat-user@jakarta.apache.org
Subject: Tomcat configuration tuning


Hi guys,

I am at stage where I have all my various components talking to one another (Apache http server
2.0.49 -> Mod JK2 -> Tomcat 4.1.30) and running nicely with each other, but the loads
on the server are increasing rapidly in our production environment ( ~2000 logins/day and
peak concurrency of ~75 currently ) and I want to get the best possible configuration for
my server. (Dual 1GHz, 1GB Ram, Win 2k, SQL Server + Web/Apps servers).  

Now, ultimately this is up to me, but I am unsure of a few relationships and variables used
in the configuration files.  The settings I have work, but I want them to be optimal and more
importantly I want to understand them, so any help on the following would be greatly appreciated.

1) server.xml/Connector/bufferSize.  Is this allocated for every users session until it is
terminated, or is it a peak size that could be allocated?
2) workers2.properties/shm.slots. Does this equate to the server.xml/Connector/maxProcessors?
or are these fundamentally different?

I have attached my fully working configuration below for those who are interested, as I noticed
a lot of people in the archives looking for working examples using JK2.

Many thanks,

Matt

P.S. I am new to the list but I have been using Tomcat for many years and love it, and if
I can help with anyones queries, from the trivial to complex,  I would be only too happy to
do so.

workers2.properties
[logger]
##############################################################
####    LOGGER                                            ####
##############################################################
# Log level. Supported: EMERG, ERROR, INFO, DEBUG
level=ERROR
# Log file. XXX you may be able to change this at runtime, to 
# implement rolling. 
file=${serverRoot}/logs/jk2_error.log

[config]
##############################################################
####    CONFIG                                            ####
##############################################################
# Location of the workers2.properties file
file=${serverRoot}/conf/workers2.properties
# Set the debug level of the config component
debug=0
# Set the debug level of the hidden env component
debugEnv=0

[shm]
##############################################################
####    SHARED MEMORY SETUP                               ####
##############################################################
# Name of the file that will be mmapped to use as shared memory, 
# If set to 'anonymous' use the anonymous shered memory
file=${serverRoot}/logs/shm.file
# Number of shared memory slots. Set to the number of child 
# processes
slots=378
# Use process memory instead of shared memory. Useful for single 
# child mpm's
useMemory=0

[lb:lb_group]
##############################################################
####    LOAD BALANCER (EVEN IF USED ON ONE MACHINE)       ####
##############################################################
# If set, jk2 won't touch the headers in case of error and will 
# let for example Apache present the 
# ErrorDocument via mod_alias.
noErrorHeader=1
# 
noWorkerMsg=No workers available
# 
noWorkerCode=503
# 
hwBalanceErr=
# 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. 
timeout=5000
# Number of attempts that lb will try on each worker before 
# giving up. 
attempts=6
# Time to wait before retrying to see if the worker came out of 
# the error state. Default = 60secs
recovery=30
# Sessions stick to the same worker, 1=true 0=false 
stickySession=1

[channel.socket:localhost:8009]
##############################################################
####    CHANNEL SETUP, LINKED TO LOAD BALANCER            ####
##############################################################
# Port where Tomcat is listening. It is automatically extracted 
# from the name - you shouldn't have to specify it explicitely.
port=8009
# Remote host. You should use the name, no need to override it
host=127.0.0.1
# If 1, only requests for existing sessions will be forwarded
graceful=0
# ?
keepAlive=0
# Socket timeout for sending and receiving (0=infinite)
timeout=0
# 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. 
lb_factor=100
# 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.
group=lb_group
# Must match the JVM route on tomcat Engine, for load balancing
tomcatId=hsInstance

[ajp13:localhost:8009]
##############################################################
####    AJP1.3 WORKER CONFIG                              ####
##############################################################
tomcatId=hsInstance
group=lb_group
channel=channel.socket:localhost:8009

[uri:/hs/*]
##############################################################
####    URI MAPPING, WHAT TO SEND TO TOMCAT               ####
##############################################################
group=lb_group

[status:jk_status]
##############################################################
####    JK STATUS GROUP                                   ####
##############################################################
info=Status worker, displays runtime information

[uri:/jkstatus/*]
##############################################################
####    JK STATUS CONFIG                                  ####
##############################################################
info=The Tomcat /jkstatus handler
group=status:jk_status


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com">www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message