Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions frameworks/rails/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,17 @@

Bundler.require(*Rails.groups)

# Catch unknown HTTP methods, routing errors, and mark /upload as binary
class MethodGuard
VALID_METHODS = %w[GET HEAD POST PUT DELETE PATCH OPTIONS TRACE].to_set.freeze

# Mark /upload as binary so Rack skips form parameter parsing
class MarkUploadAsBinary
def initialize(app)
@app = app
end

def call(env)
unless VALID_METHODS.include?(env['REQUEST_METHOD'])
return [405, { 'content-type' => 'text/plain' }, ['Method Not Allowed']]
end
# Mark /upload as binary so Rack skips form parameter parsing
if env['PATH_INFO'] == '/upload'
env['CONTENT_TYPE'] = 'application/octet-stream'
end
@app.call(env)
rescue => e
if e.class.name.include?('UnknownHttpMethod') || e.class.name.include?('RoutingError')
[400, { 'content-type' => 'text/plain' }, ['Bad Request']]
else
raise
end
end
end

Expand Down Expand Up @@ -65,7 +53,7 @@ class BenchmarkApp < Rails::Application

# Add gzip support
config.middleware.insert 0, Rack::Deflater
config.middleware.insert 0, MethodGuard
config.middleware.insert 0, MarkUploadAsBinary
config.middleware.insert 0, MarkAsIOBoundThreads

