nest icon indicating copy to clipboard operation
nest copied to clipboard

Increase official support for ultimate express

Open dalidaliW opened this issue 1 year ago • 1 comments
trafficstars

Is there an existing issue that is already proposing this?

  • [X] I have searched the existing issues

Is your feature request related to a problem? Please describe it

The Ultimate Express. Fastest http server with full Express compatibility, based on µWebSockets.

This library is a very fast re-implementation of Express.js 4. It is designed to be a drop-in replacement for Express.js, with the same API and functionality, while being much faster. It is not a fork of Express.js. To make sure µExpress matches behavior of Express in all cases, we run all tests with Express first, and then with µExpress and compare results to make sure they match.

npm install ultimate-express -> replace with -> doneexpressultimate-express*

Describe the solution you'd like

Improve the performance of Nestjs

Teachability, documentation, adoption, migration strategy

In a lot of cases, you can just replace with and everything works the same. But there are some differences:require("express")require("ultimate-express")

What is the motivation / use case for changing the behavior?

 Nestjs performance is too low,Due to some people's biases, Nestjs has been unable to embrace high performance

dalidaliW avatar Oct 18 '24 04:10 dalidaliW

I don't think we need to switch to that one since AFIAK the whole point of adopting Express by default is due to its big ecosystem, not for performance reasons.

I believe that you can supply an instance of the ultimate-express to ExpressAdapter. And the NestJS community could maintain a UltimateExpressAdapter as well

Having such adapter under @nestjs/* would just increase the maintenance burden with no good reason.

micalevisk avatar Oct 18 '24 13:10 micalevisk

since AFIAK the whole point of adopting Express by default is due to its big ecosystem, not for performance reasons.

I agree:

package Weekly Downloads from npmjs.com
@nestjs/core 3,560,223 (100%)
@nestjs/platform-express 2,562,902 (72%)
@nestjs/platform-fastify 300,121 (8%)

So ExpressJS, which is significantly slower, is used much more than the faster Fastify. In fact, their popularity differs by almost 9 times.

KostyaTretyak avatar Oct 20 '24 14:10 KostyaTretyak

@KostyaTretyak @micalevisk Is it possible that it is your cognitive error? The reason why express is more widely used than fast is not just due to ecological issues? The cost of switching from express to fast is much higher than the slight performance improvement of fast compared to express. If the performance improvement is 5x or even 10x, it is enough to drive users crazy. The biggest criticism of express is that its performance is too low. If you don't spend much money to increase support for ultimate express and achieve a performance improvement of>6x, why not do it? Express and ultimate express are not a choice, you can have both at the same time

dalidaliW avatar Oct 20 '24 14:10 dalidaliW

@dalidaliW Maybe we could have a new recipe page to showcase a "faster version of ExpressJS v4". If you'd like to have this, please open a new issue on the docs repository.

micalevisk avatar Oct 20 '24 21:10 micalevisk

@KostyaTretyak That is a big assumption to make on so little data, IMO the reason most people use nestjs express is because it is the defacto default as shown in the docs, 4 years back when our company went with nestjs we would have gladly went with fastify under the hood but that was either not a possibility or just hidden in the docs, today we have over 20 micro services floating around using express under the hood and the technical debt of moving them all to fastify, while worth it would take us weeks, adding a uExpress adapter would be great at the very least.

gotenxds avatar Oct 22 '24 07:10 gotenxds

@KostyaTretyak @micalevisk Is it possible that it is your cognitive error? The reason why express is more widely used than fast is not just due to ecological issues? The cost of switching from express to fast is much higher than the slight performance improvement of fast compared to express. If the performance improvement is 5x or even 10x, it is enough to drive users crazy. The biggest criticism of express is that its performance is too low. If you don't spend much money to increase support for ultimate express and achieve a performance improvement of>6x, why not do it? Express and ultimate express are not a choice, you can have both at the same time

Now it's an AI era. Swithing between different frameworks should be as easy as 1 prompt. But performance does make a lot of differnce

yf-hk avatar Nov 10 '25 15:11 yf-hk