Introduction
I am using the Azure Face API in my Google Cloud Function (I make around 3 or 4 https requests everytime my function is called) but I am getting a really slow execution time, 5 seconds.
Function execution took 5395 ms, finished with status: 'ok'
Function execution took 3957 ms, finished with status: 'ok
Function execution took 2512 ms, finished with status: 'ok
Basically what I am doing in my cloud function is:
1. Detect a face using Azure
2. Save the face in the Azure LargeFaceList
3. Find 20 similar faces using Azure
4. Train the updated Azure LargeFaceList (if it is not being trained already)
I have the Google Cloud Function located in us-central1 ('near' my Azure Sace Service, which is in north-central-us). I have assigned it a memory of 2GB and a timeout of 540 secs. I am in Europe.
Problem
As I said before, the function takes too long to complete its execution (from 3.5 to 5 seconds). I don't know if this is because of the "Cold Start" or because it takes a time to run the algorithm.
Pd: The LargeFaceList currently only contains 10 faces (for 1000 faces the training duration is 1 second, and for 1 million 30 minutes).
My Options
Run the code on:
1- Google Cloud Function (doing this now)
2- Google Cloud App Engine
I have been experimenting with cloud functions from the last 3 months, and I have never used the App Engine service.
My Question
Is it possible to use firestore triggers on App Engine? And will I get a faster execution time if I move this code to App Engine?