RE: How much memory will Tomcat 5.5/Java 5 support?

2005-12-03 Thread Carl Olivier
Hi.

Are you running a 64bit or 32bit OS?  If 32bit the JVM will not be able to
assign higher that 2gb for a single process (which includes system overheads
etc).  You will need to move to a 64bit OS to be able to create higher Heap.

I would check your OS memory/kernel/process memory documentation if I were
you.

There were recently some posts on this list dealing with Tomcat memory -
would suggest reading thrugh those for some useful tips too.

Rgds,

Carl

-Original Message-
From: Joe Reger, Jr. [mailto:[EMAIL PROTECTED] 
Sent: 03 December 2005 12:57
To: users@tomcat.apache.org
Subject: How much memory will Tomcat 5.5/Java 5 support?

Hi!  I'm having trouble getting my Tomcat 5.5. production box to use more
than 1.1Gb of memory.

1) When I use the Configure Tomcat console's Java tab to set the Maximum
Memory Pool I can only use a max of 1999Mb.  If I go above that the Windows
Tomcat service will fail to start.

2) Tomcat will start with a configured value of 1999Mb, but when I view max
memory in the app it says that it has a max of about 1140Mb (sorry, I forgot
the exact value... possibly 1048Mb, but i don't remember it being one of the
magic numbers).

Is this a JVM issue or a Tomcat issue?  I've got 4Gb of ram on the dedicated
Tomcat server and I'd like to give 3Gb to Tomcat.

Thanks,

Joe

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How much memory will Tomcat 5.5/Java 5 support?

2005-12-03 Thread Carl Olivier
Hi Joe.

Well, heres how I run it - and remember this is all dependent on the
beakdown of requirements of the following:

1.  Web app memory needs - how memory intensive are your web apps within
Tomcat going to be?
2.  Concurrent connections (tcp threads) for incoming requests - how busy
will the web apps be?
3.  Are you running DB connections?  Are you using a Connection pool?  How
long will each db connection take to return?
4.  Are you running OTHER applications/servers on the server which will
require memory?  E.g. RDBMS Server
5.  Always be aware that the native OS will also need memory - thus you
cannot just give it all to Tomcat!

So, heres one of my scenarios:

Server:
Quad Xeon
2GB RAM

OS:
Windows 2000 Server (32 bit)

Applications/Servers:
Tomcat 5.0.28 (with 40 web apps/contexts/classloaders)
MSSQL Server 2000

My Tomcat runtime switches are as follows:

-Xms768m//assign all the JVM heap at startup
to 768mb
-Xmx768m//assign max JVM heap
-Xss128k//set the native thread stack size
memory allocation down from windows def of 1024kb - very useful
-XX:+UseParallelGC  //parralel GC - makes use of the
multiple processors
-XX:MaxPermSize=256m//up the perm gen space (used for
classloading etc) from def 64mb - also useful with lots of web apps
-XX:+DisableExplicitGC  //don't let the System.gc() be called as it
could cuse 'pause the world's

I also limit the amount of RAM that MSSQL can have to 640mb - and have also
set the memory allocation size per sql connection down from 1024kb to 512kb
(SQL Server setting) - this is however due to my running MSSQL Server on the
same box and may not apply.

I have thus left some RAM for the OS to use where required - this should not
be ignored.

I found that this is a pretty stable setup - with my only problem occurring
occasionally when I get a MAJOR spike in concurrent requests.  I plan to
upgrade to a 64bit OS soon and to up the SQL RAM allocation as my problem
lies there - it sometimes has issues with memory!

It should be noted that my web apps can be fairly SQL intensive - I do have
VM level caching but alas not all of it

Anyway - I do hope that helps!

Other areas you could look into is the number of concurrent requests Tomcat
serves (set at a Connector level) - as too many will cause memory issues
under load, while too few will cause visitors to be rejected/wait for
response!

Anyway, take care,

Carl


