I was doing testing of my nodeJS localhost server and I used artillery tool for testing the load on the server. So, here I just want to test the concurrency level of the server like how many requests can server handle concurrently. Please have a look at the below code & artillery config file.
My nodeJS code -
const express = require('express');
const app = express();
app.get('/', (req, res) => {
// I've used the 5 second delay to make the proper async case
setTimeout(() => res.send('Welcome node!!'), 10000);
});
const server = app.listen(process.env.PORT || 3000, () => {
const host = server.address().address
const port = server.address().port
console.log("Example app listening at http://localhost", host, port)
})
Artillery config file -
{
"config": {
"target": "http://localhost:3000",
"phases": [{
"duration": 1,
"arrivalRate": 10000
}]
},
"scenarios": [{
"flow": [{
"get" : {"url": "/"}
}]
}]
}
In short, Using artillery, I'm sending the 1000 requests/second.
But here I wonder, how Artillery gives the successful result and how can server able to handle the 10000 requests/second, despite every request takes 10 seconds to send the response (I've set the timeout of 10 seconds)
Artillery log -