You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2007/03/14 14:31:13 UTC

[OT]Re: Is better one or more Tomcat instances per machine

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Leon,

Leon Rosenberg wrote:
> But the limit for max memory you can effectively use in your java
> program on a 32bit linux, i assume you use (same for windows),
> lies far below  2Gb.

I've been trying to find the real nature of this memory limit. I have
never experienced this limit, but the only time I've required a heap
larger than a gig or so was at an old job, and I don't recall exactly
what the deal was.

The reading I've done so far on this subject leads me to believe that
most people don't know what they heck they're talking about. Some claim
that 32-bit OSs can't use more than 4GB RAM (they can) or that they have
2GB/2GB kernel and process memory boundaries (they don't, except that I
think MS Windows might have this), or that the problem is that 32-bit
OSs cannot allocate more than 2GB of contiguous memory (which may be
true, but seems irrelevant, since the Java heap need not be contiguous).

So, can you point me to a resource that actually explains what the
"problem" is and why it exists?

Thanks,
- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF9/kh9CaO5/Lv0PARAlAGAKCaFqOemTtz+odAKrgWDnujkcinlgCeOn10
8yeqOiR/saXW01YjxoaXnoM=
=5h/W
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>> Subject: Re: [OT]Re: Is better one or more Tomcat instances 
>> per machine
>>
>> I guess that Linux not only does optimistic malloc, but also
>> optimistic calloc as well. I had hoped that zeroing-out the 
>> memory would count as a "write", but apparently it does not.
> 
> I'm somewhat suprised, since calloc() normally doesn't know if it's
> getting fresh memory (guaranteed to be zero) or reusing available
> memory.  Perhaps calloc() on your platform knows when it's expanding the
> C-heap and therefore avoids the redundant clear.

I think that glibc and/or the memory manager is just magic. ;) It
already knows whether non-glibc code modified the memory, so perhaps it
also knows that when you actually try to use a page of memory created
with calloc, that it should initialize it to zero when you use it, not
when you allocate it.

I figured the opposite, but my tests appear to support a zero-on-use
implementation.

>> I think I only have a gig of swap on this development machine
> 
> You should be able to change that with yast or its equivalent.

mkswap works, too. I just don't have any unallocated disk space. Ooh,
maybe I can put my swap on a ramdisk...

>> I still can't find any documentation about a 2GB contiguous allocation
>> limit for Linux anywhere.
> 
> I don't know that there is one.  Most of the contiguity problems are
> with Windows, due to its scattering of DLLs in the user process space.
> There should be tools available for Linux (there are for Windows) to
> show what's allocated where in your process space.

There are, I just don't know how to interpret the information they
display ;)

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF+CBG9CaO5/Lv0PARAn7XAJ9mIpGwEwlWsQQYAsBXw8ynl3cd4QCgmHwa
nNo8YespEQJXcd7z335UVgk=
=0ppt
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [OT]Re: Is better one or more Tomcat instances per machine

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: Re: [OT]Re: Is better one or more Tomcat instances 
> per machine
> 
> I guess that Linux not only does optimistic malloc, but also
> optimistic calloc as well. I had hoped that zeroing-out the 
> memory would count as a "write", but apparently it does not.

I'm somewhat suprised, since calloc() normally doesn't know if it's
getting fresh memory (guaranteed to be zero) or reusing available
memory.  Perhaps calloc() on your platform knows when it's expanding the
C-heap and therefore avoids the redundant clear.

> I think I only have a gig of swap on this development machine

You should be able to change that with yast or its equivalent.

> I still can't find any documentation about a 2GB contiguous allocation
> limit for Linux anywhere.

I don't know that there is one.  Most of the contiguity problems are
with Windows, due to its scattering of DLLs in the user process space.
There should be tools available for Linux (there are for Windows) to
show what's allocated where in your process space.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>> Hmm.... perhaps I have a virtual memory limit. I have 1GB 
>> of physical RAM. While allocating a 3GB heap is pretty 
>> stupid for me, I still ought to be able to do it.
> 
> If your OS will allow, yes you should.  You may need to increase your
> swap file space, and you may burn out your hard drive thrashing pages in
> and out.

I think I just did using this little beauty:

#include <stdio.h>
#include <stdlib.h>

/* 50 MB */
#define CHUNK_SIZE (1024 * 1024 * 50)

int main(int argc, char *arvg[])
{
  void *ptr;
  int i;
  unsigned long bytes = 0l;

  for( ; ;) {
    ptr = calloc((size_t)CHUNK_SIZE, (size_t)1);
    bytes += CHUNK_SIZE;

    /* write to our new memory */
    for(i=0; i<CHUNK_SIZE; ++i)
      *((char*)ptr + i) = (char)i;

    printf("Heap has now allocated %lu bytes\n", bytes);

    if(bytes > (unsigned long)(1024 * 1024 * 1024 * 3.9))
      fgetc(stdin);
  }
}

Oddly enough, it stopped printing stuff out after 1677721600 bytes.
Before I added the "write to our memory" loop, it ran very quickly and
completed (well, the fgetc was to pause so I could observe memory
usage). I guess that Linux not only does optimistic malloc, but also
optimistic calloc as well. I had hoped that zeroing-out the memory would
count as a "write", but apparently it does not.

Anyhow, I believe I'm running out of swap in this situation. I think I
only have a gig of swap on this development machine, which means that I
have a hard limit of 2GB anyway.

Anyone care to try this program on their many-gigabyted development box?

>> My ulimit man page sucks. Anyone know how to change the virtual memory
>> limits on Linux 2.6?
> 
> Here's a link for SUSE:
> http://en.opensuse.org/SDB:Ulimit_for_Protection_Against_%22Out_of_memor
> y%22

Thanks for the link. Probably won't help me with my 1GB of virtual
memory. Heh.

>> If the heap can grow and shrink, then how can the VM hope to 
>> get one bigass memory chunk for the heap?
> 
> The JVM reserves - but does not commit - the -Xmx size during
> initialization.  If that's not available, the JVM won't start.  Once
> allocated, commits and decommits occur to expand and shrink the in-use
> size.

Aah, I see. So the heap is actually fixed (to the maximum value) but the
internal management of the heap will fluctuate.

>> Still, the only remaining reason that 2GB+ wouldn't work is
>> because of a (potential) 2GB contiguous memory allocation 
>> restriction. I see no such restriction in the malloc or brk
>> man pages on my system.  What gives?
> 
> Those are typically generic descriptions aimed at application
> programmers.  What we're discussing here is OS internals, and you'll
> rarely see those documented anywhere.  If you're lucky, the OS vendor
> will have such limitiations squirreled away in some appendix to its
> installation guide.

Well, since this is Linux, there really isn't an operating guide. I
suppose the man pages couldn't include that information, anyway, since
it's a kernel setting chosen at kernel build-time. But, the GNU malloc
man page does describe the "OOM killer" behavior exhibited by Linux
kernels (under certain configurations). I had expected that this other
issue might have been covered as well.

I still can't find any documentation about a 2GB contiguous allocation
limit for Linux anywhere. Is this just "common knowledge" that nobody
has bothered to verify?

I mean, this is entirely academic at this point, but it would be nice to
actually know the truth instead of everyone just posting their 5th-hand
repeated guesses.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF+BYu9CaO5/Lv0PARAhZGAKC1u/BtCWSdI6eIGeBuH5qXtD1JZQCfTTPw
DaJRF41SVbVFJMBgfozB3lA=
=qd9B
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [OT]Re: Is better one or more Tomcat instances per machine

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: Re: [OT]Re: Is better one or more Tomcat instances 
> per machine
> 
> Hmm.... perhaps I have a virtual memory limit. I have 1GB 
> of physical RAM. While allocating a 3GB heap is pretty 
> stupid for me, I still ought to be able to do it.

If your OS will allow, yes you should.  You may need to increase your
swap file space, and you may burn out your hard drive thrashing pages in
and out.

