Skip to main content

GoatDB Benchmarks

GoatDB's benchmarks provide performance comparisons across different platforms and operational modes against SQLite. These help you understand what performance to expect and the tradeoffs involved.

Quick Summary

GoatDB is a memory-first database that loads entire datasets into memory before operations begin. This design trades initial load time for very fast operations once loaded. It's designed for offline-first applications with built-in synchronization and cryptographic security.

Key tradeoffs vs SQLite:

  • Much faster reads once data is loaded (1-2μs vs 10-500μs)
  • Slower initial loading (hundreds of ms for large datasets)
  • Built-in security and synchronization (cryptographically signed commits)
  • Real-time collaboration with automatic conflict resolution

Performance by Platform

System: Apple M4 Pro, 24GB RAM, NVMe SSD
Runtime: node v24.4.1 (darwin arm64)

OperationGoatDBGoatDB-TrustedSQLite
Create instance1.0ms1.2ms112.2μs
Open database (empty)422.4μs379.0μs280.3μs
Open database (100k items)1.1ms840.9μs77.7μs
Create item383.8μs363.2μs229.9μs
Read item by ID0.9μs0.8μs12.4μs
Update item122.2μs90.4μs1.2ms
Bulk create 100 items6.8ms1.8ms674.6μs
Bulk read 100 items193.9μs147.2μs416.4μs
Read 100k items110.3ms417.3ms36.2ms
Simple query377.6μs193.3μs752.1μs
Complex query with sort114.5μs137.1μs742.4μs
Count operation3.1μs1.4μs676.4μs
Keys operation3.3μs2.7μs647.9μs

Understanding the Numbers

GoatDB's Memory-First Design

GoatDB loads the entire dataset into memory before any operations can begin. The "Open database (100k items)" benchmark shows this upfront cost - but this comparison is misleading. SQLite only opens the database file without reading the data, while GoatDB actually loads all 100k items into memory for immediate access.

The numbers above show GoatDB in "durable mode" where every operation explicitly flushes to disk for fair comparison with SQLite's default fsync behavior. This creates an artificially pessimistic view of GoatDB's real-world performance.

When GoatDB Excels
  • Individual reads: 1-2μs vs SQLite's 10-500μs
  • Bulk reads: Processing many items at once
  • Repository operations: count, keys operations are nearly instant
  • Real-time queries: Incremental updates as data changes

In practice, GoatDB doesn't fsync by default. It uses dual-write to both local disk and network peers for redundancy, with explicit flushing available when needed.

Trade-offs to Consider
  • Initial load time: Hundreds of milliseconds for large datasets
  • Memory usage: Entire dataset must fit in memory
  • Batched writes: Operations are grouped with a slight delay, achieving write amplification = 1

Operational Modes

Default Mode: Cryptographically signs every commit with ECDSA P-384 for tamper-proof audit trails and secure multi-peer synchronization. In real-world usage, writes to both local disk and network peers without waiting for fsync, providing eventual durability with crash consistency. The benchmarks above artificially add explicit flushing for fair comparison.

Trusted Mode: Bypasses cryptographic signing for better performance in controlled environments like backend services. Same durability behavior as default mode - the performance gain comes from skipping cryptography, not durability changes.

Architecture Notes

GoatDB is built on an append-only distributed commit graph stored as a JSON log on disk. This design fundamentally differs from SQLite's B-tree approach:

Why GoatDB doesn't need fsync like SQLite:

  • SQLite's B-tree: In-place updates that can corrupt the database if interrupted during writes
  • GoatDB's append-only log: New commits are simply appended; incomplete writes are discarded on restart
  • Corruption immunity: The log truncates to the last valid commit on crash recovery

The benchmarks above show an artificial "durable mode" where GoatDB explicitly flushes after every operation to match SQLite's default fsync behavior. In real-world usage, GoatDB provides:

  • Better write performance without explicit flushing (up to 10x faster)
  • Dual redundancy through concurrent local/network persistence
  • Application-controlled durability via explicit flush when needed

Application-level sharding: Rather than growing single large databases, GoatDB uses multiple medium-sized repositories that sync independently. Each user or data group typically gets its own repository, enabling natural horizontal scaling.

Synchronization Performance

The benchmarks above focus on local database operations. For distributed synchronization between peers, GoatDB exhibits different characteristics:

MetricTypical RangeNotes
Single item sync700-1000msEnd-to-end application latency
Concurrent sync (10 items)1000-1400ms avgWith queuing overhead
Success rate under load>95%10 concurrent operations

These measurements represent end-to-end latency from item creation on one peer to availability on another, including GoatDB's polling-based sync, Bloom filter exchanges, and processing overhead. Network transmission is ~50-200ms of the total.

