SQLite4
Check-in [108a6143bf]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improve performance testing script lsmperf.tcl.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 108a6143bf80d8a37c3dfe4ea01c97e19e4451af
User & Date: dan 2012-09-15 17:03:31
Context
2012-09-17
20:41
Make it possible to flush part of the in-memory tree to disk without blocking writer clients. check-in: 6c686c6d1a user: dan tags: trunk
2012-09-15
17:03
Improve performance testing script lsmperf.tcl. check-in: 108a6143bf user: dan tags: trunk
2012-09-14
19:59
Improve speed test commands in lsmtest. Add script lsmperf.tcl to use these to generate gnuplot files. check-in: d9e0ad7566 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/lsmperf.tcl.

9
10
11
12
13
14
15

16
17
18
19
20
21
22
..
28
29
30
31
32
33
34
35
36
37
38
39
40


























41







42
43
44
45
46
47
48
49








50
51
52



53
54









55
56

57
58
59
60
61











62
63
64
65
66
67
68


69









70
71
72
73
74
75



76



77
78
79
80
81



82




83


84
85
86
87
88
89

90
91
92

93
94
95
96

  set initial [clock seconds]

  while {![eof $fd] && ($nSec==0 || ([clock second]-$initial)<$nSec)} { 
    set line [gets $fd]
    puts $line
    if {[string range $line 0 0]=="#"} continue

    lappend res $line
  }
  catch { close $fd }
  set res
}

proc write_to_file {zFile zScript} {
................................................................................
proc exec_gnuplot_script {script png} {
  write_to_file out "
    $script
    pause -1
  "
  
  set script "
    set terminal png
    $script
  "
  exec gnuplot << $script > $png 2>/dev/null
}



























proc do_write_test {nSec nWrite nFetch nRepeat zSystem zPng} {







  set wt [list -w $nWrite -r $nRepeat -f $nFetch -system $zSystem]
  set res [exec_lsmtest_speed $nSec $wt]
  set script "set boxwidth [expr $nWrite/2]"
  append script {
    set xlabel "Rows Inserted"
    set y2label "Selects per second"
    set ylabel "Inserts per second"
    set yrange [0:*]








    set xrange [0:*]
    set xrange [0:*]
    set key box lw 0.01



  }










  if {$nFetch>0} {
    append script {

      set ytics nomirror
      set y2tics nomirror
      set y2range [0:*]
    }
  }












  append script {plot "-" ti "INSERT" with boxes fs solid lc rgb "#B0C4DE"}
  if {$nFetch>0} {
    append script {, "-" ti "SELECT" axis x1y2 with points lw 3 lc }
    append script {rgb "#000000"}
  }
  append script "\n"












  foreach row $res {
    foreach {i msInsert msFetch} $row {}
    set x [expr $i*$nWrite + $nWrite/2]
    append script "$x [expr int($nWrite * 1000.0 / $msInsert)]\n"
  }
  append script "end\n"







  if {$nFetch>0} {
    foreach row $res {
      foreach {i msInsert msFetch} $row {}
      set x [expr $i*$nWrite + $nWrite]
      append script "$x [expr int($nFetch * 1000.0 / $msFetch)]\n"



    }




    append script "end\n"


  }

  append script "pause -1\n"
  exec_gnuplot_script $script $zPng
}


do_write_test 60 100000 100000 100 "mmap=1 multi_proc=0 safety=1" x.png
after 10000
do_write_test 60 100000 100000 100 leveldb y.png












>







 







|





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
|
<
<
<
<
<
<
>
>
>
>
>
>
>
>
|
<
<
>
>
>


>
>
>
>
>
>
>
>
>

<
>





>
>
>
>
>
>
>
>
>
>
>

<
<
<
<
|
<
>
>

>
>
>
>
>
>
>
>
>
|
<
<
<
|
<
>
>
>

>
>
>
|
<
<
<
<
>
>
>

>
>
>
>
|
>
>
|





>
|
<
|
>




9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77






78
79
80
81
82
83
84
85
86


87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119




120

121
122
123
124
125
126
127
128
129
130
131
132
133



134

135
136
137
138
139
140
141
142




143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161

162
163
164
165
166
167

  set initial [clock seconds]

  while {![eof $fd] && ($nSec==0 || ([clock second]-$initial)<$nSec)} { 
    set line [gets $fd]
    puts $line
    if {[string range $line 0 0]=="#"} continue
    if {[llength $line]==0} continue
    lappend res $line
  }
  catch { close $fd }
  set res
}