> My ulimit man page sucks. Anyone know how to change the virtual memory
> limits on Linux 2.6?

Here's a link for SUSE:
http://en.opensuse.org/SDB:Ulimit_for_Protection_Against_%22Out_of_memor
y%22

> If the heap can grow and shrink, then how can the VM hope to 
> get one bigass memory chunk for the heap?

The JVM reserves - but does not commit - the -Xmx size during
initialization.  If that's not available, the JVM won't start.  Once
allocated, commits and decommits occur to expand and shrink the in-use
size.

> does the VM freeze everything and relocate the heap to 
> another section of memory?

No, since the maximum size is allocated from the beginning.

> The fact that the boundaries can be moved really complicates things.

Agreed.  I think HotSpot has gone a bit overboard in this regard.

> Still, the only remaining reason that 2GB+ wouldn't work is
> because of a (potential) 2GB contiguous memory allocation 
> restriction. I see no such restriction in the malloc or brk
> man pages on my system.  What gives?

Those are typically generic descriptions aimed at application
programmers.  What we're discussing here is OS internals, and you'll
rarely see those documented anywhere.  If you're lucky, the OS vendor
will have such limitiations squirreled away in some appendix to its
installation guide.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

I knew you'd come through. It's always nice to have a VM hacker around
for questions like this.

Caldarale, Charles R wrote:
>> that they have 2GB/2GB kernel and process memory boundaries
> 
> Windows certainly does have such a boundary (although in certain server
> versions, this can be changed to 3GB/1GB user/kernel).  Most other OSs
> don't have a fixed boundary, but they do have a maximum virtual memory
> size (set by ulimit in Linux), and each installation can specify a
> default.

Hmm.... perhaps I have a virtual memory limit. I have 1GB of physical
RAM. While allocating a 3GB heap is pretty stupid for me, I still ought
to be able to do it.

My ulimit man page sucks. Anyone know how to change the virtual memory
limits on Linux 2.6?

>> since the Java heap need not be contiguous
> 
> Wouldn't it be nice if that were true.  I haven't looked at the Java SE
> 6 HotSpot code yet, but in all prior versions of Sun's JVM, the heap was
> allocated as one contiguous chunk, including the PermGen.  HotSpot has
> the ability to shift the boundaries between generations, and thus
> requires the heap to be contiguous.

Really? That sounds hard to believe. If the heap can grow and shrink,
then how can the VM hope to get one bigass memory chunk for the heap? If
the heap goes from 512MB to 768MB and the existing heap can't grow that
far (in a single heap-top-move operation), does the VM freeze everything
and relocate the heap to another section of memory? That doesn't seem right.

The fact that the boundaries can be moved really complicates things. I
had always assumed that the "heap map" that most people see in pictures
was only to make it simpler to understand. I thought that the heaps were
located wherever they needed to be.

Oh, well. Still, the only remaining reason that 2GB+ wouldn't work is
because of a (potential) 2GB contiguous memory allocation restriction. I
see no such restriction in the malloc or brk man pages on my system.
What gives?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF+A4A9CaO5/Lv0PARAtIyAJ97F8a5K+DmfNrstvtEruFdRyXdrwCdEiFa
j3AguINPMHBGDwuWSojuTXE=
=WK+n
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [OT]Re: Is better one or more Tomcat instances per machine

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: [OT]Re: Is better one or more Tomcat instances per machine

The below applies only to 32-bit systems, of course.

> Some claim that 32-bit OSs can't use more than 4GB RAM

Lots of people seem to confuse virtual space with real memory.  There is
a 4GB limitation on virtual space per process (IA32 architecture), but
the real memory (RAM) limit depends on the OS and the number of address
lines implemented between the CPU and memory, up to the max 64 GB
supported by IA32.

> that they have 2GB/2GB kernel and process memory boundaries

Windows certainly does have such a boundary (although in certain server
versions, this can be changed to 3GB/1GB user/kernel).  Most other OSs
don't have a fixed boundary, but they do have a maximum virtual memory
size (set by ulimit in Linux), and each installation can specify a
default.

> since the Java heap need not be contiguous

Wouldn't it be nice if that were true.  I haven't looked at the Java SE
6 HotSpot code yet, but in all prior versions of Sun's JVM, the heap was
allocated as one contiguous chunk, including the PermGen.  HotSpot has
the ability to shift the boundaries between generations, and thus
requires the heap to be contiguous.

Windows makes the situation worse by scattering various DLLs and other
allocations throughout the 2GB user process space, thereby significantly
reducing the contiguous space available for the JVM heap.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [OT]Re: Is better one or more Tomcat instances per machine

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Andrew Miehs [mailto:andrew@2sheds.de] 
> Subject: Re: [OT]Re: Is better one or more Tomcat instances 
> per machine
> 
> Your kernel, and the things which are doing your process 
> switching need somewhere to run - if you switch them out
> of your 4GB of virtual address space, how are they ever
> meant to 'come back to life' on the next context switch.

In IA32, it is theoretically possible to run every user process with a 4
GB local descriptor table, and when a kernel service is required, the
hardware switches to the global descriptor table due to the interrupt;
the global one maps the kernel space.  Once in kernel mode, the OS code
can juggle the segment and page tables any way it sees fit.  I don't
know if anyone actually does run with a 4 GB user process space; most
use a split in the virtual space to avoid the above juggling.

> Didn't the reason for choosing this size have something to do with  
> the memory required by the PCI slots, etc?

Not sure what you mean by "this size", since we're discussing lots of
them here.  There is considerable address space history to look back on,
starting with the original IBM PC running in what's now called x86 real
mode.  Many of the IA32 architecture aspects have evolved with
compatibility and migration in mind, so it's not what you'd design from
scratch.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Andrew Miehs <an...@2sheds.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 14/03/2007, at 3:52 PM, Caldarale, Charles R wrote:
>> The user space is the amount of RAM you as a process can
>> allocate for this single process.
>
> No - RAM has nothing to do with the split.  Process memory is the  
> amount
> of virtual space allocated to the user; the OS may choose to use much
> less RAM behind that virtual space.  Page thrashing may occur, but the
> process still gets to play with what it thinks is 2GB of "memory".

Arrgh! Ok - RAM was the wrong word.


>> This is because there needs to be some way for your process
>> to interact with the hardware and kernel.
>
> The global and local descriptor tables and the page directories/tables
> provide the translation between virtual space and RAM.  There need not
> be any split between user space and kernel space, but it's useually  
> more
> efficient to create such a boundary.

Your kernel, and the things which are doing your process switching need
somewhere to run - if you switch them out of your 4GB of virtual address
space, how are they ever meant to 'come back to life' on the next  
context
switch. As for it 'NEEDING' to be 3/1 or 2/2 - agreed - but some  
amount does
need to be there. (This is all of course assuming you are running  
some sort
of preemptive operating system)

Didn't the reason for choosing this size have something to do with  
the memory
required by the PCI slots, etc?

Andrew

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFF+BA+W126qUNSzvURAhAlAJ4qrZ1PEiQ3wnNwRBsY8lOfbaBbFACgieQD
uLK9GNTvsS7zbo1weFpM9jk=
=4UIv
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Andrew Pliszka <ap...@alienforceit.com>.
1) We are using tomcat in production with -Xmx1524M up to 1700, but I 
have never used
it with -Xmx more than 2G. I can also verify that top shows java process 
using more than 1GB.
Java process shows 200MB more allocated memory than -Xmx in top.

2) I have CentOS 4.4 machine at home that has 4GB of ram, I will test it 
as soon as I get some time.

Andrew Pliszka

Caldarale, Charles R wrote:

>>From: Andrew Miehs [mailto:andrew@2sheds.de] 
>>Subject: Re: [OT]Re: Is better one or more Tomcat instances 
>>per machine
>>
>>The user space is the amount of RAM you as a process can 
>>allocate for this single process.
>>    
>>
>
>No - RAM has nothing to do with the split.  Process memory is the amount
>of virtual space allocated to the user; the OS may choose to use much
>less RAM behind that virtual space.  Page thrashing may occur, but the
>process still gets to play with what it thinks is 2GB of "memory".
>
>  
>
>>This is because there needs to be some way for your process
>>to interact with the hardware and kernel.
>>    
>>
>
>The global and local descriptor tables and the page directories/tables
>provide the translation between virtual space and RAM.  There need not
>be any split between user space and kernel space, but it's useually more
>efficient to create such a boundary.
>
> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>  
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [OT]Re: Is better one or more Tomcat instances per machine

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Andrew Miehs [mailto:andrew@2sheds.de] 
> Subject: Re: [OT]Re: Is better one or more Tomcat instances 
> per machine
> 
> The user space is the amount of RAM you as a process can 
> allocate for this single process.

No - RAM has nothing to do with the split.  Process memory is the amount
of virtual space allocated to the user; the OS may choose to use much
less RAM behind that virtual space.  Page thrashing may occur, but the
process still gets to play with what it thinks is 2GB of "memory".

> This is because there needs to be some way for your process
> to interact with the hardware and kernel.

The global and local descriptor tables and the page directories/tables
provide the translation between virtual space and RAM.  There need not
be any split between user space and kernel space, but it's useually more
efficient to create such a boundary.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Andrew Miehs <an...@2sheds.de>.
On 14/03/2007, at 3:21 PM, Peter Crowther wrote:
> Let's be clear about the distinction between "OS" and "process managed
> by OS":
>
> - The OS as a whole can manage > 4 Gbytes of physical memory using  
> PAE;
> - On some OSs (Linux, perhaps?), a user process cannot be allocated  
> > 4
> Gbytes of RAM;

Sorry, was being lazy, yes a 32bit OS can via PAE address more than  
4GB of
memory SPACE.

On linux, and other *nixes running on IA32 hardware, you will find
that you have User and Kernel Space. The user space is the amount of RAM
you as a process can allocate for this single process. It is usually  
a 2G/2G
split, although you will sometimes find 3/1 or 1/3. This is because  
there
needs to be some way for your process to interact with the hardware  
and kernel.


> - On other OSs (Windows), a user process *can* be allocated > 4 Gbytes
> of RAM.  Microsoft SQL Server (2000 Enterprise and up) use the
> facilities built into Windows 2000 and up to allocate PAE memory to  
> the
> sinle SQL Server process.

Hey cool, looks as if Microsoft has implemented bank switching for user
space, although still rather primitive. (AWE)

Here a few links
http://support.microsoft.com/kb/274750
http://msdn2.microsoft.com/en-us/library/ms190673.aspx


You learn something new every day!

Cheers

Andrew


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Peter Crowther <Pe...@melandra.com>.
> From: Andrew Miehs [mailto:andrew@2sheds.de] 
> 32bit OSes can not use more than 4GB RAM. What you are probably  
> referring
> to is PAE, and there the kernel splits the 'extra' memory into  
> chunks, and
> can give each process part of this chunk - a single process however,  
> under
> linux can not use more than 2GB (or 3GB) of RAM (depending on how the
> kernel was compiled)

Let's be clear about the distinction between "OS" and "process managed
by OS":

- The OS as a whole can manage > 4 Gbytes of physical memory using PAE;

- On some OSs (Linux, perhaps?), a user process cannot be allocated > 4
Gbytes of RAM;

- On other OSs (Windows), a user process *can* be allocated > 4 Gbytes
of RAM.  Microsoft SQL Server (2000 Enterprise and up) use the
facilities built into Windows 2000 and up to allocate PAE memory to the
sinle SQL Server process.

		- Peter

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew,

Andrew Miehs wrote:
> 32bit OSes can not use more than 4GB RAM.

??!

A process on a 32-bit OS can't use more than 4GB of RAM, but the OS
certainly can.

