From cf939412f895f4d1d26a9c2a9f2d1d5dbc7d801b Mon Sep 17 00:00:00 2001 From: Petrik Date: Mon, 31 Aug 2026 11:26:01 +0200 Subject: [PATCH 1/2] [roda] Ignore POST params unless required request.params merges the GET and POST params. If we only need to read the GET params we don't need to parse the body for POST params. --- frameworks/roda/app.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frameworks/roda/app.rb b/frameworks/roda/app.rb index a116c0845..010dff1d8 100644 --- a/frameworks/roda/app.rb +++ b/frameworks/roda/app.rb @@ -54,7 +54,7 @@ class App < Roda end r.is('baseline11') do - total = request.params['a'].to_i + request.params['b'].to_i + total = request.GET['a'].to_i + request.GET['b'].to_i if request.post? total += request.body.read.to_i end @@ -62,14 +62,14 @@ class App < Roda end r.is 'baseline2' do - total = request.params['a'].to_i + request.params['b'].to_i + total = request.GET['a'].to_i + request.GET['b'].to_i render_plain total.to_s end r.is 'json', Integer do |count| dataset = opts[:dataset_items] r.halt 500, 'No dataset' unless dataset - m = (request.params['m'] || 1).to_i + m = (request.GET['m'] || 1).to_i items = dataset.slice(0, count).map do |d| d.merge(total: (d[:price] * d[:quantity] * m)) end @@ -84,9 +84,9 @@ class App < Roda end r.is 'async-db' do - min_val = (request.params['min'] || 10).to_i - max_val = (request.params['max'] || 50).to_i - limit = (request.params['limit'] || 50).to_i.clamp(1, 50) + min_val = (request.GET['min'] || 10).to_i + max_val = (request.GET['max'] || 50).to_i + limit = (request.GET['limit'] || 50).to_i.clamp(1, 50) rows = self.class.get_async_db&.with do |connection| connection.exec_prepared('select', [min_val, max_val, limit]) @@ -100,9 +100,9 @@ class App < Roda r.is 'crud/items' do r.get do - category = request.params['category'] || 'electronics' - page = (request.params['page'] || 1).to_i - limit = (request.params['limit'] || 10).to_i + category = request.GET['category'] || 'electronics' + page = (request.GET['page'] || 1).to_i + limit = (request.GET['limit'] || 10).to_i offset = (page - 1) * limit rows = self.class.get_async_db&.with do |connection| From fb4976716a323aa4cded2f8229bc556c08b49c74 Mon Sep 17 00:00:00 2001 From: Petrik Date: Fri, 28 Aug 2026 13:57:59 +0200 Subject: [PATCH 2/2] [roda] Disable puma-io-threads Using puma-io-threads seems to reduce performance for baseline. --- frameworks/roda/Dockerfile | 2 +- frameworks/roda/config.ru | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/frameworks/roda/Dockerfile b/frameworks/roda/Dockerfile index 33d857055..569dfdd52 100644 --- a/frameworks/roda/Dockerfile +++ b/frameworks/roda/Dockerfile @@ -12,7 +12,7 @@ ENV RUBY_MN_THREADS=1 ENV RACK_ENV=production ENV WEB_CONCURRENCY=auto ENV MAX_THREADS=4 -ENV MAX_IO_THREADS=10 +ENV MAX_IO_THREADS=4 WORKDIR /app diff --git a/frameworks/roda/config.ru b/frameworks/roda/config.ru index 37e474036..e970954d2 100644 --- a/frameworks/roda/config.ru +++ b/frameworks/roda/config.ru @@ -1,21 +1,4 @@ require_relative 'app' -# Threads marked as IO bound are allowed to go over Puma's max thread limit. -class MarkAsIOBoundThreads - IOBoundPaths = %w[/baseline11 /baseline2 /async-db].map { [_1, nil] }.to_h.freeze - - def initialize(app) - @app = app - end - - def call(env) - if IOBoundPaths.has_key? env['PATH_INFO'] - env["puma.mark_as_io_bound"].call - end - @app.call(env) - end -end - -use MarkAsIOBoundThreads use Rack::Deflater # enable gzip run App