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
1 change: 1 addition & 0 deletions frameworks/roda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV RUBY_MN_THREADS=1
ENV RACK_ENV=production
ENV WEB_CONCURRENCY=auto
ENV MAX_THREADS=4
ENV MAX_IO_THREADS=10

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion frameworks/roda/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

gem 'roda', '~> 3.102'
gem 'puma', '~> 7.2'
gem 'puma', '~> 8.0'
gem 'pg', '~> 1.5'
gem 'json'
gem 'concurrent-ruby'
Expand Down
6 changes: 3 additions & 3 deletions frameworks/roda/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GEM
pg (1.6.3)
pg (1.6.3-arm64-darwin)
pg (1.6.3-x86_64-linux)
puma (7.2.0)
puma (8.0.1)
nio4r (~> 2.0)
rack (3.2.5)
roda (3.102.0)
Expand All @@ -32,7 +32,7 @@ DEPENDENCIES
connection_pool
json
pg (~> 1.5)
puma (~> 7.2)
puma (~> 8.0)
roda (~> 3.102)

CHECKSUMS
Expand All @@ -43,7 +43,7 @@ CHECKSUMS
pg (1.6.3) sha256=1388d0563e13d2758c1089e35e973a3249e955c659592d10e5b77c468f628a99
pg (1.6.3-arm64-darwin) sha256=7240330b572e6355d7c75a7de535edb5dfcbd6295d9c7777df4d9dddfb8c0e5f
pg (1.6.3-x86_64-linux) sha256=5d9e188c8f7a0295d162b7b88a768d8452a899977d44f3274d1946d67920ae8d
puma (7.2.0) sha256=bf8ef4ab514a4e6d4554cb4326b2004eba5036ae05cf765cfe51aba9706a72a8
puma (8.0.1) sha256=7b94e50c07655718c1fb8ae41a11fc06c7d61293208b3aa608ff71a46d3ad37c
rack (3.2.5) sha256=4cbd0974c0b79f7a139b4812004a62e4c60b145cba76422e288ee670601ed6d3
roda (3.102.0) sha256=b2156fff6d2b1b52bfac39e4ccde0d820a26594f069c3d9e99cc0853f7ee7dcc

Expand Down
1 change: 1 addition & 0 deletions frameworks/roda/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class App < Roda
end

r.is 'upload' do
request.env["puma.mark_as_io_bound"].call
size = 0
buf = request.body
while (chunk = buf.read(65536))
Expand Down
15 changes: 15 additions & 0 deletions frameworks/roda/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ class MethodGuard
end
end

# Threads marked as IO bound are allowed to go over Puma's max thread limit.
class MarkAsIOBoundThreads
def initialize(app)
@app = app
end

def call(env)
if env['PATH_INFO'].start_with? '/baseline'
env["puma.mark_as_io_bound"].call
end
@app.call(env)
end
end

use MarkAsIOBoundThreads
use MethodGuard
use Rack::Deflater # enable gzip
run App
1 change: 1 addition & 0 deletions frameworks/roda/puma.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
threads ENV.fetch('MAX_THREADS', 4).to_i
max_io_threads ENV.fetch("MAX_IO_THREADS", 10).to_i

tls_cert_path = ENV.fetch('TLS_CERT', '/certs/server.crt')
tls_key_path = ENV.fetch('TLS_KEY', '/certs/server.key')
Expand Down