Server rendering with a thread

I put together a proof of concept for deferring server rendering with a thread, using webworker-threads.

The results kind of blew me away - using a thread like this consistently outperforms doing the rendering in the same process.

I'm not sure if the benchmarks I am running are realistic - it's basically a for-loop that creates <p> elements.... but when it went up to 500 elements and 100 concurrent users the server on it's own was taking ~2 seconds to respond while the thread was kicking ass at <200ms.

Here's the codes: https://github.com/tswaters/react-thread-poc

Server rendering with a thread

2 comments · 89% upvoted · other discussions

comments

ngly

nice, looks interesting. I don't really know much about threads/webworkers so this was cool to look over.

[deleted]

Did you notice the other cores of your machine being used?