Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Evaluates, configures, and migrates workloads to AWS Lambda Managed Instances on EC2 capacity in your account.
Use this skill ↓27% 91%+64 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 6 of 22 without it.
3 of 3 safety checks passed
Not used yet
Before/after code examples for migrating to multi-concurrency.
// BEFORE (race condition)
let requestCount = 0;
exports.handler = async (event) => {
requestCount++;
return { count: requestCount };
};
// AFTER (request-isolated)
const { AsyncLocalStorage } = require('node:async_hooks');
const als = new AsyncLocalStorage();
exports.handler = async (event) => {
return als.run({ id: event.requestContext?.requestId }, async () => {
return await processEvent(event);
});
};
// BEFORE (shared path)
fs.writeFileSync('/tmp/output.json', JSON.stringify(data));
// AFTER (request-unique path)
const path = `/tmp/output-${event.requestContext?.requestId}.json`;
try { fs.writeFileSync(path, JSON.stringify(data)); }
finally { fs.unlinkSync(path); }
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.