# Silence logging
Expand Down
24 changes: 12 additions & 12 deletions site/data/api-16-1024.json
Original file line number Diff line number Diff line change
Expand Up @@ -724,28 +724,28 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 24814,
"avg_latency": "40.30ms",
"p99_latency": "130.30ms",
"cpu": "1741.5%",
"memory": "956MiB",
"rps": 25015,
"avg_latency": "39.99ms",
"p99_latency": "129.10ms",
"cpu": "1675.4%",
"memory": "874MiB",
"connections": 1024,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "130.55MB/s",
"input_bw": "1.40MB/s",
"reconnects": 74318,
"status_2xx": 372223,
"bandwidth": "131.55MB/s",
"input_bw": "1.41MB/s",
"reconnects": 74953,
"status_2xx": 375225,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0,
"tpl_baseline": 139406,
"tpl_json": 139728,
"tpl_baseline": 140651,
"tpl_json": 140741,
"tpl_db": 0,
"tpl_upload": 0,
"tpl_static": 0,
"tpl_async_db": 93088
"tpl_async_db": 93833
},
{
"framework": "ring-http-exchange",
Expand Down
22 changes: 11 additions & 11 deletions site/data/api-4-256.json
Original file line number Diff line number Diff line change
Expand Up @@ -724,28 +724,28 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 9914,
"avg_latency": "25.42ms",
"p99_latency": "101.50ms",
"cpu": "393.4%",
"rps": 9974,
"avg_latency": "25.24ms",
"p99_latency": "98.90ms",
"cpu": "394.6%",
"memory": "309MiB",
"connections": 256,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "52.15MB/s",
"input_bw": "571.22KB/s",
"reconnects": 29731,
"status_2xx": 148719,
"bandwidth": "52.43MB/s",
"input_bw": "574.67KB/s",
"reconnects": 29915,
"status_2xx": 149617,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0,
"tpl_baseline": 55723,
"tpl_json": 55787,
"tpl_baseline": 56124,
"tpl_json": 56125,
"tpl_db": 0,
"tpl_upload": 0,
"tpl_static": 0,
"tpl_async_db": 37209
"tpl_async_db": 37368
},
{
"framework": "ring-http-exchange",
Expand Down
18 changes: 9 additions & 9 deletions site/data/async-db-1024.json
Original file line number Diff line number Diff line change
Expand Up @@ -576,19 +576,19 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 71458,
"avg_latency": "13.68ms",
"p99_latency": "28.70ms",
"cpu": "6322.5%",
"memory": "3.6GiB",
"rps": 70016,
"avg_latency": "14.03ms",
"p99_latency": "30.40ms",
"cpu": "6400.0%",
"memory": "2.9GiB",
"connections": 1024,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "296.94MB/s",
"input_bw": "4.77MB/s",
"reconnects": 28129,
"status_2xx": 714589,
"bandwidth": "291.08MB/s",
"input_bw": "4.67MB/s",
"reconnects": 27721,
"status_2xx": 700163,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
16 changes: 8 additions & 8 deletions site/data/baseline-4096.json
Original file line number Diff line number Diff line change
Expand Up @@ -869,19 +869,19 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 33180,
"avg_latency": "104.29ms",
"p99_latency": "365.30ms",
"cpu": "4858.3%",
"memory": "6.4GiB",
"rps": 34491,
"avg_latency": "100.31ms",
"p99_latency": "346.90ms",
"cpu": "5030.2%",
"memory": "6.6GiB",
"connections": 4096,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "6.99MB/s",
"input_bw": "2.56MB/s",
"bandwidth": "7.27MB/s",
"input_bw": "2.66MB/s",
"reconnects": 0,
"status_2xx": 165904,
"status_2xx": 172456,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
18 changes: 9 additions & 9 deletions site/data/baseline-512.json
Original file line number Diff line number Diff line change
Expand Up @@ -869,19 +869,19 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 77647,
"avg_latency": "6.60ms",
"p99_latency": "85.70ms",
"cpu": "5535.9%",
"memory": "6.9GiB",
"rps": 80896,
"avg_latency": "6.34ms",
"p99_latency": "84.80ms",
"cpu": "5651.8%",
"memory": "6.8GiB",
"connections": 512,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "16.36MB/s",
"input_bw": "6.00MB/s",
"reconnects": 290,
"status_2xx": 388239,
"bandwidth": "17.04MB/s",
"input_bw": "6.25MB/s",
"reconnects": 307,
"status_2xx": 404484,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
18 changes: 9 additions & 9 deletions site/data/json-4096.json
Original file line number Diff line number Diff line change
Expand Up @@ -656,19 +656,19 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 121800,
"avg_latency": "28.82ms",
"p99_latency": "80.50ms",
"cpu": "6479.0%",
"memory": "3.6GiB",
"rps": 120806,
"avg_latency": "30.45ms",
"p99_latency": "89.40ms",
"cpu": "6330.5%",
"memory": "3.7GiB",
"connections": 4096,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "434.81MB/s",
"input_bw": "5.81MB/s",
"reconnects": 22406,
"status_2xx": 609001,
"bandwidth": "430.55MB/s",
"input_bw": "5.76MB/s",
"reconnects": 22297,
"status_2xx": 604033,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
18 changes: 9 additions & 9 deletions site/data/json-comp-16384.json
Original file line number Diff line number Diff line change
Expand Up @@ -562,19 +562,19 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 83173,
"avg_latency": "116.31ms",
"p99_latency": "591.00ms",
"cpu": "6188.0%",
"memory": "4.6GiB",
"rps": 84414,
"avg_latency": "108.30ms",
"p99_latency": "556.90ms",
"cpu": "6245.2%",
"memory": "4.9GiB",
"connections": 16384,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "121.56MB/s",
"input_bw": "6.19MB/s",
"reconnects": 11405,
"status_2xx": 415868,
"bandwidth": "123.36MB/s",
"input_bw": "6.28MB/s",
"reconnects": 11919,
"status_2xx": 422071,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
18 changes: 9 additions & 9 deletions site/data/json-comp-4096.json
Original file line number Diff line number Diff line change
Expand Up @@ -562,19 +562,19 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 83238,
"avg_latency": "45.17ms",
"p99_latency": "92.40ms",
"cpu": "6291.2%",
"memory": "4.1GiB",
"rps": 82184,
"avg_latency": "44.70ms",
"p99_latency": "115.20ms",
"cpu": "6431.4%",
"memory": "3.8GiB",
"connections": 4096,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "121.64MB/s",
"input_bw": "6.19MB/s",
"reconnects": 14727,
"status_2xx": 416190,
"bandwidth": "120.03MB/s",
"input_bw": "6.11MB/s",
"reconnects": 14674,
"status_2xx": 410923,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
18 changes: 9 additions & 9 deletions site/data/json-comp-512.json
Original file line number Diff line number Diff line change
Expand Up @@ -562,19 +562,19 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 81194,
"avg_latency": "6.30ms",
"p99_latency": "23.80ms",
"cpu": "6354.5%",
"memory": "3.0GiB",
"rps": 83902,
"avg_latency": "6.10ms",
"p99_latency": "24.50ms",
"cpu": "6435.9%",
"memory": "3.7GiB",
"connections": 512,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "118.67MB/s",
"input_bw": "6.04MB/s",
"reconnects": 16103,
"status_2xx": 405974,
"bandwidth": "122.63MB/s",
"input_bw": "6.24MB/s",
"reconnects": 16740,
"status_2xx": 419511,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
14 changes: 7 additions & 7 deletions site/data/json-tls-4096.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,18 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 114016,
"avg_latency": "35.58ms",
"p99_latency": "35.58ms",
"cpu": "6426.1%",
"memory": "4.1GiB",
"rps": 111658,
"avg_latency": "36.51ms",
"p99_latency": "36.51ms",
"cpu": "6424.5%",
"memory": "4.2GiB",
"connections": 4096,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "407.35MB",
"bandwidth": "398.92MB",
"reconnects": 0,
"status_2xx": 581406,
"status_2xx": 569630,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
16 changes: 8 additions & 8 deletions site/data/limited-conn-4096.json
Original file line number Diff line number Diff line change
Expand Up @@ -869,19 +869,19 @@
{
"framework": "rails",
"language": "Ruby",
"rps": 27263,
"avg_latency": "130.49ms",
"p99_latency": "290.30ms",
"cpu": "4545.2%",
"rps": 27574,
"avg_latency": "130.29ms",
"p99_latency": "324.20ms",
"cpu": "4619.9%",
"memory": "5.7GiB",
"connections": 4096,
"threads": 64,
"duration": "5s",
"pipeline": 1,
"bandwidth": "5.74MB/s",
"input_bw": "2.11MB/s",
"reconnects": 11833,
"status_2xx": 136318,
"bandwidth": "5.81MB/s",
"input_bw": "2.13MB/s",
"reconnects": 12010,
"status_2xx": 137871,
"status_3xx": 0,
"status_4xx": 0,
"status_5xx": 0
Expand Down
Loading