Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!