>> 2GB/2GB kernel and process memory boundaries (they don't, except that I
>> think MS Windows might have this), or that the problem is that 32-bit
> 
> Well think again
> 
> http://support.microsoft.com/kb/283037
> 
> It will tell you all about the 2G/ 3G issues as well.

Note that I said that MS Windows has it's own issues. This is not
endemic to 32-bit OSs in general, though.

The OP was using Linux, so I'm basically ignoring MS Windows, anyway.

>> So, can you point me to a resource that actually explains what the
>> "problem" is and why it exists?
> 
> The above link should hopefully be enough.

Not really. There's not a lot of Linux information on Microsoft's site :(

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF+A659CaO5/Lv0PARAhqEAKCFT3nEmnvFkFzO7BW8nr+KOTG16QCfQaAs
eBTTJkT06Hc3NO+fnNoQ78w=
=wmBe
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Andrew Miehs <an...@2sheds.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 14/03/2007, at 2:31 PM, Christopher Schultz wrote:

> The reading I've done so far on this subject leads me to believe that
> most people don't know what they heck they're talking about. Some  
> claim
> that 32-bit OSs can't use more than 4GB RAM (they can) or that they  
> have

32bit OSes can not use more than 4GB RAM. What you are probably  
referring
to is PAE, and there the kernel splits the 'extra' memory into  
chunks, and
can give each process part of this chunk - a single process however,  
under
linux can not use more than 2GB (or 3GB) of RAM (depending on how the
kernel was compiled)

> 2GB/2GB kernel and process memory boundaries (they don't, except  
> that I
> think MS Windows might have this), or that the problem is that 32-bit

Well think again

http://support.microsoft.com/kb/283037

It will tell you all about the 2G/ 3G issues as well.

> So, can you point me to a resource that actually explains what the
> "problem" is and why it exists?

The above link should hopefully be enough.

Cheers

Andrew
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFF+APdW126qUNSzvURAqUtAJ0eNCOTgjU+/s0eZ+lGpcq2nNyu1wCfZj4u
7UAUSZz4U9SjvFHYAMMBp0w=
=KRln
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>> Subject: Re: [OT]Re: Is better one or more Tomcat instances 
>> per machine
>>
>> The fact remains that you can't allocate a VM heap bigger than around
>> 1750MB on my 32-bit, 2.6 Linux kernel. Why not?
> 
> You have to wait for a full moon...

:)

It looks like the problem could be due to a number of different issues,
which is why everyone argues about "the" cause.

It is /not/ endemic of 32-bit JVMs: it's apparently the fault of the OS.
Running a 32-bit JVM on a 64-bit OS (while kinda silly) should allow you
to allocate a heap much closer to the 4GB real limit on 32-bit-based
processes.

It's also /not/ the fault of the hardware. 32-bit pointer = 32-bit
addressable process space. If the OS doesn't allow you get all of that,
then it's the OSs fault, not the hardware.

It's OS dependent, and it is kernel option dependent, which is why
nobody can nail down the answer.

There are simply too many configurations out there to be able tp predict
why this problem occurs on /your/ system. I suppose you could find out
exactly why, but it would take a long time and you efforts are better
spent upgrading to an OS and JVM that can access more memory in the
first place.

It appears that if this is happening to you, there is little you can do
about it short of re-compiling your kernel with different process-memory
options (such as 2/2 versus 3/1 address splitting).

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF+CRn9CaO5/Lv0PARAuzcAJ9EwelMp52otOw+t0j7XD9IDvMGyQCgn2Vv
ykxFrl5q3p6r45DpguNF6Wc=
=5FHT
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [OT]Re: Is better one or more Tomcat instances per machine

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: Re: [OT]Re: Is better one or more Tomcat instances 
> per machine
> 
> The fact remains that you can't allocate a VM heap bigger than around
> 1750MB on my 32-bit, 2.6 Linux kernel. Why not?

You have to wait for a full moon...

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>> Subject: Re: [OT]Re: Is better one or more Tomcat instances 
>> per machine
>>
>> I don't think this has anything to do with hardware. 
> 
> It does.  To quote from the IA32 architecture spec:

