I am trying to learn AWS. I have deployed the following code in EC2 (t2.micro):
const http = require('http');
const hostname = 'IP_ADDRESS';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
Upon load testing using npm loadtest with 250 rps, I am noticing that some of the requests are returning ECONNRESETand ETIMEDOUT errors for 50% of the requests and the other are working fine.
In order to figure out the issue, I have done the following:
Created cloud watch log agent and push logs to cloudwatch (No good). It does not have anything meaningful. (var/log/messages)
Captured memory usage metrics. I noticed that memory is not exceeding 20% usage and CPU is not exceeding 5% usage.
What can I do not to better understand the reason behind this issue? If memory is not the issue.. then what is?