4,255 Views 21 Replies Last post: Feb 1, 2008 4:59 AM by Amol Kelaskar RSS
Amol Kelaskar Bronze 16 posts since
Sep 13, 2007
Currently Being Moderated

Nov 8, 2007 1:40 AM

Increasing Java Memory

 

I have installed Openfire server I want to increase the Java memory size how I can do  this

 

 

please help

 

 

Guus der Kinderen KeyContributor 437 posts since
Sep 8, 2005
Currently Being Moderated
Nov 8, 2007 2:37 AM in response to: Amol Kelaskar
Re: Increasing Java Memory

 

Have a look at this tutorial: http://www.igniterealtime.org/community/docs/DOC-1033

 

You're probably interested in the section that is called 'heap settings'.

 

 

nerfherder Bronze 11 posts since
Sep 4, 2007
Currently Being Moderated
Nov 8, 2007 8:24 AM in response to: Amol Kelaskar
Re: Increasing Java Memory

In the openfire/bin directory, add a vmoptions file.  The first part of the name of the vmoptions file should be the same as the executable running the Openfire service.  For example, on Windows running as a service, you'd create a file named openfire-service.vmoptions.  Among other things in this file, you can define the minimum and maximum memory to allocate to the process in the Java VM.

 

For example:


-Xms512m
-Xmx1024m

 

It's worth noting that you're bound to the 32 bit 2 GB limit on memory size for the Java VM.  While the process may need a certain amount of memory, Java also needs a certain amount.  It's all taken out of the same 2 GB space for the Java VM.  Giving the process all the available memory space (2 GB) leaves nothing for Java.  Allocating up to 1 GB for the process (see the above example) seems to be a good mark.

nerfherder Bronze 11 posts since
Sep 4, 2007
Currently Being Moderated
Nov 9, 2007 7:18 AM in response to: Amol Kelaskar
Re: Increasing Java Memory

The vmoptions file is used to override the defaults used by Openfire and is not included with the installation.  On Linux, create a plain text file /opt/openfire/bin/openfire.vmoptions and enter your memory options.  My previous post has an example format.

Ryan Bohn Bronze 57 posts since
Jun 14, 2007
Currently Being Moderated
Nov 9, 2007 9:45 AM in response to: Amol Kelaskar
Re: Increasing Java Memory

 

Alternatively, you can add the options to the INSTALL4J_ADD_VM_PARAMS= line in ./bin/openfire

 

 

I use the following and it works well:

 

 

INSTALL4J_ADD_VM_PARAMS="-Djava.net.preferIPv4Stack=true -Xms32m -Xmx128m -Xss128k -Xoss128k -XX:ThreadStackSize=128"

 

 

LG KeyContributor 5,452 posts since
Dec 13, 2005
Currently Being Moderated
Nov 13, 2007 1:18 PM in response to: Amol Kelaskar
Re: Increasing Java Memory

Hi,

 

if the openfire.vmoptions file does not work you may really want to do what Ryan did post and modify the Openfire start script and add as line 6 something like this: INSTALL4J_ADD_VM_PARAMS="-Djava.net.preferIPv4Stack=true -Xms32m -Xmx128m -Xss128k -Xoss128k -XX:ThreadStackSize=128"

 

LG

Richard J Lindgren Bronze 5 posts since
Oct 12, 2007
Currently Being Moderated
Nov 14, 2007 12:25 PM in response to: LG
Re: Increasing Java Memory

Where would you add that line 6 in a windows 2003 install ?

LG KeyContributor 5,452 posts since
Dec 13, 2005
Currently Being Moderated
Nov 14, 2007 1:20 PM in response to: Richard J Lindgren
Re: Increasing Java Memory

Hi Richard,

 

where on Windows do you have an /opt/openfire/bin path?

openfire-service.vmoptions or openfired.vmoptions should help one on Windows to set JVM parameters.

 

LG

Richard J Lindgren Bronze 5 posts since
Oct 12, 2007
Currently Being Moderated
Nov 14, 2007 1:40 PM in response to: LG
Re: Increasing Java Memory

 

I can't seem to find /opt/openfire anywhere in this openfire folder, don't know if I've missed something but

 

 

I think I have been through every sub folder and cannot find it

 

 

 

 

 

grimsy Bronze 51 posts since
May 24, 2006
Currently Being Moderated
Nov 14, 2007 8:26 PM in response to: Amol Kelaskar
Re: Increasing Java Memory

in /etc/sysconfig/openfire

add:

OPENFIRE_OPTS="-Xms256m -Xmx512m"

or whatever settings you want.

LG KeyContributor 5,452 posts since
Dec 13, 2005
Currently Being Moderated
Nov 16, 2007 1:27 PM in response to: Amol Kelaskar
Re: Increasing Java Memory

Hi Amol,

 

do you mind posting the first 10 lines of the openfire start script which you did modify to set the Xmx value?

 

LG

LG KeyContributor 5,452 posts since
Dec 13, 2005
Currently Being Moderated
Nov 17, 2007 3:10 AM in response to: Amol Kelaskar
Re: Increasing Java Memory

Hi Amol,

 

are you using the rpm install? I never saw an Openfire script which starts like this so I wonder if this one accepts this parameter.

You may want to look for the line which starts with "nohup ... java ... startup.jar" and place your Xmx value after java. It should then look similar to

cd ${OPENFIRE_HOME}/logs
nohup ${JAVA_HOME}/bin/java -Xms64m -Xmx128m -jar ../lib/startup.jar >../logs/SDTOUT.log 2>../logs/SDTERR.log &

 

LG

grimsy Bronze 51 posts since
May 24, 2006
Currently Being Moderated
Nov 16, 2007 5:05 PM in response to: Amol Kelaskar
Re: Increasing Java Memory

 

if you used the /etc/sysconfig/openfire option you would need to restart openfire for the settings to be noticed. In fact for any of the solutions here you would need to restart openfire.

 

 

service openfire restart

 

 

(on Fedora + Redhat based systems)

 

 

Scott Brissenden Bronze 43 posts since
Jan 11, 2008
Currently Being Moderated
Jan 31, 2008 11:59 AM in response to: Amol Kelaskar
Re: Increasing Java Memory

 

I just ran into a problem where my Java VM memory was pegged. I increased it from 64mb to 256mb and all is well for now. My question is what should be an acceptable limit for 400 users? Also are switching to Spark as the client if that makes a difference for this?

 

 

 

 

 

Thanks

 

 

More Like This

  • Retrieving data ...

Bookmarked By (0)