Chapter 11. Optimizing for production

 

This chapter covers

  • Optimizing performance for the browser
  • Using streaming on Node.js to improve server performance
  • Using caching to improve performance on the server
  • Handling user sessions via cookies on the server and browser

Rather than doing a deep dive into any specific topic, this chapter covers a range of topics that will make your app perform better and improve your end-user experience. This includes React performance, Node.js performance, and various caching strategies. The last section of this chapter covers handling cookies in an isomorphic application and the trade-offs that this creates with some of the caching strategies.

This chapter continues to use the complete-isomorphic-example repo on GitHub. It can be found at http://mng.bz/8gV8. The first section uses the code on branch chapter-11.1 (git checkout chapter-11.1). You can find the completed code for the chapter on the chapter-11.complete branch (git checkout chapter-11-complete).

To run each branch, make sure to use the following:

$ npm install
$ npm start

11.1. Browser performance optimizations

As I’ve spent more time with React, I’ve discovered that although it’s fast out of the box, in complex apps you’ll run into performance problems. To keep your React web app performant, you need to keep performance in mind as your app grows and adds more-complex feature interactions. Two specific cases start to cause performance issues as your app grows:

11.2. Server performance optimizations

11.3. Caching

11.4. User session management

Summary