Skip to content

Commit

Permalink
Experiment 1 - Determine chunk size
Browse files Browse the repository at this point in the history
Reading 1B for every 2048B, 4096B, 8192B
  • Loading branch information
ypwong99 committed Feb 3, 2024
1 parent 744977d commit e622cde
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 215 deletions.
224 changes: 12 additions & 212 deletions .github/workflows/image-size-experiment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,208 +38,8 @@ jobs:
path: ${{ env.working-directory }}/build.tar
retention-days: 1

# cold-image-size-50-gcr:
# name: GCR 50MB image size experiment
# needs: build_client
# runs-on: [ self-hosted, gcr ]
# timeout-minutes: 600
# env:
# working-directory: src
# DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
# DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
#
# steps:
# - name: Check out code into the Go module directory
# uses: actions/checkout@v4
# with:
# ref: ypwong99/temp-experiment-image-sizes
#
# - id: auth
# name: Configure GCR credentials
# uses: google-github-actions/auth@v1
# with:
# credentials_json: ${{ secrets.GCR_CREDENTIALS }}
#
# - name: Set up gcloud
# uses: google-github-actions/setup-gcloud@v1
# with:
# version: ">= 363.0.0"
#
# - name: Set up Node 16.16.0
# uses: actions/setup-node@v3
# with:
# node-version: 16.16.0
#
# - name: Download client artifact
# uses: actions/download-artifact@v3
# with:
# name: STeLLAR-build
#
# - name: Untar client build
# working-directory: ${{ env.working-directory }}
# run: tar --strip-components=1 -xvf ../build.tar -C .
#
# - name: Run experiment
# working-directory: ${{ env.working-directory }}
# run: ./stellar -c ../experiments/image-size/cold-image-size-50-gcr.json
#
# - uses: actions/upload-artifact@v3
# with:
# name: cold-image-size-50-gcr
# path: ${{ env.working-directory }}/latency-samples

# cold-image-size-100-gcr:
# name: GCR 100MB image size experiment
# needs: build_client
# runs-on: [ self-hosted, gcr ]
# timeout-minutes: 600
# env:
# working-directory: src
# DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
# DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
#
# steps:
# - name: Check out code into the Go module directory
# uses: actions/checkout@v4
# with:
# ref: ypwong99/temp-experiment-image-sizes
#
# - id: auth
# name: Configure GCR credentials
# uses: google-github-actions/auth@v1
# with:
# credentials_json: ${{ secrets.GCR_CREDENTIALS }}
#
# - name: Set up gcloud
# uses: google-github-actions/setup-gcloud@v1
# with:
# version: ">= 363.0.0"
#
# - name: Set up Node 16.16.0
# uses: actions/setup-node@v3
# with:
# node-version: 16.16.0
#
# - name: Download client artifact
# uses: actions/download-artifact@v3
# with:
# name: STeLLAR-build
#
# - name: Untar client build
# working-directory: ${{ env.working-directory }}
# run: tar --strip-components=1 -xvf ../build.tar -C .
#
# - name: Run experiment
# working-directory: ${{ env.working-directory }}
# run: ./stellar -c ../experiments/image-size/cold-image-size-100-gcr.json
#
# - uses: actions/upload-artifact@v3
# with:
# name: cold-image-size-100-gcr
# path: ${{ env.working-directory }}/latency-samples

cold-image-size-50-gcr-read-entire:
name: GCR 50MB image size experiment (read entire)
needs: build_client
runs-on: [ self-hosted, gcr ]
timeout-minutes: 600
env:
working-directory: src
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ypwong99/temp-experiment-image-sizes

- id: auth
name: Configure GCR credentials
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCR_CREDENTIALS }}

- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v1
with:
version: ">= 363.0.0"

- name: Set up Node 16.16.0
uses: actions/setup-node@v3
with:
node-version: 16.16.0

- name: Download client artifact
uses: actions/download-artifact@v3
with:
name: STeLLAR-build

- name: Untar client build
working-directory: ${{ env.working-directory }}
run: tar --strip-components=1 -xvf ../build.tar -C .

- name: Run experiment
working-directory: ${{ env.working-directory }}
run: ./stellar -c ../experiments/image-size/cold-image-size-50-gcr-read-entire.json

- uses: actions/upload-artifact@v3
with:
name: cold-image-size-50-gcr-read-entire
path: ${{ env.working-directory }}/latency-samples

cold-image-size-100-gcr-read-entire:
name: GCR 100MB image size experiment (read entire)
needs: build_client
runs-on: [ self-hosted, gcr ]
timeout-minutes: 600
env:
working-directory: src
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ypwong99/temp-experiment-image-sizes

- id: auth
name: Configure GCR credentials
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCR_CREDENTIALS }}

- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v1
with:
version: ">= 363.0.0"

- name: Set up Node 16.16.0
uses: actions/setup-node@v3
with:
node-version: 16.16.0

- name: Download client artifact
uses: actions/download-artifact@v3
with:
name: STeLLAR-build

- name: Untar client build
working-directory: ${{ env.working-directory }}
run: tar --strip-components=1 -xvf ../build.tar -C .

- name: Run experiment
working-directory: ${{ env.working-directory }}
run: ./stellar -c ../experiments/image-size/cold-image-size-100-gcr-read-entire.json

