Remix HTTP Benchmarks : Remix App Server vs Vanilla Express server #3835
Replies: 6 comments 13 replies
-
I know you all are busy helping Remix become the best Was just curious not looking to start a framework wars discussion / not my intent + perhaps get the performance nerds 🤓 curious about this so when there is a chance / time community may find ways to make Remix faster than it already is. CC @ryanflorence @jacob-ebey 🙏 |
Beta Was this translation helpful? Give feedback.
-
Remember Remix has to do things like converting Node.js Request to Fetch Request objects, then grab your Fetch Response and convert it to Node.js Response objects. Aside of that there's more work like matching the routes. Also did you tried in prod mode? Because in dev mode Remix will clear the require cache to ensure files are always the latest ones, so that will cause the server to take more time to process a request. Finally, the less abstractions you add, the better results you will get, Express is a really tiny layer on top of Node.js built-in http server, while Remix is another layer on top of Express. |
Beta Was this translation helpful? Give feedback.
-
Could be a few things:
Locally after removing the logger and static file middleware, I went from 96k -> 144k requests/second. Still behind a bare-bones express API route doing 190k, but that's to be expected as it's doing ~1/2 the work. Adding express.statc to the baseline we go from 190k -> 155k requests/second. The takeaway here though shouldn't be "remix is slow", it should be "understand the effects deps you take on have on performance, nothing is free". In production if you need the perf, serve static assets from a CDN, not from express and remove logging or make it non-blocking. |
Beta Was this translation helpful? Give feedback.
-
Neat! Keep in mind the "Remix App Server" is not "Remix". It's a minimal production express server to get folks unfamiliar with creating servers up and running quickly. So, I suspect what you're mostly comparing is the cost of the express middleware in the Remix App Server, but not Remix. To actually measure the cost of Remix vs. bare express handlers, I'd use the And of course, make sure you're running a production build. |
Beta Was this translation helpful? Give feedback.
-
@ryanflorence @jacob-ebey guys it looks like having a comparison article (à la Next.js vs Remix) for the adapters would be great. I go with the default for certain platforms without no big idea about their advantages or inconveniences, especially for Remix server vs Express, etc. Otherwise from my short experience with Remix over the last month or so, I can actually say that sites/apps built with Remix are faster than CRA or Next.js, assuming that your backend is fast enough. |
Beta Was this translation helpful? Give feedback.
-
Update:My original question is resolved ✅ . Thanks Remix team! Want to confirm that following what @jacob-ebey & @ryanflorence recommendations about using the express template which exposes the underlying server & disabling the logging & compression got my performance up 65% to match the benchmarks of the non-remix express server I initially mentioned in the description of the first post I made. More Benchmarking related stuff⬆️ I updated the examples in my Remix benchmarking Repo; Remix-Fastify was averaging 13% better throughput than Remix-Expresss FYI: I'll stop post benchmarking updates here, I'll keep those in the benchmarking repo: |
Beta Was this translation helpful? Give feedback.
-
I've been doing some benchmarking at work recently and decided to test Remix with a vanilla ExpressJS app.
I'm seeing a vanilla expressJS web server handle
65%
more requests than Remix currently.Initially I was surprised, but perhaps this is to be expected since Remix is more than just a conventional HTTP server 🤔
Maybe this 65% difference is due to some overhead coming from Remix where it does some converting of the underlying server's request/response API into the Fetch API on the way in, and then adapting the Fetch Response coming from Remix into the server's response API? (as stated in the docs below):
Github Repo: https://github.com/cliffordfajardo/remix-http-benchmarks


References
Beta Was this translation helpful? Give feedback.
All reactions