Sorry... I wasn't being clear. I meant that any splits and/or memory
mappings were not enabled by hardware changes. A 32-bit OS could always
use linearly accessed memory up to 4GB without any artificial split.
Hardware changes might have made it possible to go beyond 4GB (for the
OS) and to offer more exotic artificial memory splits (4GB/4GB, for
instance).

>> Apparently, certain 32-bit versions of Solaris do not have 
>> this problem, and Java can use as much memory as any process.
> 
> Not sure what the last clause above means, but there are differences in
> Solaris on Sparc and Solaris on x86.

Certainly. This evidence was anecdotal, and I'm not sure if that
particular poster (another list) mentioned their config. Something like
"I use 32-bit Solaris and have no such problem".

The fact remains that you can't allocate a VM heap bigger than around
1750MB on my 32-bit, 2.6 Linux kernel. Why not?

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF+Bas9CaO5/Lv0PARAtXxAKCT6raQLkP8qQcOQzeNM+7r8BTHIwCfQfi3
Gu5ODBHntjJD6Nmm4AujklA=
=bFH+
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [OT]Re: Is better one or more Tomcat instances per machine

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: Re: [OT]Re: Is better one or more Tomcat instances 
> per machine
> 
> I don't think this has anything to do with hardware. 

It does.  To quote from the IA32 architecture spec:

"Starting with the Pentium Pro processor, the IA-32 architecture also
supports an
extension of the physical address space to 236 bytes (64 GBytes); with a
maximum
physical address of FFFFFFFFFH. This extension is invoked in either of
two ways:
* Using the physical address extension (PAE) flag, located in bit 5 of
control
register CR4.
* Using the 36-bit page size extension (PSE-36) feature (introduced in
the Pentium
III processors)."

> Apparently, certain 32-bit versions of Solaris do not have 
> this problem, and Java can use as much memory as any process.

Not sure what the last clause above means, but there are differences in
Solaris on Sparc and Solaris on x86.

> chris@chadis ~/projects/diagnosis $ uname -a
> Linux chadis 2.6.14-gentoo-r5 #2 PREEMPT Sat Dec 17 16:30:55 EST 2005
> i686 AMD Athlon(tm) XP 1700+ AuthenticAMD GNU/Linux
> chris@chadis ~/projects/diagnosis $ java -Xms1732M -Xmx1732M JDBCTest
> Error occurred during initialization of VM
> Could not reserve enough space for object heap
> 
> If I decrease the heap size by 1M, it works. <shrug>

What are your ulimit settings?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

David Delbecq wrote:
> 32 bits architecture, a memory pointer is 32 bits and thus can only
> address memory ranges between 0 to 2^32, that makes 4G
> back in kernel 2.4 time

Pointers didn't get bigger in 2.6, so the 4GB process limit is still
there in 32-bit 2.6 linux kernels.

> This has changed. An new architecture was brought in CPU (at pentium
> II time?) that allowed OS to do a 4G/4G mapping in 32 bits mode.

I don't think this has anything to do with hardware. Apparently, certain
32-bit versions of Solaris do not have this problem, and Java can use as
much memory as any process.

> So, 4G is the maximum memory any application can allocate in 32 bits
> modes, be it at one time or in several operations.

Right, but we're talking about a 2GB limit.

> At least that's how i understood story. I only have 1G ram +1G swap, i
> can't test, but it bet using a kernel 2.6 you can use 4G for your jvm...

Nope:

chris@chadis ~/projects/diagnosis $ uname -a
Linux chadis 2.6.14-gentoo-r5 #2 PREEMPT Sat Dec 17 16:30:55 EST 2005
i686 AMD Athlon(tm) XP 1700+ AuthenticAMD GNU/Linux
chris@chadis ~/projects/diagnosis $ java -Xms1732M -Xmx1732M JDBCTest
Error occurred during initialization of VM
Could not reserve enough space for object heap

