Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Increase memory for tomcat

 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys, i want to increase heap maximum memory and initial memory, my tomcat runs in windows 2000 server, if I set JAVA_OPTS enviroment variable to -Xms128m -Xmx128m will it work??
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it should.
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can I test it??
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the methods in java.lang.Runtime
long maxMemory() long freeMemory() and long totalMemory()

You could insert these lines in any init method.
Runtime rt = Runtime.getRuntime();
System.out.println("Maximum memory available is " + rt.maxMemory() );
Bill
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it didn't change!! the max memory doesn't change.
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could some one help me here!? the max memory doesn't change with JAVA_OPTS set to -Xms256m -Xmx256m...
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Exactly where are you changing JAVA_OPTS?
2. How do you start Tomcat?
3. What is it currently reporting as maxMemory()?
Bill
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Always reports something like this (only 'Free memory' changes)
I set JAVA_OPTS enviroment variable to -Xms256m -Xmx256m. I also made a program to print the max memory and started it by prompt with the following command java test -Xmx256m -Xms256m and the max memory does not change.

Max memory: 134.217.728
Free memory: 21.686.320
Total memory: 63.979.520
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you start Tomcat with the provided batch files, then try altering JAVA_OPTS in the batch file, not as a (system) environment variable. If you've installed as a service, then there are ways of altering this as well, but it involves hacking the registry (I think).

Also, just for the heck of it... you are sure that 256MB is *available* on your server to be allocated?
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 1GB available for tomcat but it uses only a few of it... It's installed as service, could you help me increase its memory??
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Installed as a service! Thats the problem. As a service it does NOT see your environment variables that you set as a user.

This discussion - right at the bottom of the page. tells how somebody solved the problem with a very similar setup.

Bill
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to you all I could increase tomcat 4x memory as service, by modifing entries in regedit... but I need to increase tomcat 5.x memory!! have you seen any other guy trying the same in any other forum??
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
 
Tonny Tssagovic
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello folks,
I just wanted to ask confirm about passing params as Xms to tomcat while it is running as a service. Here is what I found:

For Tomcat on NT as a service, you can set the -Xms and -Xmx in the
registry. Its HKEY_LOCAL_MACHINE\Service\CurrentControlSet\<Name
of
Service>\Configuration. You can add new JVM Option Number X (and
make sure
to increment the JVM Option Count key) to contain the additional
parameters.


Tomcat as service

I wanted to ask you guys, in case I have

and I don't increase it, but add a new (5.th JVM option) in the registry will it just be ignored??? And the order of the options passed to the JVM odes not matter?
Any help will be appreciated.
 
Tonny Tssagovic
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This guy seems to have it all
Tomcat service params
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic