Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a Debian server VPS, and the provider installed 64-bit Debian 5. Should I ask for an 32-bit install, given that I have only 750 MB RAM and I have heard that variables take more RAM on 64-bit systems?

share|improve this question
2  
Depends on what you're going to run, actually. Try some of your loads and check whether your RAM will be enough. –  Renan May 11 '12 at 1:18
    
Ill run: Postgres, Apache and Tomcat. –  Jhonnytunes May 11 '12 at 1:29
    
Note: should you decide to upgrade to more RAM later, 32-bit can get problematic (there's PAE for pole-vaulting over the 4GB limit, but that has some overhead of its own). –  Piskvor May 11 '12 at 8:38
    
Both VPS hosts I've used installed custom kernels for their hypervisors so chances are you'll have to stick to their versions of the OS - if they don't offer 32-bit I doubt you can just install your own. –  Rup May 11 '12 at 10:25
add comment

4 Answers 4

up vote 11 down vote accepted

The short answer:

Variables do not take double the space in 64-bit vs 32-bit software. The potential memory gain from switching to a 32-bit OS will not be worth the effort.

The long answer:

Numbers can be larger yes, but that doesn't mean they will be. Also this applies to numbers, not strings, and strings are (generally) what consume the most amount of memory in an application.

Additionally, many applications explicitly specify the size of the number they want to work with, as in languages like C, int can be any size, including smaller than 32-bit. And going even further, on my 64-bit Linux machine, in C int is 32-bit. So you would have to explicitly request long long to get a 64-bit number.

So basically, applications aren't going to use more memory just because they were compiled for 64-bit.

EDIT:
In response to Gilles' claim that 64-bit Firefox uses twice as much memory, I went and did a comparison between 32-bit and 64-bit Firefox on my system.
I tested by launching 5 tabs open to http://acid3.acidtests.org/ and performed the test 3 times (once in 32-bit, once in 64-bit, and then repeat twice). I chose this site because it's JavaScript intensive, and uses static content (each rendering of the page will provide the same data).

On the final run:

  • 32-bit: 173,244kb rss / 918,348kb virt

  • 64-bit: 184,588kb rss / 966,624kb virt

I could do more extensive testing yes, but I think this demonstrates well enough that the size difference between the two is marginal.

share|improve this answer
    
This is grossly exaggerated. Some programs do take almost twice as much memory in 64-bit mode, it depends what kind of data they manipulate. I've noticed that Firefox and Chrome take even more than twice the memory (I've never investigated why: code size?). For Apache, the extra memory consumption is likely to be small (but I haven't measured). –  Gilles May 11 '12 at 1:35
    
@giles hardly. I just launched a 32-bit and 64-bit firefox. 32-bit uses 133,340kb after launch. 64-bit uses 133,412kb after launch. –  Patrick May 11 '12 at 1:45
    
It may have improved recently, I think I last checked with Firefox 4. I measured by taking an otherwise idle system (running almost only 64-bit programs, which should favor the 64-bit executable since some of its shared libraries were already loaded) and comparing the amount of free memory after loading a few tabs (some JS, no Flash): I found that (free_memory_with_ff_64 - free_memory_without_ff) > 2 * (free_memory_with_ff_32 - free_memory_without_ff). –  Gilles May 11 '12 at 1:49
4  
@Gilles I think there was some flaw in the test. Even if firefox stored every last little bit of data as an integer (no strings, which wouldnt change size), and every single integer changed from 32-bit to 64-bit, the size would at most double. There is no explanation for it to more than double. –  Patrick May 11 '12 at 2:58
1  
"Numbers can be larger yes, but that doesn't mean they will be." - but all pointers will now definitely be 64-bit where they used to be 32. –  Rup May 11 '12 at 10:26
show 3 more comments

If the provider installed 64-bit Debian 5, I recommend you to stay with this version.

Difference between 64bit and 32bit are not only in memory manager.

share|improve this answer
add comment

Except for a few number-crunching applications that run faster, the only benefit of a 64-bit system is that you can address more than 4GB of memory. Since some of the address space is reserved to the kernel, a process only gets about 2GB or 3GB of address space (or more or less, depending on the kernel configuration). For a database and web server use case, you aren't planning of swapping much, and you aren't going to do much number crunching. So, with only 750MB of RAM, you will not see any benefit of using a 64-bit system.

The code size is about the same between i386 (32-bit) and amd64 (64-bit) code. The data memory used by 64-bit program is somewhat larger; how much larger depends on the application. I would expect to see a noticeable, but not large difference for your use case.

Given that there is a little cost and no benefit to using 64 bits, I recommend that you use a 32-bit system, if it's not too much trouble to obtain.

share|improve this answer
add comment

I choose 32-bit over 64-bit installs for systems with less than 4gig of ram.

64-bit DOES use more memory, due to the nature of it's pointers, this ranges between roughly 10 and 50 megabytes extra for a vanilla LAMP install.

On a system with limited ram, for example 256meg, this can be a sizeable chunk.

Technically, with PAE the same applies upto 64gig, however the addressable space for applications is still limited to 4gig in any case. Therefore with anything over 4gig, 64-bit is recommended to utilize the performance gains, not least those associated with PAE's overhead.

In a nutshell: <4gig = 32bit | >4gig = 64bit.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.