r/reactjs • • Jul 31 '17

Who is SSR react in prod?

How many nodejs processes do you have? Render-to-string can take a long time and node is single threaded. How is your nginx gateway set up?

2 Upvotes

5 comments sorted by

2

u/darrenturn90 Jul 31 '17

I use setImmediate around my express processes, and have one node process for each core.

1

u/dustingetz Jul 31 '17

Do you know how many renders per second you can get out of each core, and how fast your cores are? And how often do your processes die or need restarting? How complex is your ui?

2

u/darrenturn90 Jul 31 '17

I rarely have processes die due to caching various errors and try catching others.

I've not actually tried doing so, but I would recommend caching any renderToStrings for non-custom pages to remove the requirement to call it unless necessary.

2

u/slightly_old_avocado Jul 31 '17

I asked this question stack overflow and got some cool responses. Some of the info is a bit outdated (smart/dumb component idea is basically stateless functional components). There are some examples of companies using component caching really well. Ultimately you'll probably have to do a combination of a bunch of things to get the renderToString time down, as well as cluster your node server so you get multiple processes running on multi-core machines

1

u/TotesMessenger Jul 31 '17

I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)