Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
Is it better to make 2 API calls and discard 1, or call one at a time when inside cloud functions?

I know that cloud functions charge money based on execution time and network costs.

I am writing a cloud function that calls 2 external APIs to authenticate a user. Both external APIs just return a single boolean and therefore don't send much info.

Which technique is better overall?

  1. Make both external API calls using fetch() at the same time knowing that 1 may be useless half the time.

  2. Make the external API call one after the other, and not make the second one if not needed.

I'm thinking doing #1 will shorten the "wall time" of my cloud function and therefore may be cheaper? But I make more external calls which may be expensive?

But doing #2 will make the cloud function stay in memory for longer and therefore more "wall time".

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Method 1 results in more complex code as you will need to wait for both fetches to complete unless you like container crashes to debug.

Method 2 is simpler to implement and debug but could result in longer wall clock time.

You will need to decide which method is better when you factor development time, debugging time, analyzing errors in logfiles, and execution time.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda