Low End Box

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

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.

33 Comments

  1. Minh@Minh Meo's Blog wrote:

    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
  2. QuickWeb-Joe wrote:

    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
  3. eM wrote:

    it was my thread, thanks for the clarification :)

    July 14, 2010 @ 3:12 am
  4. bekanosky wrote:

    @quickweb
    It will be good if quickweb support custom kernel on xen pv :D

    July 14, 2010 @ 4:52 am
  5. QuickWeb-Joe wrote:

    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
  6. nimad wrote:

    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
  7. Adam wrote:

    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
  8. LowEndAdmin wrote:

    @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
  9. Minh@Minh Meo's Blog wrote:

    @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
  10. dmmcintyre3 wrote:

    @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
  11. KLIKLI wrote:

    @ “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
  12. KLIKLI wrote:

    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
  13. Minh@Minh Meo's Blog wrote:

    @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
  14. dmmcintyre3 wrote:

    @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
  15. KLIKLI wrote:

    @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
  16. Minh@Minh Meo's Blog wrote:

    @ KLIKLI: i sent you vps info. Many thanks again! :D

    July 16, 2010 @ 2:02 am
  17. bekanosky wrote:

    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
  18. KLIKLI wrote:

    @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
  19. KLIKLI wrote:

    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
  20. bekanosky wrote:

    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
  21. KLIKLI wrote:

    @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
  22. bekanosky wrote:

    @KLIKLI
    Yes, it is real wordpress blog.
    Just click on my name to see the action

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

    @bekanosky

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

    July 16, 2010 @ 5:37 pm
  24. bekanosky wrote:

    @KLIKLI
    memory usage is 40MB-50MB.

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

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

    July 17, 2010 @ 4:01 am
  26. KLIKLI wrote:

    @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
  27. bekanosky wrote:

    @KLIKLI
    ?????
    i don’t use webmin

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

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

    July 17, 2010 @ 2:37 pm
  29. bekanosky wrote:

    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
  30. LowEndAdmin wrote:

    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
  31. bekanosky wrote:

    “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
  32. bekanosky wrote:

    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
  33. LowEndAdmin wrote:

    @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

RSS feed for comments on this post. TrackBack URL

Leave a comment

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.