Direkt zum Inhalt

HELP: My hello-world Nodejs Lambda function is slow! (150ms avg.)

0

Video showcasing it: https://gyazo.com/f324ce7600f7fb9057e7bb9eae2ff4b1 My lambda function:

export const main = async (event, context) => {  
  return {
    statusCode: 200,
    body: "Hello World!",
    headers: {
      "Access-Control-Allow-Origin": "*",
      "Access-Control-Allow-Credentials": true,
    },
  };
}
  • ✅I have chosen my closest region (frankfurt) (with avg. ping of 30ms)
  • ✅I have tried doubling the default memory amount for it
  • ✅I have tried screaming at the computer

runtime: "nodejs18.x", architecture: "arm_64",

The function actually only takes ~10-20ms to execute, so what accounts for the remaining 140ms of wait time? https://i.gyazo.com/2da0e649ea7ea5f9a137053cb404b400.png

gefragt vor einem Jahr243 Aufrufe
2 Antworten
0

Looking at the video I see additional printouts, which indicate that you have some dependencies that you load and they probably take some time to initialize.

AWS
EXPERTE
beantwortet vor einem Jahr
0

Perhaps turn on X-Ray as a method of troubleshooting.

https://docs.aws.amazon.com/xray/latest/devguide/xray-services-lambda.html

AWS
EXPERTE
beantwortet vor einem Jahr
EXPERTE
überprüft vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.