On throttling

Seems like nowadays InnoDB crash recovery is much funnier. Please allow me to show you something:

while (buf_pool->n_pend_reads >=
        recv_n_pool_free_frames / 2) {
  os_aio_simulated_wake_handler_threads();
  os_thread_sleep(500000);

Translation – if there’re more than 128 outstanding I/O requests, sleep for half a second. Hehehe. Optimized for floppies!

3 thoughts on “On throttling”

  1. That’s cute…. especially considering that most modern hard drives can typically queue 64 IO requests.

    Perhaps the developer encountered some OS scalability limit on his development machine?

    Or if this is an application feature, a cond var would probably be more suitable.

  2. Antony, there’s nothing really wrong with this kind of throttling, except.. timing.
    Make it wait 5ms instead of 500ms, and your I/O system will always have outstanding requests.

    Leave it at half a second, and your server will be horrible slacker during crash recovery..

  3. Like basically everything else hard-coded in InnoDB, it needs to be user-configurable. One of these days I’m going to go on a rampage and add about 150 configuration variables for InnoDB.

Comments are closed.