Multi-Database Sync
Multi-Database Sync
Section titled “Multi-Database Sync”One of Walsync’s key advantages is efficiently syncing multiple SQLite databases from a single process.
Configuration
Section titled “Configuration”Create a walsync.toml to define multiple databases:
[storage]bucket = "my-bucket"endpoint = "https://fly.storage.tigris.dev"
[[databases]]path = "/data/users.db"prefix = "users"
[[databases]]path = "/data/orders.db"prefix = "orders"
[[databases]]path = "/data/analytics.db"prefix = "analytics"Then start watching all databases:
walsync watch --config walsync.tomlHow It Works
Section titled “How It Works”Shared Resources
Section titled “Shared Resources”Walsync maintains a single:
- S3 client with connection pooling for all uploads
- File watcher that monitors all database WAL files
- Configuration context loaded once at startup
Per-Database Isolation
Section titled “Per-Database Isolation”Each database still gets:
- Its own S3 prefix (namespace)
- Independent WAL tracking
- Separate checksum verification
- Individual restore capability
Memory Efficiency
Section titled “Memory Efficiency”┌─────────────────────────────────────┐│ Walsync Process │├─────────────────────────────────────┤│ Shared S3 Client (~20MB) ││ File Watcher (~5MB) ││ ───────────────────────────── ││ Database 1 state (~500KB) ││ Database 2 state (~500KB) ││ Database 3 state (~500KB) ││ ... │└─────────────────────────────────────┘Adding more databases adds minimal overhead (~500KB-1MB each).
Use Cases
Section titled “Use Cases”Multi-Tenant Applications
Section titled “Multi-Tenant Applications”Each tenant gets their own SQLite database:
[[databases]]path = "/data/tenants/acme.db"prefix = "tenants/acme"
[[databases]]path = "/data/tenants/globex.db"prefix = "tenants/globex"Microservices
Section titled “Microservices”Each service manages its own database:
[[databases]]path = "/data/auth.db"prefix = "services/auth"
[[databases]]path = "/data/billing.db"prefix = "services/billing"Edge Deployments
Section titled “Edge Deployments”Containers or edge nodes with multiple databases:
[[databases]]path = "/app/cache.db"prefix = "edge/node-1/cache"
[[databases]]path = "/app/sessions.db"prefix = "edge/node-1/sessions"Restoring Individual Databases
Section titled “Restoring Individual Databases”Restore any single database without affecting others:
walsync restore --prefix orders -o /data/orders-restored.dbOr restore all databases:
walsync restore-all --config walsync.toml --output-dir /data/restored/