Skip to content
/ tavern Public

๐Ÿš€ A high-performance, distributed CDN caching engine written in Go, designed for ultra-low latency content delivery and multi-level cache eviction strategies.

License

Notifications You must be signed in to change notification settings

omalloc/tavern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

77 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Tavern

Build Status GoDoc codeCov Report Card License

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: ็ฎ€ไฝ“ไธญๆ–‡

โœจ Features

  • Core Caching Capabilities:
    • Prefetch
    • Cache Push (URL/DIR Push)
      • URL mark expired
      • URL cache file delete
      • DIR mark expired
      • DIR cache file delete
    • Fuzzy refresh (Fuzzing fetch)
    • Auto refresh
    • Cache validation
    • Hot migration
    • Warm/cold split
    • Upstream collapse request (request coalescing)
    • Image compression adaptation (WebP support)
    • Vary-based versioned cache (Vary cache)
    • Headers rewrite
    • Multiple Range requests support
    • 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)

๐Ÿš€ 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:

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:

# Loads config.yaml from the current directory by default
go run main.go

Build and run:

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

๐Ÿ“ License

MIT License

๐Ÿ™ Acknowledgments

This project integrates and is inspired by the following excellent open-source projects. Many thanks:

  • Kratos: A powerful microservice framework that inspired Tavern's modern architecture.
  • Pebble: A high-performance key-value store by CockroachDB, powering efficient persistent caching.
  • tableflip: Cloudflare's graceful upgrade solution enabling zero-downtime restarts.
  • Prometheus Go Client: Strong observability support for metrics.

About

๐Ÿš€ A high-performance, distributed CDN caching engine written in Go, designed for ultra-low latency content delivery and multi-level cache eviction strategies.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages