-
-
Save headius/e747249049ed7c8452e5dd6bc3d62260 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/frameworks/Ruby/rack/config/puma.rb b/frameworks/Ruby/rack/config/puma.rb | |
index a0c5b2f17..b23b5fcb6 100644 | |
--- a/frameworks/Ruby/rack/config/puma.rb | |
+++ b/frameworks/Ruby/rack/config/puma.rb | |
@@ -1,21 +1,26 @@ | |
# frozen_string_literal: true | |
-require_relative 'auto_tune' | |
require 'sequel' | |
-# FWBM only... use the puma_auto_tune gem in production! | |
-num_workers, num_threads = auto_tune | |
+if RUBY_ENGINE == 'ruby' | |
+ require_relative 'auto_tune' | |
-workers num_workers | |
-threads num_threads, num_threads | |
+ # FWBM only... use the puma_auto_tune gem in production! | |
+ num_workers, num_threads = auto_tune | |
-before_fork do | |
- Sequel::DATABASES.each(&:disconnect) | |
-end | |
+ workers num_workers | |
+ threads num_threads, num_threads | |
+ | |
+ before_fork do | |
+ Sequel::DATABASES.each(&:disconnect) | |
+ end | |
-# Use the `preload_app!` method when specifying a `workers` number. | |
-# This directive tells Puma to first boot the application and load code | |
-# before forking the application. This takes advantage of Copy On Write | |
-# process behavior so workers use less memory. | |
-# | |
-preload_app! | |
+ # Use the `preload_app!` method when specifying a `workers` number. | |
+ # This directive tells Puma to first boot the application and load code | |
+ # before forking the application. This takes advantage of Copy On Write | |
+ # process behavior so workers use less memory. | |
+ # | |
+ preload_app! | |
+else if RUBY_ENGINE == 'jruby' | |
+ threads java.lang.Runtime.runtime.availableProcesses * 2 | |
+end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment