Hi!
I ran the following test on 3 different setups:
#!/usr/bin/php <? $n=1024*256;
$usage1=memory_get_usage(); $rusage1=memory_get_usage(true); $a=array(); for($i=0;$i<$n;$i++) $a[]=0; $usage2=memory_get_usage(); $rusage2=memory_get_usage(true); echo ($usage2-$usage1).'/'.($rusage2-$rusage1); ?>
...and I got the following results:
32bit kernel & 32bit php - 18875368/19136512 64bit kernel & 64bit php - 35654376/35913728 64bit kernel & 32bit php - 18875368/19136512
Some client has a 64bit xen-based VPS with 512MB RAM user for webhosting and I'm wondering if I can free some memory installing httpd&php i386 modules.
I understand that 64bit programs use more memory because the pointers, integers, etc. are now 64bit instead of 32bit, but running a 32bit program on a 64bit architecture is the same as running that program on a 32bit architecture (just concerning the memory used)? At least, that's my conclusion after running the above test. Am I wrong?
Thank you!
PS: No, the client's service provider does not offer a 32bit vps platform and the client won't change the provider or pay for additional memory.
At Thu, 21 May 2009 23:30:44 +0300 CentOS mailing list centos@centos.org wrote:
Hi!
I ran the following test on 3 different setups:
#!/usr/bin/php
<? $n=1024*256; $usage1=memory_get_usage(); $rusage1=memory_get_usage(true); $a=array(); for($i=0;$i<$n;$i++) $a[]=0; $usage2=memory_get_usage(); $rusage2=memory_get_usage(true); echo ($usage2-$usage1).'/'.($rusage2-$rusage1); ?>
...and I got the following results:
32bit kernel & 32bit php - 18875368/19136512 64bit kernel & 64bit php - 35654376/35913728 64bit kernel & 32bit php - 18875368/19136512
Some client has a 64bit xen-based VPS with 512MB RAM user for webhosting and I'm wondering if I can free some memory installing httpd&php i386 modules.
I understand that 64bit programs use more memory because the pointers, integers, etc. are now 64bit instead of 32bit, but running a 32bit program on a 64bit architecture is the same as running that program on a 32bit architecture (just concerning the memory used)? At least, that's my conclusion after running the above test. Am I wrong?
No, you are not wrong. All x86 flavered 64-bit processors will run as 32-bit (i686) processors and when running in 32-bit mode are effectively just a i686 as far as any 32-bit program can tell. There is no reason NOT to just install a straight 32-bit OS on such a machine if there is less than 4gig of virtual memory and non-of the programms being run has any reason to use the 64-bit address space. Web hosting is a good example of this.
Thank you!
PS: No, the client's service provider does not offer a 32bit vps platform and the client won't change the provider or pay for additional memory.
On Thu, 21 May 2009 at 4:59pm, Robert Heller wrote
No, you are not wrong. All x86 flavered 64-bit processors will run as 32-bit (i686) processors and when running in 32-bit mode are effectively just a i686 as far as any 32-bit program can tell. There is no reason NOT to just install a straight 32-bit OS on such a machine if there is less than 4gig of virtual memory and non-of the programms being run has any reason to use the 64-bit address space. Web hosting
That's not strictly true. On some x86_64 chips, there are extra registers which are only available when running in 64-bit mode. Running without those registers can hamper performance, even if the program isn't using the larger address space. This can make a big difference, e.g., in the HPC space. Web hosting, yeah, probably not so much. But just saying "64bit iff >4GB RAM" doesn't tell the whole story.
On Thursday 21 May 2009, Joshua Baker-LePain wrote:
On Thu, 21 May 2009 at 4:59pm, Robert Heller wrote
No, you are not wrong. All x86 flavered 64-bit processors will run as 32-bit (i686) processors and when running in 32-bit mode are effectively just a i686 as far as any 32-bit program can tell. There is no reason NOT to just install a straight 32-bit OS on such a machine if there is less than 4gig of virtual memory and non-of the programms being run has any reason to use the 64-bit address space. Web hosting
That's not strictly true. On some x86_64 chips, there are extra registers which are only available when running in 64-bit mode. Running without those registers can hamper performance, even if the program isn't using the larger address space.
There's a 2nd factor. On 32-bit you loose full flexibility memory wise when you pass 920-ish MB. After that you're split up into low-mem and high-mem. On 64-bit, of course, all memory is low-mem.
/Peter
This can make a big difference, e.g., in the HPC space. Web hosting, yeah, probably not so much. But just saying "64bit iff >4GB RAM" doesn't tell the whole story.