Skip to content
  • Andrew Morton's avatar
    [PATCH] jbd: fix transaction batching · fe1dcbc4
    Andrew Morton authored
    
    
    Ben points out that:
    
      When writing files out using O_SYNC, jbd's 1 jiffy delay results in a
      significant drop in throughput as the disk sits idle.  The patch below
      results in a 4-5x performance improvement (from 6.5MB/s to ~24-30MB/s on my
      IDE test box) when writing out files using O_SYNC.
    
    So optimise the batching code by omitting it entirely if the process which is
    doing a sync write is the same as the one which did the most recent sync
    write.  If that's true, we're unlikely to get any other processes joining the
    transaction.
    
    (Has been in -mm for ages - it took me a long time to get on to performance
    testing it)
    
    Numbers, on write-cache-disabled IDE:
    
    /usr/bin/time -p synctest -n 10 -uf -t 1 -p 1 dir-name
    
    Unpatched:
    	40 seconds
    Patched:
    	35 seconds
    Batching disabled:
    	35 seconds
    
    This is the problematic single-process-doing-fsync case.  With multiple
    fsyncing processes the numbers are AFACIT unaltered by the patch.
    
    Aside: performance testing and instrumentation shows that the transaction
    batching almost doesn't help (testing with synctest -n 1 -uf -t 100 -p 10
    dir-name on non-writeback-caching IDE).  This is because by the time one
    process is running a synchronous commit, a bunch of other processes already
    have a transaction handle open, so they're all going to batch into the same
    transaction anyway.
    
    The batching seems to offer maybe 5-10% speedup with this workload, but I'm
    pretty sure it was more important than that when it was first developed 4-odd
    years ago...
    
    Cc: "Stephen C. Tweedie" <sct@redhat.com>
    Cc: Benjamin LaHaise <bcrl@kvack.org>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    fe1dcbc4