Skip to content

Performance degradation in node v22 #6499

Description

@amgadserry

Hello everyone,

I have a question regarding express v4/5 performance inconsistency running on node v18 vs node v22

Images below are from a bare minimum express setup code attached below just nvm use in each then npm run start these are samples but I run these tests over 10 times with different time frames etc and v22 is consistently showing this behavior

Image

node v22 ( 15.3k req/s )

Image

node v18 ( 17.3k req/s )

so the overall performance is not degraded by that much but the per request latency had a major impact, slowest in v18 is 0.07s which slowest request in v22 is 3s u can also see that that difference in the latency histogram, we have also noticed that in a recent upgrade in production where health check is failing under high load, while the same build using v18 is surviving the same load

anyone is experiencing the same or have an idea what I'm actually doing wrong ?

Thanks,

Code used for this test ( full code below )

// server.js - Node.js 22 Version
import express from 'express';

const app = express();
const port = process.env.PORT || 3000;

app.use(express.json());

app.get('/api/healthz', (req, res) => {
  res.status(200).send('ok');
});

app.use((err, req, res, next) => {
  console.error('Error:', err);
  res.status(500).send('Internal Server Error');
});

const server = app.listen(port, () => {
  console.log(`Node.js 22 server running on port ${port}`);
  console.log(`Node version: ${process.version}`);
});

const shutdown = () => {
  console.log('Shutdown signal received, closing server gracefully');
  server.close(() => {
    console.log('Server closed');
    process.exit(0);
  });
};

process.on('SIGTERM', () => shutdown());
process.on('SIGINT', () => shutdown());

Archive-1.zip

Note: I also posted on slack here https://openjs-foundation.slack.com/archives/C02QB1731FH/p1746189447244249

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions