Skip to content
/ bobr Public

bóbr is a content delivery edge with multi-origin support and image transformations

License

Notifications You must be signed in to change notification settings

azuradara/bobr

Repository files navigation

bóbr - multi-origin content delivery edge

DEPENDENCIES
  - Go 1.25+
  - libvips libwebp libheif

BUILD
  make

RUN
  bobr [command]

  server  -c <file>   Start server (default)
  migrate <file>      Migrate v1 config to v2
  purge   <prefix>    Purge cache objects
  version             Print version

CONFIG
  See config/config.yaml. Structure:

  listen: :7040
  logger: { level: debug }
  cache:  { dir: .cache, db_dir: .db, max_size: 256MB, max_object_size: 4MB }
  
  hosts:
    example.com:
      bustable: true
      transforms:
        optimize: true
        lossless: false
        resize:   true
        resize_presets: { sm: 100 }
      origins:
        - name:   s3-main
          prefix: /
          type:   s3
          transforms: { optimize: false } # Override
          config: { bucket: ..., endpoint: ..., region: ..., access_key: ..., secret_key: ... }

TRANSFORMS (URL params)
  ?width=N    Resize to width
  ?height=N   Resize to height
  ?crop=X     Crop (center, top, bottom, left, right)

MOTIVATION
  Needed a cheap and fast alternative to paying for a CDN.

BENCHMARKS
  commit: 12d1b36
  cpu: AMD Ryzen 9 7900X

  internal/transform
  Resize_Small-24               2,104        5,917,798 ns/op          1,863 B/op    10 allocs/op
  Resize_Medium-24                853       13,520,179 ns/op         98,360 B/op     8 allocs/op
  Crop_Center-24                  895       13,436,635 ns/op         98,360 B/op     8 allocs/op
  Parallel-Resize_Small-24      7,580        1,456,246 ns/op          1,868 B/op    10 allocs/op
  Parallel-Resize_Medium-24     6,924        1,562,902 ns/op         98,363 B/op     8 allocs/op
  Parallel-Crop_Center-24       7,296        1,549,709 ns/op         98,361 B/op     8 allocs/op
  Optimize-24                      99      113,957,334 ns/op        688,176 B/op     7 allocs/op
  OptimizeParallel-24           1,458        7,686,340 ns/op        688,185 B/op     7 allocs/op

  internal/cache
  Set-24                       546,896          18,533 ns/op          3,512 B/op    45 allocs/op
  Get_Hit-24                 1,000,000          10,230 ns/op          3,626 B/op    39 allocs/op
  Get_Miss-24                8,760,471           1,308 ns/op            728 B/op    15 allocs/op
  Set_Parallel-24              842,605          15,412 ns/op          4,398 B/op    45 allocs/op
  Get_Hit_Parallel-24          984,109          11,951 ns/op          3,726 B/op    40 allocs/op
  Get_Miss_Parallel-24       8,001,622           1,432 ns/op            733 B/op    15 allocs/op

About

bóbr is a content delivery edge with multi-origin support and image transformations

Topics

Resources

License

Stars

Watchers

Forks