• Vladislav Vaintroub's avatar
    A follow-up to the patch for bug #56405 "Deadlock in the MDL deadlock · 367bfa41
    Vladislav Vaintroub authored
    detector". This patch addresses performance regression in OLTP_RO/MyISAM
    test on Windows introduced by the fix for bug #56405. Thus it makes
    original patch acceptable as a solution for bug #56585 "Slowdown of
    readonly sysbench benchmarks (e.g point_select) on Windows 5.5".
    
    With this patch, MySQL will use native Windows condition variables and 
    reader-writer locks  if  they are supported by the OS.
    
    This speeds up MyISAM and the effect comes mostly from using native
    rwlocks. Native conditions improve scalability with higher number of 
    concurrent users in other situations, e.g for prlocks.
    
    Benchmark numbers for this patch as measured on Win2008R2 quad
    core machine are attached to the bug report.
    ( direct link http://bugs.mysql.com/file.php?id=15883 )
    
    Note that currently we require at least Windows7/WS2008R2 for 
    reader-writer locks, even though native rwlock is available also on Vista.
    Reason is that "trylock" APIs are missing on Vista, and trylock is used in
    the server (in a single place in query cache).
    
    While this patch could have been written differently, to enable the native
    rwlock optimization also on Vista/WS2008 (e.g using native locks everywhere
    but portable implementation in query cache), this would come at the 
    expense of the code clarity, as it would introduce a new  "try-able" rwlock
    type, to handle Vista case.
    
    Another way to improve performance for the special case 
    (OLTP_RO/MYISAM/Vista) would be to eliminate "trylock" usage from server,
     but this is outside of the scope here.
    
    
    Native conditions variables are used beginning with Vista though the effect
    of using condition variables alone is not measurable in this benchmark.
    But when used together with native rwlocks on Win7, native conditions improve 
    performance in high-concurrency OLTP_RO/MyISAM (128 and more sysbench 
    users).
    367bfa41
my_winthread.c 4.4 KB