Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,006 changes: 1,006 additions & 0 deletions .github/data/urls.txt

Large diffs are not rendered by default.

1,006 changes: 1,006 additions & 0 deletions .github/data/urls_wgs84.txt

Large diffs are not rendered by default.

Binary file added .github/data/world.tif
Binary file not shown.
77 changes: 77 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: benchmark

# On every pull request, but only on push to main
on:
push:
branches:
- main
- dev
tags:
- '*'
pull_request:

jobs:
benchmark:
if: github.repository == 'developmentseed/async-titiler'
runs-on: ubuntu-latest
permissions:
contents: write # Push benchmark results to gh-benchmarks branch
pull-requests: write # Leave PR comments when benchmark regressions exceed alert threshold

steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false

- name: install siege
run: |
sudo apt update
sudo apt install --yes siege jq
siege -C

- name: Start containers
run: docker compose -f "docker-compose.yml" up -d --build benchmark

# Let's wait a bit to make sure the docker are up
- name: Sleep for 10 seconds
run: sleep 10s
shell: bash

- name: Run siege (WebMercator TMS)
run: |
siege --file .github/data/urls.txt -b -c 1 -r 100 --json-output 2>&1 | jq -c > results.json
echo "Benchmark Results"
cat results.json | jq
echo "Parse Results"
cat results.json | jq '{"name": "WebMercator elapsed_time", "unit": "s", "value": .elapsed_time}, {"name": "WebMercator data_transferred", "unit": "Megabytes", "value": .data_transferred}, {"name": "WebMercator response_time", "unit": "s", "value": .response_time}, {"name": "WebMercator longest_transaction", "unit": "s", "value": .longest_transaction}' > output.json

- name: Run siege (WGS1984Quad TMS)
run: |
siege --file .github/data/urls_wgs84.txt -b -c 1 -r 100 --json-output 2>&1 | jq -c > results.json
echo "Benchmark Results"
cat results.json | jq
echo "Parse Results"
cat results.json | jq '{"name": "WGS1984Quad elapsed_time", "unit": "s", "value": .elapsed_time}, {"name": "WGS1984Quad data_transferred", "unit": "Megabytes", "value": .data_transferred}, {"name": "WGS1984Quad response_time", "unit": "s", "value": .response_time}, {"name": "WGS1984Quad longest_transaction", "unit": "s", "value": .longest_transaction}' >> output.json

- name: Stop containers
if: always()
run: docker compose -f "docker-compose.yml" down

- name: Merge Outputs
run: |
cat output.json | jq '[inputs]' > benchmark.json

- name: Check and Store benchmark result
uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # v1
with:
name: Async TiTiler performance Benchmarks
tool: 'customSmallerIsBetter'
output-file-path: benchmark.json
alert-threshold: '130%'
comment-on-alert: true
fail-on-alert: false
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
gh-pages-branch: 'gh-benchmarks'
# Make a commit only if main
auto-push: ${{ github.ref == 'refs/heads/main' }}
38 changes: 6 additions & 32 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,10 @@ services:
context: .
ports:
- "8081:8081"
environment:
# Application
- HOST=0.0.0.0
- PORT=8081
- WEB_CONCURRENCY=1
- WORKERS_PER_CORE=1
# GDAL Config
# This option controls the default GDAL raster block cache size.
# If its value is small (less than 100000), it is assumed to be measured in megabytes, otherwise in bytes.
- GDAL_CACHEMAX=200
- GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR
- GDAL_INGESTED_BYTES_AT_OPEN=32768
- GDAL_HTTP_MERGE_CONSECUTIVE_RANGES=YES
- GDAL_HTTP_MULTIPLEX=YES
- GDAL_HTTP_VERSION=2
# The file can be cached in RAM by setting the configuration option VSI_CACHE to TRUE.
# The cache size defaults to 25 MB, but can be modified by setting the configuration option VSI_CACHE_SIZE (in bytes).
# Content in that cache is discarded when the file handle is closed.
- VSI_CACHE=TRUE
- VSI_CACHE_SIZE=536870912
# In addition, a global least-recently-used cache of 16 MB shared among all downloaded content is enabled by default,
# and content in it may be reused after a file handle has been closed and reopen,
# during the life-time of the process or until VSICurlClearCache() is called.
# Starting with GDAL 2.3, the size of this global LRU cache can be modified by
# setting the configuration option CPL_VSIL_CURL_CACHE_SIZE (in bytes).
- CPL_VSIL_CURL_CACHE_SIZE=200000000
# TiTiler Config
# - RIO_TILER_MAX_THREADS=
- MOSAIC_CONCURRENCY=5
# AWS S3 endpoint config
# - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
# - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
command: ["uvicorn", "async_titiler.main:app", "--host", "0.0.0.0", "--port", "8081", "--workers", "1"]

benchmark:
extends:
service: api
volumes:
- ./.github/data:/data
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies = [
"titiler-core>=2.0.4,<2.1",
"titiler-mosaic>=2.0.4,<2.1",
"obstore",
"rio-tiler[geotiff,zarr]>=9.3,<10.0",
"rio-tiler[geotiff,zarr]==9.4",
"starlette-cramjam>=0.4,<0.6",
"pydantic-settings~=2.0",
"rustac",
Expand Down
Loading
Loading