-Original Message-
From: Joe Reger, Jr. [mailto:[EMAIL PROTECTED] 
Sent: 03 December 2005 13:19
To: Tomcat Users List
Subject: Re: How much memory will Tomcat 5.5/Java 5 support?

 Are you running a 64bit or 32bit OS?  If 32bit the JVM will not be 
 able to assign higher that 2gb for a single process (which includes 
 system overheads etc).

Hi Carl - I'm 32 bit right now.   I'll check the archive for past posts.

How would you go about using more of the memory that I have on the server?
Can I run two Tomcat services and cluster?

Thanks for the feedback and help!

Joe

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How much memory will Tomcat 5.5/Java 5 support?

2005-12-03 Thread Caldarale, Charles R
 From: Joe Reger, Jr. [mailto:[EMAIL PROTECTED] 
 Subject: Re: How much memory will Tomcat 5.5/Java 5 support?
 
 How would you go about using more of the memory that I have on the
 server?  Can I run two Tomcat services and cluster?

32-bit Windows normally only provides 2 GB of virtual space per process.
There is a boot-time option (I forget what it is) for some server
versions of Windows to increase that to 3 GB. This is a tradeoff with
system resources, since doing so reduces the amount of virtual space for
the kernel to 1 GB.  Windows loads several discontiguous DLLs within the
virtual space of each process, so that fragments it somewhat, and the
last time I checked, a HotSpot JVM required contiguous space for the
heap.  Also, there was a bug in the 1.4 32-bit JVM dealing with heap
sizes larger than 2 GB due to sign extension problems, but that may be
fixed now.  (Haven't looked at the heap init code in 1.5.)  64-bit
versions of Windows and the JVM obviously don't have these issues.

Running multiple instances of Tomcat would certainly allow you to use
more total memory, since each Tomcat process will get its own 2 GB.
However, clustering doesn't come free - there's a good bit of overhead
involved due to the instances sharing state.  You'll have to test with
your actual applications to see if the performance is acceptable.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How much memory will Tomcat 5.5/Java 5 support?

2005-12-03 Thread Carl Olivier
Hi Nate.

Yeah, the AggressiveHeap is definitely an option.  My take on it - over
months of researching, fighting, tweaking the memory settings is that it
leaves a lot of decision making up to the VM.  While this is not necessarily
a bad thing - prefer to keep some more control - although that may be my
paranoia talking :)

Thing is that memory settings I find are more about finding a balance
between the different 'users' of the resources within the entire system -
all the servers and apps need to coexist on the box - and as such I do not
believe there is a 'fix-all' setting - ites definitely more about finding
the settings which allow your particular setup to exist best in harmony!  

With that in mind however, I will give this setting a go on one of my boxes
- one where the SQL Server is not running and is on another machine - and
see what effect it has - will report any findings/conclusions back to the
list for those that are interested.

With regards the CPU usage I would agree with you in that dual or quad Xeons
will not suffer under the AggressiveHeap option - although it does not that
it is intended for quad processors...

Gains and losses?  Depends on your requirements and setup.  As stated in my
case (as I did in fact try the AggressiveHeap) where quite often the Tomcat
server and Database server runs on the same machine it did not work as well
as the more granular settings I have used.  I am also a firm believer in
leaving enough RAM for the underlying native processes and OS to do its
work!

All in all resource tweaking is generally a tedious task that requires
thorough investigation and a good understaning of your environment and the
requirements of your web apps, servers, and operating system...

Thanks and regards,

Carl

-Original Message-
From: Nate Rock [mailto:[EMAIL PROTECTED]
Sent: 03 December 2005 14:58
To: Tomcat Users List; [EMAIL PROTECTED]
Subject: RE: How much memory will Tomcat 5.5/Java 5 support?

-XX:+AggressiveHeap usage for JVM?

This email is pointed almost directly for Carl Oliver, since he seems to be
someone who knows his virtual memory settings, but I figure Joe Reger might
get something out of it too ;)

Evidently this setting by iteself instructs the JVM to push memory use to
the limit, and is only recommended for use on boxes containing a single JVM
with nothing else running on it (a server running only Tomcat seems to foot
the bill)

It does a few things that Carl suggested implicitly

-XX:+UseParallelGC
-XX:+UseAdaptiveSizePolicy
-Xss256k

You can read more about it here:

http://java.sun.com/docs/hotspot/gc1.4.2/

From my experience it has made some of our problem servers much more
stable, allowing them to run for months without OOM instead of days or weeks
allowing us to actually use session replication without the servers going
bananas ;) We also used to have our Max memory set at -Xms1300mb and
-Xmx1300mb, but I have found that when using the
-XX+Aggressive heap the JVM memory usage rarely tops 1024MB because it's
cleaned out much more efficiently.

Carl what is your take on this? I realize it uses a bit more CPU because of
the adaptive size and parallelGC, but on duel Xeon boxes CPU usually isn't
the limiting factor (at least in our case). 

What gains/loss do you see over using -XX:AggressiveHeap (dynamic,
adjustible settings) vs hard coding fixed settings like you suggest? 

   -rOcK 

-Original Message-
From: Carl Olivier [mailto:[EMAIL PROTECTED]
Sent: Saturday, December 03, 2005 7:43 AM
To: 'Tomcat Users List'; [EMAIL PROTECTED]
Subject: RE: How much memory will Tomcat 5.5/Java 5 support?

Hi Joe.

Well, heres how I run it - and remember this is all dependent on the
beakdown of requirements of the following:

1.  Web app memory needs - how memory intensive are your web apps within
Tomcat going to be?
2.  Concurrent connections (tcp threads) for incoming requests - how busy
will the web apps be?
3.  Are you running DB connections?  Are you using a Connection pool?
How long will each db connection take to return?
4.  Are you running OTHER applications/servers on the server which will
require memory?  E.g. RDBMS Server 5.  Always be aware that the native OS
will also need memory - thus you cannot just give it all to Tomcat!

So, heres one of my scenarios:

Server:
Quad Xeon
2GB RAM

OS:
Windows 2000 Server (32 bit)

Applications/Servers:
Tomcat 5.0.28 (with 40 web apps/contexts/classloaders) MSSQL Server 2000

My Tomcat runtime switches are as follows:

-Xms768m//assign all the JVM heap at
startup
to 768mb
-Xmx768m//assign max JVM heap
-Xss128k//set the native thread stack
size
memory allocation down from windows def of 1024kb - very useful
-XX:+UseParallelGC  //parralel GC - makes use of the
multiple processors
-XX:MaxPermSize=256m//up the perm gen space (used for
classloading etc) from def 64mb - also useful