Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
httperf tests of ditty using Diskcached
# code sample for httperf test
# - no cache
# get "/archive/?*" do
# items = archive_items
# haml :archive, :layout => choose_layout, :locals => { :state => :archive }
# end
httperf --client=0/1 --server=localhost --port=9001 --uri=/archive --send-buffer=4096 --recv-buffer=16384 --num-conns=100 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1
Total: connections 100 requests 100 replies 100 test-duration 22.585 s
Connection rate: 4.4 conn/s (225.8 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 116.0 avg 225.8 max 385.2 median 231.5 stddev 55.3
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 1.000
Request rate: 4.4 req/s (225.8 ms/req)
Request size [B]: 69.0
Reply rate [replies/s]: min 4.0 avg 4.5 max 5.0 stddev 0.4 (4 samples)
Reply time [ms]: response 225.1 transfer 0.7
Reply size [B]: header 215.0 content 13266.0 footer 0.0 (total 13481.0)
Reply status: 1xx=0 2xx=100 3xx=0 4xx=0 5xx=0
CPU time [s]: user 11.89 system 3.90 (user 52.6% system 17.3% total 69.9%)
Net I/O: 58.6 KB/s (0.5*10^6 bps)
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
# code smaple for httperf test
# - cache mongodb call
#get "/archive/?*" do
# $diskcache.cache('archive') do
# items = archive_items
# end
# haml :archive, :layout => choose_layout, :locals => { :state => :archive }
#end
httperf --client=0/1 --server=localhost --port=9001 --uri=/archive --send-buffer=4096 --recv-buffer=16384 --num-conns=100 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1
Total: connections 100 requests 100 replies 100 test-duration 18.278 s
Connection rate: 5.5 conn/s (182.8 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 114.4 avg 182.8 max 314.0 median 167.5 stddev 49.3
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 1.000
Request rate: 5.5 req/s (182.8 ms/req)
Request size [B]: 69.0
Reply rate [replies/s]: min 4.8 avg 5.3 max 5.6 stddev 0.4 (3 samples)
Reply time [ms]: response 181.5 transfer 1.2
Reply size [B]: header 215.0 content 13266.0 footer 0.0 (total 13481.0)
Reply status: 1xx=0 2xx=100 3xx=0 4xx=0 5xx=0
CPU time [s]: user 9.64 system 3.12 (user 52.7% system 17.1% total 69.8%)
Net I/O: 72.4 KB/s (0.6*10^6 bps)
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
# code smaple for httperf test
# - cache mongodb call and html render
#get "/archive/?*" do
# $diskcache.cache('archive') do
# items = archive_items
# haml :archive, :layout => choose_layout, :locals => { :state => :archive }
# end
#end
httperf --client=0/1 --server=localhost --port=9001 --uri=/archive --send-buffer=4096 --recv-buffer=16384 --num-conns=100 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1
Total: connections 100 requests 100 replies 100 test-duration 0.753 s
Connection rate: 132.7 conn/s (7.5 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 2.3 avg 7.5 max 182.1 median 4.5 stddev 18.7
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 1.000
Request rate: 132.7 req/s (7.5 ms/req)
Request size [B]: 69.0
Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples)
Reply time [ms]: response 6.6 transfer 0.9
Reply size [B]: header 215.0 content 13266.0 footer 0.0 (total 13481.0)
Reply status: 1xx=0 2xx=100 3xx=0 4xx=0 5xx=0
CPU time [s]: user 0.28 system 0.12 (user 37.2% system 16.5% total 53.6%)
Net I/O: 1756.2 KB/s (14.4*10^6 bps)
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
15 configure do
...
44 $diskcache = Diskcached.new(File.join(settings.root, 'cache'))
45 $diskcache.flush # ensure caches are empty on startup
46 end
58 before do
...
61 @cache_key = cache_sha(request.path_info)
62 end
...
231 get "/" do
232 begin
233 raise Diskcached::NotFound if authorized?
234 content = $diskcache.get(@cache_key)
235 logger.debug("reading index from cache") unless authorized?
236 rescue Diskcached::NotFound
237 logger.debug("storing index to cache") unless authorized?
238 content = haml(:index, :layout => choose_layout)
239 $diskcache.set(@cache_key, content) unless authorized?
240 end
241 content
242 end
httperf --client=0/1 --server=localhost --port=9001 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=100000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETS
Maximum connect burst length: 1
Total: connections 100000 requests 100000 replies 100000 test-duration 744.646 s
Connection rate: 134.3 conn/s (7.4 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 1.9 avg 7.4 max 398.8 median 4.5 stddev 10.5
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 1.000
Request rate: 134.3 req/s (7.4 ms/req)
Request size [B]: 62.0
Reply rate [replies/s]: min 116.6 avg 134.3 max 147.2 stddev 6.1 (148 samples)
Reply time [ms]: response 6.9 transfer 0.5
Reply size [B]: header 216.0 content 105088.0 footer 0.0 (total 105304.0)
Reply status: 1xx=0 2xx=100000 3xx=0 4xx=0 5xx=0
CPU time [s]: user 287.88 system 115.60 (user 38.7% system 15.5% total 54.2%)
Net I/O: 13818.2 KB/s (113.2*10^6 bps)
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment