lencioni / ama

Ask me anything!
1 stars 0 forks source link

How do you tackle server-side rendering (SSR) at Airbnb #2

Closed evenstensberg closed 8 years ago

lencioni commented 8 years ago

We have a node service to render React on the server. Speaking of SSR, I've been following this PR with great interest: https://github.com/facebook/react/pull/6618

evenstensberg commented 8 years ago

Indeed! Been looking at that as well. Excited to see how it turns out in the end. SSR with React in my eyes needs some work, still, to be optimized! Do you have examples of, say, server.js ?

lencioni commented 8 years ago

SSR with React in my eyes needs some work, still, to be optimized!

Yes, there is a lot of low-hanging fruit there. @aickin was recently saying that with his PR and some optimizations he has been working on, it looks like he can improve SSR perf by an order of magnitude.

Do you have examples of, say, server.js?

Unfortunately I do not. Sorry!

aickin commented 8 years ago

@aickin was recently saying that with his PR and some optimizations he has been working on, it looks like he can improve SSR perf by an order of magnitude.

Thanks for the shout out, @lencioni!

I'd like to clarify that I thought that there might be an order of magnitude to squeeze out by rewriting, and my first prototype did show something like a 7-8x improvement. I've since added a bunch more features and special cases to it so that it passes the entire unit test suite, and it's running at more like 4-5x faster than React 15. Still a great speedup, but not quite a full order of magnitude.

Do you have examples of, say, server.js ?

You might be interested in react-server, a server-rendering project from my former colleagues at Redfin. It's still pretty new as an OSS project, but it's been used in production for quite a while now.

Edited to add: I just ran another benchmark exercising properties, and it showed only ~2x improvement, so it seems like the perf is very dependent on workload.