Skip to content

Periodic CPU spikes caused by default healthcheck.js in Node-RED Docker image #513

@fullmooooon

Description

@fullmooooon

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.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions