-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting Google Cloud Function V2 #158
Comments
Also, wondering if it's possible to support Python 3.8+ on GCP. It seems like the image we are using only supports python 3.7, however, if choose other images and rebuild the image in the central repo, then we could test on Python 3.8, 3.9 to have it fair comparison against Lambda and Azure. Thanks! |
Yes, that would have been really interesting. I don't have it currently planned for the upcoming release. If you want to try it, then I'm happy to support and help in updating SeBS with the new backend. |
Yes, adding a new image should resolve the issue - functions should already be compatible with Python 3.8 and Python 3.9. Here you need to add new images. You need to ensure that new images will use Python 3.8 and 3.9 - I'm not sure how their images deal with that. |
I saw the code. However, I also see that while running the benchmark and doing deployment, it's actually getting the image from the docker repository. In addition, I was reading more about the docker image python/ js version as well and I saw node js version 10,12,14 all point to the same docker file. I'm wondering what's the reason?
Thanks |
I was happy to support higher language version. at least for AWS and Azure, we could point directly to the latest version of image in public repository: e.g
However, it seems like its not enough for adding the new image to base_images. It seems like we need to rebuild image and upload the image to the spcl central repository. Or otherwise we need to rebuild all the stuff from scratch and put the image in our own repository. I'm wondering if you have detailed documentations on how to do that (for rebuilding images locally and test it on a local repository, and then upload it to your central repo) ? That would be really helpful. |
I was able to support nodejs 16 on AWS and Azure by doing some trick. Which making the benchmark to use the nodejs 14 image even though the runtime is node js 16 (since node js 14 and 16 will use the same docker image I believe). Thanks |
Update: Trying out and reading. |
After digging into the code a bit, I was mostly confused by the The part I'm confused about is Why do we need to do |
@nervermore2 Thanks for the detailed information - yes, the building of Docker images is a deeply internal part that is not documented very well. Users are not expected to know that. I will try to push today new Node.js images. |
Thanks, it would be great helpful if we can have both new Node.js images (16.x or even higher) and also new python images (3.8x or even higher) for GCP. For other providers, I was able to work around by using the older version of images, which will work as well. By the way, would it be possible if you could briefly explain why do we need to use docker images (including a gcr/mcr/acr image) to launch our functions? We are deplying the code inside |
I'm working on this now - first, I'm verifying that everything works with existing versions. I was able to confirm that all Python benchmarks (3.7, 3.8, 3.9) and Node.js benchmarks (14) work on AWS Lambda. I will try GCP next. Updating to Node.js should be relatively easy. However, updating Python versions usually takes a bit longer as there are many package incompatibilities and I don't plan atm to go beyond 3.9. Python 3.10+ is planned for the next release (1.2), and for the current mid-release (1.1.5) I'm planning to add Node.js 16).
We aim to build all dependencies in the container similar to the one used in the cloud when executing functions. The reasoning is that some of the packages use native dependencies and installing it incorrectly might prevent functions from launching. We also have C++ benchmarks (planned for release 1.2) that require more care when building. The build image is only needed for the step of installing dependencies. At the moment, it assumes all images live in our DockerHub - but this can be easily changed by using your own repository - just the repository name in |
Thanks. It would be great help to have node 16.x and python 3.8 for now. since node14.x and python 3.7 is pretty old and is retired I believe.
So we install dependencies in the docker, and ship them (may be in a dockerized image or zipped file) along with the code right. That's why we see |
@nervermore2 On the |
@nervermore2 Almost correct :) We install dependencies and ship the zipped file. The Sometimes |
@nervermore2 You can find support for Node 16 on Updating to Node.js 18 might be possible - we will explore later if the existing images still support this. If you want to work on this yourself, I will happily accept a PR and guide you - we welcome all contributions! You can test your local image by changing the repository's name in The main problem is that many of these images are quite old. While AWS produces many new images, the official Google images are abandoned - nobody responds to issues, and PRs are not merged. The images are very old and based on Ubuntu 16.04. While current Node benchmarks still work there, Node 18 might not work there, and any new Node benchmark might require a newer OS. To solve this, one would have to start from image ubuntu:18.04 or ubuntu:2204, as these are the runtime for GCP functions, and install |
Sometimes requirements.txt is empty in benchmarks because all dependencies have different versions depending on the Python version. We try to stick to a single version to enable reproducibility, but it's quite difficult.
|
One last question regarding difference between |
One more question on your latest ubuntu image for python, please correct me if I'm wrong: Previously you used cloud provider's native python/node js image, and install specific packages on them. Now it seems like you are using a blank ubuntu image, and add specific python language/environment to that, am I right? |
No, the We don't add dependencies from the Docker image, but use it to install them :) |
Azure Functions do not have the same semantics of cold/warm because their function app can support multiple invocations. If you launch 5 functions simultaneously on Lambda, you will likely get 5 cold results. If you do it on Azure Functions, you will get maybe 1-2 cold and the rest will be warm runs. As you correctly notice, Please read our Middleware paper (link is in the repo) - it explains differences in the methodology. |
Correct - I do it because GCP itself specifies that the Google Cloud Functions environment uses these Docker images.
Correct - it should be sufficient to use a Docker image similar to Python, but instead of installing Python from the APT repository, you will have to install Node. |
@nervermore2 I verified that Azure works well for Python 3.7-3.9 and Node 14. To add Node 16 & 18, we have to migrate to Azure Functions 4. I will see how much work this can cause. |
For future reference: new code needed to query logs of GCP v2: from google.cloud import logging as gcp_logging
logging_client = gcp_logging.Client()
#logger = logging_client.logger("cloudfunctions.googleapis.com%2Fcloud-functions")
logger = logging_client.logger("run.googleapis.com%2Frequests")
timestamps = []
#for timestamp in [start_time, end_time + 1]:
#utc_date = datetime.fromtimestamp(timestamp, tz=timezone.utc)
#timestamps.append(utc_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
from google.api_core import exceptions
from time import sleep
def wrapper(gen):
while True:
try:
yield next(gen)
except StopIteration:
break
except exceptions.ResourceExhausted:
self.logging.info("Google Cloud resources exhausted, sleeping 30s")
sleep(30)
function_name='function-1'
timestamps=['2023-12-01T21:41:00', '2023-12-01T21:45:19']
invocations = logger.list_entries(
filter_=(f'''
(resource.type="cloud_run_revision" resource.labels.service_name="{function_name}")
OR
(resource.type="cloud_function" resource.labels.function_name="{function_name}")
severity>=INFO
timestamp >= "{timestamps[0]}"
timestamp <= "{timestamps[1]}"
'''
),
page_size=1000,
)
invocations_processed = 0
if hasattr(invocations, "pages"):
pages = list(wrapper(invocations.pages))
else:
pages = [list(wrapper(invocations))]
entries = 0
for page in pages: # invocations.pages:
for invoc in page:
# convert to nanoseconds
time = float(invoc.http_request['latency'][0:-1]) * 1000 * 1000 * 1000 |
@nervermore2 PR #196 now supports Azure Functions Runtime v4 and works with Node.js 16, 18 & 20, as well as with Python 3.10 and 3.11. The upcoming release will support Python up to 3.11 (3.10 on AWS) and Node.js up to 20 (up to 16 on AWS due to problems with the SDK v3). |
Thanks for supporting those language versions! They will be really helpful. |
Google Cloud published Google Cloud Function V2 last year, which is built on Cloud Run and Eventarc. It is interesting to see it's performance under Sebs benchmark set. It seems like majority of APIs remain the same.
I'm wondering if we could support Google Cloud function sometime in the future.
The text was updated successfully, but these errors were encountered: