Re:[correction ] heap size in 64 bit JVM running on 64 bit OS

65 views
Skip to first unread message

shweta sharma

unread,
Apr 25, 2012, 9:14:08 AM4/25/12
to bo...@googlegroups.com
>> I have read that on running a 32 bit JVM on  32 bit OS ( windows ) creates max of ~2.2GB size heap while same on 32 bit OS (Linux) creates heap of size ~ 3 . 2 GB ( but it wont go beyond 4GB in any case) .

On Wed, Apr 25, 2012 at 6:38 PM, shweta sharma <shwe...@gmail.com> wrote:
Hi ,

I want to know  how much will be the heap size created by 64  bit JVM on  64 bit OS.
Say for example i have 64 bit OS running with RAM attached of 80 GB  does that mean JVM can create
heap of size 80 GB ?

I have read that on running a 32 bit JVM on  32 bit OS ( windows ) creates max of ~2.2GB size heap while same on
32 bit OS (Linux) creates heap of size ~ 32. GB ( but it wont go beyond 4GB in any case) .

So how much a 64 bit JVM can create heap of max size if it's running on 64 bit OS.

Thanks in advance .

Best Regards
Shweta

shweta sharma

unread,
Apr 25, 2012, 9:08:52 AM4/25/12
to bo...@googlegroups.com

shweta sharma

unread,
Apr 26, 2012, 2:32:09 AM4/26/12
to bo...@googlegroups.com

can i give full RAM size  in JVM args to crease heap of size that is equal to RAM size ?
like  >>  java -d64 -Xms2g -Xmx80g MyApp

in that case will RAM be still available for other programs running on system ?

by giving arg
Xmx80g am i requesting JVM to create that much size of heap space or forcing JVM to create heap of that size ?.

I read that bigger the heap slower (after a threshold value ) will be performance because it will make GC to be a hazardous task to run.

Any input on this will help .

Best Regards
Shweta

Yaswanth Ravella

unread,
Apr 26, 2012, 4:07:31 AM4/26/12
to bo...@googlegroups.com
can i give full RAM size  in JVM args to crease heap of size that is equal to RAM size ?
like  >>  java -d64 -Xms2g -Xmx80g MyApp
The above JVM args does not create a process with 80g heap. It only creates a process with 2g of Heap and will only grow till 80g if required and if RAM is available.

in that case  will RAM be still available for other programs running on system ?
Depends. lets say if your current java heap usage has grown to 10-20 gb + few more gigabytes usage by native java process, you will still have space to run other programs right ? 

by giving arg Xmx80g am i requesting JVM to create that much size of heap space or forcing  JVM to create  heap of that size ?.
by specifying Xmx80g, you are only restricting the maximum heap size that the Java process can use. Note that this is the maximum and not the minimum heap size of the process.

 I read that bigger the heap slower (after a threshold value ) will be performance because it will make GC to be a hazardous task to run.
 
Yes, the more the heap size the more the time spent on GC. The performance of the application highly depends on how you size your heap generations and GC parameters.

I want to know  how much will be the heap size created by 64  bit JVM on  64 bit OS.
Say for example i have 64 bit OS running with RAM attached of 80 GB  does that mean JVM can create 
heap of size 80 GB ? 

If using a 64bit OS with 80g RAM, not the entire 80g is available for user processes. But you should easily be able to create a java process with say 50-60g of java heap.

I have read that on running a 32 bit JVM on  32 bit OS ( windows ) creates max of ~2.2GB size heap while same on 
32 bit OS (Linux) creates heap of size ~ 32. GB ( but it wont go beyond 4GB in any case) .

So how much a 64 bit JVM can create heap of max size if it's running on 64 bit OS.

A 32 bit OS can address maximum of 2^32 bytes of memory which is 4 gigabytes. Leaving 1-1.5 gb of memory for kernel you will be left with 2.5-3g of RAM for user processes. If you want to run a process with min java heap of 2g then the process may require free RAM of atleast 2.5-3gb. Java Heap is just a one portion of the total memory used by the java processes.

A 64 bit OS can address a maximum of 2^64 bytes of memory which is 16 exabytes. This is a very large. So i think it is safe to say there won't be any limit on the maximum java heap size. 

Hope this helps.


--
Yaswanth Ravella




--
You received this message because you are subscribed to the Google Groups "Bangalore Open Java Users Group- BOJUG" group.
To post to this group, send email to bo...@googlegroups.com.
To unsubscribe from this group, send email to bojug+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bojug?hl=en.

William la Forge

unread,
Apr 26, 2012, 6:02:16 AM4/26/12
to bo...@googlegroups.com
The heap size can exceed physical RAM size and other programs can still run too. Things just run slower is all--'cause disk isn't as fast as RAM.

And yes, tuning the GC to run at a reasonable speed when the JVM has very large RAM (but less than physical RAM) can be difficult. And there is no best configuration, because a lot depends on the behavior of your app.

shweta sharma

unread,
Apr 27, 2012, 7:13:35 AM4/27/12
to bo...@googlegroups.com
If a webserver is running given JVM  arg  as
 java -d64 -Xms2g -Xmx80g mywebserver

and 2 webservices are deployed in it . will webservices have separate heap space ? or will use webserver's heap ?

in order to allocate separate heap space to webservices does one require to provide JVM args -Xms -Xmx to webservices explicitly ?

Thanks
Shweta





On Thu, Apr 26, 2012 at 3:55 PM, shweta sharma <shwe...@gmail.com> wrote:
Thanks much to  All.

Best Regards
Shweta

shweta sharma

unread,
Apr 26, 2012, 6:25:28 AM4/26/12
to bo...@googlegroups.com
Thanks much to  All.

Best Regards
Shweta

Anuraag G

unread,
May 2, 2012, 4:02:34 AM5/2/12
to Bangalore Open Java Users Group- BOJUG
As far as I know, webservices cannot be allocated separate heap spaces
this way.
This is webservers heap space and will be shared by all programs
running in that webserver.

In order to provide separate heap spaces to your webservices (though I
can't imagine why you'd want to do that) - you will have to run them
in two separate instances of webservers and manage the requests via a
reverse proxy like nginx running in front of both webservers.

Rgds,
A

On Apr 27, 7:13 am, shweta sharma <shweta...@gmail.com> wrote:
> If a webserver is running given JVM  arg  as
>
> * java **-d64 -Xms2g -Xmx80g mywebserver
>
> * and 2 webservices are deployed in it . will webservices have
> separate  heap space ? or  will use webserver's heap ?
>
> in order to allocate  separate heap space to webservices  does one
> require to provide JVM args -Xms -Xmx to webservices  explicitly ?
>
> Thanks
> Shweta
>
> *
> *
>
>
>
>
>
>
>
> On Thu, Apr 26, 2012 at 3:55 PM, shweta sharma <shweta...@gmail.com> wrote:
> > Thanks much to  All.
>
> > Best Regards
> > Shweta
>
> > On Thu, Apr 26, 2012 at 1:37 PM, Yaswanth Ravella <m...@yaswanth.org>wrote:
>
> >> can i give full RAM size  in JVM args to crease heap of size that is
> >>> equal to RAM size ?
>
> >>> like  >> * java **-d64 -Xms2g -Xmx80g MyApp*
>
> >>> The above JVM args does not create a process with 80g heap. It only
> >> creates a process with 2g of Heap and will only grow till 80g if required
> >> and if RAM is available.
>
> >> in that case  will RAM be still available for other programs running on system ?
>
> >>> Depends. lets say if your current java heap usage has grown to 10-20 gb
> >> + few more gigabytes usage by native java process, you will still have
> >> space to run other programs right ?
>
> >> by giving arg* **Xmx80g *am i requesting JVM to create that much size of heap space or forcing  JVM to create  heap of that size ?.
> >> On Thu, Apr 26, 2012 at 12:02 PM, shweta sharma <shweta...@gmail.com>wrote:
>
> >>> can i give full RAM size  in JVM args to crease heap of size that is
> >>> equal to RAM size ?
>
> >>> like  >> * java **-d64 -Xms2g -Xmx80g MyApp*
>
> >>> in that case  will RAM be still available for other programs running on system ?
>
> >>> by giving arg* **Xmx80g *am i requesting JVM to create that much size of heap space or forcing  JVM to create  heap of that size ?.
>
> >>> I read that bigger the heap slower (after a threshold value ) will be performance because it will make GC to be a hazardous task to run.
>
> >>> Any input on this will help .
>
> >>> Best Regards
> >>> Shweta
>
> >>> On Wed, Apr 25, 2012 at 6:44 PM, shweta sharma <shweta...@gmail.com>wrote:
>
> >>>> >> I have read that on running a 32 bit JVM on  32 bit OS ( windows )
> >>>> creates max of ~2.2GB size heap while same on 32 bit OS (Linux) creates
> >>>> heap of size ~ *3 . 2 GB* ( but it wont go beyond 4GB in any case) .

shweta sharma

unread,
May 2, 2012, 5:54:31 AM5/2/12
to bo...@googlegroups.com
>>in order to provide separate heap spaces to your webservices you will have to run them

in two separate instances of webservers

well , my Q is  i have a webservice deployed over a webserver  ...will it  use same heapspace that of webserver .?
as per your answer ...yes .
what i think is ..by default it will use same space , but if i run webservice in different instance of JVM & webserver  in other instance of JVM then  bot will use their own heap space that is determined by jvm arg ..

but again .. i am not sure ..can it  be done ?

thanks
shweta

Anuraag G

unread,
May 3, 2012, 3:28:53 AM5/3/12
to Bangalore Open Java Users Group- BOJUG
If you run them in two different JVM then sure, they will use their
own heap space determined by the JVM args.

-Anuraag
Reply all
Reply to author
Forward
0 new messages