File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ ENV RUBY_MN_THREADS=1
1212ENV RACK_ENV=production
1313ENV WEB_CONCURRENCY=auto
1414ENV MAX_THREADS=4
15+ ENV MAX_IO_THREADS=10
1516
1617WORKDIR /app
1718
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ class App < Roda
6969 end
7070
7171 r . is 'upload' do
72+ request . env [ "puma.mark_as_io_bound" ] . call
7273 size = 0
7374 buf = request . body
7475 while ( chunk = buf . read ( 65536 ) )
Original file line number Diff line number Diff line change @@ -17,6 +17,19 @@ class MethodGuard
1717 end
1818end
1919
20+ # Threads marked as IO bound are allowed to go over Puma's max thread limit.
21+ class MarkAsIOBoundThreads
22+ def initialize ( app )
23+ @app = app
24+ end
25+
26+ def call ( env )
27+ env [ "puma.mark_as_io_bound" ] . call
28+ @app . call ( env )
29+ end
30+ end
31+
32+ use MarkAsIOBoundThreads
2033use MethodGuard
2134use Rack ::Deflater # enable gzip
2235run App
Original file line number Diff line number Diff line change 11threads ENV . fetch ( 'MAX_THREADS' , 4 ) . to_i
2+ max_io_threads ENV . fetch ( "MAX_IO_THREADS" , 10 ) . to_i
23
34tls_cert_path = ENV . fetch ( 'TLS_CERT' , '/certs/server.crt' )
45tls_key_path = ENV . fetch ( 'TLS_KEY' , '/certs/server.key' )
You can’t perform that action at this time.
0 commit comments