TomcatExpert

Allocating more RAM to Apache Tomcat on Windows

posted by SpringSource on April 15, 2010 08:36 AM

If you've recently upgraded the RAM, or are moving your Tomcat applications to a larger box, you may want to update your allocated memory.

To find out how much RAM is allocated already to your Tomcat instance, if you have Tomcat installed as a Windows service, you can run Regedit and look at:

HKEY_LOCAL_MACHINE
SOFTWARE
Apache Software Foundation
Procrun 2,0

Under that key will be all the tomcat service instances you have installed on that machine. If you expand an instance tree you will see another key named Parameters. Expand this and you will see a number of named values:

JvmMs - is the minimum memory, equivalent to -Xms
JvmMx - is the maximum memory equivalent to -Xmx
Options - any other java options you wish to set for this server.

When you run Tomcat as a service it calls the jvm.dll directly so anything you modify in one of the bat files will be disregarded. So you will need to set those options by changing those registry values. The default Tomcat configuration does not use any memory configuration. If you haven't set the -Xms or -Xmx parameters explicitly anywhere you will wind up with the JDK default which is 64M.

Be aware that even if you increase the physical memory size, if you are running 32 bit windows you won't be able to allocate over 2GB of memory per VM. On Win32 the max size for your heap is going to be 2 GB. While that is as big as it will be able to get on that platform, that does not necessarily mean that you will be able to allocate a 2GB heap. In order to achieve that, the JVM must be able to allocate that entire quantity in a set of contiguous addresses. Depending on what you have loaded, if there is anything loaded into memory that is not movable and interferes with allocating that block, it will fail to start and you'll have to reduce the size until it fits in what IS available.

There are a number of different ways to modify the memory settings for the JVM at Tomcat startup via the -Xmx and -Xms settings. 

You can set these (and other JVM parameters) in either the JAVA_OPTS or the CATALINA_OPTS in the set_env.bat. These can also be set via the Windows System Environment dialogs. If that has been done you can type set JAVA_OPTS OR set CATALINA_OPTS at the command prompt, and if they are set you will see them. Or they can be set from the command line before starting Tomcat (although if that was being done it wouldn't help you in this case). These can also be set in any of the called startup scripts such as startup.bat, catalina.bat, or set_env.bat. Do a text search through all the bat files and check to see whether the environment variables are being explicitly set somewhere there.

Normally, the quickest way to find out what the actual startup setting is would be to edit catalina.bat. 

Find the tag: doneSetArgs. Immediately after that add the line:

echo %_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% 

When you next type startup it will print out the exact command line being used to start Tomcat. If you see an -Xmx parameter, the value immediately after that will be your maximum memory for that instance. If you don't see that setting at all, it is the JVM default, 64M.

For more than 10 years, SpringSource employees have been supporting Apache technologies, with unparalleled experience and commitment to the Apache Software Foundation. More than 400 of the Fortune 500 count on SpringSource to support their mission-critical business applications. Leaders of the Apache Software Foundation, including Board Members, work at SpringSource and dedicate a significant amount of time further developing the Apache Tomcat open source project. Over the last 2 years, 95% of the issues fixed in the Apache Tomcat project were fixed by SpringSource engineers. For more information on how SpringSource can help your enterprise, see the SpringSource website, or call 800/444-1935.

Comments

Memory Allocation

What is the most amount of memory you could allocate to tomcat in a x64 OS?

And then secondly, what is the best way to allocate or set the values xmx, xms, permsize?

Chux

kami adalah

kami adlah perusahaan besi baja yang paling oke harga besi wf harga besi h beam harga besi cnp harga besi unp harga besi beton harga plat besi harga besi siku besi pipa besi

DANI

I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.
Cannaline

Thank you so much for the

Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.
visit here

DANI

I found this is an informative and interesting post so i think so it is very useful and knowledgeable. I would like to thank you for the efforts you have made in writing this article.
melatonina preço

Positive site, where did u

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.
womens clothing

I just want to let you know

I just want to let you know that I just check out your site and I find it very interesting and informative..
find this

Sa

Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging..
Mobile Phone Comparison

This is such a great resource

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...
airshou

This is such a great resource

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...
airshou

Sa

This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
good laptop for music production

Sa

I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.
pieczatki Warszawa

Sa

Thanks for sharing this quality information with us. I really enjoyed reading. Will surely going to share this URL with my friends.
find more

I read your blog frequently

I read your blog frequently and I just thought I’d say keep up the amazing work!
best laptops for producing music

I have not any word to

I have not any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.
Sheraton residences

I like this post,And I guess

I like this post,And I guess that they having fun to read this post,they shall take a good site to make a information,thanks for sharing it to me.
find here

Thanks for the blog loaded

Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for.
find more

I was surfing net and

I was surfing net and fortunately came across this site and found very interesting stuff here. Its really fun to read. I enjoyed a lot. Thanks for sharing this wonderful information.
our website

Sa

I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.
Sobha International City

Excellent .. Amazing .. I’ll

Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing.
http://horseservices.ca/

Great Article it its really

Great Article it its really informative and innovative keep us posted with new updates. its was really valuable. thanks a lot.
Driving School Melbourne

Nice post. I was checking

Nice post. I was checking constantly this blog and I’m impressed! Extremely useful info specially the last part I care for such information a lot. I was seeking this certain info for a long time. Thank you and good luck.
http://trueholisticdentist.com/

Sa

I really impressed after read this because of some quality work and informative thoughts . I just wanna say thanks for the writer and wish you all the best for coming!.
Driving School

This is a great post. I like

This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
go here

Sa

Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing
Tide Charts

Sa

I just want to let you know that I just check out your site and I find it very interesting and informative..
Tide Charts

I am very enjoyed for this

I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.
SEO Blog

Sa

Excellent information on your blog, thank you for taking the time to share with us. Amazing insight you have on this, it's nice to find a website that details so much information about different artists.
Virtual Office

Sa

It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.
stanford pelage

Sa

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.
repair services

Sa

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free.
Nigerian Newspapers

Sa

You’ve got some interesting points in this article. I would have never considered any of these if I didn’t come across this. Thanks!.
here

Sa

very interesting post.this is my first time visit here.i found so many interesting stuff in your blog especially its discussion..thanks for the post!
reviews

I am hoping the same best

I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me.
Remodeling contractor Fairfax VA

I am very enjoyed for this

I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.
find here

Nice post! This is a very

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.
50 eur to dkk

DANI

This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post!
test drive

I think this is a really good

I think this is a really good article. You make this information interesting and engaging. You give readers a lot to think about and I appreciate that kind of writing.
Insurance company

S

I high appreciate this post. It’s hard to find the good from the bad sometimes, but I think you’ve nailed it! would you mind updating your blog with more information?
ikea store near me

This is a great post. I like

This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
zillow tampa

This is a great post. I like

This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
learn more

Thanks for the blog loaded

Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for.
Sheraton Cebu Mactan Resort

Awesome blog. I enjoyed

Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
online translation

DANI

This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!.
www.friv4online.com

Nice post! This is a very

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.
www.kizi2games.net

DANI

Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject.
snack pack google

DANI

I am unable to read articles online very often, but I’m glad I did today. This is very well written and your points are well-expressed. Please, don’t ever stop writing.
office supplies

The information you have

The information you have posted is very useful. The sites you have referred was good. Thanks for sharing..
one pacific residence

Great article with excellent

Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information..
best home blood pressure monitor

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.