Skip to content

Commit 850f2b8

Browse files
committed
fix(ServerRendering) default pool_size of 1; document deadlock & therubyracer
1 parent 6f27347 commit 850f2b8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ You can configure your pool of JS virtual machines and specify where it should l
188188
# These are the defaults if you dont specify any yourself
189189
MyApp::Application.configure do
190190
# Settings for the pool of renderers:
191-
config.react.server_renderer_pool_size ||= 10
191+
config.react.server_renderer_pool_size ||= 1 # ExecJS doesn't allow more than one on MRI
192192
config.react.server_renderer_timeout ||= 20 # seconds
193193
config.react.server_renderer = React::ServerRendering::SprocketsRenderer
194194
config.react.server_renderer_options = {
@@ -198,6 +198,10 @@ MyApp::Application.configure do
198198
end
199199
```
200200

201+
- On MRI, use `therubyracer` for the best performance (see [discussion](https://github.com/reactjs/react-rails/pull/290))
202+
- On MRI, you'll get a deadlock with `pool_size` > 1
203+
- If you're using JRuby, you can increase `pool_size` to have real multi-threaded rendering.
204+
201205
### Component generator
202206

203207
`react-rails` ships with a Rails generator to help you get started with a simple component scaffold.

lib/react/rails/railtie.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class Railtie < ::Rails::Railtie
1111
config.react.jsx_transform_options = {}
1212
config.react.jsx_transformer_class = nil # defaults to BabelTransformer
1313
# Server rendering:
14-
config.react.server_renderer_pool_size = 10
15-
config.react.server_renderer_timeout = 20 # seconds
14+
config.react.server_renderer_pool_size = 1 # increase if you're on JRuby
15+
config.react.server_renderer_timeout = 20 # seconds
1616
config.react.server_renderer = nil # defaults to SprocketsRenderer
1717
config.react.server_renderer_options = {} # SprocketsRenderer provides defaults
1818

0 commit comments

Comments
 (0)