Storage

01:58 PM
Howard Marks
Howard Marks
Commentary
Connect Directly
Twitter
RSS
E-Mail
50%
50%

Flash Balances The Books With Atomic Writes

Flash is a great fit for applications that rely on atomic writes, such as finance and inventory, where data values have to be correct immediately.

Let's say you have $50,000 in your bank account. One of the important keys to making sure your accounting system and your bank agree that you really have that amount is to ensure that every transaction in your accounting system uses atomic writes.

Atomic writes in this case means that a transaction has to be indivisible. If a transaction deducts $50,000 from your Bank of America account and deposits $50,000 in your account at the Grand Cayman Community Bank, all or none of the transaction should be saved to the database.

Traditional database engines ensure atomicity by writing all the parts of the transaction to a journal, then posting them to the main database. If something goes wrong between removing the money from BofA and posting it to Grand Caymans, the system can reapply the change from the journal when the problem is corrected and the system restarted.

If the system didn't use a journal, double-write buffer or some other method for insuring atomicity, the $50,000 would just disappear.

Atomic Writes and Flash

All that journaling and such is needed to ensure atomicity on spinning disks. When you tell a spinning disk to write data to logical blocks 124-145, it overwrites the data that was previously in those locations. If the system crashes after blocks 124-130 are written, the system better be able to write blocks 131-145 at restart time, or we'll have corrupted data that's part new and part old.

Flash is a whole different animal. The flash controller in an SSD is always writing to blank pages across the flash it manages. After it writes new data to fresh pages, the flash controller updates the metadata that maps the logical block locations it presents to the outside world.

Because the flash controller doesn't overwrite the current contents when it writes to blocks 124-130, as long as it doesn't update the metadata until after all the changes for a transaction are complete, none of the transaction will be posted and it will continue to return the old data.

[Flash suppliers are investing in storage startups. Find out what this could mean for the industry in Storage Vendors, Flash Manufacturers, Buy Into Startups.]

Some efforts have been going on in the storage community to better integrate atomic writes and flash. For instance, Fusion-io promotes a dedicated atomic write API for its products. Several MySQL implementations, including the MariaDB fork, now support the use of the Fusion-io's atomic write API. Meanwhile, the INCITS T10 committee, which defines the SCSI command set, is working on an extension of the SCSI standard to support atomic writes.

Both the Fusion-io API and the T10 SCSI command set extensions simply provide a mechanism for applications to tell the flash controller which set of updates should be performed as an atomic entity. The flash controller can then hold its metadata updates until all those writes are complete.

Benchmark data shows that with MariaDB, atomic writes can provide a 30% to 50% performance boost and reduce CPU utilization. In addition to the performance boost, using atomic writes eliminates the need to write data twice, which will significantly improve SSD life.

I hope the T10 committee finishes its work on a standard set of atomic write commands as quickly as possible, and that enterprise SSD vendors get on the atomic write bandwagon right away. Then we can start thinking about how SAN vendors, whose systems use the same SCSI commands as disk drives, can implement atomicity.

Howard Marks is founder and chief scientist at Deepstorage LLC, a storage consultancy and independent test lab based in Santa Fe, N.M. and concentrating on storage and data center networking. In more than 25 years of consulting, Marks has designed and implemented storage ... View Full Bio
Comment  | 
Print  | 
More Insights
Cartoon
Hot Topics
6
The Rise Of White-Box Storage
Jim O'Reilly, Consultant,  8/27/2014
6
VMware Launches Hyper-Converged Infrastructure Appliance
Marcia Savage, Managing Editor, Network Computing,  8/25/2014
4
Cloud Storage Security: AWS Vs. Azure
Anna Andreeva, security quality assurance engineer, A1QA,  8/26/2014
White Papers
Register for Network Computing Newsletters
Current Issue
Video
Slideshows
Twitter Feed