Unsuccessful iisnode requests after being excluded from a window?

I recently tried to create a simple file server with nodejs and looked like I was facing some problems that I seem to be unable to overcome.

In short:

I configured iisnode for 4 workflows (there is a parameter in web.config for this node nodeProcessCountPerApplication = "4"). And he balances the workload between these workers.

When 8 requests are received, each employee has 2 requests for processing, but when an exception occurs in one of the processed requests, the other waiting also fails.

For instance:

worker 1 handling request 1, request 5 waiting 
worker 2 handling request 2, request 6 waiting
worker 3 handling request 3, request 7 waiting
worker 4 handling request 4, request 8 waiting

If an exception occurs while processing request 3, the server responds with my error code, iisnode shuts down and restarts. But the problem is that request 7 also fails, even if it was not processed.

maxConcurrentRequestsPerProcess="1" , , , . 5,6,7,8 503 Service Unavailable, , , 1000 ( iis).

, .

IIS, , ? node IIS?

?

node, (, ..), JavaScript . ASP.NET MVC-, , iisnode IIS, node IIS. . , node - .

?

, node:

var server = http.createServer(function (request, response) {
    var d = domain.create();
    d.on('error', function (err) {
        try {
            //stop taking new requests.
            serverShutdown();
            //send an error to the request that triggered the problem
            response.statusCode = 500;
            response.end('Oops, there was a problem! ;) \n');
        }
        catch (er2) {
            //oh well, not much we can do at this point.
            console.error('Error sending 500!', er2.stack);
            process.exit(1);
        }
    });

    d.add(request);
    d.add(response);

    d.run(function () {
        router.route(request, response);
    });
}).listen(process.env.PORT);

- , , . server.close() , :

function serverShutdown() {
    server.close();
    for (var s in sockets) {
        sockets[s].setTimeout(1, function () { });
    }
}

!

?

, . - iisnode, . iisnode 4 ( web.config nodeProcessCountPerApplication="4"). .

, , :

8 , 2 , , .

:

worker 1 handling request 1, request 5 waiting 
worker 2 handling request 2, request 6 waiting
worker 3 handling request 3, request 7 waiting
worker 4 handling request 4, request 8 waiting

3 , , iisnode. , 7 , .

maxConcurrentRequestsPerProcess="1" , , , . 5,6,7,8 503 Service Unavailable, , , 1000 ( iis).

, .

IIS, , ? node IIS?

!


Update

iisnode , .

- , , , 502 Bad Gateway.

, , , , . ...

- ? , ?

+4

Source: https://habr.com/ru/post/1659342/


All Articles