Giter VIP home page Giter VIP logo

Comments (15)

jim-king-2000 avatar jim-king-2000 commented on August 26, 2024 2

new result: https://web-frameworks-benchmark.netlify.app/result?l=javascript

And my personal analysis:

  1. uwebsockets.js is excellent. It defeats most web frameworks and let js (EcmaScript) be comparable to native languages such as go, rust and java.
  2. The frameworks based on uwebsockets.js (elysia, hono, stricjs, hyper-express, etc) introduce performance loss. Hope it could be minimized in the future.
  3. HappyX is the champion of the benchmark. Just wondering what does it do.

from elysia.

waghanza avatar waghanza commented on August 26, 2024 1

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.

SaltyAom avatar SaltyAom commented on August 26, 2024

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.

SaltyAom avatar SaltyAom commented on August 26, 2024

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.

jim-king-2000 avatar jim-king-2000 commented on August 26, 2024

Thank you very much for the analysis and quick response. How to modify the benchmark to create a fair comparison?

from elysia.

waghanza avatar waghanza commented on August 26, 2024

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.

jim-king-2000 avatar jim-king-2000 commented on August 26, 2024

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.

waghanza avatar waghanza commented on August 26, 2024

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.

jim-king-2000 avatar jim-king-2000 commented on August 26, 2024

Please apply the change to both deno and bun frameworks. And I'm looking forward to the new benchmark result.

from elysia.

jim-king-2000 avatar jim-king-2000 commented on August 26, 2024

Not sure about practices for running bun on production @SaltyAom

Also use pm2.

from elysia.

waghanza avatar waghanza commented on August 26, 2024

Could you provide me both command ?

from elysia.

SaltyAom avatar SaltyAom commented on August 26, 2024

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.

SaltyAom avatar SaltyAom commented on August 26, 2024

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

from elysia.

jim-king-2000 avatar jim-king-2000 commented on August 26, 2024

Could you open PR for pm2 @jim-king-2000 ?

Sure.

from elysia.

jim-king-2000 avatar jim-king-2000 commented on August 26, 2024

I turned the benchmark of bun and deno to multi-processing. Let's see the new result.

from elysia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.