From 6ac6ee71f3b7aced2b04ae856b3cc8c8892afb0a Mon Sep 17 00:00:00 2001 From: Petrik Date: Thu, 8 May 2025 10:22:01 +0200 Subject: [PATCH] [ruby/sinatra] Remove Unicorn variant Unicorn hasn't been updated for 4 years and seems unmaintained. It isn't the fastest on any of the benchmarks either. --- frameworks/Ruby/sinatra-sequel/Gemfile | 4 -- frameworks/Ruby/sinatra-sequel/Gemfile.lock | 6 -- frameworks/Ruby/sinatra-sequel/README.md | 4 -- .../Ruby/sinatra-sequel/benchmark_config.json | 20 ------ frameworks/Ruby/sinatra-sequel/boot.rb | 16 ++--- frameworks/Ruby/sinatra-sequel/config.toml | 68 ------------------- .../Ruby/sinatra-sequel/config/mri_unicorn.rb | 6 -- ...tra-sequel-postgres-unicorn-mri.dockerfile | 20 ------ frameworks/Ruby/sinatra/Gemfile | 4 -- frameworks/Ruby/sinatra/benchmark_config.json | 20 ------ frameworks/Ruby/sinatra/boot.rb | 15 ++-- frameworks/Ruby/sinatra/config/mri_unicorn.rb | 6 -- .../sinatra-postgres-unicorn-mri.dockerfile | 20 ------ 13 files changed, 13 insertions(+), 196 deletions(-) delete mode 100644 frameworks/Ruby/sinatra-sequel/config/mri_unicorn.rb delete mode 100644 frameworks/Ruby/sinatra-sequel/sinatra-sequel-postgres-unicorn-mri.dockerfile delete mode 100644 frameworks/Ruby/sinatra/config/mri_unicorn.rb delete mode 100644 frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile diff --git a/frameworks/Ruby/sinatra-sequel/Gemfile b/frameworks/Ruby/sinatra-sequel/Gemfile index 9c25813a61a..26021a05d64 100644 --- a/frameworks/Ruby/sinatra-sequel/Gemfile +++ b/frameworks/Ruby/sinatra-sequel/Gemfile @@ -20,7 +20,3 @@ end group :puma, optional: true do gem 'puma', '~> 6.4', require: false end - -group :unicorn, optional: true do - gem 'unicorn', '~> 6.1', platforms: [:ruby, :mswin], require: false -end diff --git a/frameworks/Ruby/sinatra-sequel/Gemfile.lock b/frameworks/Ruby/sinatra-sequel/Gemfile.lock index 048bb1d0518..a4fd073bce8 100644 --- a/frameworks/Ruby/sinatra-sequel/Gemfile.lock +++ b/frameworks/Ruby/sinatra-sequel/Gemfile.lock @@ -5,7 +5,6 @@ GEM bigdecimal (3.1.9) iodine (0.7.58) json (2.11.3) - kgio (2.11.4) logger (1.6.6) mustermann (3.0.3) ruby2_keywords (~> 0.0.1) @@ -22,7 +21,6 @@ GEM rack-session (2.1.0) base64 (>= 0.1.0) rack (>= 3.0.0) - raindrops (0.20.1) ruby2_keywords (0.0.5) sequel (5.90.0) bigdecimal @@ -37,9 +35,6 @@ GEM rack-session (>= 2.0.0, < 3) tilt (~> 2.0) tilt (2.6.0) - unicorn (6.1.0) - kgio (~> 2.6) - raindrops (~> 0.7) PLATFORMS ruby @@ -55,7 +50,6 @@ DEPENDENCIES sequel (~> 5.0) sequel_pg (~> 1.6) sinatra (~> 4.0) - unicorn (~> 6.1) BUNDLED WITH 2.6.2 diff --git a/frameworks/Ruby/sinatra-sequel/README.md b/frameworks/Ruby/sinatra-sequel/README.md index 5c150595ff9..291b26d9151 100644 --- a/frameworks/Ruby/sinatra-sequel/README.md +++ b/frameworks/Ruby/sinatra-sequel/README.md @@ -13,13 +13,9 @@ comparing a variety of web platforms. The tests will be run with: * [Ruby 3.4](http://www.ruby-lang.org) -* [JRuby 9.4](http://jruby.org) * [Puma 6](http://puma.io) -* [Passenger 6](https://www.phusionpassenger.com) -* [Unicorn 5](https://bogomips.org/unicorn/) * [Sinatra 4](http://www.sinatrarb.com) * [Sequel 5](http://sequel.jeremyevans.net) -* [Slim 3](http://slim-lang.com) * [MySQL 5.5](https://www.mysql.com) * [Postgres 9.3](https://www.postgresql.org) diff --git a/frameworks/Ruby/sinatra-sequel/benchmark_config.json b/frameworks/Ruby/sinatra-sequel/benchmark_config.json index 187cb418def..8b09aafbd54 100644 --- a/frameworks/Ruby/sinatra-sequel/benchmark_config.json +++ b/frameworks/Ruby/sinatra-sequel/benchmark_config.json @@ -61,26 +61,6 @@ "display_name": "sinatra-sequel-postgres-iodine-mri", "versus": "rack-sequel-postgres-iodine-mri", "notes": "" - }, - "postgres-unicorn-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": "Unicorn", - "os": "Linux", - "database_os": "Linux", - "display_name": "sinatra-sequel-postgres-unicorn-mri", - "versus": "rack-sequel-postgres-unicorn-mri", - "notes": "" } } ] diff --git a/frameworks/Ruby/sinatra-sequel/boot.rb b/frameworks/Ruby/sinatra-sequel/boot.rb index 3cff8a30069..bf12ee2a818 100644 --- a/frameworks/Ruby/sinatra-sequel/boot.rb +++ b/frameworks/Ruby/sinatra-sequel/boot.rb @@ -16,8 +16,8 @@ def connect(dbtype) Bundler.require(dbtype) # Load database-specific modules adapters = { - :mysql=>{ :jruby=>'jdbc:mysql', :mri=>'mysql2' }, - :postgresql=>{ :jruby=>'jdbc:postgresql', :mri=>'postgres' } + mysql: 'mysql2', + postgresql: 'postgres' } opts = {} @@ -26,17 +26,15 @@ def connect(dbtype) if defined?(Puma) && (threads = Puma.cli_config.options.fetch(:max_threads)) > 1 opts[:max_connections] = (2 * Math.log(threads)).floor opts[:pool_timeout] = 10 - elsif defined?(Unicorn) - Sequel.single_threaded = true end Sequel.connect \ '%{adapter}://%{host}/%{database}?user=%{user}&password=%{password}' % { - :adapter=>adapters.fetch(dbtype).fetch(defined?(JRUBY_VERSION) ? :jruby : :mri), - :host=>'tfb-database', - :database=>'hello_world', - :user=>'benchmarkdbuser', - :password=>'benchmarkdbpass' + adapter: (dbtype == :mysql ? 'mysql2' : 'postgresql'), + host: 'tfb-database', + database: 'hello_world', + user: 'benchmarkdbuser', + password: 'benchmarkdbpass' }, opts end diff --git a/frameworks/Ruby/sinatra-sequel/config.toml b/frameworks/Ruby/sinatra-sequel/config.toml index 4dd4f8ac1cc..93d9f2ded5c 100644 --- a/frameworks/Ruby/sinatra-sequel/config.toml +++ b/frameworks/Ruby/sinatra-sequel/config.toml @@ -34,71 +34,3 @@ orm = "Full" platform = "Rack" webserver = "Puma" versus = "rack-sequel-puma-mri" - -[postgres-passenger-mri] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "Rack" -webserver = "Passenger" -versus = "rack-sequel-postgres-passenger-mri" - -[postgres-unicorn-mri] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "Rack" -webserver = "Unicorn" -versus = "rack-sequel-postgres-unicorn-mri" - -[passenger-mri] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Micro" -database = "MySQL" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "Rack" -webserver = "Passenger" -versus = "rack-sequel-passenger-mri" - -[unicorn-mri] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Micro" -database = "MySQL" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "Rack" -webserver = "Unicorn" -versus = "rack-sequel-unicorn-mri" diff --git a/frameworks/Ruby/sinatra-sequel/config/mri_unicorn.rb b/frameworks/Ruby/sinatra-sequel/config/mri_unicorn.rb deleted file mode 100644 index c9a0c55083e..00000000000 --- a/frameworks/Ruby/sinatra-sequel/config/mri_unicorn.rb +++ /dev/null @@ -1,6 +0,0 @@ -require_relative 'auto_tune' - -# FWBM only... -num_workers, = auto_tune - -worker_processes num_workers diff --git a/frameworks/Ruby/sinatra-sequel/sinatra-sequel-postgres-unicorn-mri.dockerfile b/frameworks/Ruby/sinatra-sequel/sinatra-sequel-postgres-unicorn-mri.dockerfile deleted file mode 100644 index 50801f63715..00000000000 --- a/frameworks/Ruby/sinatra-sequel/sinatra-sequel-postgres-unicorn-mri.dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ruby:3.5-rc - -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:unicorn -RUN bundle install --jobs=4 --gemfile=/sinatra-sequel/Gemfile - -ENV DBTYPE=postgresql - -EXPOSE 8080 - -CMD bundle exec unicorn -c config/mri_unicorn.rb -o 0.0.0.0 -p 8080 -E production diff --git a/frameworks/Ruby/sinatra/Gemfile b/frameworks/Ruby/sinatra/Gemfile index 5aa6b339e27..fc568a99542 100644 --- a/frameworks/Ruby/sinatra/Gemfile +++ b/frameworks/Ruby/sinatra/Gemfile @@ -19,7 +19,3 @@ end group :puma, optional: true do gem 'puma', '~> 6.4', require: false end - -group :unicorn, optional: true do - gem 'unicorn', '~> 6.1', platforms: [:ruby, :mswin], require: false -end diff --git a/frameworks/Ruby/sinatra/benchmark_config.json b/frameworks/Ruby/sinatra/benchmark_config.json index 7b4aea2fdeb..0d14929dd67 100644 --- a/frameworks/Ruby/sinatra/benchmark_config.json +++ b/frameworks/Ruby/sinatra/benchmark_config.json @@ -65,26 +65,6 @@ "display_name": "sinatra-postgres-iodine-mri", "versus": "rack-postgres-iodine-mri", "notes": "" - }, - "postgres-unicorn-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": "Unicorn", - "os": "Linux", - "database_os": "Linux", - "display_name": "sinatra-postgres-unicorn-mri", - "versus": "rack-postgres-unicorn-mri", - "notes": "" } } ] diff --git a/frameworks/Ruby/sinatra/boot.rb b/frameworks/Ruby/sinatra/boot.rb index 9431a3d7c98..55be87eb951 100644 --- a/frameworks/Ruby/sinatra/boot.rb +++ b/frameworks/Ruby/sinatra/boot.rb @@ -15,18 +15,15 @@ def connect(dbtype) Bundler.require(dbtype) # Load database-specific modules opts = { - :adapter=>(dbtype == :mysql ? 'mysql2' : 'postgresql'), - :username=>'benchmarkdbuser', - :password=>'benchmarkdbpass', - :host=>'tfb-database', - :database=>'hello_world' + adapter: (dbtype == :mysql ? 'mysql2' : 'postgresql'), + username: 'benchmarkdbuser', + password: 'benchmarkdbpass', + host: 'tfb-database', + database: 'hello_world' } # Determine threading/thread pool size and timeout - if defined?(JRUBY_VERSION) - opts[:pool] = (2 * Math.log(Integer(ENV.fetch('MAX_CONCURRENCY')))).floor - opts[:checkout_timeout] = 10 - elsif defined?(Puma) && (threads = Puma.cli_config.options.fetch(:max_threads)) > 1 + if defined?(Puma) && (threads = Puma.cli_config.options.fetch(:max_threads)) > 1 opts[:pool] = (2 * Math.log(threads)).floor opts[:checkout_timeout] = 10 else diff --git a/frameworks/Ruby/sinatra/config/mri_unicorn.rb b/frameworks/Ruby/sinatra/config/mri_unicorn.rb deleted file mode 100644 index c9a0c55083e..00000000000 --- a/frameworks/Ruby/sinatra/config/mri_unicorn.rb +++ /dev/null @@ -1,6 +0,0 @@ -require_relative 'auto_tune' - -# FWBM only... -num_workers, = auto_tune - -worker_processes num_workers diff --git a/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile b/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile deleted file mode 100644 index 59ee177fd7e..00000000000 --- a/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ruby:3.5-rc - -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 -WORKDIR /sinatra - -ENV BUNDLE_WITH=postgresql:unicorn -RUN bundle install --jobs=4 --gemfile=/sinatra/Gemfile - -ENV DBTYPE=postgresql - -EXPOSE 8080 - -CMD bundle exec unicorn -c config/mri_unicorn.rb -o 0.0.0.0 -p 8080 -E production