serverless-benchmarks icon indicating copy to clipboard operation
serverless-benchmarks copied to clipboard

Add Multi-Architecture Support (x86_64, arm64) for Benchmarks

Open prajinkhadka opened this issue 1 year ago • 8 comments

This PR resolves issue #92 by adding support for multiple architectures (x86_64 and arm64) across all benchmarks, with the exception of 411.image-recognition. for AWS Lambda with Python3.8.

Key Changes:

  1. Introduced a new architecture parameter in config/example.json, accepting either x86_64 or arm64 as values.
  2. The architecture parameter is now passed to the Docker container and accessed as an environment variable during dependency installation.
  3. Modified dockerfiles/pythoninstaller.sh to set the appropriate flag for PIP package installations based on the architecture (arm64 or x86_64).
  4. Updated the benchmarks (excluding 411.image-recognition) with a new requirements file, requirements.txt.arm.3.8, when necessary. Benchmarks without specific arm64 dependencies remain unchanged.
  5. For the 200.multimedia/220.video-processing benchmark, which requires FFmpeg, the init.sh script now checks the architecture and downloads the corresponding FFmpeg binary. The architecture parameter for init.sh is passed through the add_benchmark_data function in sebs/benchmark.py.
  6. The architecture parameter is passed while creating the lambda function.

Testing:

I've tested the benchmarks with Python 3.8, and they all function as expected. However, it's important to note that benchmarks 020.network-benchmark, 030.clock-synchronization, and 040.server-reply currently do not run due to issue #191. The changes introduced in this PR do not impact these benchmarks, as they do not rely on Python dependencies.

For Testers:

To test these changes, you must first build the Docker image locally using python3 build_docker_images.py --deployment aws --type build --language python --language-version 3.8. Otherwise, Docker will pull an image from Docker Hub that does not include the latest changes.

prajinkhadka avatar Mar 19 '24 04:03 prajinkhadka

@prajinkhadka Thank you! I scheduled a review of this PR.

mcopik avatar Mar 19 '24 16:03 mcopik

@prajinkhadka Did you test all functions on AWS?

mcopik avatar Mar 27 '24 17:03 mcopik

@mcopik yes, I did. I can run once again today and export the logs.

prajinkhadka avatar Mar 27 '24 17:03 prajinkhadka

hi @mcopik, I did run the regression test and it works for AWS.

Test Scenario

Platform -> AWS Python -> Python3.8 Architecture -> (x86_64 and arm64 )

Here are the logs from regression tests : Regreesion Test Logs

prajinkhadka avatar Mar 29 '24 00:03 prajinkhadka

@mcopik any updates on this ?

prajinkhadka avatar Apr 12 '24 14:04 prajinkhadka

@prajinkhadka Thanks for your help; it's almost there! There are two pending tasks:

  • We also need to test it on other Python versions; I can help with that, but it should be simple: just run Python 3.9/3.10 (another PR) and update package versions as needed.
  • We do not have support for Node.js functions. Do you see any problems there? It hopefully should work out of the box and npm has a flag --target_arch. I can help in case the Node and NPM environments are too difficult.

mcopik avatar May 07 '24 12:05 mcopik

@prajinkhadka Thanks for your help; it's almost there! There are two pending tasks:

* We also need to test it on other Python versions; I can help with that, but it should be simple: just run Python 3.9/3.10 (another PR) and update package versions as needed.

* We do not have support for Node.js functions. Do you see any problems there? It hopefully should work out of the box and npm has a flag `--target_arch`. I can help in case the Node and NPM environments are too difficult.

-> I tested for python3.8/3.9 ( updated the required files here in this PR ) and performed the regression test. -> Also, I tested for nodejs 16 ( updated the files here in this PR ). Needed to change the sharp package version as sharp 0.28 version didn't have the required prebuilt library for the arm so upgraded it to 0.32.

( Not tested on nodejs14, Python3.7 as lambda has dropped the support )

Not tested on Python3.10 as it is not supported in SeBs as of now in this PR. When 3.10 supports get merged, I can do that.

@mcopik

prajinkhadka avatar Jun 30 '24 05:06 prajinkhadka

@prajinkhadka Sounds great! we have to merge first the PR updating the version of benchmarks, and then we can finalize this one :-) We will work on this soon.

mcopik avatar Jul 02 '24 00:07 mcopik

@prajinkhadka Thank you so much for your work! I merged your contributions through the PR #227

mcopik avatar Nov 06 '24 14:11 mcopik