Software Secret Weapons™
|
Running MySQL on Windows with 4 GB of RAM |
|||
The Problem If you just bought a brand new server with 4 GB of RAM hoping to speed up your MySQL 5.0.27 database you might be disappointed! By default, 32-bit Windows XP Professional and Windows Server 2003 cannot allocate more than 2GB RAM per process. Nor can the 32-bit MySQL/InnoDB binaries distributed by MySQL. Having 4 GB of physical RAM on the box, your MySQL instance can only use around 1.5 GB. As I have previously mentioned in my article about MySQL SNMP monitoring, MySQL continues to be extremely valuable tool in many e-commerce projects. Not without its quirks, MySQL is capable, reliable, fast and free. The fact that it's also open source and I can recompile it makes me like it even more.
The Solution In order to get around the Windows 2 GB limitation, modifications have to be made both to Windows' configuration and to InnoDB. To use the memory over 2GB MySQL relies on a special feature of Intel processors (PAE) and Windows operating system (AWE). PAE is an Intel-provided memory address extension that enables support of up to 64 GB of physical memory for applications running on most 32-bit. Support for PAE is provided under Windows 2000 and 32-bit versions of Windows XP and Windows Server 2003. PAE allows the most recent IA-32 processors to expand the number of bits that can be used to address physical memory from 32 bits to 36 bits through support in the host operating system for applications using the Address Windowing Extensions (AWE) application programming interface (API).
Thanks to Heikki Tuuri, the author of InnoDB storage engine, the InnoDB can use all the RAM you can buy. For this to work, MySQL (and InnoDB engine) will have to be recompiled, since MySQL 5.0.x standard distributions don't have this feature enabled. There are several forum posts The whole process took under an hour. It worked without any glitches the first time we tried. Before you begin, make sure that you have:
Recompiling MySQL to support over 2 GB of RAM Follow these steps:
Configure MySQL to use over 2 GB of RAM On the computer on which you wish to deploy, modify mysql.ini file. Follow these steps:
Configure Windows to use over 2 GB of RAM
On the computer on which you wish to deploy, configure Windows to use more than 2GB per process by modifying the boot.ini file by adding the /3GB flag which permits large address aware applications to use 3 GB of virtual address space (see Microsoft article
The /3GB switch should not be used on Windows 2000 Server or Window XP Pro because it is unsupported and can cause application or operating system crashes. The /3GB switch is supported only on the following operating systems: Windows 2000 Advanced Server, Windows 2000 Datacenter Server, Windows Server 2003 Standard Edition, Windows Server 2003 Enterprise Edition, Windows Server 2003 Datacenter Edition.
Allow locking of memory pages for user under which MySQL will be running. Follow these steps:
The Final Word While all appears to work great, the custom MySQL build described here might not be suitable for your needs. It works great for our off-line analytical applications, OLAP, data-mining – all those things that can benefits from a lot of RAM, but it might not work you. We recommend that you use the official MySQL binaries distributed as part of MySQL release, unless you absolutely have to use custom compilation. Comments (7) Leave a comment |
|
|||
|
Copyright © 2004-2010 by Pavel Simakov any conclusions, recommendations, ideas, thoughts or the source code presented on this site are my own and do not reflect a official opinion of my current or past employers, partners or clients |
|
Comment by Ajay M — December 27, 2007 @ 7:06 pm
I am trying a custom compilation using MS Visual Studio 2005 (ver8.0)
Microsoft Visual C# 2005 77626-009-0000007-41120
I am mostly getting the following errors along with others:
LNK1169: one or more multiply defined symbols found
Overall 17 projects suceed and 17 projects fail in the solution.
Can you possibly provide your compiled version of mysql ?
Comment by Joel — January 5, 2008 @ 11:20 pm
I pre-compiled it. Use at your own risk.
Replace the files in the bin directory with the ones in the zip.
http://rapidshare.com/files/81610254/mysql-5.0.27-win-awe.zip.html [13MB]
Comment by wizualizacje architektoniczne — February 4, 2008 @ 10:34 am
Thats great info. Thanks
Comment by Enel — September 23, 2008 @ 3:33 pm
this is a great article, gonna to try out
Comment by Nguyen — September 28, 2008 @ 5:57 pm
I am trying to compile the awe with visual studio 2005
Which file can I add the
__WIN2000__
condition define
Thanks for your help
Comment by Facepalm — February 15, 2009 @ 3:57 am
Very useful files search engine. http://Indexoffiles.com is a search engine designed to search files in various file sharing and uploading sites.
Comment by wizualizacje — August 9, 2009 @ 1:39 pm
To complex to me, I can not handle it.