Skip to content

Commit

Permalink
[ruby/sinatra-sequel] Add Iodine server
Browse files Browse the repository at this point in the history
+---------------------+------+-----+-----+-------+--------------+
|          branch_name|update|   db|query|fortune|weighted_score|
+---------------------+------+-----+-----+-------+--------------+
|               master| 10712|42587|18920|  30587|          1342|
|sinatra-sequel/iodine| 36294|70876|51271|   9335|          3757|
+---------------------+------+-----+-----+-------+--------------+
  • Loading branch information
p8 committed Jan 5, 2025
1 parent 2ed435c commit 9ae5168
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 16 deletions.
15 changes: 10 additions & 5 deletions frameworks/Ruby/sinatra-sequel/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@ gem 'json', '~> 2.8'
gem 'sequel', '~> 5.0'
gem 'sinatra', '~> 4.0', :require=>'sinatra/base'

group :mysql do
group :mysql, optional: true do
gem 'mysql2', '~> 0.5', :platforms=>[:ruby, :mswin]
end

group :postgresql do
group :postgresql, optional: true do
gem 'pg', '~> 1.5', :platforms=>[:ruby, :mswin]
gem 'sequel_pg', '~> 1.6', :platforms=>:ruby, :require=>false
end

group :passenger do

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

group :puma do
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
10 changes: 5 additions & 5 deletions frameworks/Ruby/sinatra-sequel/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ GEM
specs:
base64 (0.2.0)
bigdecimal (3.1.8)
iodine (0.7.58)
json (2.8.2)
kgio (2.11.4)
mustermann (3.0.3)
ruby2_keywords (~> 0.0.1)
mysql2 (0.5.6)
nio4r (2.7.4)
passenger (6.0.23)
passenger (6.0.24)
rack (>= 1.6.13)
rackup
rackup (>= 2.0.0)
rake (>= 12.3.3)
pg (1.5.8)
puma (6.5.0)
Expand All @@ -22,9 +23,8 @@ GEM
rack (>= 3.0.0, < 4)
rack-session (2.0.0)
rack (>= 3.0.0)
rackup (2.1.0)
rackup (2.2.1)
rack (>= 3)
webrick (~> 1.8)
raindrops (0.20.1)
rake (13.2.1)
ruby2_keywords (0.0.5)
Expand All @@ -43,13 +43,13 @@ GEM
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
webrick (1.8.2)

PLATFORMS
ruby
x86_64-darwin-23

DEPENDENCIES
iodine (~> 0.7)
json (~> 2.8)
mysql2 (~> 0.5)
passenger (~> 6.0)
Expand Down
20 changes: 20 additions & 0 deletions frameworks/Ruby/sinatra-sequel/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@
"versus": "rack-sequel-postgres-puma-mri",
"notes": ""
},
"postgres-iodine-mri": {
"db_url": "/db",
"query_url": "/queries?queries=",
"fortune_url": "/fortunes",
"update_url": "/updates?queries=",
"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-sequel-postgres-iodine-mri",
"versus": "rack-sequel-postgres-iodine-mri",
"notes": ""
},
"postgres-passenger-mri": {
"db_url": "/db",
"query_url": "/queries?queries=",
Expand Down
4 changes: 2 additions & 2 deletions frameworks/Ruby/sinatra-sequel/boot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
'puma'
elsif defined?(Unicorn)
'unicorn'
elsif defined?(Agoo)
'agoo'
elsif defined?(Iodine)
'iodine'
end

Bundler.require(:default) # Load core modules
Expand Down
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-sequel
WORKDIR /sinatra-sequel

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

ENV DBTYPE=postgresql

EXPOSE 8080

CMD bundle exec iodine -p 8080
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV LD_PRELOAD=libjemalloc.so.2
ADD ./ /sinatra-sequel
WORKDIR /sinatra-sequel

ENV BUNDLE_WITHOUT=mysql:puma:unicorn
ENV BUNDLE_WITH=postgresql:passenger
RUN bundle install --jobs=4 --gemfile=/sinatra-sequel/Gemfile

# TODO: https://github.com/phusion/passenger/issues/1916
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV LD_PRELOAD=libjemalloc.so.2
ADD ./ /sinatra-sequel
WORKDIR /sinatra-sequel

ENV BUNDLE_WITHOUT=mysql:passenger:puma
ENV BUNDLE_WITH=postgresql:unicorn
RUN bundle install --jobs=4 --gemfile=/sinatra-sequel/Gemfile

ENV DBTYPE=postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV LD_PRELOAD=libjemalloc.so.2
ADD ./ /sinatra-sequel
WORKDIR /sinatra-sequel

ENV BUNDLE_WITHOUT=mysql:passenger:unicorn
ENV BUNDLE_WITH=postgresql:puma
RUN bundle install --jobs=4 --gemfile=/sinatra-sequel/Gemfile

ENV DBTYPE=postgresql
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Ruby/sinatra-sequel/sinatra-sequel.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV LD_PRELOAD=libjemalloc.so.2
ADD ./ /sinatra-sequel
WORKDIR /sinatra-sequel

ENV BUNDLE_WITHOUT=postgresql:passenger:unicorn
ENV BUNDLE_WITH=mysql:puma
RUN bundle install --jobs=4 --gemfile=/sinatra-sequel/Gemfile

ENV DBTYPE=mysql
Expand Down

0 comments on commit 9ae5168

Please sign in to comment.