LowEndBox

Hosting Websites on Bare Minimum VPS/Dedicated Servers

32bit or 64bit for My Low End VPS, Take #2

Date/Time: July 14, 2010 @ 12:57 am, by LowEndAdmin

Saw this discussion on WHT today when someone tries to confirm whether “32bit systems are better when it comes to memory management”, and when it comes to low end virtual servers, which of 32bit or 64bit operating system is preferred.

That’s something I have discussed over 2 years ago, but for all the new readers out there — go for 32bit OS for your next low end VPS. The “memory management” perspect is the same between 32bit and 64bit — it’s the same OS with the same virtual memory manager (well, not quite, as with 64bit there are a lot more tricks for OS to play with). But the main reason for going 32bit is, your applications are going to use far less memory due to a lot of data is only stored at 1/2 the space as 64bit. Modern scripting language VMs are full of pointers (I am talking about PHP, Python VMs etc) and when all those values are double in size, it can really add up.

I will only go 64bit for my low end VPS if

  • That’s the only OS image the providers offer. Let’s just call it a conspiracy to get you upgrade earlier.
  • 64bit testing. I have one small 64bit VPS around so I can do compilation + testing of some of my open sourced code under 64bit.
  • Application requirement. Probably not that relevant if you are just running an web app, but some other apps might require 64bit.

Or your MySQL database that needs more than 4GB for key buffers. But in those case you should not be reading LowEndBox anyway :) These days I found 32bit is usually good enough for big boxes when you use PAE, as the performance penalty is really insignificant with today’s CPU/memory speed.

42 Comments

  1. Another great post! Most of us are looking for next tutorial “how to setup webserver (nginx + php-fpm + mysql) for popular wordpress blog like LEB with 80mb Ram only”

    Many thanks for great site!

    July 14, 2010 @ 1:18 am | Reply
  2. Well for Xen para-virtualization VPS, as most host node run on 64-bit unless custom kernel is allowed or supported by host node (via hooks/pygrub) 64-bit template OS offer better compatibility and could have lesser issues in some cases… this is not the case with OpenVZ though.

    July 14, 2010 @ 2:27 am | Reply
  3. eM:

    it was my thread, thanks for the clarification :)

    July 14, 2010 @ 3:12 am | Reply
  4. @quickweb
    It will be good if quickweb support custom kernel on xen pv :D

    July 14, 2010 @ 4:52 am | Reply
  5. The SolusVM version released yesterday supports Xen custom kernel [1], we need to fully test it first before putting into production as well as building new templates, Ubuntu 10.04 LST OS template will be coming soon for sure, however we could not give any ETA at this stage.

    [1] http://wiki.solusvm.com/index.php/Advanced_Configuration#Xen_PV_Custom_Kernel_per_Template

    July 14, 2010 @ 5:57 am | Reply
  6. Actually I came here having exactly the question about 32 vs 64 byte in my mind, and at all my surprise the answer was in the first post! You showed again that you are GREAT!

    @Minh@Minh Meo’s Blog
    I have written a tutorial for nginx+nsd3 (instead of bind)+ ,php-fastcgi+ drupal, but it may well server installing wordpress too just by changing the last bit:

    http://vpsdiary.blogspot.com/2010/06/unmanaged-vps-set-up-from-scratch.html

    The configuration above is quite robust, but to be honest I am not sure which one is better: php-fm or php-fastcgi. A comparison would be great

    July 14, 2010 @ 11:09 am | Reply
  7. SolusVM will support PyGrub in their next release :)

    PyGrub enables you to start Linux PV DomUs with the kernels that lie in the filesystem of the DomU instead of with a Kernel that lies in the filesystem of the Dom0.

    July 14, 2010 @ 11:47 am | Reply
  8. @nimad — nice blog post!

    php-fm is “better” in terms of FastCGI management, as the default php-cgi has pretty limited FastCGI capability. However for low-memory virtual servers I don’t think these are needed. Certainly using php-cgi would save you a lot of time compiling/recompiling PHP from source (i.e. php-fm). If you have million page views/day then it might be a different story.

    July 14, 2010 @ 12:15 pm | Reply
  9. @nimad: many thanks! But i want to know how we can optimize like LEB (popular blog with 80mb ram only!!!). As i know php-fm better than php-fastcfi :D

    @LEB Admin: please publish your tutorial soon :D

    July 14, 2010 @ 1:38 pm | Reply
  10. @Minh@Minh Meo’s Blog I use this:
    https://freevps.tk/thread-60.html
    It’s handling over 1k pageviews per day on a 128 MB dedicated/256 MB burstable VPS and rarely gets into the burstable ram. It hovers around 96-150 MB used.

    July 14, 2010 @ 9:42 pm | Reply
  11. KLIKLI:

    @ “Minh@Minh Meo’s Blog”

    How many memory you expect to use for bare nginx+PHP-FPM+MySQL?

    I am using 28MB currently. Is it lower then the one in https://freevps.tk/thread-60.html

    FYI:

    # ps aux; free
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root         1  0.1  0.5   1980   688 ?        Ss   19:30   0:00 init [2]      
    root      1465  0.0  0.6   2296   892 pts/0    R+   19:33   0:00 ps aux
    root     28427  0.0  0.4   1692   600 ?        Ss   19:30   0:00 /sbin/syslogd
    root     28465  0.0  0.3   1704   512 ?        S    19:30   0:00 /bin/sh /usr/bin/mysqld_safe
    mysql    28516  0.0  3.6  22512  4736 ?        Sl   19:30   0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld
    root     28517  0.0  0.4   1628   536 ?        S    19:30   0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
    root     28563  0.0  0.3   2040   464 ?        Ss   19:30   0:00 /usr/sbin/dropbear -d /etc/dropbear/dropbear_dss_host_key -r /etc/dropbear/dropbear_rsa_host_key -p 999
    root     28569  0.0  2.1  18652  2804 ?        Ss   19:30   0:00 /usr/local/bin/php-cgi --fpm --fpm-config /usr/local/etc/php-fpm.conf
    www      28570  0.0  1.8  18652  2464 ?        S    19:30   0:00 /usr/local/bin/php-cgi --fpm --fpm-config /usr/local/etc/php-fpm.conf
    www      28571  0.0  1.8  18652  2464 ?        S    19:30   0:00 /usr/local/bin/php-cgi --fpm --fpm-config /usr/local/etc/php-fpm.conf
    www      28572  0.0  1.8  18652  2464 ?        S    19:30   0:00 /usr/local/bin/php-cgi --fpm --fpm-config /usr/local/etc/php-fpm.conf
    www      28573  0.0  1.8  18652  2464 ?        S    19:30   0:00 /usr/local/bin/php-cgi --fpm --fpm-config /usr/local/etc/php-fpm.conf
    www      28575  0.0  1.8  18652  2464 ?        S    19:30   0:00 /usr/local/bin/php-cgi --fpm --fpm-config /usr/local/etc/php-fpm.conf
    root     28596  0.0  0.6   2352   868 ?        Ss   19:30   0:00 /usr/sbin/xinetd -pidfile /var/run/xinetd.pid -stayalive -inetd_compat -inetd_ipv6
    root     28611  0.0  0.6   2036   872 ?        Ss   19:30   0:00 /usr/sbin/cron
    root     32025  0.0  0.9   2352  1240 ?        Rs   19:31   0:00 /usr/sbin/dropbear -d /etc/dropbear/dropbear_dss_host_key -r /etc/dropbear/dropbear_rsa_host_key -p 999
    root     32122  0.0  0.4   1800   588 pts/0    Rs   19:31   0:00 -bash
                 total       used       free     shared    buffers     cached
    Mem:        131072      28668     102404          0          0          0
    -/+ buffers/cache:      28668     102404
    Swap:            0          0          0
    #
    
    July 15, 2010 @ 3:29 pm | Reply
  12. KLIKLI:

    If you can provide me an VPS for 1 day or 2 I can help you to write one and post it in your blog:)

    July 15, 2010 @ 3:35 pm | Reply
  13. @KLIKLI: You great man! How can i contact you, please give me your mail, my mail: media at minhmeo dot info

    July 15, 2010 @ 7:02 pm | Reply
  14. @KLIKLI
    I restarted every service (except ssh) and it went down to 45 mb used. Also, I forgot to turn off webmin which was using 20 MB for itself. Anyway, I might have a VPS for you to make a tutorial with.

    July 15, 2010 @ 10:38 pm | Reply
  15. KLIKLI:

    @dmmcintyre3
    I believe that if you use pdksh instead of bash and replace OpenSSH with dropbear your VPS will use even less ram compared with me.

    @ ‘Minh@Minh Meo’s Blog’
    klikli@ymail.com

    July 16, 2010 @ 1:26 am | Reply
  16. @ KLIKLI: i sent you vps info. Many thanks again! :D

    July 16, 2010 @ 2:02 am | Reply
  17. I guess KLIKLI’s VPS is openvz.
    Clean openvz vps installation will consume less RAM than Xen .
    You can see that there is no kernel process in ‘ps aux’

    July 16, 2010 @ 2:35 am | Reply
  18. KLIKLI:

    @bekanosky:
    Yes you are correct I am using an low-end VPS with this http://www.lowendbox.com/blog/pingvps-openvz-vps-in-france-starting-from-1-07/

    OpenVZ is an OS-Level virtualisation and its kernnel is shared thus fewer RAM is consumed.

    REF: http://en.wikipedia.org/wiki/OpenVZ

    July 16, 2010 @ 2:44 am | Reply
  19. KLIKLI:

    well reply to bekanosky is filtered out :(
    Anyway,

    Yes you are correct that I am using OpenVZ. Actually I am using an low-end VPS with this: http://www.lowendbox.com/blog/pingvps-openvz-vps-in-france-starting-from-1-07/

    As OpenVZ is actually an OS-Level virtualisation, it consumes less RAM since their kernel is shared among VPSes. This saves up many ram and I actually prefer it more.

    July 16, 2010 @ 3:01 am | Reply
  20. KLIKLI
    I also use pingvps.
    How do you thing about their burstable RAM? i don’t sure that i can rely on the burstable RAM (even a little ).

    July 16, 2010 @ 3:07 am | Reply
  21. KLIKLI:

    @bekanosky

    Are you serving real websites on your VPS? How is the memory usage?

    Anyway I would say burstable RAMs should not be calculated in your “Usable RAMs” list.

    July 16, 2010 @ 3:20 am | Reply
  22. @KLIKLI
    Yes, it is real wordpress blog.
    Just click on my name to see the action

    July 16, 2010 @ 4:39 pm | Reply
  23. KLIKLI:

    @bekanosky

    Good :D you did make a great website with low generation time

    July 16, 2010 @ 5:37 pm | Reply
  24. @KLIKLI
    memory usage is 40MB-50MB.

    July 16, 2010 @ 10:52 pm | Reply
  25. KLIKLI:

    @bekanosky
    Isn’t you said that turning off webmin saved 20MB memory?

    July 17, 2010 @ 4:01 am | Reply
  26. @KLIKL that was me.

    Mine is sitting in 79-85 mb RAM use right now. My php config probably could use some optimization though. Also, this is 64 bit CentOS on OpenVZ as 64 bit is the only option for CentOS.

    July 17, 2010 @ 5:15 am | Reply
  27. @KLIKLI
    ?????
    i don’t use webmin

    July 17, 2010 @ 1:46 pm | Reply
  28. KLIKLI:

    Is somebody “stealing” my name?!
    @bekanosky Sorry I was confused.

    July 17, 2010 @ 2:37 pm | Reply
  29. I have made some *simple* research about this 32 bit issue.
    It is obviously not a real research.
    My conclusion is, what’s really matter in openvz is your host kernel/distro, not your distro/kernel.

    http://en.seputarvps.info/blog/openvz-user-bad-news-32bit-distro-will-not-save-your-memory/

    And i think Xen PV without own kernel will be the same.

    July 26, 2010 @ 5:29 am | Reply
  30. Well. Your research is on comparing Xen vs. OpenVZ, rather than 32bit vs. 64bit. OpenVZ uses a completely different memory accounting system, where your burstable memory/privvmpages is probably the single most important metrics. Applications on VZ that allocates more than it uses (kernel-level overcommitting) imply that you probably will not be able to run as many applications if not tuned properly — issues that are not relevant to Xen/KVN/VMWare-based VPS.

    However if you are comparing the same distro on the same virtualization platform, 64bit is still using more memory than 32bit.

    July 26, 2010 @ 5:35 am | Reply
  31. “For example the contained processes may be 64 bit and use multiple cpus, if the host is 64 bit and has multiple cpus” -> how about this statement.
    But, maybe you’re right. Don’t try this yet at 64bit openvz.

    July 26, 2010 @ 5:41 am | Reply
  32. Another question. Our user process living inside the kernel, right ? The kernel itself use 64bit.So, our process is in 64bit mode.

    LEA:”However if you are comparing the same distro on the same virtualization platform, 64bit is still using more memory than 32bit.”
    I guess not only process that consume memory, something else will consume too. Need to digging more.

    — afterall, i’m just another VPS newbie —

    July 26, 2010 @ 6:02 am | Reply
  33. @bekanosky — there is no problem running 32bit guests on 64bit OpenVZ system. The burstable/guaranteed memory also only counts the memory used in the userland, i.e. your 32bit apps. All the kernel portion of your apps will be counted against kmemsize in OpenVZ, and most sensible providers will give you a very large allowance on that so mostly irrelevant.

    I guess not only process that consume memory, something else will consume too. Need to digging more.

    For OpenVZ, it is mostly processes and their related resources (shared memory, opened files, TCP connections, etc). On Xen your kernel memory is counted against your allocated amount + cache/buffers and lots of other cryptic stuff that you can check under /proc/meminfo. Very different ball game.

    July 26, 2010 @ 8:41 am | Reply
  34. Sidahmed:

    @bekanosky has confirm that “there is no problem running 32bit guests on 64bit OpenVZ system”.
    What Xen, does is recommend to run 64bit OS on a VPS that hosted on 64bit node? I need someone to confirm what QuickWeb-Joe (Comment #2) has wrote.

    September 9, 2010 @ 1:13 pm | Reply
  35. Sidahmed:

    Sorry, I mean what about Xen? (about is missing from the above comment)

    September 9, 2010 @ 1:14 pm | Reply
  36. Ron:

    @Sidahmed – Generally if you’re running a 32bit OS on Xen (Paravirtulized) then I would highly recommend that you ask the provider to enable PyGrub for you so that you can use the 32bit Xen kernel on your OS.

    On the other hand, if the provider does not offer PyGrub, then you are better going for a 64bit OS as it will likely cause less compatibility problems.

    For example, various installation scripts check the kernel architecture to determine if to install 32bit or 64bit packages. If you were running a 32bit on a Paravirtulized OS on a 64bit host node, without PyGrub, the install script would then think you were running a 64bit OS, try to install the 64bit packages, and fail to do so.

    September 9, 2010 @ 3:43 pm | Reply
  37. Sidahmed:

    Thanks very much Ron for the clear and detailed answer, I appreciate it.

    September 9, 2010 @ 4:05 pm | Reply
  38. dd:

    “But the main reason for going 32bit is, your applications are going to use far less memory due to a lot of data is only stored at 1/2 the space as 64bit. ”

    While this is true there are speed advantages to 64 bit:

    1) 64 bit integer math (such as used in encryption algorithms) is done in hardware not software.
    2) The number of general purpose registers is 8 for 32 bit (eax, ebx, ecx, edx, ebp, esp, esi, edi) wheras it is 16 for 64 bit (rax, rbx, rcx, rdx, rbp, rsp, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15) so it is possible for the compiler to keep more variables on registers which are faster than the stack.
    3) More arguments can be passed in registers for small functions than pushing them on the stack.

    These points make the same program faster when compiled as 64 bit than when compiled as 32 bit though it may use more memory it will make it up in speed.

    March 20, 2011 @ 5:04 pm | Reply
    • Yes I don’t deny that. Specific programs tuned for 64bit can get quite a bit of performance gain, especially those using 64bit arithmetic and 64bit registers. At the same time 64bit code is a bit bigger so your performance might suffer if a loop cannot be fit into cache.

      I guess people just need to weight out what architecture is most suitable for his/her applications. You are trading memory for arithmetic performance. Sometimes it’s worth it, and sometimes not.

      March 20, 2011 @ 10:43 pm | Reply
  39. I am trying to choose the os template. thanks for the post. So 32bit is good for low end. what if I upgrade later to high end vps? 32bit will still work fine??

    August 1, 2011 @ 4:50 am | Reply
  40. Excellent Piece

    August 1, 2014 @ 10:40 am | Reply
  41. Helped a lot! Thanks!

    August 16, 2015 @ 1:00 am | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Quoting webhostingtalk.com URL seems to get binned consistently here, but I do peek into the spam box frequently to publish those comments.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *