Skip to main content
HydroGo
ReliabilityEngineering guarantees

Engineering guarantees

How HydroGo keeps data correct when networks, processes and third parties misbehave: outbox, idempotency, retries, dead letters, tenant isolation and a hash-chained audit log.

This page names the mechanisms HydroGo uses to stay correct under failure. Each row says what the mechanism does and where it lives, so you can check it in the code or the linked decision record.

Consistency and delivery

MechanismWhat it does
Transactional outboxEvents such as content.updated and site.updated, and webhook deliveries, are written to the outbox_events table inside the same database transaction as the change. A worker delivers them afterwards, so a crash never leaves a change without its event (decision 0009).
Idempotent checkoutA client-supplied idempotency key is bound to the cart that used it. Retrying the same checkout returns the same order; reusing the key for a different cart is rejected with a conflict.
Retries with exponential backoffThe notification outbox doubles its delay after every failed attempt, starting at 1 second and capped at 1 hour by default. The mail transport retries with bounded exponential backoff too.
Leased jobs and dead lettersBackground jobs are claimed with a lease and then acknowledged, or returned with a retry time. Jobs that keep failing are set aside as dead letters for operator review and can be requeued from the admin.
Reconciliationhydro commerce reconcile, and a background sweep that runs every five minutes, look for stale pending orders, payment notifications that arrived without flipping an order, and stock-reservation drift.
Stampede protectionConcurrent public reads of the same content share one lookup instead of each hitting the database.

Isolation and integrity

MechanismWhat it does
Tenant isolationApplication-layer tenant-scoped query filters (RequireTenantScope) across SQLite, MySQL, and PostgreSQL, backed on PostgreSQL by forced row-level security (RLS) that fails closed (decision 0032).
Hash-chained audit logEvery audit event is linked into a per-tenant hash chain (prev_hash, chain_hash). hydro audit verify recomputes the chains and exits non-zero when they do not add up; a head printed earlier can be used as an anchor to prove the chain was not truncated.

Architecture

MechanismWhat it does
Single binaryThe server, the embedded Svelte admin and the static assets compile into one executable.
Database abstractionOne data layer over SQLite, PostgreSQL and MySQL, with a migration per dialect.
Compile-time safetyWritten in Go: type errors are caught when the binary is built, not while it serves requests.
Provider interfaces and add-on modulesPayment, shipping and invoicing sit behind small interfaces. Add-on modules plug in at build time and own their config sections through config extensions (decision 0036); core runs without them.

AI-native control plane

hydro mcp serves the Model Context Protocol over stdio, and the HTTP/SSE endpoint exposes the same tools (schema_list, schema_apply, content_query, content_mutate). Tool calls run inside the caller's tenant scope and are recorded in the audit log. See the MCP guide.

Performance benchmarks & test conditions

All benchmarks below were measured on an Oracle Cloud Linux ARM64 VPS (`4 vCPU aarch64`, `23 GiB RAM`) with competing application services stopped during the run. CPU percentages are reported across 4 vCPUs (400% max).

1. Staged stress test: JSON API vs Embedded HTML vs Node SSR (--capacity-profile standard)

Compiled hydro binary (48 MB at the time; the current release is ~63 MB, SQLite WAL, --capacity-profile standard -> DBMaxOpenConns=10, MaxInFlightHTTP=300), 5-second sustained stages over 127.0.0.1 loopback. Idle baseline: Go `108.3 MB` RSS, Node SSR `57.3 MB` RSS.

Workload (What was served)ConcurrencyThroughputLatency (p50 / p95 / p99)CPU & RAM Footprint
GET /healthz (Go router)324,925 req/s (0 err)5.81 / 13.21 / 17.77 msGo 126% CPU, 169 MB RSS
GET /healthz (Go router)5124,462 req/s (0 err)101.4 / 235.8 / 317.6 msGo 144% CPU, 114 MB RSS
GET /api/v1/pages (JSON + SQLite)323,198 req/s (0 err)8.91 / 20.18 / 27.23 msGo 144% CPU, 115 MB RSS
GET /api/v1/pages (JSON + SQLite)2563,071 req/s (0 err)73.89 / 171.9 / 232.8 msGo 145% CPU, 106 MB RSS
GET /api/v1/site/themes (JSON + SQLite)322,323 req/s (0 err)12.58 / 27.77 / 35.88 msGo 158% CPU, 128 MB RSS
GET /api/v1/site/themes (JSON + SQLite)2562,132 req/s (0 err)105.7 / 249.5 / 329.8 msGo 170% CPU, 128 MB RSS
GET / Embedded HTML (embed.FS)323,060 req/s (0 err)9.19 / 23.41 / 32.02 msGo 178% CPU, 133 MB RSS
GET / Embedded HTML (embed.FS)2562,915 req/s (0 err)73.34 / 202.7 / 290.0 msGo 185% CPU, 127 MB RSS
GET / Node SSR (calls Themes + Pages API)321,604 req/s (0 err)18.53 / 34.91 / 45.54 msGo 185% / 121 MB, Node 4.6% / 89 MB
GET / Node SSR (calls Themes + Pages API)2561,570 req/s (0 err)153.9 / 254.9 / 313.1 msGo 181% / 108 MB, Node 12.0% / 160 MB

At c=512 (> MaxInFlightHTTP=300 in standard profile), HydroGo intentionally sheds excess concurrent requests with 503 fast-fail backpressure (1,739 req/s served on /api/v1/pages, 888 req/s on /) instead of queuing and exhausting RAM.

2. SQLite WAL vs PostgreSQL 16 & PublicHTMLCache (wrk -t2 -c128 -d5s)

Measured with wrk (epoll, 2 threads, 128 connections, 5s, 0 non-2xx errors) on the same Oracle ARM64 VPS (--capacity-profile standard):

Backend / ModeEndpointThroughputp50p99
SQLite WALGET /healthz4,724 req/s25.16 ms74.70 ms
SQLite WAL (uncached JSON)GET /api/v1/pages?locale=en3,141 req/s37.83 ms116.28 ms
PostgreSQL 16 (uncached JSON)GET /api/v1/pages?locale=en3,153 req/s37.82 ms113.56 ms
SQLite WAL (uncached JSON)GET /api/v1/site/themes3,421 req/s34.76 ms105.17 ms
PostgreSQL 16 (uncached JSON)GET /api/v1/site/themes3,482 req/s34.31 ms103.27 ms
SQLite WAL (PublicHTMLCache ON)GET / (HTML)5,471 req/s21.58 ms78.71 ms
PostgreSQL 16 (PublicHTMLCache ON)GET / (HTML)5,581 req/s21.10 ms76.00 ms

3. k6 & tools/bench production-profile runs (Oracle Linux ARM64 VPS)

Workload / ToolThroughputLatency / MemoryNotes
k6 public/commerce reads (250 req/s)250 req/sp95 0.48 ms0.00% error rate
k6 public/commerce burst (19,372 reqs)1,500 req/sp95 0.56 ms (max 7.9 ms)0.00% error rate
tools/bench read workload2,499.5 req/s-0% error rate
tools/bench concurrent writes864.3 req/sp95 99.96 ms0% error rate + 20/20 SSE
Go binary RSS footprint (idle / burst)-~105 MB RSS idle / 108-186 MB (stress)Go + Node SSR cgroup peak 186.5 MB
Loopback benchmarks isolate Go HTTP routing, middleware, JSON/HTML serialization, and database overhead without WAN latency, TLS termination, or external payment gateway calls (in real-world checkout bursts, external payment APIs and worker pools become the bottleneck before HTTP serving).
Some features in this list are available only with the add-on modules or Hydro Cloud (coming soon). The mechanisms above are part of the core.