Salta al contenuto

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

posta un anno fa243 visualizzazioni
2 Risposte
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
ESPERTO
con risposta un anno fa
0

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

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

AWS
ESPERTO
con risposta un anno fa
ESPERTO
verificato un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.