Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit bc26c4b

Browse files
authored
[ruby/roda-sequel] Test with Iodine only (#10601)
Replace the Puma default with Iodine, as it performs better than Puma in these benchmarks.
1 parent 0fbf61d commit bc26c4b

7 files changed

Lines changed: 16 additions & 82 deletions

File tree

frameworks/Ruby/roda-sequel/Gemfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,3 @@ end
2020
group :iodine, optional: true do
2121
gem "iodine", "~> 0.7", require: false
2222
end
23-
24-
group :puma, optional: true do
25-
gem "puma", "~> 7.1", require: false
26-
end

frameworks/Ruby/roda-sequel/Gemfile.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ GEM
77
erubi (1.13.1)
88
iodine (0.7.58)
99
json (2.16.0)
10-
nio4r (2.7.4)
1110
pg (1.6.2)
1211
pg (1.6.2-x86_64-darwin)
1312
pg (1.6.2-x86_64-linux)
14-
puma (7.1.0)
15-
nio4r (~> 2.0)
1613
rack (3.2.4)
1714
roda (3.99.0)
1815
rack
@@ -36,7 +33,6 @@ DEPENDENCIES
3633
iodine (~> 0.7)
3734
json (~> 2.8)
3835
pg (~> 1.4)
39-
puma (~> 7.1)
4036
roda (~> 3.66)
4137
sequel (~> 5.67)
4238
sequel_pg (~> 1.17)

frameworks/Ruby/roda-sequel/benchmark_config.json

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
"language": "Ruby",
1717
"orm": "Full",
1818
"platform": "Rack",
19-
"webserver": "Puma",
19+
"webserver": "Iodine",
2020
"os": "Linux",
2121
"database_os": "Linux",
22-
"display_name": "roda-sequel [puma, mysql]",
23-
"versus": "rack-sequel-puma-mri",
22+
"display_name": "roda-sequel [mysql]",
23+
"versus": "",
2424
"notes": ""
2525
},
2626
"postgres": {
@@ -36,33 +36,11 @@
3636
"language": "Ruby",
3737
"orm": "Full",
3838
"platform": "Rack",
39-
"webserver": "Puma",
40-
"os": "Linux",
41-
"database_os": "Linux",
42-
"display_name": "roda-sequel [puma, postgres]",
43-
"versus": "rack-sequel-postgres-puma-mri",
44-
"notes": ""
45-
},
46-
"postgres-iodine-mri": {
47-
"json_url": "/json",
48-
"db_url": "/db",
49-
"query_url": "/queries?queries=",
50-
"fortune_url": "/fortunes",
51-
"update_url": "/updates?queries=",
52-
"plaintext_url": "/plaintext",
53-
"port": 8080,
54-
"approach": "Realistic",
55-
"classification": "Micro",
56-
"database": "Postgres",
57-
"framework": "roda-sequel",
58-
"language": "Ruby",
59-
"orm": "Full",
60-
"platform": "Rack",
6139
"webserver": "Iodine",
6240
"os": "Linux",
6341
"database_os": "Linux",
64-
"display_name": "roda-sequel [iodine, postgres]",
65-
"versus": "rack-sequel-postgres-iodine-mri",
42+
"display_name": "roda-sequel [postgres]",
43+
"versus": "",
6644
"notes": ""
6745
}
6846
}

frameworks/Ruby/roda-sequel/db.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,14 @@ class World < Sequel.Model(:World)
4242
def_column_alias(:randomnumber, :randomNumber) if DB.database_type == :mysql
4343

4444
def self.batch_update(worlds)
45-
if DB.database_type == :mysql
46-
worlds.map(&:save_changes)
47-
else
48-
ids = []
49-
sql = String.new("UPDATE world SET randomnumber = CASE id ")
50-
worlds.each do |world|
51-
sql << "when #{world.id} then #{world.randomnumber} "
52-
ids << world.id
53-
end
54-
sql << "ELSE randomnumber END WHERE id IN ( #{ids.join(',')})"
55-
DB.run(sql)
45+
ids = []
46+
sql = String.new("UPDATE world SET randomnumber = CASE id ")
47+
worlds.each do |world|
48+
sql << "when #{world.id} then #{world.randomnumber} "
49+
ids << world.id
5650
end
51+
sql << "ELSE randomnumber END WHERE id IN ( #{ids.join(',')})"
52+
DB.run(sql)
5753
end
5854
end
5955

frameworks/Ruby/roda-sequel/roda-sequel-postgres-iodine-mri.dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.

frameworks/Ruby/roda-sequel/roda-sequel-postgres.dockerfile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,19 @@ ADD ./ /roda-sequel
44
WORKDIR /roda-sequel
55

66
ENV RUBY_YJIT_ENABLE=1
7-
ENV RUBY_MN_THREADS=1
87

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

1413
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
15-
RUN bundle config set with 'postgresql puma'
14+
RUN bundle config set with 'postgresql iodine'
1615
RUN bundle install --jobs=8
1716

1817
ENV RACK_ENV=production
1918
ENV DBTYPE=postgresql
2019

21-
ENV MIN_THREADS=5
22-
ENV MAX_THREADS=5
23-
2420
EXPOSE 8080
2521

26-
CMD export WEB_CONCURRENCY=$(($(nproc)*5/4)) && \
27-
bundle exec puma -C config/puma.rb -b tcp://0.0.0.0:8080
22+
CMD bundle exec iodine -p 8080 -w $(($(nproc)*5/4))

frameworks/Ruby/roda-sequel/roda-sequel.dockerfile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,19 @@ ADD ./ /roda-sequel
44
WORKDIR /roda-sequel
55

66
ENV RUBY_YJIT_ENABLE=1
7-
ENV RUBY_MN_THREADS=1
87

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

1413
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
15-
RUN bundle config set with 'mysql puma'
14+
RUN bundle config set with 'mysql iodine'
1615
RUN bundle install --jobs=8
1716

1817
ENV RACK_ENV=production
1918
ENV DBTYPE=mysql
2019

21-
ENV MIN_THREADS=5
22-
ENV MAX_THREADS=5
23-
2420
EXPOSE 8080
2521

26-
CMD export WEB_CONCURRENCY=$(($(nproc)*5/4)) && \
27-
bundle exec puma -C config/puma.rb -b tcp://0.0.0.0:8080
22+
CMD bundle exec iodine -p 8080 -w $(($(nproc)*5/4))

0 commit comments

Comments
 (0)