Currently, I'm using Google Function with python which refactors the result of Goolge OCR (Vision API). So, the current structure is as below.
User sends the target image with mobile application -> Trigger the function in Goolge Function -> Sends the result to mobile application.
Since it is quite slow, I am trying to change the process with Golang. So this is my question.
I think although I deploy my golang function to Google Functions, it isn't compiled. The code is compiled when instance is made and runs. However, I want to compile the code and just execute the program when the user triggers. So how can I use compiled file in Google Function?
CodePudding user response:
Can you elaborate please, why do you think so:
I think although I deploy my golang function to Google Functions, it isn't compiled. The code is compiled when instance is made and runs.
From the best of my understanding, the build happens at the deployment time, as described on the documentation page Building Cloud Functions Images:
When you deploy your function's source code to Cloud Functions, that source is stored in a Cloud Storage bucket. Cloud Build then automatically builds your code into a container image and pushes that image to Container Registry.
There may be a few ways to improve performance and decrease latency (depending on your context, requirements and budget) - see One-time initialization for Go, and Cloud Functions Execution Environment paying attention to the Cold starts section...