I have running server on node js.
And I have problem while sending http request. Request are sending by 
async.parallel in for cycle by 3000 request per time.
And most of this request goes to socket hang up error.

With Angent and without it.
100mbit chanel

http.globalAgent.maxSockets = 50000;

function httpGet(link, callback){
    var result = '';
    var u = url.parse(link);
    
    var options = {
        path    : u.path,
        headers : {'Host':u.host,'Accept':'*/*','User-Agent':'Mozilla/5.0', 
'Connection':'keep-alive'},
        agent   : false,
        host     : u.hostname,
        port     : u.port || 80
    };
    
    var request = http.get(options, function(response) {
        if (response.statusCode != 200) {
            return callback(new Error("httpGet : response status 
"+response.statusCode), result);
        }
        response.on('data', function (chunk) {
            result += chunk;
        });
        response.on('end', function () {
            if (!result.length) {
                return callback(new Error("httpGet : response empty"), 
result);
            }
            callback(0,result);
        });
    });
    
    request.setTimeout(5000, function () {
        request.abort();
    });
    request.on('error', function(e) {
        callback(new Error("httpGet : exception "+e.message), result);
    });
}

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to