2

I am experimenting with server-side rendering of React components from within a ASP.NET website using both React.Net and SuperchargedReact implementations.

My initial load test results show that a single request can be handled reasonably quickly (circa 100ms) but that performance quickly degrades under concurrent requests (> 4 seconds). Details below.

It's probably I'm not using these tools to their potential and testing was cursory, but I need some advise on where to start on improving performance.

Questions

  1. Roughly what level of concurrency should I expect? E.g. Is concurrency limited to the number of javascript engine instances I can hold in memory. Or is it dependent on the number of IIS worker processes. Or something else.

  2. Where should I start looking to improve performance - tips? tricks? resources?

  3. What could explain SuperchargedReact underperforming React.Net when it supposedly implements a number of performance improvements.

Testing Details

I constructed a js bundle from ES6 sources via browserify/babelify/gulp-minify. Then the react components were exposed via global variables. The react-router was not included and some small modifications were made to SuperchargedReact to get it working without the router.

I requested a single server-side rendered page of about 5kb from JMeter on another server with different numbers of threads and request-per-minute limits.

Results for React.Net

10 threads

req/min | avg ms | min ms | max ms

    100 |    138 |     90 |  1,161

    500 |    256 |      4 |  2,049

   1000 |    566 |     31 |  4,969

20 threads

req/min | avg ms | min ms | max ms

    100 |    284 |     88 |  1,964

    500 |    432 |     52 |  3,649

   1000 |  1,557 |     75 |  4,405

50 threads

req/min | avg ms | min ms | max ms

    100 |  1,393 |     91 |  4,693

    500 |  1,723 |     19 | 10,523

   1000 |  4,418 |     97 | 32,769

Results for SuperchargedReact

10 threads

req/min | avg ms | min ms | max ms

    100 |    763 |      7 |  2,194

    500 |  2,149 |    263 |  5,160

   1000 |  2,270 |    149 |  4,865

I stopped testing SuperchagedReact at this point since it looked significantly worse than React.Net

jdmcay
  • 21
  • 2

1 Answers1

1

This helped us:

ReactSiteConfiguration.Configuration.AllowMsieEngine = false;
ReactSiteConfiguration.Configuration.ReuseJavaScriptEngines = false;
  • Enforce that V8 is being used instead of IE's Javascript engine. Sometimes V8 can silently fail to load if you don't the VC++ 2013 runtime installed.
  • Disable JS engine pooling, which we found to be buggy.
  • We have legacy Razor views, so we call .ReactWithInit only on pages that need React components rendered. This allows us to avoid calling .ReactInitJavascript on every page, which significantly reduced the workload on the JS engine.

Hope that helps.

Dustin
  • 256
  • 1
  • 10