Skip to content
Merged
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
20 changes: 13 additions & 7 deletions .github/workflows/on-version-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ jobs:
shell: bash
run: echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin

- name: Docker Build
shell: bash
run: docker build -f Dockerfile -t ghcr.io/ogxd/cacheus:latest -t ghcr.io/ogxd/cacheus:${{ github.ref_name }} .

- name: Docker Push
shell: bash
run: docker push --all-tags ghcr.io/ogxd/cacheus
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker Build and Push (Multi-Arch)
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/ogxd/cacheus:latest
ghcr.io/ogxd/cacheus:${{ github.ref_name }}
5 changes: 5 additions & 0 deletions benches/baseline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sh```
docker compose up -d
k6 cloud login --token <token>
k6 cloud run --local-execution script.js
```
20 changes: 20 additions & 0 deletions benches/baseline/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.9"
name: baseline-bench

services:
proxy:
image: ghcr.io/ogxd/cacheus:latest
container_name: cacheus-proxy
ports:
- "8080:8080"
volumes:
- ./proxy.yml:/etc/cacheus.yml:ro
restart: unless-stopped
cpus: 2

hello:
image: hashicorp/http-echo
container_name: hello
command: "-text='Hello World'"
restart: unless-stopped
cpus: 1 # Does not need much since it's supposed to be cached anyway
19 changes: 19 additions & 0 deletions benches/baseline/proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
listening_port: 8080
prometheus_port: 5000
https: false
http2: false
minimum_log_level: warn

middlewares:
- use_cache:
cache_name: cache
- forward_request:
target_host: hello:5678

caches:
- in_memory:
name: cache
ttl_seconds: 60
hash_path: true
hash_query: true
hash_body: false
Binary file added benches/baseline/report.pdf
Binary file not shown.
27 changes: 27 additions & 0 deletions benches/baseline/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import http from 'k6/http';

export const options = {
discardResponseBodies: true,
cloud: {
projectID: 4565599,
name: 'Cacheus to Hello World',
},
scenarios: {
contacts: {
executor: 'ramping-arrival-rate',
// Start iterations per `timeUnit`
startRate: 100,
// Start `startRate` iterations per minute
timeUnit: '1s',
// Pre-allocate necessary VUs.
preAllocatedVUs: 10000,
stages: [
{ target: 20000, duration: '5m' },
],
},
},
};

export default function() {
http.get('http://127.0.0.1:8080');
}
5 changes: 5 additions & 0 deletions benches/nginx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sh```
docker compose up -d
k6 cloud login --token <token>
k6 cloud run --local-execution script.js
```
12 changes: 12 additions & 0 deletions benches/nginx/bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
docker run -d --name nginx-cache -p 8080:80 -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro -v $(pwd)/cache:/var/cache/nginx nginx
k6 run script.js
docker stop nginx-cache
docker rm nginx-cache

podman stats nginx-cache

podman run -d --name cacheus -p 8081:80 -v $(pwd)/cacheus.yml:/etc/cacheus.yml ghcr.io/ogxd/cacheus:0.1.0
docker run -d --name cacheus -p 8081:80 -v $(pwd)/cacheus.yml:/etc/cacheus.yml ghcr.io/ogxd/cacheus:0.1.0


podman run -d --name nginx-cache -p 8080:80 -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro -v $(pwd)/cache:/var/cache/nginx docker.io/library/nginx
20 changes: 20 additions & 0 deletions benches/nginx/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.9"
name: nginx-bench

services:
proxy:
image: nginx:latest
container_name: nginx-proxy
ports:
- "8080:8080"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
restart: unless-stopped
cpus: 2

hello:
image: hashicorp/http-echo
container_name: hello
command: "-text='Hello World'"
restart: unless-stopped
cpus: 1 # Does not need much since it's supposed to be cached anyway
19 changes: 19 additions & 0 deletions benches/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
worker_processes 1;

events { worker_connections 1024; }

http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=cache_zone:10m max_size=100m inactive=60m use_temp_path=off;

server {
listen 8080;

location / {
proxy_pass http://hello:5678;
proxy_cache cache_zone;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 404 1m;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
}
}
}
Binary file added benches/nginx/report.pdf
Binary file not shown.
27 changes: 27 additions & 0 deletions benches/nginx/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import http from 'k6/http';

export const options = {
discardResponseBodies: true,
cloud: {
projectID: 4565599,
name: 'Nginx to Hello World',
},
scenarios: {
contacts: {
executor: 'ramping-arrival-rate',
// Start iterations per `timeUnit`
startRate: 100,
// Start `startRate` iterations per minute
timeUnit: '1s',
// Pre-allocate necessary VUs.
preAllocatedVUs: 100,
stages: [
{ target: 20000, duration: '5m' },
],
},
},
};

export default function() {
http.get('http://127.0.0.1:8080');
}