Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ruby/roda] Add Iodine server #9492

Merged
merged 1 commit into from
Jan 6, 2025
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
15 changes: 12 additions & 3 deletions frameworks/Ruby/roda-sequel/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ source "https://rubygems.org"
gem 'base64' # required by passenger on Ruby 3.4
gem "erubi", "~> 1.12"
gem "json", "~> 2.8"
gem "passenger", "~> 6.0", platforms: %i[ruby mswin], require: false
gem "puma", "~> 6.2", require: false
gem "sequel", "~> 5.67"
gem "roda", "~> 3.66"
gem "tilt", "~> 2.1", require: "tilt/erb"
gem "unicorn", "~> 6.1", platforms: %i[ruby mswin], require: false

group :mysql do
gem "mysql2", "~> 0.5", platforms: %i[ruby mswin]
Expand All @@ -18,3 +15,15 @@ group :postgresql do
gem "pg", "~> 1.4", platforms: %i[ruby mswin]
gem "sequel_pg", "~> 1.17", platforms: :ruby, require: false
end

group :iodine, optional: true do
gem "iodine", "~> 0.7", require: false
end

group :puma, optional: true do
gem "puma", "~> 6.2", require: false
end

group :unicorn, optional: true do
gem "unicorn", "~> 6.1", platforms: %i[ruby mswin], require: false
end
10 changes: 0 additions & 10 deletions frameworks/Ruby/roda-sequel/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@ GEM
kgio (2.11.4)
mysql2 (0.5.6)
nio4r (2.7.4)
passenger (6.0.23)
rack (>= 1.6.13)
rackup
rake (>= 12.3.3)
pg (1.5.8)
puma (6.5.0)
nio4r (~> 2.0)
rack (3.1.8)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
raindrops (0.20.1)
rake (13.2.1)
roda (3.85.0)
rack
sequel (5.85.0)
Expand All @@ -32,7 +24,6 @@ GEM
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
webrick (1.8.2)

PLATFORMS
ruby
Expand All @@ -43,7 +34,6 @@ DEPENDENCIES
erubi (~> 1.12)
json (~> 2.8)
mysql2 (~> 0.5)
passenger (~> 6.0)
pg (~> 1.4)
puma (~> 6.2)
roda (~> 3.66)
Expand Down
6 changes: 3 additions & 3 deletions frameworks/Ruby/roda-sequel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ comparing a variety of web platforms.

The tests will be run with:

* [Ruby 3.3](http://www.ruby-lang.org)
* [Ruby 3.4](http://www.ruby-lang.org)
* [Puma 6](http://puma.io)
* [Passenger 6](https://www.phusionpassenger.com)
* [Unicorn 5](https://bogomips.org/unicorn/)
* [Unicorn 6](https://bogomips.org/unicorn/)
msmith-techempower marked this conversation as resolved.
Show resolved Hide resolved
* [Iodine](https://github.com/boazsegev/iodine)
* [Roda 3](http://roda.jeremyevans.net)
* [Sequel 5](http://sequel.jeremyevans.net)
* [Erubi 1](https://github.com/jeremyevans/erubi)
Expand Down
10 changes: 6 additions & 4 deletions frameworks/Ruby/roda-sequel/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@
"versus": "rack-sequel-postgres-puma-mri",
"notes": ""
},
"postgres-passenger-mri": {
"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",
Expand All @@ -57,11 +59,11 @@
"language": "Ruby",
"orm": "Full",
"platform": "Rack",
"webserver": "Passenger",
"webserver": "Iodine",
"os": "Linux",
"database_os": "Linux",
"display_name": "roda-sequel-postgres-passenger-mri",
"versus": "rack-sequel-postgres-passenger-mri",
"display_name": "roda-sequel-postgres-iodine-mri",
"versus": "rack-sequel-postgres-iodine-mri",
"notes": ""
},
"postgres-unicorn-mri": {
Expand Down
13 changes: 5 additions & 8 deletions frameworks/Ruby/roda-sequel/boot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
SEQUEL_NO_ASSOCIATIONS = true

SERVER_STRING =
if defined?(PhusionPassenger)
[
PhusionPassenger::SharedConstants::SERVER_TOKEN_NAME,
PhusionPassenger::VERSION_STRING
].join("/").freeze
if defined?(Iodine)
"Iodine"
elsif defined?(Puma)
Puma::Const::PUMA_SERVER_STRING
"Puma"
elsif defined?(Unicorn)
Unicorn::HttpParser::DEFAULTS["SERVER_SOFTWARE"]
"Unicorn"
end

Bundler.require(:default) # Load core modules
Expand Down Expand Up @@ -48,7 +45,7 @@ def connect(dbtype)
(threads = Puma.cli_config.options.fetch(:max_threads)) > 1
opts[:max_connections] = (2 * Math.log(threads)).floor
opts[:pool_timeout] = 10
else
elsif defined?(Unicorn)
Sequel.single_threaded = true
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ruby:3.4

ADD ./ /roda-sequel
WORKDIR /roda-sequel

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

ENV BUNDLE_FORCE_RUBY_PLATFORM=true
RUN bundle config set with 'iodine'
RUN bundle install --jobs=8

ENV DBTYPE=postgresql

EXPOSE 8080

CMD bundle exec iodine -p 8080

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apt-get update && \
ENV LD_PRELOAD=libjemalloc.so.2

ENV BUNDLE_FORCE_RUBY_PLATFORM=true
RUN bundle config set with 'unicorn'
RUN bundle install --jobs=8

ENV DBTYPE=postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apt-get update && \
ENV LD_PRELOAD=libjemalloc.so.2

ENV BUNDLE_FORCE_RUBY_PLATFORM=true
RUN bundle config set with 'puma'
RUN bundle install --jobs=8

ENV DBTYPE=postgresql
Expand Down
1 change: 1 addition & 0 deletions frameworks/Ruby/roda-sequel/roda-sequel.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apt-get update && \
ENV LD_PRELOAD=libjemalloc.so.2

ENV BUNDLE_FORCE_RUBY_PLATFORM=true
RUN bundle config set with 'puma'
RUN bundle install --jobs=8

ENV DBTYPE=mysql
Expand Down
Loading