Browse Source

Merge pull request #9493 from p8/rack/iodine

[ruby/rack] Add Iodine server
Mike Smith 7 months ago
parent
commit
68a50181ca

+ 8 - 4
frameworks/Ruby/rack/Gemfile

@@ -11,19 +11,23 @@ gem 'sequel'
 gem 'sequel_pg', platforms: %i[ruby mswin]
 gem 'sequel_pg', platforms: %i[ruby mswin]
 gem 'tzinfo-data', '1.2023.3'
 gem 'tzinfo-data', '1.2023.3'
 
 
-group :falcon do
+group :falcon, optional: true do
   gem 'falcon', '~> 0.47', platforms: %i[ruby mswin]
   gem 'falcon', '~> 0.47', platforms: %i[ruby mswin]
 end
 end
 
 
-group :puma do
+group :iodine, optional: true do
+  gem 'iodine', '~> 0.7', platforms: %i[ruby mswin]
+end
+
+group :puma, optional: true do
   gem 'puma', '~> 6.4'
   gem 'puma', '~> 6.4'
 end
 end
 
 
-group :unicorn do
+group :unicorn, optional: true do
   gem 'unicorn', '~> 6.1', platforms: %i[ruby mswin]
   gem 'unicorn', '~> 6.1', platforms: %i[ruby mswin]
 end
 end
 
 
-group :development do
+group :development, optional: true do
   gem 'rack-test'
   gem 'rack-test'
   gem 'rubocop', platforms: %i[ruby mswin]
   gem 'rubocop', platforms: %i[ruby mswin]
 end
 end

+ 2 - 0
frameworks/Ruby/rack/Gemfile.lock

@@ -53,6 +53,7 @@ GEM
     io-endpoint (0.14.0)
     io-endpoint (0.14.0)
     io-event (1.7.3)
     io-event (1.7.3)
     io-stream (0.6.1)
     io-stream (0.6.1)
+    iodine (0.7.58)
     json (2.9.1)
     json (2.9.1)
     kgio (2.11.4)
     kgio (2.11.4)
     language_server-protocol (3.17.0.3)
     language_server-protocol (3.17.0.3)
@@ -127,6 +128,7 @@ PLATFORMS
 DEPENDENCIES
 DEPENDENCIES
   connection_pool (~> 2.4)
   connection_pool (~> 2.4)
   falcon (~> 0.47)
   falcon (~> 0.47)
+  iodine (~> 0.7)
   jdbc-postgres (~> 42.2)
   jdbc-postgres (~> 42.2)
   json (~> 2.8)
   json (~> 2.8)
   pg (~> 1.5)
   pg (~> 1.5)

+ 4 - 4
frameworks/Ruby/rack/README.md

@@ -11,16 +11,16 @@ comparing a variety of web servers.
 ## Infrastructure Software Versions
 ## Infrastructure Software Versions
 The tests were run with:
 The tests were run with:
 
 
-* [Ruby 3.3](http://www.ruby-lang.org/)
+* [Ruby 3.4](http://www.ruby-lang.org/)
 * [JRuby 9.4](http://jruby.org/)
 * [JRuby 9.4](http://jruby.org/)
 * [Rack 3.0.7](http://rack.github.com/)
 * [Rack 3.0.7](http://rack.github.com/)
 * [Unicorn 6.1.0](http://unicorn.bogomips.org/)
 * [Unicorn 6.1.0](http://unicorn.bogomips.org/)
-* [Puma 6.2.1](http://puma.io/)
-* [Falcon 0.42.3](https://github.com/socketry/falcon)
+* [Puma 6.4](http://puma.io/)
+* [Iodine](https://github.com/boazsegev/iodine)
+* [Falcon](https://github.com/socketry/falcon)
 * [Sequel 5.68.0](https://sequel.jeremyevans.net/)
 * [Sequel 5.68.0](https://sequel.jeremyevans.net/)
 
 
 
 
-
 ## Paths & Source for Tests
 ## Paths & Source for Tests
 
 
 * Routing and controller logic is in hello_world.rb
 * Routing and controller logic is in hello_world.rb

+ 21 - 0
frameworks/Ruby/rack/benchmark_config.json

@@ -23,6 +23,27 @@
         "display_name": "rack-puma-mri-sequel-raw",
         "display_name": "rack-puma-mri-sequel-raw",
         "notes": ""
         "notes": ""
       },
       },
+      "iodine": {
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "db_url": "/db",
+        "query_url": "/queries?queries=",
+        "fortune_url": "/fortunes",
+        "update_url": "/updates?queries=",
+        "port": 8080,
+        "approach": "Stripped",
+        "classification": "Micro",
+        "orm": "raw",
+        "database": "Postgres",
+        "framework": "rack",
+        "language": "Ruby",
+        "platform": "Mri",
+        "webserver": "Iodine",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "rack-iodine-mri-sequel-raw",
+        "notes": ""
+      },
       "unicorn": {
       "unicorn": {
         "json_url": "/json",
         "json_url": "/json",
         "plaintext_url": "/plaintext",
         "plaintext_url": "/plaintext",

+ 2 - 0
frameworks/Ruby/rack/hello_world.rb

@@ -29,6 +29,8 @@ class HelloWorld
                     'Passenger'
                     'Passenger'
                   elsif defined?(Puma)
                   elsif defined?(Puma)
                     'Puma'
                     'Puma'
+                  elsif defined?(Iodine)
+                    'Iodine'
                   elsif defined?(Unicorn)
                   elsif defined?(Unicorn)
                     'Unicorn'
                     'Unicorn'
                   elsif defined?(Falcon)
                   elsif defined?(Falcon)

+ 1 - 1
frameworks/Ruby/rack/rack-falcon.dockerfile

@@ -12,7 +12,7 @@ WORKDIR /rack
 COPY Gemfile ./
 COPY Gemfile ./
 
 
 ENV BUNDLE_FORCE_RUBY_PLATFORM=true
 ENV BUNDLE_FORCE_RUBY_PLATFORM=true
-RUN bundle config set without 'development test puma unicorn'
+RUN bundle config set with 'falcon'
 RUN bundle install --jobs=8
 RUN bundle install --jobs=8
 
 
 COPY . .
 COPY . .

+ 22 - 0
frameworks/Ruby/rack/rack-iodine.dockerfile

@@ -0,0 +1,22 @@
+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
+
+WORKDIR /rack
+
+COPY Gemfile ./
+
+ENV BUNDLE_FORCE_RUBY_PLATFORM=true
+RUN bundle config set with 'iodine'
+RUN bundle install --jobs=8
+
+COPY . .
+
+EXPOSE 8080
+
+CMD bundle exec iodine -p 8080

+ 1 - 1
frameworks/Ruby/rack/rack-jruby.dockerfile

@@ -6,7 +6,7 @@ WORKDIR /rack
 
 
 COPY Gemfile  ./
 COPY Gemfile  ./
 
 
-RUN bundle config set without 'development test falcon unicorn'
+RUN bundle config set with 'puma'
 RUN bundle install --jobs=8
 RUN bundle install --jobs=8
 
 
 COPY . .
 COPY . .

+ 1 - 1
frameworks/Ruby/rack/rack-unicorn.dockerfile

@@ -12,7 +12,7 @@ WORKDIR /rack
 COPY Gemfile ./
 COPY Gemfile ./
 
 
 ENV BUNDLE_FORCE_RUBY_PLATFORM=true
 ENV BUNDLE_FORCE_RUBY_PLATFORM=true
-RUN bundle config set without 'development test falcon puma'
+RUN bundle config set with 'unicorn'
 RUN bundle install --jobs=8
 RUN bundle install --jobs=8
 
 
 COPY . .
 COPY . .

+ 1 - 1
frameworks/Ruby/rack/rack.dockerfile

@@ -13,7 +13,7 @@ WORKDIR /rack
 COPY Gemfile ./
 COPY Gemfile ./
 
 
 ENV BUNDLE_FORCE_RUBY_PLATFORM=true
 ENV BUNDLE_FORCE_RUBY_PLATFORM=true
-RUN bundle config set without 'development test falcon unicorn'
+RUN bundle config set with 'puma'
 RUN bundle install --jobs=8
 RUN bundle install --jobs=8
 
 
 COPY . .
 COPY . .