List:General Discussion« Previous MessageNext Message »
From:Jeremiah Gowdy Date:June 18 2005 1:40pm
Subject:3G address space and large memory on x86 32bit (was: can innodb_buffer_pool_size be set > 2Gb on FreeBSD?)
View as plain text  
I'm hoping this will serve as a reference since this topic comes up often. 
If you Google search, you'll find people who explain these topics better 
than I do, but here's what you need to know.

2GB is the division set between the user's address space, and the address 
space the kernel maintains for kernel and other code to be mapped into.  It 
is adjustable, for better or for worse.

In FreeBSD, look in /boot/defaults/loader.conf and you'll see kern.maxdsiz. 
If you have 4GB of ram, you can probably get away with setting this to 3GB. 
You can expirement with the setting and if your system panics because you 
set the value too high, you can just use the boot loader to override 
kern.maxdsiz back to something sane.  Before I went 64bit on my MySQL boxes, 
I ran MySQL under FreeBSD this configuration.

For Windows XP Pro (which you should not be using for MySQL or any other 
server), Windows 2000 Advanced/Datacenter Server, Windows Server 2003 (any 
edition), or Windows NT 4.0 Enterprise you can specify the /3GB switch which 
has pretty much the same effect as the FreeBSD tuning, except that you need 
to recompile MySQL specifying the /LARGEADDRESSAWARE linker flag, or use 
Editbin.exe (part of Visual Studio 6) to modify the stock MySQL for Windows 
EXE (probably your best bet).

As I understand it, Linux runs 3G user space, 1G kernel space by default.

FreeBSD and Windows don't use the 3G/1G split because that's a very small 
amount of address space for things like your AGP aperture, cache manager, 
and other kernel usage.  Traditionally a 2GB/2GB split works out best for 
everyone because most programs don't use more than 2GB of memory.  However, 
for MySQL you *may* find that shrinking your disk cache and other kernel 
structures in order to increase your key cache pay off.

If you have an x86 system with more than 4GB of memory, and you have PAE 
enabled, and you have a kernel (of whatever operating system) that supports 
PAE, you get more than 4GB of memory total available to *all* of your 
applications, but not more than 4GB available to any particular application 
because the address space is still 32bit.  PAE just lets your operating 
system to allocate to processes all of your 6GB or 8GB of physical memory.

Under Windows XP/2000/2003, you can use Address Windowing Extensions to 
access more than 4GB of memory in a single application.  Say you had a Dual 
Xeon 3.0ghz with 16GB of ram.  You call VirtualAlloc() to acquire some 
address space for mapping the memory, call AllocateUserPhysicalPages() to 
allocate yourself 10GB worth of pages, and MapUserPhysicalPages() to map 
them into the part of your normal the 32bit space you reserved with 
VirtualAlloc().  You map the pages in, read/write them, and unmap them. 
Because the mapping of pages is just tweaking virtual memory table entries, 
the operation is very fast.

AWE will remind some old DOS programmers of EMS, where you paged 16K EMS 
pages into the 64KB EMS frame between 640K and 1MB of memory.  However, the 
overhead of AWE paging is much faster because there are no mode switches and 
no memcopy takes place when you map/unmap pages (which may or may not have 
occured in EMS depending on which EMS implementation you were using).

Corrections welcome.


Thread
can innodb_buffer_pool_size be set > 2Gb on FreeBSD?Brady Brown17 Jun
  • Re: can innodb_buffer_pool_size be set > 2Gb on FreeBSD?Jeff Smelser17 Jun
    • Re: can innodb_buffer_pool_size be set > 2Gb on FreeBSD?David Griffiths17 Jun
      • Re: can innodb_buffer_pool_size be set > 2Gb on FreeBSD?mfatene18 Jun
  • Re: can innodb_buffer_pool_size be set > 2Gb on FreeBSD?mfatene18 Jun
  • 3G address space and large memory on x86 32bit (was: can innodb_buffer_pool_size be set > 2Gb on FreeBSD?)Jeremiah Gowdy18 Jun