From 1f29a038e35f0b31fcce3e0da3a4c9cd538761ec Mon Sep 17 00:00:00 2001 From: Petrik Date: Fri, 3 Jan 2025 17:43:21 +0100 Subject: [PATCH] [ruby/rack] Add Iodine server +-------------------------------+---------+------+------+-----+-----+-------+--------------+ | name|plaintext|update| json| db|query|fortune|weighted_score| +-------------------------------+---------+------+------+-----+-----+-------+--------------+ | rack| 102678| 16547|149247|48456|28472| 41675| 2170| | rack-iodine| 351213| 38250|295618|87024|71838| 80948| 5011| +-------------------------------+---------+------+------+-----+-----+-------+--------------+ --- frameworks/Ruby/rack/Gemfile | 12 +++++++---- frameworks/Ruby/rack/Gemfile.lock | 2 ++ frameworks/Ruby/rack/README.md | 8 +++---- frameworks/Ruby/rack/benchmark_config.json | 21 +++++++++++++++++++ frameworks/Ruby/rack/hello_world.rb | 2 ++ frameworks/Ruby/rack/rack-falcon.dockerfile | 2 +- frameworks/Ruby/rack/rack-iodine.dockerfile | 22 ++++++++++++++++++++ frameworks/Ruby/rack/rack-jruby.dockerfile | 2 +- frameworks/Ruby/rack/rack-unicorn.dockerfile | 2 +- frameworks/Ruby/rack/rack.dockerfile | 2 +- 10 files changed, 63 insertions(+), 12 deletions(-) create mode 100644 frameworks/Ruby/rack/rack-iodine.dockerfile diff --git a/frameworks/Ruby/rack/Gemfile b/frameworks/Ruby/rack/Gemfile index 5b34822d7e0..83ef0486ea3 100644 --- a/frameworks/Ruby/rack/Gemfile +++ b/frameworks/Ruby/rack/Gemfile @@ -11,19 +11,23 @@ gem 'sequel' gem 'sequel_pg', platforms: %i[ruby mswin] gem 'tzinfo-data', '1.2023.3' -group :falcon do +group :falcon, optional: true do gem 'falcon', '~> 0.47', platforms: %i[ruby mswin] 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' end -group :unicorn do +group :unicorn, optional: true do gem 'unicorn', '~> 6.1', platforms: %i[ruby mswin] end -group :development do +group :development, optional: true do gem 'rack-test' gem 'rubocop', platforms: %i[ruby mswin] end diff --git a/frameworks/Ruby/rack/Gemfile.lock b/frameworks/Ruby/rack/Gemfile.lock index 0c5027553b4..e15a39ea4cf 100644 --- a/frameworks/Ruby/rack/Gemfile.lock +++ b/frameworks/Ruby/rack/Gemfile.lock @@ -53,6 +53,7 @@ GEM io-endpoint (0.14.0) io-event (1.7.3) io-stream (0.6.1) + iodine (0.7.58) json (2.9.1) kgio (2.11.4) language_server-protocol (3.17.0.3) @@ -127,6 +128,7 @@ PLATFORMS DEPENDENCIES connection_pool (~> 2.4) falcon (~> 0.47) + iodine (~> 0.7) jdbc-postgres (~> 42.2) json (~> 2.8) pg (~> 1.5) diff --git a/frameworks/Ruby/rack/README.md b/frameworks/Ruby/rack/README.md index 1f4c0a3ad45..65783108d2e 100644 --- a/frameworks/Ruby/rack/README.md +++ b/frameworks/Ruby/rack/README.md @@ -11,16 +11,16 @@ comparing a variety of web servers. ## Infrastructure Software Versions 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/) * [Rack 3.0.7](http://rack.github.com/) * [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/) - ## Paths & Source for Tests * Routing and controller logic is in hello_world.rb diff --git a/frameworks/Ruby/rack/benchmark_config.json b/frameworks/Ruby/rack/benchmark_config.json index 8e2f5884387..97227d81e36 100644 --- a/frameworks/Ruby/rack/benchmark_config.json +++ b/frameworks/Ruby/rack/benchmark_config.json @@ -23,6 +23,27 @@ "display_name": "rack-puma-mri-sequel-raw", "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": { "json_url": "/json", "plaintext_url": "/plaintext", diff --git a/frameworks/Ruby/rack/hello_world.rb b/frameworks/Ruby/rack/hello_world.rb index f2884f3ad1b..ec6655c2f2c 100644 --- a/frameworks/Ruby/rack/hello_world.rb +++ b/frameworks/Ruby/rack/hello_world.rb @@ -29,6 +29,8 @@ class HelloWorld 'Passenger' elsif defined?(Puma) 'Puma' + elsif defined?(Iodine) + 'Iodine' elsif defined?(Unicorn) 'Unicorn' elsif defined?(Falcon) diff --git a/frameworks/Ruby/rack/rack-falcon.dockerfile b/frameworks/Ruby/rack/rack-falcon.dockerfile index f030cd54177..e1640c67328 100644 --- a/frameworks/Ruby/rack/rack-falcon.dockerfile +++ b/frameworks/Ruby/rack/rack-falcon.dockerfile @@ -12,7 +12,7 @@ WORKDIR /rack COPY Gemfile ./ 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 COPY . . diff --git a/frameworks/Ruby/rack/rack-iodine.dockerfile b/frameworks/Ruby/rack/rack-iodine.dockerfile new file mode 100644 index 00000000000..999eb9fc6e7 --- /dev/null +++ b/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 diff --git a/frameworks/Ruby/rack/rack-jruby.dockerfile b/frameworks/Ruby/rack/rack-jruby.dockerfile index c280cca6ac8..f310f8cf62f 100644 --- a/frameworks/Ruby/rack/rack-jruby.dockerfile +++ b/frameworks/Ruby/rack/rack-jruby.dockerfile @@ -6,7 +6,7 @@ WORKDIR /rack COPY Gemfile ./ -RUN bundle config set without 'development test falcon unicorn' +RUN bundle config set with 'puma' RUN bundle install --jobs=8 COPY . . diff --git a/frameworks/Ruby/rack/rack-unicorn.dockerfile b/frameworks/Ruby/rack/rack-unicorn.dockerfile index 74b3e82041c..ce64116cd9d 100644 --- a/frameworks/Ruby/rack/rack-unicorn.dockerfile +++ b/frameworks/Ruby/rack/rack-unicorn.dockerfile @@ -12,7 +12,7 @@ WORKDIR /rack COPY Gemfile ./ 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 COPY . . diff --git a/frameworks/Ruby/rack/rack.dockerfile b/frameworks/Ruby/rack/rack.dockerfile index 615775cf9ea..72871103b7e 100644 --- a/frameworks/Ruby/rack/rack.dockerfile +++ b/frameworks/Ruby/rack/rack.dockerfile @@ -13,7 +13,7 @@ WORKDIR /rack COPY Gemfile ./ 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 COPY . .