note

Measurement methodology: Unlike the automated benchmarks above, synchronization performance is measured manually in real-world scenarios. Synchronization currently prioritizes consistency and offline-first design over minimal latency, making GoatDB well-suited for collaborative applications but less optimal for high-frequency real-time scenarios. However, this is expected to improve significantly with the planned sync protocol optimization, which will reduce end-to-end sync latency and make GoatDB more suitable for low-latency and high-frequency use cases in the future.

Fast Mode Comparison

For maximum performance, GoatDB can drop both cryptographic signing and fsync while retaining crash-proof storage and network sync:

GoatDB Fast Mode (no signing, no fsync) vs SQLite with synchronous = OFF

OperationGoatDB-FastSQLite-Fast-Unsafe
Create instance1.1ms65.6μs
Open database (empty)376.1μs314.2μs
Create item18.5μs448.8μs
Read item by ID1.1μs482.2μs
Update item7.1μs633.7μs
Bulk create 100 items2.3ms518.7μs
Bulk read 100 items18.1μs935.0μs
Read 100k items398.5ms133.3ms
Simple query137.7μs678.2μs
Complex query with sort112.8μs591.8μs
Count operation1.7μs474.2μs
Keys operation3.2μs544.0μs
GoatDB Fast Mode

Fast Mode drops both cryptographic signing and fsync but retains dual writes to disk and network. This creates a multi-master embedded cache that is:

  • Memory-first fast: All operations work from memory
  • Crash-proof: Append-only log design prevents corruption
  • Network-synced: Automatic replication to peers
  • Perfect for backend caching: Maximum speed with reliability

GoatDB exposes sync() and flush() methods so applications can control synchronization and durability in the rare cases where explicit control is needed.

SQLite synchronous = OFF risks database corruption on crash, while GoatDB Fast Mode remains crash-proof due to its append-only design.

Detailed Statistics

Expand for detailed percentile breakdowns

GoatDB Default Mode

OperationAveragep95p99Samples
Create instance1.0ms1.1ms1.1ms10
Open repository (empty)422.4μs630.5μs630.5μs3
Open repository (100k items)1.1ms1.3ms1.3ms3
Read 100k items110.3ms124.6ms124.6ms3
Create single item383.8μs445.7μs445.7μs10
Read item by path0.9μs1.3μs1.3μs10
Update item122.2μs157.3μs157.3μs10
Bulk create 100 items6.8ms10.7ms10.7ms10
Bulk read 100 items193.9μs254.5μs254.5μs10
Simple query377.6μs2.0ms2.0ms10
Complex query with sort114.5μs370.6μs370.6μs10
Repository operations: count3.1μs15.2μs15.2μs10
Repository operations: keys3.3μs6.8μs6.8μs10

GoatDB Trusted Mode

OperationAveragep95p99Samples
Create instance1.2ms1.4ms1.4ms10
Open repository (empty)379.0μs507.4μs507.4μs3
Open repository (100k items)840.9μs923.9μs923.9μs3
Create single item363.2μs419.8μs419.8μs10
Read item by path0.8μs1.3μs1.3μs10
Update item90.4μs176.0μs176.0μs10
Bulk create 100 items1.8ms1.9ms1.9ms10
Bulk read 100 items147.2μs159.2μs159.2μs10
Read 100k items417.3ms426.7ms426.7ms3
Simple query193.3μs531.1μs531.1μs10
Complex query with sort137.1μs459.9μs459.9μs10
Repository operations: count1.4μs1.8μs1.8μs10
Repository operations: keys2.7μs5.1μs5.1μs10

SQLite

OperationAveragep95p99Samples
Create instance112.2μs188.5μs188.5μs10
Create table280.3μs403.3μs403.3μs10
Open database (100k items)77.7μs93.7μs93.7μs3
Read 100k items36.2ms39.1ms39.1ms3
Create single item229.9μs298.3μs298.3μs10
Read item by ID12.4μs15.0μs15.0μs10
Update item1.2ms2.5ms2.5ms10
Bulk create 100 items674.6μs707.0μs707.0μs10
Bulk read 100 items416.4μs431.5μs431.5μs10
Simple query752.1μs796.2μs796.2μs10
Complex query with sort742.4μs859.4μs859.4μs10
Count operation676.4μs1.4ms1.4ms10
Keys operation647.9μs749.7μs749.7μs10

Running Your Own Benchmarks

To replicate these results on your machine:

git clone https://github.com/goatplatform/goatdb
cd goatdb
deno task bench

The benchmark suite runs on Deno, Node.js, and Browser environments automatically, providing comprehensive performance data across all supported platforms.