If I decrease the heap size by 1M, it works. <shrug>

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF+Av89CaO5/Lv0PARApLQAKCsfJClSdo9EgqR3ME7sw3NNxibsQCdEPFS
HWANdJSSiKM4awlb1TcoqGo=
=DERq
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by Andrew Miehs <an...@2sheds.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 14/03/2007, at 3:11 PM, David Delbecq wrote:
> This has changed. An new architecture was brought in CPU (at  
> pentium II
> time?) that allowed OS to do a 4G/4G mapping in 32 bits mode. Since  
> you
> don't access kernel space from user mode directly, you can simply use
> different pointer for kernel space and user space. Hardware wiring
> allows to map to different addresses. At application level, it does  
> not
> change anything, you still do a malloc and use resulting pointer. At
> kernel level, changes have been made when datas are transfered from
> kernel space to user space. However, for this 4G/4G split to work, you
> will need a 2.6 kernel i think.
>
> So, 4G is the maximum memory any application can allocate in 32 bits
> modes, be it at one time or in several operations.

Ummm - 4G/4G can't work - I think what you are referring to is PAE, and
this does what effectively was earlier called bank switching - oh those
memorys of TRS80s and Commodore 64s! (Oh and this works with 2.4)

Cheers

Andrew

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFF+AS1W126qUNSzvURAsx/AJ0bOtkSMX32G4Iu6Mfa/2i6F2UxGgCdEvPi
9sN8iQ0+WYNuYWAhv+ue4es=
=nKSG
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT]Re: Is better one or more Tomcat instances per machine

Posted by David Delbecq <de...@oma.be>.
En l'instant précis du 14/03/07 14:31, Christopher Schultz s'exprimait
en ces termes:
> Leon,
>
> Leon Rosenberg wrote:
> > But the limit for max memory you can effectively use in your java
> > program on a 32bit linux, i assume you use (same for windows),
> > lies far below  2Gb.
>
> I've been trying to find the real nature of this memory limit. I have
> never experienced this limit, but the only time I've required a heap
> larger than a gig or so was at an old job, and I don't recall exactly
> what the deal was.
>
> The reading I've done so far on this subject leads me to believe that
> most people don't know what they heck they're talking about. Some claim
> that 32-bit OSs can't use more than 4GB RAM (they can) or that they have
> 2GB/2GB kernel and process memory boundaries (they don't, except that I
> think MS Windows might have this), or that the problem is that 32-bit
> OSs cannot allocate more than 2GB of contiguous memory (which may be
> true, but seems irrelevant, since the Java heap need not be contiguous).
>
> So, can you point me to a resource that actually explains what the
> "problem" is and why it exists?
>
> Thanks,
> -chris
>

32 bits architecture, a memory pointer is 32 bits and thus can only
address memory ranges between 0 to 2^32, that makes 4G
back in kernel 2.4 time, you add same pointer to address kernel space
from within application and application allocated space. However, there
needed to be a way to distinguish easily between kernel space and
application space and by this mean prevent user space to play in kernel
space. This was decided the separation would be at 2G. In those time
this was not a real problem. My home computer had barely 32M memory, so
why would i need to address more than 2G? But progressively this limit
became a problem to user applications. Patch were issued to do a 3G/1G
split but it was not enough.

This has changed. An new architecture was brought in CPU (at pentium II
time?) that allowed OS to do a 4G/4G mapping in 32 bits mode. Since you
don't access kernel space from user mode directly, you can simply use
different pointer for kernel space and user space. Hardware wiring
allows to map to different addresses. At application level, it does not
change anything, you still do a malloc and use resulting pointer. At
kernel level, changes have been made when datas are transfered from
kernel space to user space. However, for this 4G/4G split to work, you
will need a 2.6 kernel i think.

So, 4G is the maximum memory any application can allocate in 32 bits
modes, be it at one time or in several operations.

At least that's how i understood story. I only have 1G ram +1G swap, i
can't test, but it bet using a kernel 2.6 you can use 4G for your jvm...

Also, you can go 64bits if it's not enough :)

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org