Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 71d5106777 | |||
| 8b1b229539 | |||
| ff1ab31327 | |||
| 85e14bc8af | |||
| 3f5175b482 |
@@ -7,6 +7,8 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
with:
|
with:
|
||||||
@@ -21,4 +23,6 @@ jobs:
|
|||||||
version: 'latest'
|
version: 'latest'
|
||||||
args: release
|
args: release
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{secrets.RELEASE_TOKEN}}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
GORELEASER_FORCE_TOKEN: gitea
|
||||||
|
|||||||
@@ -62,6 +62,30 @@ validate run-validation: build clean-disk ## Start steamcache2 on :80 with small
|
|||||||
fi; \
|
fi; \
|
||||||
exec "$$BINARY" --config docs/examples/validate-config.yaml --log-level info
|
exec "$$BINARY" --config docs/examples/validate-config.yaml --log-level info
|
||||||
|
|
||||||
|
validate-check: ## Curl local /metrics (full dump + hit/miss fields) and /lancache-heartbeat (default :80)
|
||||||
|
@echo "=== http://localhost/metrics ==="
|
||||||
|
@metrics=$$(curl -sf --max-time 5 http://localhost/metrics) || { \
|
||||||
|
echo "ERROR: could not fetch http://localhost/metrics"; \
|
||||||
|
echo "Is steamcache2 running on the default listen address :80?"; \
|
||||||
|
exit 1; \
|
||||||
|
}; \
|
||||||
|
printf '%s\n' "$$metrics"; \
|
||||||
|
echo ""; \
|
||||||
|
echo "=== hit/miss fields ==="; \
|
||||||
|
printf '%s\n' "$$metrics" | grep -E '^(total_requests|cache_hits|cache_misses|hit_rate|memory_cache_hits|disk_cache_hits|errors) ' || true; \
|
||||||
|
echo ""; \
|
||||||
|
echo "=== http://localhost/lancache-heartbeat (GET; expect 204 + X-LanCache-Processed-By: SteamCache2) ==="; \
|
||||||
|
hb=$$(curl -sD - -o /dev/null --max-time 5 http://localhost/lancache-heartbeat) || { \
|
||||||
|
echo "ERROR: could not fetch http://localhost/lancache-heartbeat"; \
|
||||||
|
echo "Is steamcache2 running on the default listen address :80?"; \
|
||||||
|
exit 1; \
|
||||||
|
}; \
|
||||||
|
printf '%s\n' "$$hb"; \
|
||||||
|
echo "$$hb" | grep -q '204' && echo "$$hb" | grep -qi 'X-LanCache-Processed-By' || { \
|
||||||
|
echo "ERROR: expected HTTP 204 and X-LanCache-Processed-By on /lancache-heartbeat"; \
|
||||||
|
exit 1; \
|
||||||
|
}
|
||||||
|
|
||||||
validate-kill: ## Kill leftover steamcache2 processes (safer, checks process name)
|
validate-kill: ## Kill leftover steamcache2 processes (safer, checks process name)
|
||||||
@echo "Looking for steamcache2 processes on common validation ports (80 is primary)..."
|
@echo "Looking for steamcache2 processes on common validation ports (80 is primary)..."
|
||||||
@for port in 80 8040 8080; do \
|
@for port in 80 8040 8080; do \
|
||||||
@@ -109,6 +133,7 @@ help: ## Show this help message
|
|||||||
@echo " clean-disk Remove disk cache"
|
@echo " clean-disk Remove disk cache"
|
||||||
@echo " bench Run low-level VFS microbenchmarks"
|
@echo " bench Run low-level VFS microbenchmarks"
|
||||||
@echo " validate / run-validation Start server on :80 (builds, auto-setcaps fresh binary, then runs as normal user, cleans disk cache first)"
|
@echo " validate / run-validation Start server on :80 (builds, auto-setcaps fresh binary, then runs as normal user, cleans disk cache first)"
|
||||||
|
@echo " validate-check Curl local /metrics (full dump + hit/miss fields) and /lancache-heartbeat (default :80)"
|
||||||
@echo " setcap Explicitly set cap on current build (for port 80 use outside validate)"
|
@echo " setcap Explicitly set cap on current build (for port 80 use outside validate)"
|
||||||
@echo " validate-kill Kill leftover steamcache2 processes (safer)"
|
@echo " validate-kill Kill leftover steamcache2 processes (safer)"
|
||||||
@echo " prefill Download latest SteamPrefill into bin/steam-prefill/SteamPrefill (gitignored)"
|
@echo " prefill Download latest SteamPrefill into bin/steam-prefill/SteamPrefill (gitignored)"
|
||||||
@@ -53,6 +53,39 @@ SteamCache2 is a blazing fast download cache for Steam, designed to reduce bandw
|
|||||||
make run # or ./steamcache2
|
make run # or ./steamcache2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Quick check: is it caching?
|
||||||
|
|
||||||
|
After steamcache2 is running (default `listen_address: :80`) and has seen a little Steam traffic — a game download, a short SteamPrefill pass, or any cacheable request — confirm hits vs misses from the existing endpoints. You do not need a full benchmark or log diving.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make validate-check
|
||||||
|
# or, manually:
|
||||||
|
curl -s http://localhost/metrics
|
||||||
|
curl -s -i http://localhost/lancache-heartbeat
|
||||||
|
```
|
||||||
|
|
||||||
|
`make validate-check` prints the full `/metrics` dump, highlights hit/miss fields, and curls `/lancache-heartbeat`. Read these fields:
|
||||||
|
|
||||||
|
| Field | Meaning |
|
||||||
|
| --- | --- |
|
||||||
|
| `cache_hits` / `cache_misses` / `hit_rate` | Whether later requests were served from cache |
|
||||||
|
| `memory_cache_hits` / `disk_cache_hits` | Which tier served the hits |
|
||||||
|
| `total_requests` / `errors` | Volume and failures |
|
||||||
|
|
||||||
|
A first pass through new content is mostly misses (`hit_rate` near 0). Repeat the same content and `cache_hits` / `hit_rate` should rise.
|
||||||
|
|
||||||
|
To confirm the process is up (HTTP 204 and `X-LanCache-Processed-By: SteamCache2`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -s -i http://localhost/lancache-heartbeat
|
||||||
|
```
|
||||||
|
|
||||||
|
Use GET (`curl -i`), not HEAD (`curl -I`): the server only accepts GET.
|
||||||
|
|
||||||
|
These are the cache process's own `/metrics` and `/lancache-heartbeat` endpoints. There is no separate metrics daemon.
|
||||||
|
|
||||||
|
If you changed `listen_address`, point curl at that host:port instead. For a full SteamPrefill validation workflow (small caches, coalescing, GC), see [Validating Full Functionality](#validating-full-functionality-with-external-tools).
|
||||||
|
|
||||||
### Development Workflow
|
### Development Workflow
|
||||||
|
|
||||||
Use `make` for the majority of common development tasks. The Makefile handles running tests, linting, hygiene checks, building, running the application, and other routine boilerplate work.
|
Use `make` for the majority of common development tasks. The Makefile handles running tests, linting, hygiene checks, building, running the application, and other routine boilerplate work.
|
||||||
@@ -96,13 +129,16 @@ When the server is running, point your external SteamPrefill (or other load gene
|
|||||||
./SteamPrefill benchmark run ...
|
./SteamPrefill benchmark run ...
|
||||||
```
|
```
|
||||||
|
|
||||||
When finished, you can get a quick metrics summary with:
|
When finished, you can get a quick metrics + heartbeat report with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make validate-check
|
make validate-check
|
||||||
|
# or, manually:
|
||||||
|
curl -s http://localhost/metrics
|
||||||
|
curl -s -i http://localhost/lancache-heartbeat
|
||||||
```
|
```
|
||||||
|
|
||||||
This is the recommended simple workflow. No automatic downloading or running of external tools.
|
See [Quick check: is it caching?](#quick-check-is-it-caching) for which fields to read. This is the recommended simple workflow. No automatic downloading or running of external tools.
|
||||||
|
|
||||||
#### Inspecting the Result
|
#### Inspecting the Result
|
||||||
|
|
||||||
@@ -110,14 +146,17 @@ After a benchmark run you can ask for a quick report:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
make validate-check
|
make validate-check
|
||||||
# or manually:
|
# or, manually:
|
||||||
curl -s http://localhost/metrics
|
curl -s http://localhost/metrics
|
||||||
|
curl -s -i http://localhost/lancache-heartbeat
|
||||||
```
|
```
|
||||||
|
|
||||||
Look for:
|
`make validate-check` prints the full `/metrics` dump, highlights hit/miss fields, and curls `/lancache-heartbeat`. Look for:
|
||||||
- High cache hit rate after the warmup pass
|
- High cache hit rate after the warmup pass (`cache_hits`, `hit_rate`, plus `memory_cache_hits` / `disk_cache_hits`)
|
||||||
- Non-zero `coalesced` and `disk` activity
|
- Non-zero `coalesced` and `disk` activity
|
||||||
- Zero unexpected errors
|
- Zero unexpected `errors`
|
||||||
|
|
||||||
|
Heartbeat should be HTTP 204 with `X-LanCache-Processed-By: SteamCache2`. Use GET (`curl -i`), not HEAD (`curl -I`).
|
||||||
|
|
||||||
#### The Validation Config
|
#### The Validation Config
|
||||||
|
|
||||||
@@ -160,8 +199,9 @@ While most configuration is done via the YAML file, some runtime options are sti
|
|||||||
# Set logging level
|
# Set logging level
|
||||||
./steamcache2 --log-level debug --log-format json
|
./steamcache2 --log-level debug --log-format json
|
||||||
|
|
||||||
# Set number of worker threads
|
# Override concurrency from the CLI (0 = use config.yaml)
|
||||||
./steamcache2 --threads 8
|
./steamcache2 --max-concurrent-requests 8
|
||||||
|
./steamcache2 --max-requests-per-client 4
|
||||||
|
|
||||||
# Show help
|
# Show help
|
||||||
./steamcache2 --help
|
./steamcache2 --help
|
||||||
@@ -311,7 +351,7 @@ This will direct any requests to `lancache.steamcontent.com` to your SteamCache2
|
|||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
- Go 1.19 or later
|
- Go 1.27.0 or later
|
||||||
- Make (optional, but recommended)
|
- Make (optional, but recommended)
|
||||||
|
|
||||||
### Build Commands
|
### Build Commands
|
||||||
@@ -319,7 +359,7 @@ This will direct any requests to `lancache.steamcontent.com` to your SteamCache2
|
|||||||
```bash
|
```bash
|
||||||
# Clone the repository
|
# Clone the repository
|
||||||
git clone <repository-url>
|
git clone <repository-url>
|
||||||
cd SteamCache2
|
cd steamcache2
|
||||||
|
|
||||||
# Download dependencies
|
# Download dependencies
|
||||||
make deps
|
make deps
|
||||||
@@ -371,6 +411,11 @@ make
|
|||||||
- Consider using a different GC algorithm like `hybrid`
|
- Consider using a different GC algorithm like `hybrid`
|
||||||
- Adjust the disk cache size to match available storage
|
- Adjust the disk cache size to match available storage
|
||||||
|
|
||||||
|
6. **Not sure if it is caching**
|
||||||
|
- Do not start with the full SteamPrefill chapter. Use [Quick check: is it caching?](#quick-check-is-it-caching): `make validate-check` (full `/metrics`, hit/miss fields, and `/lancache-heartbeat`)
|
||||||
|
- A first pass is mostly `cache_misses`; repeating the same content should raise `cache_hits` / `hit_rate`
|
||||||
|
- Confirm the process is up with `curl -s -i http://localhost/lancache-heartbeat` (GET, not HEAD)
|
||||||
|
|
||||||
### Getting Help
|
### Getting Help
|
||||||
|
|
||||||
- Check the logs for detailed error messages
|
- Check the logs for detailed error messages
|
||||||
|
|||||||
@@ -27,7 +27,10 @@
|
|||||||
# SteamPrefill benchmark run -c 20 ...
|
# SteamPrefill benchmark run -c 20 ...
|
||||||
#
|
#
|
||||||
# After the benchmark run, inspect with:
|
# After the benchmark run, inspect with:
|
||||||
|
# make validate-check # full /metrics + hit/miss fields + /lancache-heartbeat
|
||||||
|
# # or, manually:
|
||||||
# curl -s http://localhost/metrics
|
# curl -s http://localhost/metrics
|
||||||
|
# curl -s -i http://localhost/lancache-heartbeat # GET, not HEAD
|
||||||
#
|
#
|
||||||
# Tweak sizes upward if you want to run very large workloads while still
|
# Tweak sizes upward if you want to run very large workloads while still
|
||||||
# exercising the disk tier (workload >> RAM is ideal for real disk testing).
|
# exercising the disk tier (workload >> RAM is ideal for real disk testing).
|
||||||
|
|||||||
Reference in New Issue
Block a user