Skip to content

Storage Selection and Benchmarks

This page focuses on backend selection guidance and benchmark data.

For backend capabilities and connection format examples, see Storage Backends.

Storage Backend Selection Guide

Selection by Deployment Scale

toml
# config.toml ([database].database_url)
[database]
# Small scale (< 10,000 links)
# database_url = "sqlite://./shortlinks.db"

# Medium scale (10,000 - 100,000 links)
# database_url = "sqlite://./shortlinks.db"
# Or use MySQL/MariaDB
# database_url = "mysql://user:pass@host:3306/db"

# Large scale (> 100,000 links)
# database_url = "postgresql://user:pass@host:5432/db"
# Or use MySQL/MariaDB
# database_url = "mysql://user:pass@host:3306/db"

Selection by Use Case

toml
# config.toml ([database].database_url)
[database]
# Development environment
# database_url = "sqlite://./dev.db"

# Testing environment
# database_url = ":memory:"

# Production environment (single machine)
# database_url = "sqlite:///data/shortlinks.db"

# Production environment (cluster)
# database_url = "postgresql://user:pass@cluster:5432/shortlinker"

Selection by Concurrency Requirements

toml
# config.toml ([database].database_url)
[database]
# Low concurrency (< 100 QPS)
# database_url = "sqlite://shortlinks.db"

# Medium concurrency (100-1000 QPS)
# database_url = "sqlite://shortlinks.db"
# Or MySQL/MariaDB
# database_url = "mysql://user:pass@host:3306/db"

# High concurrency (> 1000 QPS)
# database_url = "postgres://user:pass@host:5432/shortlinker"

Performance Benchmark Data

Read Performance (Single Query Latency)

Storage TypeAverage LatencyP95 LatencyP99 Latency
SQLite0.1ms0.3ms0.8ms
PostgreSQL0.2ms0.5ms1.2ms
MySQL0.15ms0.4ms1.0ms
MariaDB0.15ms0.4ms1.0ms

Write Performance (Including Click Counting)

Storage TypeTPSBatch WriteClick Count TPS
SQLite1,00010,0005,000
PostgreSQL10,000100,00050,000
MySQL8,00080,00040,000
MariaDB8,50085,00042,000

Concurrent Performance (50 Concurrent Users)

Storage TypeQPSError RateAverage Response Time
SQLite2,000< 0.1%25ms
PostgreSQL15,000< 0.01%3ms
MySQL12,000< 0.01%4ms
MariaDB12,500< 0.01%4ms

📊 Test Environment: 4-core 8GB memory, Docker container based

Released under the MIT License