title: Reduce durability in MySQL for performance
body: <p>My site occasionally has fairly predictable bursts of traffic that increase the throughput by 100 times more than normal. For example, we are going to be featured on a television show, and I expect in the hour after the show, I'll get more than 100 times more traffic than normal.</p>
  
  <p>My understanding is that MySQL (InnoDB) generally keeps my data in a bunch of different places:</p>
  
  <ul>
  <li>RAM Buffers</li>
  <li>commitlog</li>
  <li>binary log</li>
  <li>actual tables</li>
  <li>All of the above places on my DB slave</li>
  </ul>
  
  <p>This is too much "durability" given that I'm on an EC2 node and most of the stuff goes across the same network pipe (file systems are network attached). Plus the drives are just slow. The data is not high value and I'd rather take a small chance of a few minutes of data loss rather than have a high probability of an outage when the crowd arrives.</p>
  
  <p>During these traffic bursts I would like to do all of that I/O <em>only</em> if I can afford it. I'd like to just keep as much in RAM as possible (I have a fair chunk of RAM compared to the data size that would be touched over an hour). If buffers get scarce, or the I/O channel is not too overloaded, then sure, I'd like things to go to the commitlog or binary log to be sent to the slave. If, and only if, the I/O channel is not overloaded, I'd like to write back to the actual tables.</p>
  
  <p>In other words, I'd like MySQL/InnoDB to use a "write back" cache algorithm rather than a "write through" cache algorithm. Can I convince it to do that?</p>
  
  <p>If this is not possible, I am interested in general MySQL write-performance optimization tips. Most of the docs are about optimizing read performance, but when I get a crowd of users, I am creating accounts for all of them, so that's a write-heavy workload.</p>