- uses: actions/upload-artifact@v3
with:
name: cold-image-size-100-gcr-read-entire
path: ${{ env.working-directory }}/latency-samples

cold-image-size-100-gcr-read-consecutive:
name: GCR 100MB image size experiment (read consecutive)
cold-image-size-100-gcr-read-per-page:
name: GCR 100MB image size experiment (read-per-page)
needs: build_client
runs-on: [ self-hosted, gcr ]
timeout-minutes: 600
Expand Down Expand Up @@ -281,15 +81,15 @@ jobs:

- name: Run experiment
working-directory: ${{ env.working-directory }}
run: ./stellar -c ../experiments/image-size/cold-image-size-100-gcr-read-consecutive.json
run: ./stellar -c ../experiments/image-size/cold-image-size-100-gcr-read-per-page.json

- uses: actions/upload-artifact@v3
with:
name: cold-image-size-100-gcr-read-consecutive
name: cold-image-size-100-gcr-read-per-page
path: ${{ env.working-directory }}/latency-samples

cold-image-size-100-gcr-read-per-page:
name: GCR 100MB image size experiment (read per page)
cold-image-size-100-gcr-read-per-2048-bytes:
name: GCR 100MB image size experiment (read-per-2048-bytes)
needs: build_client
runs-on: [ self-hosted, gcr ]
timeout-minutes: 600
Expand Down Expand Up @@ -331,15 +131,15 @@ jobs:

- name: Run experiment
working-directory: ${{ env.working-directory }}
run: ./stellar -c ../experiments/image-size/cold-image-size-100-gcr-read-per-page.json
run: ./stellar -c ../experiments/image-size/cold-image-size-100-gcr-read-per-2048-bytes.json

- uses: actions/upload-artifact@v3
with:
name: cold-image-size-100-gcr-read-per-page
name: cold-image-size-100-gcr-read-per-2048-bytes
path: ${{ env.working-directory }}/latency-samples

cold-image-size-100-gcr-read-random:
name: GCR 100MB image size experiment (read random)
cold-image-size-100-gcr-read-per-8192-bytes:
name: GCR 100MB image size experiment (read-per-8192-bytes)
needs: build_client
runs-on: [ self-hosted, gcr ]
timeout-minutes: 600
Expand Down Expand Up @@ -381,9 +181,9 @@ jobs:

- name: Run experiment
working-directory: ${{ env.working-directory }}
run: ./stellar -c ../experiments/image-size/cold-image-size-100-gcr-read-random.json
run: ./stellar -c ../experiments/image-size/cold-image-size-100-gcr-read-per-8192-bytes.json

- uses: actions/upload-artifact@v3
with:
name: cold-image-size-100-gcr-read-random
name: cold-image-size-100-gcr-read-per-8192-bytes
path: ${{ env.working-directory }}/latency-samples
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"Provider": "gcr",
"Runtime": "python3.9",
"SubExperiments": [
{
"Title": "cold-image-size-100-gcr-read-per-2048-bytes",
"Function": "hellopy-read-per-2048-bytes",
"Handler": "Dockerfile",
"PackageType": "Container",
"PackagePattern": "lambda_function.py",
"Bursts": 500,
"BurstSizes": [
1
],
"IATSeconds": 900,
"DesiredServiceTimes": [
"0ms"
],
"Parallelism": 50,
"FunctionImageSizeMB": 100
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"Provider": "gcr",
"Runtime": "python3.9",
"SubExperiments": [
{
"Title": "cold-image-size-100-gcr-read-per-8192-bytes",
"Function": "hellopy-read-per-8192-bytes",
"Handler": "Dockerfile",
"PackageType": "Container",
"PackagePattern": "lambda_function.py",
"Bursts": 500,
"BurstSizes": [
1
],
"IATSeconds": 900,
"DesiredServiceTimes": [
"0ms"
],
"Parallelism": 50,
"FunctionImageSizeMB": 100
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"Handler": "Dockerfile",
"PackageType": "Container",
"PackagePattern": "lambda_function.py",
"Bursts": 100,
"Bursts": 500,
"BurstSizes": [
1
],
"IATSeconds": 900,
"DesiredServiceTimes": [
"0ms"
],
"Parallelism": 30,
"Parallelism": 50,
"FunctionImageSizeMB": 100
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.7-alpine

RUN pip install Flask gunicorn

WORKDIR /app
COPY . .

CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import json
import os
import time
from flask import Flask, request

app = Flask(__name__)


@app.route('/')
def hello_world():
incr_limit = 0
if request.args and 'incrementLimit' in request.args:
incr_limit = request.args.get('incrementLimit')

simulate_work(incr_limit)
read_filler_file("./filler.file")

response = {
"statusCode": 200,
"headers": {
"Content-Type": "application/json"
},
"body": {
"RequestID": "gcr-does-not-specify",
"TimestampChain": [str(time.time_ns())],
}
}

return json.dumps(response, indent=4)


def simulate_work(incr):
num = 0
while num < incr:
num += 1


def read_filler_file(path: str) -> None:
with open(path, 'rb') as f:
for i in range(1024):
f.seek(i * 2048)
f.read(1)


if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.7-alpine

RUN pip install Flask gunicorn

WORKDIR /app
COPY . .

CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app
Loading

0 comments on commit e622cde

Please sign in to comment.