proc write_to_file {zFile zScript} {
................................................................................
proc exec_gnuplot_script {script png} {
  write_to_file out "
    $script
    pause -1
  "
  
  set script "
    set terminal pngcairo size 1000,400
    $script
  "
  exec gnuplot << $script > $png 2>/dev/null
}

proc make_totalset {res nWrite} {
  set ret ""
  set nMs 0
  set nIns 0
  foreach row $res {
    foreach {i msInsert msFetch} $row {}
    incr nIns $nWrite
    incr nMs $msInsert
    append ret "$nIns [expr $nIns*1000.0/$nMs]\n"
  }
  append ret "end\n"
  set ret
}

proc make_dataset {res iRes nWrite nShift} {
  set ret ""
  foreach row $res {
    set i [lindex $row 0]
    set j [lindex $row [expr $iRes+1]]
    set x [expr $i*$nWrite + $nShift]
    append ret "$x [expr int($nWrite * 1000.0 / $j)]\n"
  }
  append ret "end\n"
  set ret
}

proc do_write_test {zPng nSec nWrite nFetch nRepeat lSys} {

  if {[llength $lSys]!=2 && [llength $lSys]!=4} {
    error "lSys must be a list of 2 or 4 elements"
  }

  set lRes [list]
  foreach {name sys} $lSys {
    set wt [list -w $nWrite -r $nRepeat -f $nFetch -system $sys]
    lappend lRes [exec_lsmtest_speed $nSec $wt]






    if {$sys != [lindex $lSys end]} {
      puts "Sleeping 20 seconds..."
      after 20000
    }
  }

  # Set up the header part of the gnuplot script.
  #
  set xmax 0


  foreach res $lRes {
    set xthis [expr [lindex $res end 0]*$nWrite + 5*$nWrite/4]
    if {$xthis>$xmax} {set xmax $xthis}
  }

  append labeltext "Test parameters:\\n"
  append labeltext "   $nWrite writes per iteration\\n"
  append labeltext "   $nFetch fetches per iteration\\n"
  append labeltext "   key size is 12 bytes\\n"
  append labeltext "   value size is 100 bytes\\n"
  set labelx [expr int($xmax * 1.2)]

  set nWrite2 [expr $nWrite/2]
  set y2setup ""
  if {$nFetch>0} {

    set y2setup {
      set ytics nomirror
      set y2tics nomirror
      set y2range [0:*]
    }
  }
  set script [subst -nocommands {
    set boxwidth $nWrite2
    set xlabel "Database Size"
    set y2label "Queries per second"
    set ylabel "Writes per second"
    set yrange [0:*]
    set xrange [0:$xmax]
    set key outside bottom
    $y2setup
    set label 1 "$labeltext" at screen 0.95,graph 1.0 right
  }]







  set cols [list {#B0C4DE #00008B} {#F08080 #8B0000}]
  set cols [lrange $cols 0 [expr ([llength $lSys]/2)-1]]

  set nShift [expr ($nWrite/2)]
  set plot1 ""
  set plot2 ""
  set plot3 ""
  set data1 ""
  set data2 ""
  set data3 ""

  foreach {name sys} $lSys res $lRes col $cols {
    foreach {c1 c2} $col {}





    if {$plot1 != ""} { set plot1 ", $plot1" }
    set plot1 "\"-\" ti \"$name writes/sec\" with boxes fs solid lc rgb \"$c1\"$plot1"
    set data1 "[make_dataset $res 0 $nWrite $nShift] $data1"

    set plot3 ",\"-\" ti \"$name cumulative writes/sec\" with lines lc rgb \"$c2\" lw 2 $plot3"
    set data3 "[make_totalset $res $nWrite] $data3"

    if {$nFetch>0} {




      set new ", \"-\" ti \"$name fetches/sec\" axis x1y2 with points lw 3 lc rgb \"$c2\""
      set plot2 "$new $plot2"
      set data2 "[make_dataset $res 1 $nWrite $nWrite] $data2"
    }

    incr nShift [expr $nWrite/4]
  }
  append script "plot $plot1 $plot2 $plot3\n"
  append script $data1
  append script $data2
  append script $data3


  append script "pause -1\n"
  exec_gnuplot_script $script $zPng
}

do_write_test x.png 100 100000 100000 1000 {
  LSM   "mmap=1 multi_proc=0 safety=1" 

  LevelDB leveldb
}