Skip to content

Instantly share code, notes, and snippets.

@sudara
Last active December 25, 2015 00:59
Show Gist options
  • Save sudara/6891977 to your computer and use it in GitHub Desktop.
Save sudara/6891977 to your computer and use it in GitHub Desktop.
Testing log tagging
require 'benchmark/ips'
Benchmark.ips do |x|
x.report("mem from $$") { `ps -o rss= -p #{$$}`}
x.report("mem from Process.pid") { `ps -o rss= -p #{Process.pid}`}
x.report("mem from static pid") { `ps -o rss= -p 15754`}
x.report("mem + Process.pid via system") { system("ps -o rss= -p #{Process.pid}") }
end
# $ ruby bench_ps.rb
# Calculating -------------------------------------
# mem from $$ 7 i/100ms
# mem from Process.pid 7 i/100ms
# mem from static pid 7 i/100ms
# -------------------------------------------------
# mem from $$ 79.7 (±3.8%) i/s - 399 in 5.011782s
# mem from Process.pid 76.5 (±5.2%) i/s - 385 in 5.042869s
# mem from static pid 76.4 (±5.2%) i/s - 385 in 5.052205s
$ ab -n100 -c3 -t 10 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Finished 121 requests
Server Software: Apache/2.2.22
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 96 bytes
Concurrency Level: 3
Time taken for tests: 10.100 seconds
Complete requests: 121
Failed requests: 0
Write errors: 0
Non-2xx responses: 121
Total transferred: 69575 bytes
HTML transferred: 11616 bytes
Requests per second: 11.98 [#/sec] (mean)
Time per request: 250.421 [ms] (mean)
Time per request: 83.474 [ms] (mean, across all concurrent requests)
Transfer rate: 6.73 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 146 247 70.7 246 672
Waiting: 145 246 70.4 243 664
Total: 146 247 70.7 246 672
Percentage of the requests served within a certain time (ms)
50% 245
66% 264
75% 273
80% 276
90% 305
95% 321
98% 410
99% 632
100% 672 (longest request)
$ ab -n100 -c3 -t 10 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Finished 116 requests
Server Software: Apache/2.2.22
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 96 bytes
Concurrency Level: 3
Time taken for tests: 10.080 seconds
Complete requests: 116
Failed requests: 0
Write errors: 0
Non-2xx responses: 116
Total transferred: 66700 bytes
HTML transferred: 11136 bytes
Requests per second: 11.51 [#/sec] (mean)
Time per request: 260.691 [ms] (mean)
Time per request: 86.897 [ms] (mean, across all concurrent requests)
Transfer rate: 6.46 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 160 259 83.2 244 705
Waiting: 159 258 83.2 244 705
Total: 160 259 83.2 244 705
Percentage of the requests served within a certain time (ms)
50% 244
66% 271
75% 283
80% 286
90% 316
95% 332
98% 578
99% 686
100% 705 (longest request)
$ ab -n100 -c3 -t 10 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Finished 1733 requests
Server Software: Apache/2.2.22
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 96 bytes
Concurrency Level: 3
Time taken for tests: 13.331 seconds
Complete requests: 1733
Failed requests: 0
Write errors: 0
Non-2xx responses: 1735
Total transferred: 997625 bytes
HTML transferred: 166560 bytes
Requests per second: 129.99 [#/sec] (mean)
Time per request: 23.078 [ms] (mean)
Time per request: 7.693 [ms] (mean, across all concurrent requests)
Transfer rate: 73.08 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 6 19 101.0 12 3535
Waiting: 6 18 101.0 11 3530
Total: 6 19 101.0 12 3535
Percentage of the requests served within a certain time (ms)
50% 12
66% 14
75% 15
80% 16
90% 18
95% 20
98% 25
99% 205
100% 3535 (longest request)
$ ab -n100 -c3 -t 10 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Finished 115 requests
Server Software: Apache/2.2.22
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 96 bytes
Concurrency Level: 3
Time taken for tests: 10.047 seconds
Complete requests: 115
Failed requests: 0
Write errors: 0
Non-2xx responses: 115
Total transferred: 66125 bytes
HTML transferred: 11040 bytes
Requests per second: 11.45 [#/sec] (mean)
Time per request: 262.094 [ms] (mean)
Time per request: 87.365 [ms] (mean, across all concurrent requests)
Transfer rate: 6.43 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 159 259 83.6 240 761
Waiting: 158 258 83.6 239 760
Total: 159 259 83.6 240 761
Percentage of the requests served within a certain time (ms)
50% 239
66% 268
75% 291
80% 301
90% 311
95% 324
98% 654
99% 662
100% 761 (longest request)
$ ab -n100 -c3 -t 10 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Finished 2117 requests
Server Software: Apache/2.2.22
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 96 bytes
Concurrency Level: 3
Time taken for tests: 10.165 seconds
Complete requests: 2117
Failed requests: 0
Write errors: 0
Non-2xx responses: 2119
Total transferred: 1218425 bytes
HTML transferred: 203424 bytes
Requests per second: 208.27 [#/sec] (mean)
Time per request: 14.404 [ms] (mean)
Time per request: 4.801 [ms] (mean, across all concurrent requests)
Transfer rate: 117.06 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 6 14 20.9 12 318
Waiting: 5 13 20.4 10 317
Total: 6 14 20.9 12 318
Percentage of the requests served within a certain time (ms)
50% 12
66% 13
75% 14
80% 15
90% 17
95% 19
98% 23
99% 128
100% 318 (longest request)
$ ab -n100 -c3 -t 10 http://localhost/
Benchmarking localhost (be patient)
Finished 117 requests
Server Software: Apache/2.2.22
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 96 bytes
Concurrency Level: 3
Time taken for tests: 10.107 seconds
Complete requests: 117
Failed requests: 0
Write errors: 0
Non-2xx responses: 117
Total transferred: 67275 bytes
HTML transferred: 11232 bytes
Requests per second: 11.58 [#/sec] (mean)
Time per request: 259.166 [ms] (mean)
Time per request: 86.389 [ms] (mean, across all concurrent requests)
Transfer rate: 6.50 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 164 256 52.9 250 425
Waiting: 163 255 52.9 250 424
Total: 164 256 52.9 250 425
Percentage of the requests served within a certain time (ms)
50% 250
66% 284
75% 294
80% 303
90% 321
95% 329
98% 395
99% 409
100% 425 (longest request)
$ ab -n100 -c3 -t 10 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Finished 1235 requests
Server Software: Apache/2.2.22
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 96 bytes
Concurrency Level: 3
Time taken for tests: 10.003 seconds
Complete requests: 1235
Failed requests: 0
Write errors: 0
Non-2xx responses: 1235
Total transferred: 710125 bytes
HTML transferred: 118560 bytes
Requests per second: 123.47 [#/sec] (mean)
Time per request: 24.298 [ms] (mean)
Time per request: 8.099 [ms] (mean, across all concurrent requests)
Transfer rate: 69.33 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 6 24 51.5 19 759
Waiting: 5 21 51.5 16 758
Total: 6 24 51.5 19 759
Percentage of the requests served within a certain time (ms)
50% 19
66% 20
75% 21
80% 23
90% 25
95% 29
98% 38
99% 69
100% 759 (longest request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment