First, you need a 64-bit OS and a 64-bit JVM (well, if you are running 32-bit Linux you might be able to get a 2GB heap). Second, you an't tell the JVM to not do any garbage collections until it reached 1.5GB of usage. Finally, are you sure that you really need a 2GB heap?
To get a better understanding of how GC works, see my whitepapers titled:
- Java Garbage Collection Statistical Analysis 101
- Java Garbage Collection Performance Analysis 201
In the JBoss AS run config file, change the JAVA_OPTS line that sets the heap. Example:
set "JAVA_OPTS=-Xms2048m -Xmx2024m -XX:MaxPermSize=256M"
I would provide some more specific instructions but you never said:
- what OS you are running on
- which version of JBoss AS you are using
- which version of the JVM you are running
As Peter said it is a bit rare information.
But I support a application with about 400-500 transactions per second for one JBoss instance.
It run with 1500m heap (Xms and Xmx with same value) and 128m permSize.
The maximum of memory depends on the OS and JVM implementation, simple to test with the Xms option, the JVM did not start if the memory is not supported. (e.g. we use Solaris 64Bit with the original Sun 32Bit-JVM with 3600m for some cases)
The GC behaviour is extreme application dependend! A good practice is to have objects with short livecycle, in this case the GC is able to run faster.
In general you have to understand how the GC works. Good starting points are .
Also you might test the JVM tools JStat and VisualGC from Sun (sorry Oracle ;-)
search at oracle techwork for 'GC tuning' or the tools.