https://github.com/omalloc/tavern
đ A high-performance CDN caching engine written in Go, designed for ultra-low latency content delivery and multi-level cache eviction strategies.
https://github.com/omalloc/tavern
caching cdn go http http-cache http-proxy
Last synced: 10 days ago
JSON representation
đ A high-performance CDN caching engine written in Go, designed for ultra-low latency content delivery and multi-level cache eviction strategies.
- Host: GitHub
- URL: https://github.com/omalloc/tavern
- Owner: omalloc
- License: mit
- Created: 2025-11-20T07:13:58.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-01-30T12:11:59.000Z (12 days ago)
- Last Synced: 2026-01-31T05:17:56.882Z (11 days ago)
- Topics: caching, cdn, go, http, http-cache, http-proxy
- Language: Go
- Homepage: https://tavern.omalloc.com
- Size: 5.52 MB
- Stars: 12
- Watchers: 0
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Tavern
Tavern is a high-performance HTTP caching proxy server implemented in Go. It leverages a modern service framework to deliver a flexible architecture, strong extensibility, and excellent performance.
Other languages: [įŽäŊ䏿](README.zh-CN.md)
## ⨠Features
- **Core Caching Capabilities**:
- [x] Prefetch
- [x] Cache Push (URL/DIR Push)
- [x] URL mark expired
- [x] URL cache file delete
- [x] DIR mark expired
- [x] DIR cache file delete
- [x] Fuzzy refresh (Fuzzing fetch)
- [x] Auto refresh
- [x] Cache validation
- [ ] Hot migration
- [ ] Warm/cold split
- [x] Upstream collapse request (request coalescing)
- [ ] ~~Image compression adaptation (WebP support)~~
- [x] Vary-based versioned cache (Vary cache)
- [x] Headers rewrite
- [x] Multiple Range requests support
- [x] CacheFile verification (CRC checksum / EdgeMode)
- **Modern Architecture**:
- Built on the **Kratos** framework for high extensibility and module reuse
- **Plugin System**: Extend core business logic via plugins
- **Storage Layer**: Decoupled storage backend with memory, disk, and custom implementations
- **Reliability & Operations**:
- **Graceful Upgrade**: Zero-downtime config reload and binary upgrade
- **Failure Recovery**: Built-in panic recovery and error handling
- **Observability**: Native Prometheus metrics and PProf profiling
- **Traffic Control**:
- Header rewrite (Rewrite)
- Upstream load balancing (via custom Selector)
## Ecosystem
- Cache CRC verification service: [CRC-Center](https://github.com/omalloc/trust-receive)
## đ Quick Start
### Requirements
- Go 1.24+
- Linux/macOS (Graceful restart may be limited on Windows)
### 1. Fetch & Configure
Clone the repository and prepare the configuration file:
```bash
git clone https://github.com/omalloc/tavern.git
cd tavern
# Initialize with example configuration
cp config.example.yaml config.yaml
```
### 2. Run the Service
**Development mode:**
```bash
# Loads config.yaml from the current directory by default
go run main.go
```
**Build and run:**
```bash
make build
./bin/tavern -c config.yaml
```
### 3. Debugging & Monitoring
Once started, you can monitor and debug using the following (ports depend on `config.yaml`):
- **Metrics**: Access `/metrics` for Prometheus metrics (default prefix `tr_tavern_`)
- **PProf**: When debug mode is enabled, visit `/debug/pprof/` for profiling
## đ§Š Project Structure
- `api/`: Protocol and interface definitions
- `conf/`: Configuration definitions and parsing
- `plugin/`: Plugin interfaces and implementations
- `proxy/`: Core proxy and forwarding logic
- `server/`: HTTP server implementation and middleware
- `storage/`: Storage engine abstractions and implementations
## đ Documentation
- PURGE design and operations: [docs/purge.md](docs/purge.md)
## đ License
[MIT License](LICENSE)
## đ Acknowledgments
This project integrates and is inspired by the following excellent open-source projects. Many thanks:
- **[Kratos](https://github.com/go-kratos/kratos)**: A powerful microservice framework that inspired Tavern's modern architecture.
- **[Pebble](https://github.com/cockroachdb/pebble)**: A high-performance key-value store by CockroachDB, powering efficient persistent caching.
- **[tableflip](https://github.com/cloudflare/tableflip)**: Cloudflare's graceful upgrade solution enabling zero-downtime restarts.
- **[Prometheus Go Client](https://github.com/prometheus/client_golang)**: Strong observability support for metrics.
