Posts tagged with: memory

Linux 64bit or 32bit?

Linux 64bit has been around for a very long time. It came out long before Microsoft released 64bit version of their Windows. During that time, AMD was the leader in 64 bit processor, thus it was called AMD64 during that time. The name has stuck on until now that some linux packages are using it in their package for 64bit packages. So don’t be puzzled that you will be installing package_AMD64.deb for your debian or ubuntu.

It was a no brainier for me by now that Linux 64bit platform has been established to be very stable and almost all packages comes with it. Being 64bit means your software will have double the bandwidth for memory usage and even processing power. However, in real work, performance is not that much faster. But the main thing about 64bit platform is to break the memory limitation of 32bit which is 4GB RAM.

I would go for 64bit for almost all my OS installation nowadays be it Linux or Windows. However, something happened the other day that made me re-think my perception on 64bit.

Recently, there was a server that I manage that needed to be upgraded. We bought a new server with better hardware specs but it remained 4GB RAM. At that time, we do not think there is a need to add more RAM and server RAMs are not cheap either. As usual, I went for Ubuntu 10.04 LTS 64bit as this is currently our choice of Linux for our servers. After taking few days to painstakingly install, configure and migrated the data from old server, the new server went online. However, the following day we encountered some problems. The server were slow and at one time it even crashed. We had to reboot it and as usual, we check the logs for any signs of problems. Eventually, we found that the APC (Alternative PHP cache) that is running in the server keep churning out error that it does not have enough memory. So we knew this has something to do with memory. We tinkered with APC and the server became more stable and load is now running pretty low at less than 2.0.

However, there are still some problem which we are still not sure whether it is APC or other components like Apache2 or PHP. Eventhough the configurations are all same from old server, the software version is running at newer version. Another few days are spend checking and tinkering until we found the “blank page” problem is due to APC. However, disabling APC does not solve the problem permanently as it will cause the server to run higher load and more memory.

After even more checking, we found that each PHP session is using double the amount of memory from previous server. This eventually lead to the culprit…..64bit. Apparently when you go to 64bit, the amount of memory used will almost become double. That is for certain applications only. In our case, PHP is using double the memory to run the usual stuff but to give 64bit some credit, it does run a bit faster than before. Maybe it is due to the wider 64bit memory bandwidth or maybe it is due to the better processor.

In any case, this taught me a lesson on 32bit vs 64bit.

  1. Use 32bit – if you do not plan to upgrade your system RAM to more than 4GB.**
  2. Use 64bit – if you will definitely be using more than 4GB memory now or later in upgrade. To take advantage of 64bit processor and hardware.

**Bear in mind that it is possible to have 32bit Linux with more than 4GB RAM. Linux 32bit kernel will still be able to make use of all the memory using something called PAE (Physical Address Extension). However, this method does have some limitations. **