diff --git a/frameworks/Ruby/padrino/Gemfile b/frameworks/Ruby/padrino/Gemfile index 3e643448adb..8ccd7f58765 100644 --- a/frameworks/Ruby/padrino/Gemfile +++ b/frameworks/Ruby/padrino/Gemfile @@ -8,10 +8,6 @@ gem 'slim', '2.0.3' gem 'padrino', git: 'https://github.com/padrino/padrino-framework.git' gem 'rack' -group :puma, optional: true do - gem 'puma', '~> 7.1', require: false -end - -group :unicorn, optional: true do - gem 'unicorn', '~> 6.1', platforms: [:ruby, :windows], require: false +group :iodine, optional: true do + gem "iodine", "~> 0.7", require: false end diff --git a/frameworks/Ruby/padrino/Gemfile.lock b/frameworks/Ruby/padrino/Gemfile.lock index 45c6deadd77..3636648c76e 100644 --- a/frameworks/Ruby/padrino/Gemfile.lock +++ b/frameworks/Ruby/padrino/Gemfile.lock @@ -66,8 +66,8 @@ GEM drb (2.2.1) i18n (1.14.7) concurrent-ruby (~> 1.0) + iodine (0.7.58) json (2.11.3) - kgio (2.11.4) logger (1.6.6) mail (2.8.1) mini_mime (>= 0.1.1) @@ -93,9 +93,6 @@ GEM timeout net-smtp (0.5.1) net-protocol - nio4r (2.7.4) - puma (7.1.0) - nio4r (~> 2.0) rack (3.1.18) rack-protection (4.1.1) base64 (>= 0.1.0) @@ -106,7 +103,6 @@ GEM rack (>= 3.0.0) rackup (2.2.1) rack (>= 3) - raindrops (0.20.1) ruby2_keywords (0.0.5) securerandom (0.4.1) sinatra (4.1.1) @@ -125,9 +121,6 @@ GEM timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicorn (6.1.0) - kgio (~> 2.6) - raindrops (~> 0.7) uri (1.0.3) PLATFORMS @@ -137,13 +130,12 @@ PLATFORMS DEPENDENCIES activerecord (>= 7.1) + iodine (~> 0.7) json mysql2 (> 0.5) padrino! - puma (~> 7.1) rack slim (= 2.0.3) - unicorn (~> 6.1) BUNDLED WITH 2.7.0 diff --git a/frameworks/Ruby/padrino/README.md b/frameworks/Ruby/padrino/README.md index c0c1e7601fe..9d11b9ef5a4 100644 --- a/frameworks/Ruby/padrino/README.md +++ b/frameworks/Ruby/padrino/README.md @@ -11,14 +11,9 @@ comparing a variety of web servers. ## Infrastructure Software Versions The tests were run with: -* [Ruby 2.0.0-p0](http://www.ruby-lang.org/) -* [JRuby 1.7.8](http://jruby.org/) -* [Rubinius 2.2.10](http://rubini.us/) +* [Ruby 3.5](http://www.ruby-lang.org/) * [Padrino 0.12.3](http://www.padrinorb.com/) -* [Rack 1.5.2](http://rack.github.com/) -* [Unicorn 4.8.3](http://unicorn.bogomips.org/) -* [Puma 3.9](http://puma.io/) -* [Thin 1.6.2](http://code.macournoyer.com/thin/) +* [Iodine](https://github.com/boazsegev/iodine) ## Paths & Source for Tests diff --git a/frameworks/Ruby/padrino/benchmark_config.json b/frameworks/Ruby/padrino/benchmark_config.json index 1b467408cc2..0eaf86be1d9 100644 --- a/frameworks/Ruby/padrino/benchmark_config.json +++ b/frameworks/Ruby/padrino/benchmark_config.json @@ -2,28 +2,6 @@ "framework": "padrino", "tests": [{ "default": { - "json_url": "/json", - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "MySQL", - "framework": "padrino", - "language": "Ruby", - "orm": "Full", - "platform": "Rack", - "webserver": "Puma", - "os": "Linux", - "database_os": "Linux", - "display_name": "padrino [puma]", - "notes": "", - "versus": "rack-puma-mri" - }, - "unicorn": { "json_url": "/json", "db_url": "/db", "query_url": "/queries?queries=", @@ -38,12 +16,12 @@ "language": "Ruby", "orm": "Full", "platform": "Rack", - "webserver": "Unicorn", + "webserver": "Iodine", "os": "Linux", "database_os": "Linux", - "display_name": "padrino [unicorn]", + "display_name": "padrino", "notes": "", - "versus": "rack-unicorn" + "versus": "rack-iodine" } }] } diff --git a/frameworks/Ruby/padrino/config.toml b/frameworks/Ruby/padrino/config.toml index 795c2789614..e5103e75fa5 100644 --- a/frameworks/Ruby/padrino/config.toml +++ b/frameworks/Ruby/padrino/config.toml @@ -15,22 +15,5 @@ database_os = "Linux" os = "Linux" orm = "Full" platform = "Rack" -webserver = "Puma" -versus = "rack-puma-mri" - -[unicorn] -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-unicorn" +webserver = "Iodine" +versus = "rack-iodine" diff --git a/frameworks/Ruby/padrino/config/nginx.conf b/frameworks/Ruby/padrino/config/nginx.conf deleted file mode 100644 index 83d4479f28d..00000000000 --- a/frameworks/Ruby/padrino/config/nginx.conf +++ /dev/null @@ -1,158 +0,0 @@ -# This is example contains the bare mininum to get nginx going with -# Unicorn or Rainbows! servers. Generally these configuration settings -# are applicable to other HTTP application servers (and not just Ruby -# ones), so if you have one working well for proxying another app -# server, feel free to continue using it. -# -# The only setting we feel strongly about is the fail_timeout=0 -# directive in the "upstream" block. max_fails=0 also has the same -# effect as fail_timeout=0 for current versions of nginx and may be -# used in its place. -# -# Users are strongly encouraged to refer to nginx documentation for more -# details and search for other example configs. - -# you generally only need one nginx worker unless you're serving -# large amounts of static files which require blocking disk reads -worker_processes 8; - -# # drop privileges, root is needed on most systems for binding to port 80 -# # (or anything < 1024). Capability-based security may be available for -# # your system and worth checking out so you won't need to be root to -# # start nginx to bind on 80 -# user nobody nogroup; # for systems with a "nogroup" -#user nobody nobody; # for systems with "nobody" as a group instead - -# Feel free to change all paths to suite your needs here, of course -pid /tmp/nginx.pid; -#error_log /tmp/nginx.error.log; -error_log stderr error; - -events { - worker_connections 4096; # increase if you have lots of clients - accept_mutex off; # "on" if nginx worker_processes > 1 - use epoll; # enable for Linux 2.6+ - # use kqueue; # enable for FreeBSD, OSX -} - -http { - # nginx will find this file in the config directory set at nginx build time - include /etc/nginx/mime.types; - - # fallback in case we can't determine a type - default_type application/octet-stream; - - # click tracking! - #access_log /tmp/nginx.access.log combined; - access_log off; - - # you generally want to serve static files with nginx since neither - # Unicorn nor Rainbows! is optimized for it at the moment - sendfile on; - - tcp_nopush on; # off may be better for *some* Comet/long-poll stuff - tcp_nodelay off; # on may be better for some Comet/long-poll stuff - - # we haven't checked to see if Rack::Deflate on the app server is - # faster or not than doing compression via nginx. It's easier - # to configure it all in one place here for static files and also - # to disable gzip for clients who don't get gzip/deflate right. - # There are other gzip settings that may be needed used to deal with - # bad clients out there, see http://wiki.nginx.org/NginxHttpGzipModule - #gzip on; - #gzip_http_version 1.0; - #gzip_proxied any; - #gzip_min_length 500; - #gzip_disable "MSIE [1-6]\."; - #gzip_types text/plain text/html text/xml text/css - # text/comma-separated-values - # text/javascript application/x-javascript - # application/atom+xml; - - # this can be any application server, not just Unicorn/Rainbows! - upstream app_server { - # fail_timeout=0 means we always retry an upstream even if it failed - # to return a good HTTP response (in case the Unicorn master nukes a - # single worker for timing out). - - # for UNIX domain socket setups: - server unix:/tmp/.sock fail_timeout=0; - - # for TCP setups, point these to your backend servers - # server 192.168.0.7:8080 fail_timeout=0; - # server 192.168.0.8:8080 fail_timeout=0; - # server 192.168.0.9:8080 fail_timeout=0; - } - - server { - # enable one of the following if you're on Linux or FreeBSD - listen 8080 default deferred; # for Linux - # listen 80 default accept_filter=httpready; # for FreeBSD - - # If you have IPv6, you'll likely want to have two separate listeners. - # One on IPv4 only (the default), and another on IPv6 only instead - # of a single dual-stack listener. A dual-stack listener will make - # for ugly IPv4 addresses in $remote_addr (e.g ":ffff:10.0.0.1" - # instead of just "10.0.0.1") and potentially trigger bugs in - # some software. - # listen [::]:80 ipv6only=on; # deferred or accept_filter recommended - - client_max_body_size 4G; - server_name _; - - # ~2 seconds is often enough for most folks to parse HTML/CSS and - # retrieve needed images/icons/frames, connections are cheap in - # nginx so increasing this is generally safe... - keepalive_timeout 10; - - # path for static files - root /path/to/app/current/public; - - # Prefer to serve static files directly from nginx to avoid unnecessary - # data copies from the application server. - # - # try_files directive appeared in in nginx 0.7.27 and has stabilized - # over time. Older versions of nginx (e.g. 0.6.x) requires - # "if (!-f $request_filename)" which was less efficient: - # http://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127 - try_files $uri/index.html $uri.html $uri @app; - - location @app { - # an HTTP header important enough to have its own Wikipedia entry: - # http://en.wikipedia.org/wiki/X-Forwarded-For - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - # enable this if you forward HTTPS traffic to unicorn, - # this helps Rack set the proper URL scheme for doing redirects: - # proxy_set_header X-Forwarded-Proto $scheme; - - # pass the Host: header from the client right along so redirects - # can be set properly within the Rack application - proxy_set_header Host $http_host; - - # we don't want nginx trying to do something clever with - # redirects, we set the Host: header above already. - proxy_redirect off; - - # set "proxy_buffering off" *only* for Rainbows! when doing - # Comet/long-poll/streaming. It's also safe to set if you're using - # only serving fast clients with Unicorn + nginx, but not slow - # clients. You normally want nginx to buffer responses to slow - # clients, even with Rails 3.1 streaming because otherwise a slow - # client can become a bottleneck of Unicorn. - # - # The Rack application may also set "X-Accel-Buffering (yes|no)" - # in the response headers do disable/enable buffering on a - # per-response basis. - # proxy_buffering off; - - proxy_pass http://app_server; - } - - # Rails error pages - error_page 500 502 503 504 /500.html; - location = /500.html { - root /path/to/app/current/public; - } - } -} diff --git a/frameworks/Ruby/padrino/config/puma.rb b/frameworks/Ruby/padrino/config/puma.rb deleted file mode 100644 index 8a42642fd61..00000000000 --- a/frameworks/Ruby/padrino/config/puma.rb +++ /dev/null @@ -1,9 +0,0 @@ -require_relative 'auto_tune' - -num_workers, num_threads = auto_tune - -workers num_workers -threads num_threads, num_threads - -environment 'production' -bind 'tcp://0.0.0.0:8080' diff --git a/frameworks/Ruby/padrino/config/unicorn.rb b/frameworks/Ruby/padrino/config/unicorn.rb deleted file mode 100644 index 9ca3171328b..00000000000 --- a/frameworks/Ruby/padrino/config/unicorn.rb +++ /dev/null @@ -1,15 +0,0 @@ -require_relative 'auto_tune' - -num_workers, = auto_tune - -worker_processes num_workers -listen "/tmp/.sock", :backlog => 4096 - -preload_app true -GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true - -before_fork do |server, worker| -end - -after_fork do |server, worker| -end diff --git a/frameworks/Ruby/padrino/padrino-unicorn.dockerfile b/frameworks/Ruby/padrino/padrino-unicorn.dockerfile deleted file mode 100644 index 81a6e0fefda..00000000000 --- a/frameworks/Ruby/padrino/padrino-unicorn.dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM ruby:3.4 - -WORKDIR /padrino -COPY app app -COPY config config -COPY models models -COPY .components .components -COPY config.ru config.ru -COPY Gemfile Gemfile -COPY Gemfile.lock Gemfile.lock -COPY Rakefile Rakefile - -RUN bundle config set with 'unicorn' -RUN bundle install --jobs=4 --gemfile=/padrino/Gemfile - -RUN apt-get update -yqq && apt-get install -yqq nginx - -EXPOSE 8080 - -ENV RUBY_YJIT_ENABLE=1 - -CMD nginx -c /padrino/config/nginx.conf && \ - bundle exec unicorn -E production -c config/unicorn.rb diff --git a/frameworks/Ruby/padrino/padrino.dockerfile b/frameworks/Ruby/padrino/padrino.dockerfile index fc6ba9456d3..57fe29b1034 100644 --- a/frameworks/Ruby/padrino/padrino.dockerfile +++ b/frameworks/Ruby/padrino/padrino.dockerfile @@ -10,11 +10,12 @@ COPY Gemfile Gemfile COPY Gemfile.lock Gemfile.lock COPY Rakefile Rakefile -RUN bundle config set with 'puma' +RUN bundle config set with 'iodine' RUN bundle install --jobs=4 --gemfile=/padrino/Gemfile EXPOSE 8080 ENV RUBY_YJIT_ENABLE=1 +ENV RACK_ENV=production -CMD bundle exec puma -C config/puma.rb +CMD bundle exec iodine -p 8080 -w $(ruby config/auto_tune.rb | grep -Eo '[0-9]+' | head -n 1)