public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Search Repo:
Add option for keep-alive on abc script
macournoyer (author)
Tue Feb 19 21:24:04 -0800 2008
commit  0e1eaf123a113403f3517f0bf7d35928dd40d48e
tree    c224d11e3c292703746c3fbd743a0141cdef1922
parent  213a04207ce7fda3ff4c2c5fe295eb0f267278a8
...
21
22
23
 
24
25
26
...
31
32
33
34
 
35
36
37
...
21
22
23
24
25
26
27
...
32
33
34
 
35
36
37
38
0
@@ -21,6 +21,7 @@
0
   opts.on("-e", "--end N", "Last concurrency level") { |n| options[:end] = n.to_i }
0
   opts.on("-S", "--step N", "Concurrency level step") { |n| options[:step] = n.to_i }
0
   opts.on("-u", "--uri PATH", "Path to send to") { |u| options[:uri] = u }
0
+ opts.on("-k", "--keep-alive", "Use Keep-Alive") { options[:keep_alive] = true }
0
   
0
   opts.on_tail("-h", "--help", "Show this message") { puts opts; exit }
0
 end.parse!(ARGV)
0
@@ -31,7 +32,7 @@
0
 c = options[:start]
0
 until c >= options[:end]
0
   sleep 0.5
0
- out = `nice -n20 ab -k -c #{c} -n #{options[:requests]} #{options[:address]}:#{options[:port]}/#{options[:uri]} 2> /dev/null`
0
+ out = `nice -n20 ab #{'-k' if options[:keep_alive]} -c #{c} -n #{options[:requests]} #{options[:address]}:#{options[:port]}/#{options[:uri]} 2> /dev/null`
0
 
0
   r = if requests = out.match(/^Requests.+?(\d+\.\d+)/)
0
     requests[1].to_i

Comments

    No one has commented yet.