Skip to content

Instantly share code, notes, and snippets.

@titanous
Created July 27, 2012 18:14
Show Gist options
  • Save titanous/3189513 to your computer and use it in GitHub Desktop.
Save titanous/3189513 to your computer and use it in GitHub Desktop.
The SYMPOCALYPSE
reqs memory_kb
0 46588
100 79820
200 86960
300 91192
400 101440
500 139200
600 145512
700 153800
800 174852
900 231812
1000 236228
1100 241880
1200 249588
1300 254748
1400 264064
1500 307932
1600 393924
1700 395472
1800 404292
1900 410892
2000 418076
2100 423316
2200 428476
2300 437424
2400 443428
2500 447436
2600 454208
2700 470664
2800 600556
2900 637488
3000 650276
3100 652668
3200 667120
3300 680196
3400 683020
3500 695584
3600 707692
3700 708364
3800 722036
3900 734384
4000 746492
4100 750540
4200 761804
4300 776236
4400 776664
4500 782616
4600 791520
4700 797536
4800 799328
4900 808576
5000 855092
5100 880872
5200 900504
5300 916888
5400 946300
5500 946632
5600 965556
5700 985392
5800 987184
5900 1004832
6000 1025452
6100 1032408
6200 1043784
6300 1063776
6400 1082328
6500 1082484
6600 1105736
6700 1126064
6800 1126888
6900 1145576
7000 1163620
7100 1167060
7200 1182084
7300 1198984
7400 1209564
7500 1219164
7600 1238340
7700 1257624
7800 1258244
7900 1276544
8000 1298680
8100 1300572
8200 1317800
8300 1336340
8400 1339792
8500 1355160
8600 1374324
8700 1388024
8800 1394572
8900 1418304
9000 1436088
9100 1437060
9200 1450352
9300 1470768
9400 1472224
9500 1490224
9600 1509852
9700 1520152
9800 1531072
9900 1548528
10000 1566048
10100 1568924
10200 1588904
10300 1608720
10400 1609644
10500 1659540
10600 1667372
10700 1709468
10800 1724824
10900 1731660
11000 1753616
11100 1755248
11200 1775240
11300 1797492
11400 1797492
11500 1819432
11600 1824516
11700 1842564
11800 1862200
11900 1862948
12000 1886904
12100 1893588
12200 1908764
12300 1930168
12400 1933380
12500 1954296
12600 1967500
12700 1975700
12800 1995728
12900 1999652
13000 2022056
13100 2044640
13200 2044640
13300 2064016
13400 2067124
13500 2084928
13600 2107460
13700 2107460
13800 2130224
13900 2136048
14000 2150148
14100 2174372
14200 2175532
14300 2196176
14400 2208928
14500 2218692
14600 2239756
14700 2243380
14800 2264088
14900 2285304
15000 2285364
15100 2306532
15200 2309468
15300 2329264
15400 2352396
15500 2353464
15600 2372100
15700 2376696
15800 2393796
15900 2416528
16000 2416568
16100 2439520
16200 2453144
16300 2464972
16400 2484676
16500 2484676
16600 2503732
16700 2529776
16800 2529776
16900 2549144
17000 2552888
17100 2570868
17200 2595452
17300 2595452
17400 2616828
17500 2621748
17600 2637048
17700 2659084
17800 2659496
17900 2680752
18000 2690928
18100 2702576
18200 2725028
18300 2731856
18400 2747360
18500 2768308
18600 2769392
18700 2793904
18800 2795716
18900 2814644
19000 2837620
19100 2837620
19200 2859976
19300 2866208
19400 2883200
19500 2904264
19600 2904264
19700 2925800
19800 2936896
19900 2949040
20000 2970556
20100 2974060
20200 2995400
20300 3016604
20400 3018440
20500 3038964
20600 3040708
20700 3057832
20800 3078516
20900 3078804
21000 3168364
21100 3169636
21200 3276428
21300 3289064
21400 3291576
21500 3321708
21600 3321708
21700 3355464
21800 3355756
21900 3356848
22000 3388092
22100 3388092
22200 3421552
22300 3421552
22400 3428564
22500 3453908
22600 3454048
22700 3487204
22800 3487204
22900 3499520
23000 3520748
23100 3522836
23200 3555680
23300 3555688
23400 3572680
23500 3586624
23600 3586660
23700 3619324
23800 3619324
23900 3650432
24000 3652756
24100 3653944
24200 3685904
24300 3685904
24400 3718448
24500 3718480
24600 3726040
24700 3751260
24800 3751260
24900 3785012
25000 3785012
require 'open-uri'
require 'securerandom'
app = 'get("/") do params.each { |a| a.each(&:to_sym) } end'
$app_pid = Process.spawn('ruby', '-r', 'sinatra', '-e', app)
def memory_usage
`ps -o rss= -p #{$app_pid}`.to_i
end
sleep 1 # wait for sinatra to start
csv = File.open('output.csv', 'w')
csv.puts [0, memory_usage].join(',')
num_reqs = 25_000
begin
1.upto(num_reqs) do |i|
query = (1..500).map { [SecureRandom.urlsafe_base64(6), SecureRandom.urlsafe_base64(6)].join('=') }.join('&')
open "http://localhost:4567/?#{query}"
print 13.chr
print [i, num_reqs].join('/')
csv.puts [i, memory_usage].join(',') if i % 100 == 0
end
ensure
csv.close
Process.kill(:INT, $app_pid)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment