Live Long and Prosper: The Logical Page

Computers are all about abstraction. In the early days of computing you had to write assembly code to get your hardware to do anything. Programming languages like C and C++ created a layer of abstraction between the programmer and the hardware, simplifying the development process. The key word there is simplification. You can be more efficient writing directly for the hardware, but it’s far simpler (and much more manageable) to write high level code and let a compiler optimize it.

The same principles apply within SSDs.

The smallest writable location in NAND flash is a page; that doesn’t mean that it’s the largest size a controller can choose to write. Today I’d like to introduce the concept of a logical page, an abstraction of a physical page in NAND flash.

Confused? Let’s start with a (hopefully, I'm no artist) helpful diagram:

On one side of the fence we have how the software views storage: as a long list of logical block addresses. It’s a bit more complicated than that since a traditional hard drive is faster at certain LBAs than others but to keep things simple we’ll ignore that.

On the other side we have how NAND flash stores data, in groups of cells called pages. These days a 4KB page size is common.

In reality there’s no fence that separates the two, rather a lot of logic, several busses and eventually the SSD controller. The latter determines how the LBAs map to the NAND flash pages.

The most straightforward way for the controller to write to flash is by writing in pages. In that case the logical page size would equal the physical page size.

Unfortunately, there’s a huge downside to this approach: tracking overhead. If your logical page size is 4KB then an 80GB drive will have no less than twenty million logical pages to keep track of (20,971,520 to be exact). You need a fast controller to sort through and deal with that many pages, a lot of storage to keep tables in and larger caches/buffers.

The benefit of this approach however is very high 4KB write performance. If the majority of your writes are 4KB in size, this approach will yield the best performance.

If you don’t have the expertise, time or support structure to make a big honkin controller that can handle page level mapping, you go to a larger logical page size. One such example would involve making your logical page equal to an erase block (128 x 4KB pages). This significantly reduces the number of pages you need to track and optimize around; instead of 20.9 million entries, you now have approximately 163 thousand. All of your controller’s internal structures shrink in size and you don’t need as powerful of a microprocessor inside the controller.

The benefit of this approach is very high large file sequential write performance. If you’re streaming large chunks of data, having big logical pages will be optimal. You’ll find that most flash controllers that come from the digital camera space are optimized for this sort of access pattern where you’re writing 2MB - 12MB images all the time.

Unfortunately, the sequential write performance comes at the expense of poor small file write speed. Remember that writing to MLC NAND flash already takes 3x as long as reading, but writing small files when your controller needs large ones worsens the penalty. If you want to write an 8KB file, the controller will need to write 512KB (in this case) of data since that’s the smallest size it knows to write. Write amplification goes up considerably.

Remember the first OCZ Vertex drive based on the Indilinx Barefoot controller? Its logical page size was equal to a 512KB block. OCZ asked for a firmware that enabled page level mapping and Indilinx responded. The result was much improved 4KB write performance:

Iometer 4KB Random Writes, IOqueue=1, 8GB sector space Logical Block Size = 128 pages Logical Block Size = 1 Page
Pre-Release OCZ Vertex 0.08 MB/s 8.2 MB/s

A Quick Flash Refresher The Cleaning Lady and Write Amplification
Comments Locked

295 Comments

View All Comments

  • kisjoink - Monday, August 31, 2009 - link

    "Intel doesn't need to touch the G1, the only thing faster than it is the G2."

    I've been an avid anandtech-reader since 1998, but this is the first time I'm commenting on an article. I just have to say how much I disagree with this quote!

    I've used the x25m since its launch (December 08) and at first I was very happy with the drive. Although really expensive, I got convinced to buy one after reading your first previews and review. And the performance was great, at least for the first 4-5 months. At that time I started noticing some 'hiccups' (system freeze). At first they were few and short. But over time they become more noticeable and now they're a real pain. Sometimes my system can freeze for more than 15 seconds. It usually happens when I edit a picture in photoshop, but it can also happen while writing something in Word, programming java in Eclipse or just surfing the web.

    The problem? I'm pretty sure its the Intel drive. After reading too many SSD-articles I immediately suspected the x25m when the I started noticing the hiccups. So I got used to running the "Windows Resource Monitor" in the background - studying the disk activity after every hiccup. Just take a look at this example (just started photoshop and did some light editing on a picture):
    http://img256.imageshack.us/img256/3073/hickup.jpg">http://img256.imageshack.us/img256/3073/hickup.jpg

    I'm sure there are many ways I could tune my system better. I've done a couple of things, like moved the internet temp folder to a mechanical drive etc. And the performance of the drive will probably recover if I do this special SSD-format - but it's a real pain to have to do complete OS installation 2-3 times a year when you claim it's possible for Intel to create a new firmware with TRIM-support. I mean - I really did pay premium price for this product (close to 800$ included VAT here in Norway for the 80GB version in December 08).

    So, to summarise - I got convinced to buy the drive after reading your articles (you write great reviews!) - and I understand that the problem that I (and others from what I've been reading on forums) is really difficult to recreate in a testing environment - but that doesn't mean that the problem doesn't exist. I just wish you could point this out. The expensive G1 has some really big performance issues that might force you to do a complete reinstall of your system a couple times a year - and although Intel could fix it they wont, because they have a new, better and cheaper product out - and people like me (altough we feel really screwed over by Intel) will buy their next device (as long as its the best device out there).
  • IntelUser2000 - Monday, August 31, 2009 - link

    Is that after you installed the firmware version 8820 or before?? That reduces the problem a lot unless you filled the drive to more than 70%.
  • kisjoink - Monday, August 31, 2009 - link

    Yes, I forgot to mention that - it's after I upgraded to the 8820 firmware. I don't think I've ever filled it up with more than 80%, usually I have about 30GB of free space
  • Anand Lal Shimpi - Monday, August 31, 2009 - link

    This is actually an interesting scenario that I've been investigating a bit myself. The 8820 firmware actually significantly changes the way the drive likes to store data compared to the original firmware. That's fine for a cleanly secure-erased drive, but what happens if you have data/fragmentation on the drive already?

    Every time you write to the drive the controller will look at the preferred state specified by the new firmware. It will see that your data is organized the way the old firmware liked it, but not the new firmware. Thus upon every...single...write it will try and reorganize the data until it gets to its happy state.

    I honestly have no idea how long this process will take, I can see it taking quite a bit of time but perhaps you could speed it up by writing a bunch of sequential files to fill up the drive? The safer bet would be to backup, secure erase and restore onto the drive. You shouldn't see it happen again.

    Think of it like this. I live in my house and I have everything organized a certain way. It takes me minimal time to find everything I need. Let's say tomorrow I leave my house and you move in. You look at how things are organized and it's quite different from how you like things setup. Whenever you go to grab a plate or book you try cleaning up a bit. Naturally it'll take a while before things get cleaned up and until then you won't be as quick as you're used to.

    Take care,
    Anand
  • jimhsu - Friday, September 11, 2009 - link

    The G2's I've discovered REALLY don't like to be filled up more than 80% or so. When I had 8GB free on the 80GB drive, seq write performance basically plummeted at random intervals (to levels like 30MB/s.) Random writes sometimes dropped down to 4MB/s. Now that I've freed 20GB and tried writing and deleting large ISO files to the drive, the performance is coming back slowly.
  • Dunk - Monday, August 31, 2009 - link

    Hi Anand,

    I'm blown away by your article series on SSD - absolutely fantastic.

    When new Intel firmware is launched with TRIM support for the G2, can I flash it without losing the drive and needing to reinstall everything?

    I'm happy using the out of the box MS driver for now in Win7, but would prefer to use Intel's TRIM version once available.

    Many thanks
    Duncan
  • Anand Lal Shimpi - Monday, August 31, 2009 - link

    If Intel follows the same pattern as what we saw with the G1's firmware update, you should be able to flash without destroying your data (although it's always a good idea to back up).

    Thank you for your comment :)

    Take care,
    Anand
  • mgrmgr - Monday, August 31, 2009 - link

    Okay, single X25-M G2s can be updated without losing data. But I am considering two 80GB drives in RAID-0 to overcome the sequential write slowdown with Photoshop. How will updating work for the RAID-0 pair?

    Do you have an opinion about using a RAID pair for Photoshop?
  • Noteleet - Monday, August 31, 2009 - link

    Fantastic article, I'm definitely planning on getting a SSD next time I upgrade.

    I'm fairly interested in seeing some reviews for the Solid 2. If OCZ can get the kinks worked out I think the Intel flash and the Indilinx controller would make a winning combination for price to performance.
  • Visual - Monday, August 31, 2009 - link

    Where does the drive store the mapping between logical and physical pages and other system data it needs to operate? Does it use the same memory where user data is stored? If so, doesn't it need to write-balance that map data as well? And if that's true, doesn't it need to have a map for the map written somewhere? How is that circular logic broken?

    Or does the drive have some small amount of higher-quality, more reliable, maybe single-level-cell based flash memory for its system data?

Log in

Don't have an account? Sign up now