Permalink
Browse files

Option to use different request files for each run.

  • Loading branch information...
1 parent 36f5ae5 commit df0b9ce04f4abf654a0af883383702e0ae8a3512 @dvrensk dvrensk committed May 18, 2010
Showing with 28 additions and 1 deletion.
  1. +13 −0 README
  2. +10 −1 autoperf.rb
  3. +5 −0 sample.conf
View
13 README
@@ -33,3 +33,16 @@ Sample output:
| 180 | 132.2 | 129.8 | 137.4 | 27 | 0 | 59.6 |
| 200 | 119.8 | 117.6 | 139.9 | 31 | 14 | 53.9 |
+-----------------------------------------------------------------------------+
+
+
+If your server uses caching, making it pointless to run the same requests over
+and over, you can use different requests for each run.
+
+# Create 10 1000-line files (xa, xb, xc etc)
+split -a 1 requests_path
+
+# Convert to null-terminated strings
+for x in x?; do tr "\n" "\0" < $x > $x.nul; done
+
+# run as before, but use the `wlog` line instead of `httperf_wlog` in the conf file
+ruby autoperf.rb -c sample.conf
View
11 autoperf.rb
@@ -47,12 +47,21 @@ def parse_config(config_file)
end
}
+ if conf['wlog']
+ conf['wlog'] = Dir[conf['wlog']].sort
+ end
+
return conf
end
def benchmark(conf)
httperf_opt = conf.keys.grep(/httperf/).collect {|k| "--#{k.gsub(/httperf_/, '')} #{conf[k]}"}.join(" ")
- httperf_cmd = "httperf --hog --server #{conf['host']} --port #{conf['port']} #{httperf_opt}"
+ if conf['wlog']
+ wlog = conf['wlog'].shift
+ conf['wlog'].push wlog
+ wlog_opt = "--wlog n,#{wlog}"
+ end
+ httperf_cmd = "httperf --hog --server #{conf['host']} --port #{conf['port']} #{httperf_opt} #{wlog_opt}"
res = Hash.new("")
IO.popen("#{httperf_cmd} 2>&1") do |pipe|
View
5 sample.conf
@@ -20,6 +20,11 @@ rate_step = 50
# have been replayed
# httperf_wlog = n,requests_httperf
+# Autoperf can generate different wlog instructions for every run if
+# you set wlog (not httperf_wlog) to a glob pattern of the files you
+# want to use.
+# wlog = x?.nul
+
# num-conns is the total number of connections to make during a test
# num-calls is the number of requests per connection (if keep alive is supported)
# The product of num_call and rate is the the approximate number of

0 comments on commit df0b9ce

Please sign in to comment.