Skip to content

Node Proxy to Node App #687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chuntley opened this issue Aug 26, 2014 · 2 comments
Closed

Node Proxy to Node App #687

chuntley opened this issue Aug 26, 2014 · 2 comments

Comments

@chuntley
Copy link

I'm running PM2 with 3 cores on a Node Proxy, and 3 cores on a Node App. The proxy takes the incoming request and throws it at either the Node app or Apache, depending on the URL.

This works fine until we hit high traffic. On the server I get the following error:

[proxy-6 (err)] Trace: Error
[proxy-6 (err)]     at ProxyServer.<anonymous> (/var/www/node/proxy.js:44:10)
[proxy-6 (err)]     at ProxyServer.emit (/var/www/node/node_modules/http-proxy/node_modules/eventemitter3/index.js:98:27)
[proxy-6 (err)]     at ClientRequest.proxyError (/var/www/node/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:140:16)
[proxy-6 (err)]     at ClientRequest.emit (events.js:117:20)
[proxy-6 (err)]     at Socket.socketCloseListener (http.js:1522:9)
[proxy-6 (err)]     at Socket.emit (events.js:95:17)
[proxy-6 (err)]     at TCP.close (net.js:465:12)
[proxy-6 (err)] Error processing: /apache-redirect.php
[proxy-6 (err)] { [Error: socket hang up] code: 'ECONNRESET' }

On my local machine running Apache Bench with thousands of concurrent requests I get:

Error processing: /node_url
{ [Error: connect ECONNREFUSED]
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect' }
Trace: Error
    at ProxyServer.<anonymous> (C:\Users\site\proxy.js:45:13)
    at ProxyServer.emit (C:\Users\site\node_modules\http-proxy\node_modules\eventemitter3\index.js:98:27)
    at ClientRequest.proxyError (C:\Users\site\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:140:16)
    at ClientRequest.emit (events.js:117:20)
    at Socket.socketErrorListener (http.js:1547:9)
    at Socket.emit (events.js:95:17)
    at net.js:440:14
    at process._tickCallback (node.js:419:13)

Also when I run benchmarks against the Node app itself (skipping the proxy), I do not hit any errors.

Any ideas on what is causing this? 95%+ of the requests work fine.

@jondubois
Copy link

There are a few issues which address this. See my answer here: #527

@indexzero
Copy link
Member

Closing as a duplicate of #527. Thanks @jondubois!

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

No branches or pull requests

3 participants