# How to substantially slow down your Node.js server

DevFeed: [How to substantially slow down your Node.js server](<https://devfeed.tech/articles/how-to-substantially-slow-down-your-node-js-server-28028.md>)

Original publisher: [Read original article](<https://tech.trivago.com/post/2022-09-15-how-to-substantially-slow-down-your-nodejs-server/>)

Author: Abdelrahman Abdelhafez Human code formatter @ trivago GitHub profile

Published: 2022-09-15T00:00:00Z

Content type: article

Language: en

Sources: [Trivago](<https://devfeed.tech/sources/trivago.md>)

Topics: [Back end](<https://devfeed.tech/topics/backend.md>), [Fastify](<https://devfeed.tech/topics/fastify.md>), [Express](<https://devfeed.tech/topics/express.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>), [Post Mortem](<https://devfeed.tech/topics/post-mortem.md>)

Tags: [2](<https://devfeed.tech/tags/2.md>), [2022](<https://devfeed.tech/tags/2022.md>), [about](<https://devfeed.tech/tags/about.md>), [access-tokens](<https://devfeed.tech/tags/access-tokens.md>), [allowed](<https://devfeed.tech/tags/allowed.md>), [also](<https://devfeed.tech/tags/also.md>), [application](<https://devfeed.tech/tags/application.md>), [aspect](<https://devfeed.tech/tags/aspect.md>), [authorization](<https://devfeed.tech/tags/authorization.md>), [automatically](<https://devfeed.tech/tags/automatically.md>), [backend](<https://devfeed.tech/tags/backend.md>), [bearer](<https://devfeed.tech/tags/bearer.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [body](<https://devfeed.tech/tags/body.md>), [bombshell](<https://devfeed.tech/tags/bombshell.md>), [bug](<https://devfeed.tech/tags/bug.md>), [built-in](<https://devfeed.tech/tags/built-in.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [server](<https://devfeed.tech/tags/server.md>), [spending](<https://devfeed.tech/tags/spending.md>)

## AI overview

After migrating a Node.js GraphQL server from Express to Fastify, staging tests showed Fastify responding more than twice as fast, yet production showed no improvement. Live heap profiling traced the problem to request log redaction: the code recreated fast-redact's redaction function on every request. Creating that function once and reusing it fixed the issue. After the hotfix, average memory use fell from 4 GB to 2 GB, and the EU Kubernetes cluster scaled from 310 pods to 160 while handling the same traffic. Staging tests missed the bug because logging was disabled, which also bypassed redaction. The article says Fastify remained faster than Express and recommends keeping production-enabled behavior active during load tests.

## Source excerpt

Back in March 2022, after spending a considerable amount of effort migrating our monolithic Node.js GraphQL server from