{"id":244409,"date":"2011-02-14T15:00:14","date_gmt":"2011-02-14T23:00:14","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/research\/?p=244409"},"modified":"2016-12-08T06:26:02","modified_gmt":"2016-12-08T14:26:02","slug":"faster-servers-services-flashstore","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/research\/blog\/faster-servers-services-flashstore\/","title":{"rendered":"Faster Servers, Services with FlashStore"},"content":{"rendered":"
By Doug Gantenbein<\/em><\/p>\n Memory has its faults\u2014and not only the human variety.<\/p>\n Hard drives, for instance, can hold terabytes cheaply. But they\u2019re slow. Random-access memory (RAM) is fast but expensive, and data in RAM disappear the instant the power goes off. Flash memory is faster than hard drives and cheaper than RAM, and it retains information. But the way it handles data writes handicaps its usefulness in server environments.<\/p>\n Still, the distinct advantages of flash\u2014particularly its ability to retain data when power is off, as well as its speed\u2014led two Microsoft Research scientists, Sudipta Sengupta<\/a> and Jin Li<\/a>, to develop what they call FlashStore. It\u2019s a flash-based \u201cbridge\u201d between RAM and a hard drive that helps to overcome the handicaps of each while maximizing flash memory\u2019s capabilities and minimizing its weaknesses.<\/p>\n FlashStore operates as a key-value store and uses a \u201ckey\u201d to access the \u201cvalue\u201d associated with each piece of a data record. It supports the operations of read, write, update, and deletion of such data records. A third collaborator on FlashStore, Biplob Debnath, was a research intern at Microsoft and now works for EMC, a network-storage and data-recovery firm.<\/p>\n FlashStore has potentially significant usefulness across a range of computing applications, from server farms to cloud applications. It already has shown it can speed up online gaming for Xbox LIVE (opens in new tab)<\/span><\/a> players, as well as data-intensive server applications.<\/p>\n Sudipta Sengupta, Principal Research Scientist<\/p><\/div>\n Flash memory sits conveniently in the huge gap between RAM and a hard disk in terms of both cost and performance. With its properties of low power consumption, physical ruggedness, and small size, flash has enabled new experiences with many consumer electronic devices for more than a decade. But it is only recently that flash is seeing widespread adoption in desktop and server applications, in the form of solid-state drives. New applications of flash involve different storage-access patterns from those in typical consumer devices and, because of flash\u2019s device properties, pose new challenges to its ability to deliver sustained high throughput and low latency.<\/p>\n \u201cFlash is great technology, but it requires intelligent software to make the best use of it,\u201d says Sengupta, a researcher at Microsoft Research Redmond<\/a>. \u201cThat\u2019s where our work comes in.\u201d Sengupta and Li have written several papers for technical conferences on intelligent software design for utilizing flash memory, one of which is FlashStore: High Throughput Persistent Key-Value Store<\/a><\/i>, which appeared in the 36th International Conference on Very Large Data Bases in September 2010.<\/em><\/p>\n In FlashStore, flash \u201csits\u201d between a hard drive and RAM, acting as a high-speed holding area for frequently used data. FlashStore works by overcoming flash memory\u2019s drawbacks. These relate to the way in which flash stores and manages data. In flash memory, data is not as easily overwritten as it is on a hard drive. Flash memory starts in an erased state, then collects data in page-sized units at a time, where a page can vary in size from 512 bytes to eight kilobytes, depending on the device.<\/p>\n But if you need to erase data, you can\u2019t do it a page at a time. Typically, an erase block consists of 32 to 64 data pages. Li compares the way flash works to a line of water buckets.<\/p>\n Jin Li, Partner Researcher Manager of the Cloud Computing and Storage (CCS) group in Microsoft Research \u2013 Technologies.<\/p><\/div>\n \u201cThe write operation is like pouring water into a series of buckets,\u201d says Li, a principal researcher with Microsoft Research Redmond\u2019s Communication and Collaboration Systems<\/a> group. \u201cThe cheapest flash devices are designed so that if you need to erase a bank\u2014the block\u2014you have to drain the water from all the buckets. You can\u2019t drain just one bucket.\u201d<\/p>\n To handle data writes and reads, the memory controller in a flash-memory device uses a mapping system called Flash Translation Layer (FTL), which maps the logical page address of the incoming data to the actual physical page location of the data in flash memory. If a page of data is rewritten, it is written to a new location with an updated FTL entry.<\/p>\n During a process known in computing circles as \u201cgarbage collection,\u201d the flash controller takes valid data from a memory block, as well as new data, and writes both to a new memory block. The freed memory block then can be erased for storing new data\u2014in effect, draining all the buckets in one memory block. But this process isn\u2019t efficient, in large part because of the requirement to reclaim space with pages that are rendered invalid by such operations. In time, repeated erase cycles also degrade the life expectancy of each flash memory block.<\/p>\n Flash also writes only to pages\u2014nothing smaller. Data written to a page that is less than the page size, typically 512 bytes to eight kilobytes, make poor use of that page. Any attempt to write a small chunk of data within a page means the controller will have to move the existing data to another page, along with the new data.<\/p>\n Flash works fine on consumer electronic devices such as cameras and digital music players, where each photo or music file is at least megabytes in size, and data are written to flash mostly sequentially.<\/p>\n But flash performance drops drastically when data writes are random, which is the case for many desktop computing and server applications. Even today\u2019s high-performance, flash-based disk-replacement devices experience a dramatic drop in access latencies and throughput when performing random write operations.<\/p>\n Then there is the cost aspect of flash memory, which is about 10 times more expensive than hard disk per GB\u2014and about 10 times less expensive than RAM. Flash makes most sense for applications that can identify and exploit the sweet spot between cost and performance.<\/p>\n To make flash work efficiently enough to be more attractive on the price-performance tradeoff for heavy-duty server and cloud computing, FlashStore\u2019s creators had to create a more flash-friendly data structure while avoiding random data writes to flash. They did that by giving FlashStore three important design features.<\/p>\n First, FlashStore introduces flash as a cache in the memory hierarchy between RAM and hard disk so that the flash memory holds a \u201cworking set\u201d of data\u2014information a computer is most apt to need. FlashStore tracks data use so that, as data becomes less frequently accessed, it eventually is sent back to the hard drive so that new, fresh data can take its place. That makes better use of flash while still getting much faster retrievals than are possible with a hard drive.<\/p>\n Second, FlashStore is designed to eliminate random writes. It organizes data in a log structure on flash so that new data sent to flash does not lead to random writes and, hence, is not subject to garbage collection by the device. FlashStore aggregates small writes from the application into a write buffer in memory and writes to flash when there is enough data to fill a flash page. By making writes sequential to flash, FlashStore makes much better use of flash-device architecture. If the application needs strict data-durability guarantees, FlashStore can aggregate writes in memory up to a timeout interval provided by the application or when a flash page worth of data is amassed, whichever comes first.<\/p>\n Finally, FlashStore is designed to use RAM efficiently by employing a specialized RAM index to access the data on flash. It uses a hash-table-based index in RAM that is designed to save space along both the vertical and horizontal dimensions\u2014the number of slots and the size of each slot, respectively. To reduce the number of slots, it uses a variant of cuckoo hashing that achieves high hash-table load factors while keeping lookup times fast. To reduce the size of each slot, it stores a compact key signature of about two bytes in each slot instead of the full key, which could be tens of bytes or larger, depending on the application. Each slot also stores a pointer, typically four bytes, that points to the full key-value pair record on flash. During key access, the pointer to flash is followed only if the signature in the hash-table slot matches that of the key being searched. These techniques keep the RAM usage frugal\u2014at about six bytes per key-value pair, independent of the key-value pair size\u2014and key-access times fast, involving at most one flash read per lookup on the average.<\/p>\n
Peculiarities of Flash Memory<\/h1>\n

FlashStore Efficiency<\/h1>\n