Performance Benchmarks
tileserver-rs is designed for high-performance tile serving. This page documents benchmark results for PMTiles, MBTiles, PostgreSQL, and Cloud Optimized GeoTIFF (COG) 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
| Source | File | Area | Zoom Range | Size |
|---|---|---|---|---|
| PMTiles | protomaps-sample.pmtiles | Florence, Italy | 0-15 | 6.3 MB |
| MBTiles | zurich_switzerland.mbtiles | Zurich, Switzerland | 0-14 | 34 MB |
| PostgreSQL | benchmark_points table | Zurich, Switzerland | 0-14 | 50,000 points |
| COG | benchmark-rgb.cog.tif | World (Web Mercator) | 0-22 | 90 MB |
Summary Results
| Source | Avg Requests/sec | Avg Throughput | Avg Latency |
|---|---|---|---|
| PMTiles | 1,047 req/s | 93.18 MB/s | 171ms |
| MBTiles | 1,133 req/s | 92.62 MB/s | 181ms |
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)
| Zoom | Location | Requests/sec | Throughput | Avg Latency | P99 Latency |
|---|---|---|---|---|---|
| z0 | World | 236 | 97.88 MB/s | 461ms | 1,190ms |
| z4 | Europe | 403 | 95.51 MB/s | 264ms | 607ms |
| z8 | Italy | 1,071 | 91.72 MB/s | 99ms | 191ms |
| z10 | Tuscany | 1,290 | 89.81 MB/s | 81ms | 158ms |
| z12 | Florence | 1,675 | 93.62 MB/s | 62ms | 119ms |
| z14 | City Center | 1,605 | 90.54 MB/s | 63ms | 121ms |
MBTiles (Zurich, Switzerland)
| Zoom | Location | Requests/sec | Throughput | Avg Latency | P99 Latency |
|---|---|---|---|---|---|
| z0 | World | 3,441 | 89.82 MB/s | 29ms | 55ms |
| z4 | Europe | 990 | 89.84 MB/s | 104ms | 207ms |
| z8 | Switzerland | 426 | 92.90 MB/s | 252ms | 669ms |
| z10 | Zurich Region | 590 | 92.33 MB/s | 180ms | 361ms |
| z12 | Zurich City | 1,088 | 91.47 MB/s | 97ms | 191ms |
| z14 | City Center | 266 | 99.37 MB/s | 425ms | 1,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
| Aspect | PMTiles | MBTiles |
|---|---|---|
| Best for | Production, CDN, cloud | Development, local |
| Consistency | More predictable | Variable by tile size |
| High-zoom perf | Excellent | Good |
| Low-zoom perf | Good | Excellent |
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 PostgreSQL table sources
node run-benchmarks.js --format postgres
# Test PostgreSQL function sources
node run-benchmarks.js --format postgres_function
# Test COG/raster sources
node run-benchmarks.js --format cog --connections 10
# 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)
| Server | Avg Req/sec | Avg Latency | Throughput |
|---|---|---|---|
| tileserver-rs | 1,409 | 79ms | 92 MB/s |
| tileserver-gl | 1,274 | 91ms | 81 MB/s |
| martin | 53 | 1,783ms | 6 MB/s |
tileserver-rs is ~10% faster than tileserver-gl and ~26x faster than martin for PMTiles serving.
MBTiles Performance (Zurich, Switzerland)
| Server | Avg Req/sec | Avg Latency | Throughput |
|---|---|---|---|
| martin | 876 | 128ms | 179 MB/s |
| tileserver-gl | 756 | 198ms | 89 MB/s |
| tileserver-rs | 736 | 188ms | 90 MB/s |
All three servers perform competitively for MBTiles. Martin leads on throughput due to in-memory caching; tileserver-rs and tileserver-gl are within ~3% of each other.
PostgreSQL Performance (Zurich Points)
Benchmarks run in isolation (fresh DB for each server) to ensure fair comparison.
| Server | Avg Req/sec | Avg Latency | Throughput |
|---|---|---|---|
| tileserver-rs | 3,337 | 316ms | 273 MB/s |
| martin | 3,149 | 212ms | 269 MB/s |
tileserver-rs matches martin's PostgreSQL performance with connection pool pre-warming and prepared statement caching. Both servers show similar throughput at ~270 MB/s.
PostgreSQL by Zoom Level (tileserver-rs vs martin)
| Zoom | tileserver-rs | martin | Winner |
|---|---|---|---|
| z10 | 58 req/s | 104 req/s | martin |
| z11 | 120 req/s | 124 req/s | ~tie |
| z12 | 617 req/s | 422 req/s | tileserver-rs (+46%) |
| z13 | 2,796 req/s | 2,867 req/s | ~tie |
| z14 | 13,097 req/s | 12,230 req/s | tileserver-rs (+7%) |
PostgreSQL Optimizations
tileserver-rs includes several PostgreSQL performance optimizations:
- Connection pool pre-warming - All connections established at startup
- Prepared statement caching - Tile queries pre-prepared on all connections
- ST_TileEnvelope margin - PostGIS 3.1+ margin parameter for better tile edge clipping
- SRID-aware envelope transformation - Transform tile envelope to table SRID instead of every geometry
- Moka-based tile cache - LRU cache with configurable size and TTL
Feature Comparison
| Feature | tileserver-rs | tileserver-gl | martin |
|---|---|---|---|
| Language | Rust | Node.js | Rust |
| PMTiles | ✅ | ✅ | ✅ |
| MBTiles | ✅ | ✅ | ✅ |
| MLT (MapLibre Tiles) | ✅ | ❌ | ✅ |
| PostGIS | ✅ | ❌ | ✅ |
| Raster Rendering | ✅ Native | ✅ Node | ❌ |
| Static Images | ✅ | ✅ | ❌ |
| PMTiles Req/sec | 1,409 | 1,274 | 53 |
| MBTiles Req/sec | 736 | 756 | 876 |
| PostGIS Req/sec | 3,337 | - | 3,149 |
tileserver-rs provides the best balance: fastest PMTiles performance (~10% faster than tileserver-gl, 26x faster than martin), competitive PostgreSQL performance (matches martin), native MapLibre rendering for raster tiles, static image generation - all in a single binary.
COG/Raster Performance
tileserver-rs supports Cloud Optimized GeoTIFF (COG) serving with on-the-fly reprojection and PNG encoding via GDAL.
Test Configuration
- COG File: 4096x4096 RGB image in Web Mercator (EPSG:3857)
- Connections: 10 concurrent (COG processing is CPU-intensive)
- Output: 256x256 PNG tiles
COG Benchmark Results (tileserver-rs)
| Zoom | Requests/sec | Throughput | Avg Latency | P99 Latency |
|---|---|---|---|---|
| z0 | 2 req/s | 276 KB/s | 2,568ms | 4,343ms |
| z1 | 7 req/s | 1 MB/s | 1,349ms | 2,261ms |
| z2 | 20 req/s | 3.4 MB/s | 478ms | 1,177ms |
| z3 | 38 req/s | 7.6 MB/s | 258ms | 595ms |
Key Observations
- Latency scales with tile complexity - Lower zoom levels read more data from the COG
- Higher zoom = faster - z3+ tiles achieve 38+ req/s with sub-300ms latency
- CPU-bound - COG processing (GDAL read + PNG encode) limits throughput
- LZW compression - The benchmark COG uses LZW compression; uncompressed COGs are faster
Running COG Benchmarks
# Test COG performance only
node run-benchmarks.js --format cog --connections 10
# Compare with TiTiler (Python COG server)
docker compose -f benchmarks/docker-compose.yml up -d titiler tileserver-rs
node run-benchmarks.js --format cog --server tileserver-rs
node run-benchmarks.js --format cog --server titiler
TiTiler Comparison
The benchmark suite includes TiTiler for COG comparison:
| Server | Avg Req/sec | Avg Latency | Notes |
|---|---|---|---|
| tileserver-rs | 15 req/s | 1,613ms | GDAL-based, Rust |
| TiTiler | TBD | TBD | Rio-tiler/GDAL, Python |
Run
docker compose -f benchmarks/docker-compose.yml up -dto start both servers for comparison.
Optimization Tips
- Use release builds -
cargo build --releaseis 10-50x faster than debug - Use PMTiles for production - cloud-native, HTTP range request friendly
- Use MBTiles for development - easy to generate and inspect with SQLite tools
- Enable compression - gzipped tiles reduce bandwidth significantly
- Use CDN caching - tiles are immutable, cache with long TTLs
- Match connections to cores - more connections than CPU cores adds overhead
- For COG serving - use internal tiling and overviews for faster access