node-red / node-red/node-red-docker
Periodic CPU spikes caused by default `healthcheck.js` in Node-RED Docker image
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 540
- Forks
- 434
- Avg merge
- 24m
- Merged PRs (30d)
- 5
Description
Periodic CPU spikes caused by default healthcheck in Node-RED Docker image
I recently tried to deliver a Node-RED Docker container to a colleague who is not very familiar with Node-RED and is quite cautious about trusting it in production.
During testing, he noticed a periodic CPU spike every 30 seconds, where CPU usage briefly jumps from ~0.5% to ~6% within less than a second.
After investigation, I found the cause is the default healthcheck.js. The Docker healthcheck executes every 30 seconds and runs node /healthcheck.js, which starts a full Node.js process and performs an HTTP request to check service availability.
While this design is functionally correct, it introduces unnecessary CPU overhead in lightweight or single-node deployments.
I would like to suggest considering a more lightweight healthcheck approach, such as a TCP port check or a lightweight HTTP probe, instead of starting a full Node.js process (node /healthcheck.js) on every check.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the default healthcheck.js and the Docker image configuration that runs it every 30 seconds. Compare the current node /healthcheck.js check with the lightweight alternatives described in the issue, and verify that the chosen healthcheck still confirms service availability while avoiding the reported periodic CPU spike.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, javascript, node.js
- Domain
- devops, infrastructure, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100