What does the cache on an SSD do?

Discussion in 'MacBook Pro' started by Traverse, May 2, 2014.

  1. Traverse macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #1
    I know third party SSDs like samsung have 512MB or 1GB "caches" as does Apple's retina Macs (I just saw a forum post about it), but what purpose does the cache serve?

    Forgive the ignorance, I'm trying to learn more about computer hardware.
     
  2. dmccloud macrumors 6502a

    dmccloud

    Joined:
    Sep 7, 2009
    Location:
    Anchorage, AK
    #2
    A cache holds data in memory for quicker access. Even on a HDD/SSD, items held in the cache have roughly the same access time as RAM, and both are faster than accessing from the drive itself. Cache can also be used as a buffer during I/O intensive activities to prevent drops in reading the data from the drive.
     
  3. Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #3
    Oh okay. I know what caches are used for, but not in an SSD. A buffer for I/O tasks makes sense.
     
  4. ColdCase macrumors 68030

    Joined:
    Feb 10, 2008
    Location:
    NH
    #4
    Short answer is that writing data to a SSD can sometimes take longer to store permanently than the engineer would like. A cache is used in a similar way as a HD cache, to temporarily store some data so the OS can get on with its job while the drive permanently stores the data. Just about all SSDs have some kind of cache.

    You need to spend a few weeks, perhaps in a library, studying SSD technology to fully understand how they work, the clever strategies to make them fast, and the side effects.
     
  5. thundersteele macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #5
  6. dusk007 macrumors 68040

    dusk007

    Joined:
    Dec 5, 2009
    #6
    The buffer function for the Cache is actually not why SSDs have such big caches. Even the chip often has enough cache to buffer write operations.

    The most important thing SSDs store in their cache is basically a b-tree that translates LBA (Operating System addresses) to whichever internal physical address the SSD stores a specific LBA and also to keep track of which LBAs are empty, deleted or fill with valid data.
    This is the main reason a bigger SSD needs a bigger buffer. I once read you need about 512MB for 512GB and 1GB for the 1TB SSDs to store the tree for all the LBAs.

    The cache is just a necessary part that keeps an SSD operational. It says nothing about performance and just needs to be big enough for the SSD capacity. If you look at SSDs of the same company they usually have 256MB cache for 240-256GB SSDs and 512MB for 512GB and so on.
    Some small amount of the cache is probably used as an IO buffer but that part is really not the essential function here and depends on how the controller chip handles queing.

    In theory the SSD would work without the cache but since most SSDs need to translate the address each time something is written or read it would be really slow if they had to gather the information stored on slow nand. Some really old SSDs did that and had atrocious random r/w performance (before SSDs got popular).
    Sandforce use some different way to map address and don't need the big cache. No idea how exactly they do it but I guess the controller calculates the right address and doesn't randomize it like the others. They only have a small cache on chip for buffer operations.
     
  7. ColdCase, May 3, 2014
    Last edited: May 3, 2014

    ColdCase macrumors 68030

    Joined:
    Feb 10, 2008
    Location:
    NH
    #7
    Technically correct... but why do SSDs go to all this trouble and complexity in the first place... because writing to non-zero memory is slow. As we all know, except for those starting out to understand SSDs, currently writes are basically a two step process (first erase then write) but technology only allows erase on a relatively large memory block basis.... which leads to a wide variety of vendor specific and clever techniques that optimize performance... For some techniques, some vendors find a cache is useful.... not sure if Sandisk still depends on large amounts of cache.
     
  8. Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #8
    Thank you for that article! I love reading about technology. :)
     

Share This Page