7

I have a production server with 16GB of RAM that came with a 32bit CentOS installation.

The website hosted on this server is getting increasing amounts of traffic every day, which has led to some some MySQL performance issues. I ran mysqltuner.pl and got the following messages:

[!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***

Can I survive with the 32 bit OS, or do I need have to install the 64 bit version?

6
  • 12
    I'm pretty sure the giant warning coming out of MySQL has answered this question for you already. There's pretty much no good reason to be using a 32-bit server OS on hardware released in the last five years. Oct 2, 2012 at 11:00
  • 2
    There's some rabid downvoting on this site lately.
    – gravyface
    Oct 2, 2012 at 11:14
  • 3
    The warning is incorrect. MySQL can use all your RAM, it just can't map it, which makes its use of large amounts of RAM much less efficient than it would be with a 64-bit OS. Oct 2, 2012 at 11:30
  • 6
    @gravyface Some rabid upvoting too. 4 upvotes on a question asking whether it's a good idea to use a 64 bit OS, given: >4GB RAM and app warning saying "switch to 64 bit OS" seems pretty excessive to me. I guess I'll choose to believe that my "innate superiority" is what makes it seem like a trivial question to me. Oct 2, 2012 at 11:57
  • 8
    Why the server didn't come with 64 bit in the first place is a major concern to me...
    – tombull89
    Oct 2, 2012 at 12:00

3 Answers 3

24

You can survive just fine with the 32 bit CentOS install. But, like the warning says, using a 32 bit OS means that MySQL can't actually use all (or even most of) the RAM installed in the system.

Seems like a waste to me. If the hardware supports 64-bit, I'd certainly replace the 32 bit OS with a 64 bit one, yeah. You'd probably want to do some testing first, and/or use a second server to find out what's going to break when you switch OSes, because something always does.

Strictly speaking, you don't need to install a 64 bit OS, but you definitely should. And probably sooner, rather than later, before the RAM limitations of a 32 bit OS start causing you problems.

1
  • 1
    We should mention that this limit counts for every single process, however if mysql is the main task of this machine as that is a single process (with multiple threads) going 64 bit will be worth it.
    – ZaphodB
    Oct 2, 2012 at 13:07
13

Maximum virtual address space of a 32 bit binary is 2^32 (4GB) - once you hit this limit, you're going nowhere.

Should you switch to 64-bit? Absolutely.

Not only will you no longer hit the memory barrier, the generic 64-bit instruction set has generally better performance than generic 32-bit (due to the sheer age of x86) and thus, switching to x64 will give gains in terms of both memory and computational speed.

Obviously if you custom-compiled x86 binaries yourself with the arch target of your exact CPU, you could well find that performance compared to x64 is not all that different, however, since you're using pre-packaged CentOS binaries, obviously that's not the case.

8
  • 1
    To be a little nitpicky, 32-bit OSes can/may be able to access RAM in excess of 4GB with PAE. Otherwise a spot-on answer, and +1 anyhow. Oct 2, 2012 at 12:08
  • 5
    @HopelessN00b Yes, with PAE, the kernel can address all 16GB of RAM, but any particular process is still limited to a bit less than 4GB. Oct 2, 2012 at 12:16
  • 4
    IIRC you can implement PAE at the application level as well; and that it used to be fairly common among DBs and other memory hungry server apps back before x86-64 hardware was common. However with it now ubiquitous PAE code branches are being deprecated/abandoned due to lack of use sufficient to justify continued development work. Oct 2, 2012 at 12:39
  • 1
    "...generic 64-bit instruction set has generally better performance than generic 32-bit (due to the sheer age of x86)" -- This is a dubious statement. While it's true that 64-bit code is generally faster than 32-bit code (for various reasons including register size, memory bandwidth, and better optimization), the performance difference has nothing to do with how long x86 has been around. In fact, x86_64 is an extension of x86 and it therefore could be argued that the instruction set's history stretches all the way back to 1986. :-) Oct 2, 2012 at 14:53
  • Justin: no. All x86_64 processors are guaranteed to have certain x86 extensions SSE, SSE2 and several others, thus enabling the compiler to utilise a significantly larger instruction set when targeting the generic x86_64 architecture vs. generic i(3|4|5|6)86
    – Olipro
    Oct 3, 2012 at 15:33
3

Although answer has been accepted, there's a lot of stuff missing from the discussion here.

First: Alexandru does not mention what database engines are running on this machine, nor whether it's a dedicated DBMS server or if it's also running other stuff, nor what size the data is, nor any stats on physical I/O / VFS usage.

For a dedicated MyISAM based server, then you're not going to get much benefit from making more memory addressable. VFS does as good a job of caching the I/O as MySQL can. OTOH if it were innodb - then by golly, yes: the innodb buffer pool on a dedicated box should be around 80% of the phsyical memory on a dedicated machine.

Regardless of which DBMS is used, switching to 64bit has significant a performance benefit when doing comparison operations on the DBMS - how much depends on whether you're doing a lot of hash or b-tree based lookups.

If the same box is being used for webserving, then the big difference will be if you're using a lot of SSL on the box - SSL is all about calculating large numbers - so even without the AES acceleration in recent intel chips there's an improvment there too.

1
  • I am serving a Real Estate website that you can see here bit.ly/fwTEsT , so the server is doing all sorts of things. Database, serving website, image resizing, cron jobs, sending mails and so on. I have finally decided to take advantage of this situation and change the hosting to a dedicated server in the same country the business is. That server will have the 64bit OS installed already. Oct 5, 2012 at 12:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .