Skip to content
Merged
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
6 changes: 5 additions & 1 deletion frameworks/Ruby/sinatra/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ group :postgresql, optional: true do
gem 'pg', '~> 1.5', platforms: [:ruby, :mswin]
end

group :iodine, optional: true do
gem 'iodine', '~> 0.7', platforms: [:ruby, :mswin], require: false
end

group :passenger, optional: true do
gem 'passenger', '~> 6.0', platforms: [:ruby, :mswin], require: false
end
Expand All @@ -20,7 +24,7 @@ group :puma, optional: true do
gem 'puma', '~> 6.4', require: false
end

group :unicorn do
group :unicorn, optional: true do
gem 'unicorn', '~> 6.1', platforms: [:ruby, :mswin], require: false
end

Expand Down
2 changes: 2 additions & 0 deletions frameworks/Ruby/sinatra/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ GEM
drb (2.2.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
iodine (0.7.58)
json (2.10.1)
kgio (2.11.4)
logger (1.6.6)
Expand Down Expand Up @@ -81,6 +82,7 @@ PLATFORMS
DEPENDENCIES
activerecord (~> 8.0)
agoo
iodine (~> 0.7)
json (~> 2.8)
mysql2 (~> 0.5)
passenger (~> 6.0)
Expand Down
22 changes: 22 additions & 0 deletions frameworks/Ruby/sinatra/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,28 @@
"versus": "rack-postgres-agoo-mri",
"notes": ""
},
"postgres-iodine-mri": {
"json_url": "/json",
"db_url": "/db",
"query_url": "/queries?queries=",
"fortune_url": "/fortunes",
"update_url": "/updates?queries=",
"plaintext_url": "/plaintext",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"database": "Postgres",
"framework": "sinatra",
"language": "Ruby",
"orm": "Full",
"platform": "Rack",
"webserver": "Iodine",
"os": "Linux",
"database_os": "Linux",
"display_name": "sinatra-postgres-iodine-mri",
"versus": "rack-postgres-iodine-mri",
"notes": ""
},
"postgres-passenger-mri": {
"db_url": "/db",
"query_url": "/queries?queries=",
Expand Down
2 changes: 2 additions & 0 deletions frameworks/Ruby/sinatra/boot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
'puma'
elsif defined?(Unicorn)
'unicorn'
elsif defined?(Iodine)
'iodine'
elsif defined?(Agoo)
'agoo'
end
Expand Down
3 changes: 3 additions & 0 deletions frameworks/Ruby/sinatra/hello_world.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class HelloWorld < Sinatra::Base
# XSS, CSRF, IP spoofing, etc. protection are not explicitly required
disable :protection

# disable it for all environments
set :host_authorization, { permitted_hosts: [] }

# Only add the charset parameter to specific content types per the requirements
set :add_charset, [mime_type(:html)]
end
Expand Down
20 changes: 20 additions & 0 deletions frameworks/Ruby/sinatra/sinatra-postgres-iodine-mri.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ruby:3.4

ENV RUBY_YJIT_ENABLE=1

# Use Jemalloc
RUN apt-get update && \
apt-get install -y --no-install-recommends libjemalloc2
ENV LD_PRELOAD=libjemalloc.so.2

ADD ./ /sinatra
WORKDIR /sinatra

ENV BUNDLE_WITH=postgresql:iodine
RUN bundle install --jobs=4 --gemfile=/sinatra/Gemfile

ENV DBTYPE=postgresql

EXPOSE 8080

CMD bundle exec iodine -p 8080 -w $(ruby config/auto_tune.rb | grep -Eo '[0-9]+' | head -n 1)
Loading