ruby-on-railshandlebars.jstherubyracerexecjs

Rails serverside handlebars performance


We are using server side handlebars in a backbone single page app rails project in a high traffic environment and we are finding that our rendering speed increased by 100%. We are using the sht_rails gem which appears to be well coded and simply handing off the rendering of the template to v8/execjs/rubyracer. After going live our GC increased a ton and we've tried various cacheing strategies to alleviate the issue but it's not going to work for us and we're about to bail on the idea of shared handlebars templates even though the benefits have been great from an seo/shared code standpoint.

Short of going with ruby ee, is there anything else we can do to fine tune/speed up this process? Or is it just the nature of the beast handing off strings to javascript serializing/deserializing and so on.

From our experiences it seems as though this server side rendering is not ready for production rendering. Anybody have any experience with this?


Solution

  • We ended up creating a node renderer service and handed the template rendering off to it instead of using the rails based ruby racer etc. Solved our problem for now. In the end it would have been nice to use node full stack to get better isomorphic support but we are a rails shop so this is where we are.