File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 7
7
# MAX_THREADS, add threads per process to reach MAX_THREADS.
8
8
require 'etc'
9
9
10
- KB_PER_WORKER = 128 * 1_024 # average of peak PSS of single-threaded processes (watch smem -k)
10
+ KB_PER_WORKER = 64 * 1_024 # average of peak PSS of single-threaded processes (watch smem -k)
11
11
MIN_WORKERS = 2
12
12
MAX_WORKERS_PER_VCPU = 1.25 # virtual/logical
13
13
MIN_THREADS_PER_WORKER = 1
Original file line number Diff line number Diff line change 6
6
7
7
# FWBM only... use the puma_auto_tune gem in production!
8
8
num_workers , num_threads = auto_tune
9
-
9
+ num_threads = [ num_threads , 32 ] . min
10
10
11
11
before_fork do
12
12
Sequel ::DATABASES . each ( &:disconnect )
Original file line number Diff line number Diff line change @@ -54,8 +54,13 @@ class HelloWorld
54
54
</html>'
55
55
56
56
def initialize
57
- # auto_tune
58
- max_connections = 512
57
+ if defined? ( Puma )
58
+ num_workers , num_threads = auto_tune
59
+ num_threads = [ num_threads , 32 ] . min
60
+ max_connections = num_workers * num_threads
61
+ else
62
+ max_connections = 512
63
+ end
59
64
@db = PgDb . new ( DEFAULT_DATABASE_URL , max_connections )
60
65
end
61
66
You can’t perform that action at this time.
0 commit comments