Skip to content

Conversation

mydea
Copy link
Member

@mydea mydea commented Aug 14, 2025

This adds a simple node express app that is run on CI to get very ~~ overhead measurements of using Sentry.

THIS IS NOT NECESSARILY REPRESENTATIVE OF USING SENTRY IN A REAL APP! The app is very synthetic and real world numbers may vary wildly.

We run 3 endpoints with 3 scenarios each:

  1. Minimal GET request:
app.get('/test-get', function (req, res) {
  res.send({ version: 'v1' });
});
  1. POST request with a bit of compute work:
app.post('/test-post', function (req, res) {
  const body = req.body;
  res.send(generateResponse(body));
});

function generateResponse(body) {
  const bodyStr = JSON.stringify(body);
  const RES_BODY_SIZE = 10000;

  const bodyLen = bodyStr.length;
  let resBody = '';
  for (let i = 0; i < RES_BODY_SIZE; i++) {
    resBody += `${i}${bodyStr[i % bodyLen]}-`;
  }
  return { version: 'v1', length: bodyLen, resBody };
}
  1. GET request with MySQL query:
app.get('/test-mysql', function (_req, res) {
  pool.query('SELECT * from users').then(([users]) => {
    res.send({ version: 'v1', users });
  });
});

Each of these is run for 10s (after warmup) via autocannon, and we capture the average # of requests per seconds. The scenarios are:

  1. Plain, no Sentry/instrumentation
  2. With "full" Sentry instrumentation:
Sentry.init({
  dsn: process.env.E2E_TEST_DSN,
  tracesSampleRate: 1,
});

3, With errors-only Sentry instrumentation:

Sentry.init({
  dsn: process.env.E2E_TEST_DSN
});

@mydea mydea self-assigned this Aug 14, 2025
@mydea mydea force-pushed the fn/node-perf-test branch 2 times, most recently from 000d08e to 3d9bba7 Compare September 1, 2025 08:08
@getsentry getsentry deleted a comment from github-actions bot Sep 1, 2025
@mydea mydea force-pushed the fn/node-perf-test branch from 85bf57a to c1dfc7b Compare September 1, 2025 09:30
Copy link
Contributor

github-actions bot commented Sep 1, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,004 - - added
GET With Sentry 1,317 15% - added
GET With Sentry (error only) 4,175 46% - added
POST Baseline 1,196 - - added
POST With Sentry 496 41% - added
POST With Sentry (error only) 944 79% - added
MYSQL Baseline 3,306 - - added
MYSQL With Sentry 419 13% - added
MYSQL With Sentry (error only) 2,228 67% - added

@mydea mydea force-pushed the fn/node-perf-test branch from f80f0c6 to 0ba37a7 Compare September 1, 2025 11:52
@getsentry getsentry deleted a comment from github-actions bot Sep 1, 2025
@mydea mydea force-pushed the fn/node-perf-test branch from 62f223d to e2e4e72 Compare September 1, 2025 12:59
@mydea mydea marked this pull request as ready for review September 1, 2025 13:19
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thans for adding this!

(as discussed, some more involved endpoints would also be interesting to test against but we (anyone in the team) can add these as a follow-up)

cursor[bot]

This comment was marked as outdated.

@mydea mydea force-pushed the fn/node-perf-test branch from 189af8e to 1c64a2a Compare September 2, 2025 09:26
@mydea mydea merged commit 94b268d into develop Sep 2, 2025
188 checks passed
@mydea mydea deleted the fn/node-perf-test branch September 2, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants