Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | 938bb92e374ac42d6c1947205cbc0785c37d9b38 |
|---|---|
| Date: | 2012-12-03 13:41:35 |
| User: | dan |
| Comment: | Add www/lsmperf.wiki. |
Tags And Properties
- branch=trunk inherited from [84d5dea8fd]
- sym-trunk inherited from [84d5dea8fd]
Changes
Changes to tool/lsmperf.tcl
1 #!/bin/sh 1 #!/bin/sh 2 # \ 2 # \ 3 exec tclsh "$0" "$@" 3 exec tclsh "$0" "$@" 4 4 > 5 package require sqlite3 5 6 > 7 ########################################################################## > 8 # Procedures used when running tests (collecting data). > 9 # 6 proc exec_lsmtest_speed {nSec spec} { 10 proc exec_lsmtest_speed {nSec spec} { 7 set fd [open [list |./lsmtest speed2 {*}$spec]] 11 set fd [open [list |./lsmtest speed2 {*}$spec]] 8 set res [list] 12 set res [list] 9 13 10 puts -nonewline "./lsmtest speed2" 14 puts -nonewline "./lsmtest speed2" 11 foreach s $spec { 15 foreach s $spec { 12 if {[llength $s]==1} { 16 if {[llength $s]==1} { ................................................................................................................................................................................ 28 if {[llength $line]==0} continue 32 if {[llength $line]==0} continue 29 lappend res $line 33 lappend res $line 30 } 34 } 31 catch { close $fd } 35 catch { close $fd } 32 set res 36 set res 33 } 37 } 34 38 35 proc write_to_file {zFile zScript} { | 39 proc run_speed_test {zDb nTimeout nWrite nFetch nPause nRepeat zSystem zName} { 36 set fd [open $zFile w] < 37 puts $fd $zScript < 38 close $fd < 39 } | 40 > 41 set spec [list -w $nWrite -f $nFetch -r $nRepeat -p $nPause -system $zSystem] > 42 set res [exec_lsmtest_speed $nTimeout $spec] > 43 set cmd "lsmtest speed2 -w $nWrite -f $nFetch -r $nRepeat -p $nPause" > 44 append cmd " -system \"$zSystem\"" 40 45 41 proc exec_gnuplot_script {script png} { < 42 write_to_file out " | 46 sqlite3 db $zDb 43 $script < 44 pause -1 < 45 " | 47 > 48 db eval { > 49 PRAGMA synchronous = OFF; > 50 CREATE TABLE IF NOT EXISTS run( > 51 runid INTEGER PRIMARY KEY, nWrite INT, nFetch INT, nPause INT, > 52 cmd TEXT, name TEXT > 53 ); > 54 CREATE TABLE IF NOT EXISTS sample( > 55 runid INT, sample INT, writems INT, fetchms INT, > 56 PRIMARY KEY(runid, sample) > 57 ); > 58 INSERT INTO run VALUES(NULL, $nWrite, $nFetch, $nPause, $cmd, $zName); 46 | 59 } 47 set script " < 48 set terminal pngcairo size 1200,400 < 49 $script < 50 " | 60 51 exec gnuplot << $script > $png 2>/dev/null < > 61 set id [db last_insert_rowid] > 62 foreach sample $res { > 63 foreach {a b c} $sample {} > 64 db eval { INSERT INTO sample VALUES($id, $a, $b, $c) } 52 } | 65 } 53 66 54 proc make_totalset {res nOp bFetch} { < 55 set ret "" < 56 set nMs 0 < 57 set nIns 0 < 58 foreach row $res { < 59 foreach {i msInsert msFetch} $row {} < 60 incr nIns $nOp < 61 if {$bFetch==0} { < 62 incr nMs $msInsert < 63 } else { | 67 db close 64 incr nMs $msFetch < 65 } | 68 } > 69 # 66 append ret "$nIns [expr $nIns*1000.0/$nMs]\n" | 70 # End of procs used while gathering data. > 71 ########################################################################## 67 } | 72 68 append ret "end\n" < 69 set ret < > 73 ########################################################################## 70 } | 74 > 75 proc chart_y_to_canvas {y} { > 76 foreach v [uplevel {info vars c_*}] { upvar $v $v } > 77 set ytotal [expr ($c_height - $c_top_margin - $c_bottom_margin)] > 78 expr $c_height - $c_bottom_margin - int($ytotal * $y / $c_ymax) 71 | 79 } 72 proc make_dataset {res iRes nWrite nShift nOp} { < 73 set ret "" < 74 foreach row $res { < 75 set i [lindex $row 0] < 76 set j [lindex $row [expr $iRes+1]] | 80 proc chart_sample_to_canvas {nSample x} { 77 set x [expr $i*$nWrite + $nShift] | 81 foreach v [uplevel {info vars c_*}] { upvar $v $v } 78 append ret "$x [expr int($nOp * 1000.0 / $j)]\n" | 82 set xtotal [expr ($c_width - $c_left_margin - $c_right_margin)] > 83 expr {$c_left_margin + ($x*$xtotal/$nSample)} 79 } | 84 } 80 append ret "end\n" < 81 set ret < 82 } | 85 > 86 proc draw_line_series {nSample lSeries tag} { > 87 foreach v [uplevel {info vars c_*}] { upvar $v $v } > 88 set xtotal [expr ($c_width - $c_left_margin - $c_right_margin)] > 89 set ytotal [expr ($c_height - $c_top_margin - $c_bottom_margin)] 83 90 84 proc do_write_test {zPng nSec nWrite nFetch nRepeat lSys} { < > 91 set x 0 > 92 for {set i 1} {$i < $nSample} {incr i} { > 93 set x2 [expr $x + int( double($xtotal - $x) / ($nSample-$i) )] > 94 if {[lindex $lSeries $i-1] < $c_ymax && [lindex $lSeries $i] < $c_ymax} { 85 95 86 if {[llength $lSys]!=2 && [llength $lSys]!=4} { < 87 error "lSys must be a list of 2 or 4 elements" < > 96 set y1 [chart_y_to_canvas [lindex $lSeries $i-1]] > 97 set y2 [chart_y_to_canvas [lindex $lSeries $i]] > 98 .c create line \ > 99 [expr ($c_left_margin + $x)] $y1 \ > 100 [expr ($c_left_margin + $x2)] $y2 \ > 101 -tag $tag 88 } | 102 } 89 103 90 set lRes [list] < 91 foreach {name sys} $lSys { < 92 set wt [list -w $nWrite -r $nRepeat -f $nFetch -system $sys] < 93 lappend lRes [exec_lsmtest_speed $nSec $wt] < 94 if {$sys != [lindex $lSys end]} { < 95 puts "Sleeping 20 seconds..." < 96 after 20000 < > 104 set x $x2 97 } | 105 } 98 } | 106 } 99 107 100 # Set up the header part of the gnuplot script. < > 108 proc draw_points_series {nSample lSeries tag} { > 109 foreach v [uplevel {info vars c_*}] { upvar $v $v } > 110 set xtotal [expr ($c_width - $c_left_margin - $c_right_margin)] > 111 set ytotal [expr ($c_height - $c_top_margin - $c_bottom_margin)] 101 # | 112 102 set xmax 0 < 103 foreach res $lRes { < 104 set xthis [expr [lindex $res end 0]*$nWrite + 5*$nWrite/4] < 105 if {$xthis>$xmax} {set xmax $xthis} < > 113 for {set i 0} {$i < $nSample} {incr i} { > 114 set x [chart_sample_to_canvas $nSample $i] > 115 set y [chart_y_to_canvas [lindex $lSeries $i]] > 116 .c create rectangle $x $y [expr $x+2] [expr $y+2] -tag $tag 106 } 117 } 107 | 118 } 108 append labeltext "Test parameters:\\n" < 109 append labeltext " $nWrite writes per iteration\\n" < 110 append labeltext " $nFetch fetches per iteration\\n" < 111 append labeltext " key size is 12 bytes\\n" < 112 append labeltext " value size is 100 bytes\\n" < 113 set labelx [expr int($xmax * 1.2)] < 114 119 115 set nWrite2 [expr $nWrite/2] < 116 set y2setup "" | 120 proc draw_bars_series {nSample nShift lSeries tag} { 117 if {$nFetch>0} { | 121 foreach v [uplevel {info vars c_*}] { upvar $v $v } 118 set y2setup { | 122 set xtotal [expr ($c_width - $c_left_margin - $c_right_margin)] 119 set ytics nomirror | 123 set ytotal [expr ($c_height - $c_top_margin - $c_bottom_margin)] 120 set y2tics nomirror < > 124 121 set y2range [0:*] | 125 set b [expr $c_height - $c_bottom_margin] > 126 for {set i 0} {$i < $nSample} {incr i} { > 127 set x [expr [chart_sample_to_canvas $nSample $i] + $nShift] > 128 set y [chart_y_to_canvas [lindex $lSeries $i]] > 129 .c create rectangle $x $y [expr $x+$c_bar_width-1] $b -tag $tag 122 } | 130 } 123 } | 131 } 124 set script [subst -nocommands { < 125 set boxwidth $nWrite2 < 126 set xlabel "Database Size" < 127 set y2label "Queries per second" < 128 set ylabel "Writes per second" < > 132 129 set yrange [0:*] | 133 proc draw_text {iRun iRun2} { 130 set xrange [0:$xmax] | 134 foreach v [uplevel {info vars c_*}] { upvar $v $v } 131 set key outside bottom < > 135 132 $y2setup | 136 set y $c_height 133 set label 1 "$labeltext" at screen 0.95,graph 1.0 right | 137 if {$iRun2!=""} { 134 }] | 138 array set metrics [font metrics {-size 8}] > 139 set cmd [db one {SELECT cmd FROM run WHERE runid=$iRun2}] > 140 .c create text 10 $y -anchor sw -text $cmd -fill grey70 -font {-size 8} > 141 set y [expr $y-$metrics(-ascent)] 135 | 142 } > 143 set cmd [db one {SELECT cmd FROM run WHERE runid=$iRun}] > 144 .c create text 10 $y -anchor sw -text $cmd -fill grey70 -font {-size 8} 136 | 145 } 137 set cols [list {#B0C4DE #00008B #000000} {#F08080 #8B0000 #FFA500}] < 138 set cols [lrange $cols 0 [expr ([llength $lSys]/2)-1]] < 139 146 140 set nShift [expr ($nWrite/2)] < 141 set plot1 "" < 142 set plot2 "" < 143 set plot3 "" | 147 proc format_integer {n} { 144 set plot4 "" | 148 if { ($n % 1000000)==0 } { return "[expr $n/1000000]M" } 145 set data1 "" | 149 if { $n>1000000 && ($n % 100000)==0 } { 146 set data2 "" | 150 return "[expr double($n)/1000000]M" 147 set data3 "" < 148 set data4 "" < 149 | 151 } 150 foreach {name sys} $lSys res $lRes col $cols { < 151 foreach {c1 c2 c3} $col {} < > 152 if { ($n % 1000)==0 } { return "[expr $n/1000]K" } > 153 return $n 152 | 154 } 153 # First plot. Writes per second (bar chart). < 154 # | 155 > 156 proc populate_chart {nSample nShift iRun colors} { > 157 foreach v [uplevel {info vars c_*}] { upvar $v $v } > 158 upvar nWrite nWrite 155 if {$plot1 != ""} { set plot1 ", $plot1" } | 159 upvar nFetch nFetch 156 set plot1 "\"-\" ti \"$name writes/sec\" with boxes fs solid lc rgb \"$c1\"$ | 160 set name [db one "SELECT name FROM run WHERE runid=$iRun"] 157 set data1 "[make_dataset $res 0 $nWrite $nShift $nWrite] $data1" < 158 161 > 162 set lWrite [list] 159 # Third plot. Cumulative writes per second (line chart). | 163 set lFetch [list] > 164 for {set i 0} {$i < $nSample} {incr i} { > 165 set q "SELECT writems, fetchms FROM sample WHERE runid=$iRun AND sample=$i" > 166 db eval $q break > 167 lappend lWrite [expr {(1000.0*$nWrite) / $writems}] > 168 lappend lFetch [expr {(1000.0*$nFetch) / $fetchms}] > 169 } 160 # | 170 161 set plot3 ",\"-\" ti \"$name cumulative writes/sec\" with lines lc rgb \"$c2 < 162 set data3 "[make_totalset $res $nWrite 0] $data3" < > 171 draw_bars_series $nSample $nShift $lWrite writes_p_$iRun > 172 draw_points_series $nSample $lFetch fetches_p_$iRun 163 173 164 if {$nFetch>0} { < > 174 set lWrite [list] > 175 set lFetch [list] > 176 for {set i 0} {$i < $nSample} {incr i} { > 177 set q "SELECT 1000.0 * ($i+1) * $nWrite / sum(writems) AS r1, " > 178 append q " 1000.0 * ($i+1) * $nFetch / sum(fetchms) AS r2 " > 179 append q "FROM sample WHERE runid=$iRun AND sample<=$i" > 180 > 181 db eval $q break > 182 lappend lWrite $r1 > 183 lappend lFetch $r2 > 184 } > 185 > 186 draw_line_series $nSample $lWrite writes_$iRun > 187 draw_line_series $nSample $lFetch fetches_$iRun > 188 > 189 # Create the legend for the data drawn above. > 190 # > 191 array set metrics [font metrics default] > 192 set y $c_legend_ypadding > 193 set x [expr $c_width - $c_legend_padding] > 194 set xsym [expr { $c_width > 195 - [font measure default "$name cumulative fetches/sec"] > 196 }] > 197 > 198 foreach {t g} { 165 set new ", \"-\" ti \"$name fetches/sec\" axis x1y2 " | 199 "$name fetches/sec" { 166 append new "with points lw 1 lc rgb \"$c2\"" < 167 set plot2 "$new $plot2" < 168 set data2 "[make_dataset $res 1 $nWrite $nWrite $nFetch] $data2" < > 200 rectangle 0 0 -2 2 -tag fetches_p_$iRun 169 | 201 } > 202 "$name writes/sec" { > 203 rectangle 0 0 $c_bar_width $metrics(-ascent) -tag writes_p_$iRun > 204 } 170 set new ",\"-\" ti \"$name cumulative fetches/sec\" " | 205 "$name cumulative fetches/sec" { 171 append new "with lines lc rgb \"$c2\" lw 1 " < 172 set plot4 "$new $plot4" < 173 set data4 "[make_totalset $res $nFetch 1] $data4" < > 206 line 0 0 -30 0 -tag fetches_$iRun 174 } 207 } > 208 "$name cumulative writes/sec" { > 209 line 0 0 -30 0 -tag writes_$iRun 175 | 210 } 176 incr nShift [expr $nWrite/4] < > 211 } { > 212 .c create text $x $y -tag legend_$iRun -text [subst $t] -anchor e 177 } | 213 178 append script "plot " < 179 append script $plot1 < 180 append script $plot2 < 181 append script $plot3 < 182 append script $plot4 < 183 append script "\n" < 184 append script $data1 < 185 append script $data2 < 186 append script $data3 < 187 append script $data4 < > 214 set id [eval [concat {.c create} [subst $g]]] > 215 .c addtag legend_$iRun withtag $id 188 216 189 append script "pause -1\n" < 190 exec_gnuplot_script $script $zPng < > 217 set box [.c bbox $id] > 218 set xmove [expr {$xsym - ([lindex $box 0]/2 + [lindex $box 2]/2)}] > 219 set ymove [expr $y - ([lindex $box 1]/2 + [lindex $box 3]/2)] 191 } | 220 > 221 .c move $id $xmove $ymove > 222 incr y $metrics(-linespace) 192 | 223 } 193 do_write_test x.png 400 100000 100000 100 { < 194 lsm-4M "mt_mode=4 multi_proc=0 autoflush=4M page_size=1024" < 195 } | 224 > 225 .c itemconfigure writes_$iRun -fill [lindex $colors 0] -width 2 > 226 .c itemconfigure fetches_$iRun -fill [lindex $colors 2] > 227 .c itemconfigure writes_p_$iRun -fill [lindex $colors 1] > 228 .c itemconfigure fetches_p_$iRun -fill [lindex $colors 3] > 229 catch { .c itemconfigure fetches_p_$iRun -outline [lindex $colors 3] } > 230 catch { .c itemconfigure writes_p_$iRun -outline [lindex $colors 1] } 196 | 231 } 197 232 198 #lsm "mmap=1 multi_proc=0 page_size=4096 block_size=2097152 autocheckpoint=419 < 199 #lsm-mt "mmap=1 multi_proc=0 threads=2 autowork=0 autocheckpoint=4196000" < > 233 proc generate_chart {png db iRun {iRun2 {}}} { > 234 sqlite3 db $db > 235 db eval { SELECT nWrite, nFetch FROM run WHERE runid=$iRun } {} > 236 if {0==[info exists nWrite]} { > 237 error "No such run in db $db: $iRun" 200 | 238 } > 239 > 240 set c_left_margin 50 > 241 set c_bottom_margin 60 > 242 set c_top_margin 20 > 243 set c_right_margin 400 > 244 set c_width 1250 > 245 set c_height 350 > 246 > 247 set c_ymax 300000 > 248 set c_ytick 50000 > 249 set c_ticksize 5 > 250 set c_nxtick 10 > 251 set c_dbsize_padding 20 > 252 set c_legend_padding 20 > 253 set c_legend_ypadding 100 > 254 set c_bar_width 2 > 255 > 256 package require Tk > 257 canvas .c > 258 .c configure -width $c_width -height $c_height > 259 pack .c -fill both -expand 1 > 260 > 261 # Make the background white > 262 .c configure -background white > 263 draw_text $iRun $iRun2 > 264 > 265 # Draw the box for the chart > 266 # > 267 set y [expr $c_height - $c_bottom_margin] > 268 set x [expr $c_width - $c_right_margin] > 269 .c create rectangle $c_left_margin $c_top_margin $x $y > 270 > 271 # Draw the vertical ticks > 272 # > 273 set ytotal [expr ($c_height - $c_top_margin - $c_bottom_margin)] > 274 for {set y $c_ytick} {$y <= $c_ymax} {incr y $c_ytick} { > 275 > 276 # Calculate the canvas y coord at which to draw the tick > 277 set ypix [expr {$c_height - $c_bottom_margin - ($y * $ytotal) / $c_ymax}] > 278 > 279 set left_tick_x $c_left_margin > 280 set right_tick_x [expr $c_width - $c_right_margin - $c_ticksize] > 281 foreach x [list $left_tick_x $right_tick_x] { > 282 .c create line $x $ypix [expr $x+$c_ticksize] $ypix > 283 } > 284 > 285 .c create text $c_left_margin $ypix -anchor e -text "[format_integer $y] " > 286 set x [expr $c_width - $c_right_margin] > 287 .c create text $x $ypix -anchor w -text " [format_integer $y]" > 288 } > 289 > 290 # Figure out the total number of samples for this chart > 291 # > 292 set nSample [db one {SELECT count(*) FROM sample where runid=$iRun}] > 293 if {$nSample==0} { error "No such run: $iRun" } > 294 #set nSample 100 > 295 > 296 # Draw the horizontal ticks > 297 # > 298 set w [expr {$c_width - $c_left_margin - $c_right_margin}] > 299 set xincr [expr ($nSample * $nWrite) / $c_nxtick] > 300 for {set i 1} {$i <= $c_nxtick} {incr i} { > 301 set x [expr $i * $xincr] > 302 set xpix [expr {$c_left_margin + ($w / $c_nxtick) * $i}] > 303 > 304 set b [expr $c_height-$c_bottom_margin] > 305 .c create line $xpix $b $xpix [expr $b-$c_ticksize] > 306 .c create text $xpix $b -anchor n -text [format_integer $x] > 307 } > 308 > 309 set x [expr (($c_width-$c_right_margin-$c_left_margin) / 2) + $c_left_margin] > 310 set y [expr $c_height - $c_bottom_margin + $c_dbsize_padding] > 311 .c create text $x $y -anchor n -text "Database Size (number of entries)" > 312 > 313 populate_chart $nSample 0 $iRun {black grey55 black black} > 314 if {$iRun2 != ""} { > 315 #populate_chart $nSample 3 $iRun2 {royalblue skyblue royalblue royalblue} > 316 > 317 set s $c_bar_width > 318 populate_chart $nSample $s $iRun2 {royalblue lightsteelblue royalblue royalb > 319 set box [.c bbox legend_$iRun] > 320 set shift [expr $c_legend_padding + [lindex $box 3]-[lindex $box 1]] > 321 .c move legend_$iRun2 0 $shift > 322 } > 323 > 324 .c lower fetches_p_$iRun > 325 .c lower fetches_p_$iRun2 > 326 .c lower writes_p_$iRun > 327 .c lower writes_p_$iRun2 > 328 > 329 bind .c <q> exit > 330 bind . <q> exit > 331 db close > 332 } > 333 > 334 proc capture_photo {z} { > 335 package require Img > 336 set img [image create photo -format window -data .c] > 337 $img write $z -format GIF > 338 } > 339 201 # lsm "safety=1 multi_proc=0" | 340 # "autoflush=1M multi_proc=0" > 341 # "autoflush=1M multi_proc=0 mt_mode=4 mt_min_ckpt=2M mt_max_ckpt=3M" > 342 # "autoflush=4M multi_proc=0 autocheckpoint=8M" > 343 # "autoflush=4M multi_proc=0 mt_mode=4" > 344 proc run_all_tests {} { > 345 set nInsert 50000 > 346 set nSelect 50000 > 347 set nSleep 20000 > 348 set nPause 2500 202 349 203 # lsm-mt "mmap=1 multi_proc=0 threads=2 autowork=0 autocheckpoint=8192000" < 204 # lsm-mt "mmap=1 multi_proc=0 safety=1 threads=3 autowork=0" < 205 # lsm-st "mmap=1 multi_proc=0 safety=1 threads=1 autowork=1" < 206 # lsm-mt "mmap=1 multi_proc=0 safety=1 threads=3 autowork=0" < 207 # lsm-mt "mmap=1 multi_proc=0 safety=1 threads=3 autowork=0" < 208 # LevelDB leveldb < 209 # lsm-st "mmap=1 multi_proc=0 safety=1 threads=1 autowork=1" < 210 # LevelDB leveldb < 211 # SQLite sqlite3 < > 350 #set nInsert 5000 > 351 #set nSelect 5000 > 352 #set nSleep 2000 > 353 #set nPause 250 212 354 > 355 set bFirst 0 213 356 > 357 foreach {name config} { > 358 single-threaded "autoflush=1M multi_proc=0" > 359 multi-threaded > 360 "autoflush=1M multi_proc=0 mt_mode=4 mt_min_ckpt=2M mt_max_ckpt=3M" > 361 single-threaded "autoflush=4M multi_proc=0 autocheckpoint=8M" > 362 multi-threaded "autoflush=4M multi_proc=0 mt_mode=4" > 363 } { > 364 if {$bFirst!=0} { > 365 puts "sleeping 20 seconds..." ; after $nSleep 214 | 366 } > 367 run_speed_test res.db 900 $nInsert $nSelect 0 200 $config $name > 368 set bFirst 1 215 | 369 } > 370 > 371 # Tests with a 2.5 second delay. > 372 # > 373 foreach {name config} { > 374 single-threaded "autoflush=4M multi_proc=0 autocheckpoint=8M" > 375 multi-threaded "autoflush=4M multi_proc=0 mt_mode=4" > 376 } { > 377 puts "sleeping 20 seconds..." ; after $nSleep > 378 run_speed_test res.db 900 $nInsert $nSelect $nPause 200 $config $name > 379 } > 380 } > 381 > 382 #run_all_tests > 383 > 384 generate_chart png res.db 1 2 > 385 update > 386 capture_photo lsmperf1.gif > 387 destroy .c > 388 > 389 generate_chart png res.db 3 4 > 390 update > 391 capture_photo lsmperf2.gif > 392 destroy .c > 393 > 394 generate_chart png res.db 5 6 > 395 update > 396 capture_photo lsmperf3.gif > 397 destroy .c > 398 > 399 exit > 400 > 401
Added www/lsmperf.wiki
> 1 > 2 <title>LSM Benchmarks</title> > 3 <nowiki> > 4 > 5 <p> > 6 This page contains the results of a benchmark test run on the LSM library > 7 in several different configurations. > 8 > 9 <p> > 10 The test uses a single client database connection. It begins with an empty > 11 database. The test runs for 200 iterations. Each iteration, the client: > 12 > 13 <ul> > 14 <li> Inserts 50,000 new key-value pairs into the database. Each key is > 15 a pseudo-randomly generated 12-byte blob. Each value is a > 16 pseudo-randomly generated 100 byte blob. Each insert operation is > 17 run in a separate implicit transaction. > 18 <li> Runs 50,000 fetch queries to retrieve arbitrarily selected entries > 19 from the database (all searches are hits - the queried keys are > 20 selected from the set of keys that are present in the db). > 21 </ul> > 22 > 23 <p> > 24 The time taken to insert or retrieve each batch of 50,000 keys is recorded, > 25 and transformed to an operations-per-second rate (e.g. if it takes 0.5 > 26 seconds to insert 50,000 keys, this is reported as 100,000 > 27 operations-per-second). These values are the values reported below. > 28 The final database size is roughly 1.2GB. > 29 > 30 <p> > 31 All tested configurations set the > 32 <a href=lsmusr.wiki#data_durability>LSM_CONFIG_SAFETY parameter</a> to "normal" > 33 and the <a href=lsmusr.wiki#performance_related_configuration_options> > 34 LSM_CONFIG_MULTIPLE_PROCESSES parameter</a> to zero (single process mode). > 35 > 36 <p> > 37 Tests were run on a 3.3GHz dual-core PC with 4GB of RAM. The file-system is > 38 ext4 on a 7200rpm HDD. > 39 > 40 <h2> Small Write Buffers Test </h2> > 41 > 42 <p> > 43 The following plot shows the performance of LSM in its default, single-threaded > 44 configuration against a multi-threaded deployment. > 45 > 46 <p> > 47 In the single-threaded mode the in-memory tree is allowed to use up to 1MB of > 48 memory before it is flushed to disk, and the database is checkpointed after > 49 each 2MB of data is written into the database file. > 50 > 51 <p> > 52 The multi-threaded configuration launches two background threads as well as > 53 the main client thread used to run the test case. One background thread is > 54 dedicated to calling lsm_work() (writing data into the database file) and > 55 the other to calling lsm_checkpoint() (writing to the database header and > 56 syncing the database file). The in-memory tree is declared eligible to > 57 be flushed to disk when it uses 1MB of memory. If it grows to 1.5MB, then > 58 the client thread is blocked from continuing until the background thread > 59 has flushed it to disk. After 2MB of data has been written into the database > 60 file it is eligible for checkpointing. Once the database file contains 3MB of > 61 uncheckpointed data, the worker thread is prevented from writing any further > 62 data to the file until a checkpoint has been completed. > 63 > 64 <p> > 65 More detail regarding lsm_work() and lsm_checkpoint() is > 66 <a href=lsmusr.wiki#using_worker_threads_or_processes>available here</a>. > 67 > 68 <p> > 69 <img src=lsmperf1.gif> > 70 > 71 <h2> Large Write Buffers Test </h2> > 72 <p> > 73 This test is similar to the one above, except with larger write buffers. > 74 Specifically, in the single-threaded mode: > 75 <ul> > 76 <li> The in-memory tree is allowed to use up to 4MB of memory before it > 77 is flushed to disk, and > 78 <li> The database is checkpointed after each 8MB of data is written to > 79 the database file. > 80 </ul> > 81 > 82 <p> > 83 And in multi-threaded mode: > 84 <ul> > 85 <li> The in-memory tree is eligible to be flushed to disk once it uses > 86 4MB of memory. The client thread is blocked if it reaches 6MB in > 87 size. > 88 <li> The database is still eligible for checkpointing after each 2MB of > 89 data is written to it, but up to 8MB of uncheckpointed data is allowed > 90 to accumulate in the database file before the worker thread is > 91 blocked. > 92 </ul> > 93 > 94 <p> > 95 <img src=lsmperf2.gif> > 96 > 97 <h2> Large Write Buffers Test With Pauses</h2> > 98 > 99 <p> > 100 This test is the same as the previous test, except that each iteration the > 101 client thread pauses (sleeps) for 2.5 seconds after performing the database > 102 inserts and queries. > 103 > 104 <p> > 105 <img src=lsmperf3.gif> > 106
Added www/lsmperf1.gif
cannot compute difference between binary files
Added www/lsmperf2.gif
cannot compute difference between binary files
Added www/lsmperf3.gif
cannot compute difference between binary files