Skip to main content

glassfish memory settings

2 replies [Last post]
Joined: 2008-06-10


I'm quite new to glassfish clustering and have a few questions.
Currently we have a two two machine cluster (a third is the DAS and the load balancer), with 1 server instance per machine.

The two machines have 4 cores and 6gb ram each. Is it usual to run multiple instances on each server? what could be a good value?

If I set the xmx and xms values for the jvm, are these per-instance values? So if I have 2 instances on one machine, and set xmx and xms to 4gb, this server will require 8gb of ram?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-12-09

The xmx/xms values are per instance so it would be possible to run 6 instances of xmx=512MB on an 8GB ram server (remember operating system and other apps such as databases would obviously require some of the remaining ram). I seem to recall a JVM limit of 2GB on 32 bit machines so there is a maximum in some circumstances (others will probably correct me of the exact details). It would seem a waste in having a 4 core 6GB server hosting a single GF instance when you could have more running. The allocated memory will depend on many things including connection pool sizes, number of web applications, processing threads etc. so there is no hard and fast rule. Smaller apps will probably only require an instance with 512MB memory. You will need to experiment and test to configure the instance to your requirements (connecting with JConsole to your running instance and viewing memory usage is a great start). You shouldn't assume that you need to allocate 4GB per instance.

Don't underestimate what Glassfish can do. As an example, we are hosting 5 public web apps per instance (with 512MB allocated per instance, each having 5 connection pools - one per web app - with 16 max connections each). The instances have been running for over 360 days and we are running four such GF V2.1 instances on a 4GB server (which is also running the MySQL database). Load per web app is not high but reliability and stability is superb!

Joined: 2014-01-20


I am little bit confuse about the xms/xmx value in the cluster.

I want to know .. If we have 2 instance in a cluster.

Cluste -CLS1


If I have give -Xms:2048 in the cluster by admin cosole in the jvm setting.

so it means both instance in my cluster will take 2048 memory..

means INS-1 will take 2048 and INS-2 also take 2048 memory.

or both share only 2048m memory.

Can you please clerify my doubt.