Benchmarks

Performance Benchmarks

Benchmark results comparing PMTiles vs MBTiles performance in tileserver-rs

tileserver-rs is designed for high-performance vector tile serving. This page documents benchmark results for both PMTiles and MBTiles sources.

Test Environment

  • Hardware: Apple Silicon (M-series) MacBook
  • Runtime: All servers running in Docker containers (ARM64 native)
  • Test Tool: autocannon (Node.js HTTP benchmarking)
  • Configuration: 100 concurrent connections, 10 seconds per endpoint

Test Data

SourceFileAreaZoom RangeSize
PMTilesprotomaps-sample.pmtilesFlorence, Italy0-156.3 MB
MBTileszurich_switzerland.mbtilesZurich, Switzerland0-1434 MB

Summary Results

SourceAvg Requests/secAvg ThroughputAvg Latency
PMTiles1,047 req/s93.18 MB/s171ms
MBTiles1,133 req/s92.62 MB/s181ms

Both formats deliver ~93 MB/s throughput with 1,000+ requests/second under heavy load (100 concurrent connections).

Detailed Results by Zoom Level

PMTiles (Florence, Italy)

ZoomLocationRequests/secThroughputAvg LatencyP99 Latency
z0World23697.88 MB/s461ms1,190ms
z4Europe40395.51 MB/s264ms607ms
z8Italy1,07191.72 MB/s99ms191ms
z10Tuscany1,29089.81 MB/s81ms158ms
z12Florence1,67593.62 MB/s62ms119ms
z14City Center1,60590.54 MB/s63ms121ms

MBTiles (Zurich, Switzerland)

ZoomLocationRequests/secThroughputAvg LatencyP99 Latency
z0World3,44189.82 MB/s29ms55ms
z4Europe99089.84 MB/s104ms207ms
z8Switzerland42692.90 MB/s252ms669ms
z10Zurich Region59092.33 MB/s180ms361ms
z12Zurich City1,08891.47 MB/s97ms191ms
z14City Center26699.37 MB/s425ms1,166ms

Analysis

Key Insights

  • Throughput is consistent at ~90-100 MB/s regardless of zoom level
  • Latency scales with tile size - low zoom (large tiles) = higher latency
  • High zoom requests are fastest - z10-z14 achieve 1,000-3,400 req/s

PMTiles Performance

  • Consistent performance across zoom levels
  • Best at city zoom (z12-z14): 1,600+ req/s with 62ms latency
  • Memory-mapped file access provides predictable performance

MBTiles Performance

  • Fastest at z0: 3,441 req/s with only 29ms latency
  • SQLite overhead more visible at high-detail tiles (z14: 425ms)
  • Good for local development and smaller datasets

Format Comparison

AspectPMTilesMBTiles
Best forProduction, CDN, cloudDevelopment, local
ConsistencyMore predictableVariable by tile size
High-zoom perfExcellentGood
Low-zoom perfGoodExcellent

Running Benchmarks

To reproduce these benchmarks with fair Docker-to-Docker comparison:

# Build tileserver-rs Docker image for your platform
docker build -t tileserver-rs:local .

# Update benchmarks/docker-compose.yml to use local image
# Then start all servers
docker compose -f benchmarks/docker-compose.yml up -d

# Run benchmarks
cd benchmarks
bun install
node run-benchmarks.js --duration 10 --connections 100

Benchmark Options

# Test only PMTiles
node run-benchmarks.js --format pmtiles

# Test only MBTiles  
node run-benchmarks.js --format mbtiles

# Test specific server
node run-benchmarks.js --server tileserver-rs

# Longer test with more connections
node run-benchmarks.js --duration 30 --connections 200

# Generate markdown report
node run-benchmarks.js --markdown

Server Comparison

We benchmarked tileserver-rs against martin and tileserver-gl using the same test data. All servers ran in Docker containers on ARM64 for a fair apples-to-apples comparison.

PMTiles Performance (Florence, Italy)

ServerAvg Req/secAvg LatencyThroughput
tileserver-rs1,37280ms90 MB/s
tileserver-gl1,14893ms75 MB/s
martin781,252ms9 MB/s

tileserver-rs is ~20% faster than tileserver-gl and ~17x faster than martin for PMTiles serving.

MBTiles Performance (Zurich, Switzerland)

ServerAvg Req/secAvg LatencyThroughput
tileserver-rs751188ms90 MB/s
martin722154ms155 MB/s
tileserver-gl712194ms85 MB/s

All three servers perform similarly for MBTiles (within ~5% of each other).

Feature Comparison

Featuretileserver-rstileserver-glmartin
LanguageRustNode.jsRust
PMTiles
MBTiles
PostGIS
Raster Rendering✅ Native✅ Node
Static Images
PMTiles Req/sec1,3721,14878
MBTiles Req/sec751712722

tileserver-rs provides the best balance: fastest PMTiles performance (~20% faster than tileserver-gl, 17x faster than martin), native MapLibre rendering for raster tiles, and static image generation - all in a single binary.

Optimization Tips

  1. Use release builds - cargo build --release is 10-50x faster than debug
  2. Use PMTiles for production - cloud-native, HTTP range request friendly
  3. Use MBTiles for development - easy to generate and inspect with SQLite tools
  4. Enable compression - gzipped tiles reduce bandwidth significantly
  5. Use CDN caching - tiles are immutable, cache with long TTLs
  6. Match connections to cores - more connections than CPU cores adds overhead