Search

Top 60 Oracle Blogs

Recent comments

If you’re not using hugepages, you’re doing it wrong!

Well, there’s been a bit of a delay in with my planned testing of dbVisit Replicate and Oracle GoldenGate for zero-downtime upgrades. So, I’ll be (hopefully) getting back to that within a couple of weeks.

Meanwhile, I recently ran across a discussion on the Oracle OTN Community forums, asking about performance and hugepages configuration, here in the Oracle Database – General Questions Forum.

I think my answer bears repeating, so, here is a slightly modified version:

First, I’m going to take a strong position on hugepages. I’m going to go as far as to say, for any non-trivial SGA size, if you’re not using hugepages, you’re doing it wrong. There are three main points to consider.

First, when allocating a large SGA, each page needs an entry in the page table. On x86-64 (a 64-bit architecture), each PTE (page table entry) is 8 bytes. So, let’s assume you are allocating a 20GB SGA. Standard shared memory pages are 4kb. So, to allocate 20GB of SGA, you need 5,242,880 4kb pages. Each of those pages requires an 8-byte entry in the page table. So, that’s 40MB of page table entries.

The second point is that, with standard 4k pages, each process that attaches to the SGA needs it’s own copy of the page table. So, if you have, say, 200 dedicated server processes, that implies 8000MB of page table entries. So, for a 20GB SGA, you have an extra 8GB (approximately) of overhead.

Compare that to the same 20GB SGA, implemented with hugepages. 20GB, using 2MB sized hugepages, means 10,240 pages, and correspondingly, 10,240 page table entries. Again, a page table entry is 8 bytes. So, for the same 20GB SGA, the page table overhead is only 80kb. However, the other big savings, is that with hugepages, the page table is shared. So, you only need that one copy of the 80kb page table for your 20GB SGA, regardless of how many dedicated server processes attach to the SGA!

Finally, hugepages are locked into memory, and cannot swap. So, that also can add significantly to stability.

So, depending on the size of your SGA, the number of dedicated server processes, and the total amount of RAM on the server, it’s not hard to imagine that without hugepages configured correctly, you could suffer from significant performance problems.

As I said before, if you’re not using hugepages, you’re doing it wrong!