On Fri, Nov 21, 2014 at 2:40 AM, nik600 AT 10^100 <[email protected]> wrote:
> Dear all
>
> i'm experiencing some performance-gap using http-proxy.
>
> I've got a very simple server that does the following:
>
> var http = require('http');
> var httpProxy = require('http-proxy');
> var proxy = httpProxy.createProxyServer({});
>
>
> var server = http.createServer(function(req, res) {
> proxy.web(req, res, {
> target : 'http://127.0.0.1:19007'
> });
> });
>
> server.listen(19081);
>
>
First the general recommendation:
Is this an accurate representation of what your real proxy will be doing?
If it is, and performance is a real concern, you should probably look at
using something like NGINX for your proxying instead of using Node.
If writing your own proxy really is necessary, then there are some things
to look at.
>From a quick scan of the http-proxy README, I see that it has an agent
option that is uses internally for http.request(). This strongly suggests
to me that you will run into issues with the default
http.globalAgent.maxSockets being 5.
Try adding something like the following to your proxy code above:
http.globalAgent.maxSockets = 50;
You'll want to play around with different values to see which gives you the
best performance for your request sizes and durations.
~Ryan
--
http://twitter.com/rmgraham
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/CAGjmZGwK3iSAeY%3DAt3j1Y7EwBViiba9qM%2BjXoG6BBE9y-FFOmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.