|
1 | 1 |
|
2 | | -SeBS caches built code packages to save time, as installing dependencies can be time and bandwidth consuming, e.g., for ML frameworks such as PyTorch. |
3 | | -Furthermore, some benchmarks require special treatment - for example, PyTorch image recognition benchmark requires additional stripping and compression steps to fit into the size limits of AWS Lambda code package. |
| 2 | +SeBS caches built code packages to save time, as installing dependencies can be time and bandwidth-consuming, e.g., for ML frameworks such as PyTorch. |
| 3 | +Furthermore, some benchmarks require special treatment - for example, the PyTorch image recognition benchmark requires additional stripping and compression steps to fit into the size limits of AWS Lambda code package. |
4 | 4 |
|
5 | | -By default, we deploy benchmark code as package uploaded to the serverless platform. |
6 | | -However, on some platforms we use [Docker images](#docker-image-build) instead. |
| 5 | +By default, we deploy benchmark code as a package uploaded to the serverless platform. There, we use custom **build images** to install dependencies in an environment resembling the |
| 6 | +function executor in the cloud. However, on some platforms, we deploy functions as [Docker images](#docker-image-build) instead. There, we create one **function image** for each benchmark and configuration (language, language version, architecture). |
| 7 | + |
| 8 | +## Code Package Deployment |
7 | 9 |
|
8 | 10 | ```mermaid |
9 | 11 | sequenceDiagram |
10 | 12 | participant Benchmark Builder |
11 | 13 | participant Cache |
12 | 14 | participant Platform |
13 | | - participant Docker Image Builder |
| 15 | + participant Build Image Runner |
14 | 16 | Benchmark Builder->>Cache: Query for an up-to-date build. |
15 | 17 | Benchmark Builder->>Benchmark Builder: Prepare environment and benchmark code. |
16 | | - Benchmark Builder->>Benchmark Builder: Install platform-specific dependencies. |
17 | | - Benchmark Builder->>Benchmark Builder: Install benchmark dependencies. |
| 18 | + Benchmark Builder->>Benchmark Builder: Add platform-specific dependencies. |
| 19 | + Benchmark Builder->>Build Image Runner: Install benchmark dependencies. |
18 | 20 | Benchmark Builder->>Platform: Package code. |
19 | | - Platform-->>Docker Image Builder: Build Image. |
20 | | - Platform->>Benchmark Builder: Returns zip file or image tag. |
| 21 | + Platform->>Benchmark Builder: Returns a finalized function deployment. |
21 | 22 | ``` |
22 | 23 |
|
23 | | -## Code Package Build |
24 | | - |
25 | | -**Query Cache** - first, we check if there is an up-to-date build of the benchmark function |
26 | | -that can be used. |
| 24 | +**Query Cache** - first, we check if there is an up-to-date build of the benchmark function that can be used. If there is no cached package, or the function code has been changed, we need to build a new deployment package. |
27 | 25 |
|
28 | 26 | **Prepare Environment** - benchmark code with data is copied to the build location. |
29 | 27 |
|
30 | 28 | **Add Benchmark Data** - optional step of adding additional, external dependencies. An example is downloading `ffmpeg` release into `220.video-processing` benchmark. |
31 | 29 |
|
32 | 30 | **Add Platform-Specific Wrappers** - we add lightweight shims to implement the cloud-specific API and keep benchmark applications generic and portable. |
33 | 31 |
|
34 | | -**Add Deployment Packages** - some platforms require installing specific dependencies, such as cloud storage SDKs in Azure and Google Cloud, as well as the Minio SDK for OpenWhisk. |
| 32 | +**Add Deployment Packages** - some platforms require installing specific dependencies, such as cloud storage SDKs in Azure and Google Cloud, as well as the Minio SDK for OpenWhisk. We extend function configuration to add those packages, as they will be installed in the next step. In C++, we generate a customized CMake configuration that includes all packages required by the function, e.g., OpenCV or Torch. |
35 | 33 |
|
36 | | -**Install Dependencies** - in this step, we use the Docker builder container. |
37 | | -We mount the working copy as a volume in the container, and execute there |
38 | | -This step is skipped for OpenWhisk. |
| 34 | +**Install Dependencies** - in this step, we use the Docker builder container. We mount the working copy as a volume in the container, and install dependencies inside it. In C++, we perform the CMake configuration and build steps here. |
39 | 35 |
|
40 | | -**Package Code** - we move files to create the directory structure expected on each cloud platform and |
41 | | -create a final deployment package. An example of a customization is Azure Functions, where additional |
| 36 | +**Package Code** - we move files to create the directory structure expected on each cloud platform and create a final deployment package. An example of a customization is Azure Functions, where additional |
42 | 37 | JSON configuration files are needed. |
43 | 38 |
|
44 | | -**Build Docker Image** - in this step, we create a new image `function.{platform}.{benchmark}.{language}-{version}`. |
45 | | -Benchmark and all of its dependencies are installed there, and the image can be deployed directly |
46 | | -to the serverless platform. At the moment, this step is used only on AWS and in OpenWhisk. |
| 39 | +## Docker Image Deployment |
| 40 | + |
| 41 | +```mermaid |
| 42 | +sequenceDiagram |
| 43 | + participant Benchmark Builder |
| 44 | + participant Cache |
| 45 | + participant Platform |
| 46 | + participant Docker Image Builder |
| 47 | + Benchmark Builder->>Cache: Query for an up-to-date build. |
| 48 | + Benchmark Builder->>Benchmark Builder: Prepare environment and benchmark code. |
| 49 | + Benchmark Builder->>Benchmark Builder: Add platform-specific dependencies. |
| 50 | + Benchmark Builder->>Docker Image Builder: Build image (including dependency installation). |
| 51 | + Benchmark Builder->>Docker Image Builder: Push image to Docker registry. |
| 52 | + Benchmark Builder-->>Platform: Package code. |
| 53 | + Docker Image Builder->>Benchmark Builder: Returns a finalized function image. |
| 54 | +``` |
| 55 | + |
| 56 | +An alternative to uploading a code package is to deploy a Docker image. This option is not supported on all platforms; for example, Azure Functions and Google Cloud Functions do not support custom Docker images. Compared to code package deployment, we have two new steps and one step is modified: |
| 57 | + |
| 58 | +**Build Docker Image** - in this step, we create a new image `function.{platform}.{benchmark}.{language}-{version}-{architecture}-{sebs-version}`. |
| 59 | +Benchmark and all of its dependencies are installed there, and the image can be deployed directly to the serverless platform. |
| 60 | + |
| 61 | +**Push Docker Image** - the image is pushed to a Docker registry. On AWS, we use AWS ECR. For OpenWhisk, we use DockerHub but also support |
| 62 | +pushing images to a custom registry. For example, a local registry deployment can be preferred since pushing and pulling images is much faster. |
| 63 | + |
| 64 | +**Package Code** - while this step is mandatory for a code package, it is rarely needed when building a Docker image. However, it might be necessary on some platforms (see OpenWhisk details below). |
47 | 65 |
|
48 | | -## Docker Image Build |
| 66 | +### AWS Lambda |
49 | 67 |
|
50 | | -An alternative to uploading a code package is to deploy a Docker image. This option is not supported on every platform, i.e., Azure Functions and Google Cloud Functions do not support custom Docker images. |
| 68 | +We support deploying functions as Docker images for Python, Node.js, and C++ functions. We also support building arm64 images for this platform, except for C++ functions (extension to ARM functions is planned in the future). |
51 | 69 |
|
52 | | -On AWS Lambda, we support deploying functions as Docker images for Python, Node.js, and C++ functions. |
53 | | -We also support building arm64 images for this platform, except for C++ functions (extension to ARM functions is planned in future). |
| 70 | +### OpenWhisk |
54 | 71 |
|
55 | | -A slightly different approach is taken in OpenWhisk. |
56 | | -Since OpenWhisk has a very small size limit on code packages, we deploy all functions as Docker images. |
57 | | -There, in this step, we copy the prepared benchmark code into a newly created Docker image where |
| 72 | +This platform has a very small size limit on code packages. Thus, we deploy all functions as Docker images. |
| 73 | +In this step, we copy the prepared benchmark code into a newly created Docker image where |
58 | 74 | all dependencies are installed. The image is later pushed to either DockerHub or a user-defined registry. |
59 | | -However, we still create a small zip package that contains the main handler only; it is not possible to create an OpenWhisk action directly from a Docker image. |
| 75 | +However, we still create a small zip package containing only the main handler; it is not possible to create an OpenWhisk action directly from a Docker image. |
60 | 76 |
|
0 commit comments