aws sdk js – AWS cloudwatch node.js metrics send performance concern
I am new to using aws-sdk in a node.js project. I was going through the guide mentioned here about sending metrics to AWS cloudwatch. The example below in particular uses a promise based approach for sending metrics, if i am to use the below strategy for sending metrics, for e.g. whenever a particular endpoint is triggered, how performant will this usage be?
Node.js runtime is single threaded, so, for every request adding something on the call stack for a single threaded process seems like a performance degrading practice, in Java you could use daemon threads for sending metrics.
Should this be a concern? If yes, then what could be a better strategy for sending the metrics?
export const run = async () => {
try {
const data = await cwClient.send(new PutMetricDataCommand(params));
console.log("Success", data.$metadata.requestId);
return data;
} catch (err) {
console.log("Error", err);
}
};
Read more here: Source link