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.
- 5 Reasons Why You Want a Low End Box - May 26, 2021
- Dead Pool January 2012 - February 2, 2012
- exit(0); - January 19, 2012
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!
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.
it was my thread, thanks for the clarification :)
@quickweb
It will be good if quickweb support custom kernel on xen pv :D
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
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
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.
@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.
@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
@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.
@ “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:
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:)
@KLIKLI: You great man! How can i contact you, please give me your mail, my mail: media at minhmeo dot info
@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.
@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
@ KLIKLI: i sent you vps info. Many thanks again! :D
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’
@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
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.
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 ).
@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.
@KLIKLI
Yes, it is real wordpress blog.
Just click on my name to see the action
@bekanosky
Good :D you did make a great website with low generation time
@KLIKLI
memory usage is 40MB-50MB.
@bekanosky
Isn’t you said that turning off webmin saved 20MB memory?
@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.
@KLIKLI
?????
i don’t use webmin
Is somebody “stealing” my name?!
@bekanosky Sorry I was confused.
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.
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.
“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.
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 —
@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.
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.
@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.
Sorry, I mean what about Xen? (about is missing from the above comment)
@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.
Thanks very much Ron for the clear and detailed answer, I appreciate it.
“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.
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.
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??
Excellent Piece
Helped a lot! Thanks!