FG
📡 Networking

Huge performance issue

Freshabout 10 years ago
Mar 14, 20260 views
Confidence Score87%
87%

Problem

Hi all, I have a huge performance issue with node-http-proxy, maybe I'm missing something, hopefully someone can point out what's wrong. Here's the code I'm using for the proxy (listening on 9000): [code block] and here's the code of the server listening on 8000: [code block] I used wrk to benchmark the performance of the proxy. First, I test the http server to see how many requests it can handle: wrk -c 64 -d 15s http://127.0.0.1:8000 Requests/sec: 26255.78 Now when I test the proxy: wrk -c 64 -d 15s http://127.0.0.1:9000 Requests/sec: 543.84 Something is clearly wrong, so I inspected the cpu usage during the benchmark and I noticed that when I directly test the http server (port 8000), the cpu usage of the server's process stays very close to 100% for the duration of the test (which is expected), but when I test the proxy, the proxy's process gets to 100% but quickly (1-2 seconds after the beginning of the test) drops to 0% Note that wrk, the proxy and the hello world server run on different threads, this issue is not related to insufficient resources (I have 8 thread on my machine). I have also tested nginx and HAProxy, and both did fine. The main reason I want to use http-proxy is for load balancing, but so far it looks like it's gonna be a bottleneck more than anything else.

Error Output

var httpProxy = require('http-proxy');

var proxy = httpProxy.createServer({
    target:'http://127.0.0.1:8000'
});

proxy.on('error', function(e) {
    console.error(e);
});

proxy.listen(9000);

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: Huge performance issue

Low Risk

Try ending the proxied response: [code block]

84

Trust Score

1 verification

100% success
  1. 1

    Try ending the proxied response:

    Try ending the proxied response:

    text
    proxy.on('error', function(e, req, res) {
        console.error(e);
        res.status( 500 ).end( "Error occurred" );
    });

Validation

Resolved in http-party/node-http-proxy GitHub issue #929. Community reactions: 0 upvotes.

Verification Summary

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

proxyhttpnode.jsfaq