Comments (15)
new result: https://web-frameworks-benchmark.netlify.app/result?l=javascript
And my personal analysis:
uwebsockets.js
is excellent. It defeats most web frameworks and let js (EcmaScript) be comparable to native languages such as go, rust and java.- The frameworks based on
uwebsockets.js
(elysia, hono, stricjs, hyper-express, etc) introduce performance loss. Hope it could be minimized in the future. - HappyX is the champion of the benchmark. Just wondering what does it do.
from elysia.
Could you open PR for pm2
@jim-king-2000 ?
We use keep alive @SaltyAom
https://github.com/the-benchmarker/web-frameworks/blob/bd09015eb57e9b0b2aab5dbee2ed577671275caf/.tasks/collect.rake#L70
from elysia.
This is kind of suspicious, normally framework that runs on Bun should technically be faster than Node since Bun is based on WebSocket.
Digging on to that.
from elysia.
I think because of this:
Hmm, I dig it a bit, my guess is that since Node is using pm2-runtime, it's spawning multi-process to run multiple servers in parallel.
Fast, Deno-based one is also slower as well.
HyperExpress couldn't outperform Fiber multithreaded without this as well.
So kinda make sense.
https://twitter.com/saltyAom/status/1681697389189668864?s=20
You can see on this PR that Node is using pm2-runtime.
https://github.com/the-benchmarker/web-frameworks/pull/6422/files
So basically because Node framework uses multi-process, (using multiple threads to spawn servers simultaneously) therefore, Elysia is slower because, on that benchmark, any Bun-based framework uses only single-thread, therefore not quite fair.
from elysia.
Thank you very much for the analysis and quick response. How to modify the benchmark to create a fair comparison?
from elysia.
Hi @jim-king-2000 @SaltyAom ,
The purpose of the benchmark you notice is to reflect common usage in real workloads.
It's a common practice to use pm2
on top of node
in order to spawn multiple processes.
Is there not such a thing is bun and deno communities?
from elysia.
So basically because Node framework uses multi-process, (using multiple threads to spawn servers simultaneously) therefore, Elysia is slower because, on that benchmark, any Bun-based framework uses only single-thread, therefore not quite fair.
Do you mean that we should also run bun
relevant tests with pm2-runtime
?
from elysia.
Maybe we should use pm2 start app.ts --interpreter="deno" --interpreter-args="run --allow-net
for deno
@jim-king-2000
Not sure about practices for running bun
on production @SaltyAom
from elysia.
Please apply the change to both deno
and bun
frameworks. And I'm looking forward to the new benchmark result.
from elysia.
Not sure about practices for running bun on production @SaltyAom
Also use pm2
.
from elysia.
Could you provide me both command ?
from elysia.
It's fine to use PM2 to run Bun server.
For Bun, I would recommend using this command.
pm2-runtime start "NODE_ENV=production bun src/index.ts" -i max
As for Deno, I think @waghanza command would also be working fine.
from elysia.
Also, this is from Jarred (Creator of Bun), may I ask this question as well?
He suggests that the slower response might be due to the usage of HTTP 1.0 or Keep Alive being disabled.
![image](https://private-user-images.githubusercontent.com/35027979/254959380-5e7e38b2-19f5-4aae-963a-f1bc70a3cfc5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzOTEwMDMsIm5iZiI6MTcyNDM5MDcwMywicGF0aCI6Ii8zNTAyNzk3OS8yNTQ5NTkzODAtNWU3ZTM4YjItMTlmNS00YWFlLTk2M2EtZjFiYzcwYTNjZmM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA1MjUwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY0NGFhZmZlY2RlOTNkY2Y4NTlhMmU0MzlkMDQxMWEzNmU3YzJjZmZjOTBiY2FjNmEzOGQ2OGE4YThmN2IxODAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.1aVe61oHCcC413MAhQFYjz-5ehNoOPK1sR3FqhiRMk4)
from elysia.
Could you open PR for pm2 @jim-king-2000 ?
Sure.
from elysia.
I turned the benchmark of bun
and deno
to multi-processing. Let's see the new result.
from elysia.
Related Issues (20)
- Support for route meta HOT 1
- TypeBox errors are stringified instead of returning object
- Support tRPC v11 HOT 1
- Make Elysia easier to maintain and debug by setting aot: false by default
- Error from body-parser when sent `Content-Type` header without body HOT 4
- Sveltekit integration doesn't work
- Consider using ajv instead of typebox for schema validation HOT 2
- MESSY ERROR `NOT FOUND` HOT 4
- Custom errors thrown in `onRequest` do not get proper `code` set in `onError` HOT 2
- Body type will be unknown if strictNullChecks not enabled HOT 1
- Add Default .gitignore to Prevent Committing .env Files HOT 3
- Custom errors thrown in `onRequest` are not usable when caught in `onError` in `1.1.6`
- Error from sending empty body multipart/form-data HOT 1
- Global websocket publish() not possible HOT 2
- Unable to upload multiple File types from Elysiajs v.0.8>. In v0.7.21 was working well HOT 5
- tRPC Mutation or Query no found on path HOT 2
- Typecheck breaks for response schema not containing 200 status code HOT 6
- Unexpected TypeError on NODE_ENV=production in mapValueError
- elysia validation doesn't work on NODE_ENV=production HOT 4
- Details hook not generating example in Request body in SwaggerUI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elysia.