Capacity & Cost — monolith on VPS at 1.000 accounts
Workload as you stated it: 500 tx/day/account × 1.000 accounts = 500.000 tx/day, plus 100 API pulls/s. All prices Dec 2026, EUR→IDR at 17.800.
1. First, the arithmetic check
| Quantity | Your figure | Reality |
|---|---|---|
| Transactions | 500 tx/day/acct × 1.000 | 500.000/day = 5,8 tx/s average, peak ~23 tx/s (4× burst) |
| "500 pulls every 5 seconds" | 100 req/s | 8,64 juta req/day = 259,2 juta req/mo — that is a read rate, not a transaction rate |
| If 500 tx per 5s were real | — | 100 tx/s = 8,6 juta tx/day = 17× your own total. Contradiction. So 100/s must be reads |
That distinction is the whole cost story: writes are tiny (5,8/s), reads are 100× larger. Optimise reads, never the write path.
2. What 100 reads/s costs on each architecture
| Design | Monthly | Notes |
|---|---|---|
| Cloudflare Workers API | $5 + $74,76 requests + $25,32 CPU = $105 ≈ Rp1.681.000 | 259M req/mo blows past the 10M included tier; 5ms CPU each |
| Monolith, 2× CX32 (4 vCPU/8 GB, +20% backup) | Rp290.496 | 5,8× cheaper; 100 rps ≈ 1–2 cores |
| Monolith, 2× CX42 (8 vCPU/16 GB) | Rp700.608 | headroom for 5.000 accounts + robots |
| Monolith, 1× CX32 + CF free proxy | Rp121.040 | no HA; survives 100 rps easily |
| Monolith, 1× CX22 + CF free | Rp67.462 | tight with Postgres + 12 browsers in 4 GB |
| Managed Postgres (Neon Scale $69) | Rp1.104.000 | unnecessary — the DB does 5,8 writes/s |
Your instinct is correct at these numbers. Edge compute is the wrong shape for sustained 100 rps: Workers price requests, a VPS prices capacity. VPS wins by ~5,8× and removes the per-request anxiety entirely.
Caveat: egress 494 GB/mo (2 KB/resp) — inside Hetzner's 20 TB. Zero egress on CF is irrelevant at this volume.
3. Component load on one CX32
| Component | Load at 1.000 accts | Verdict |
|---|---|---|
| Postgres writes | 5,8/s (23/s peak) | trivial — a laptop handles it |
| Postgres reads | 100/s point + range queries, 2–5 ms each | ~0,3–0,5 core with indexes; PgBouncer for connections |
| FastAPI/uvicorn | 100 rps async, 2 KB JSON | ~1 core |
| Robots (Playwright) | 1.000 accounts @5 min = 3,3 sessions/s × 3,5 s = 12 concurrent browsers | 2–3 cores + 2–3 GB — the real CPU consumer |
| Disk I/O | 0,45 GB/day written (~0,02 MB/s) | irrelevant vs SSD IOPS |
| Network | ~18 GB/day egress | irrelevant |
Bottleneck order: robots → CPU, then Postgres read latency, then everything else. The API is not the problem.
4. Storage is the only line that grows
| Horizon | Rows | On-disk (300 B + 2× index overhead) |
|---|---|---|
| 1 month | 15 juta | ~13,5 GB |
| 1 year | 182,5 juta | ~164 GB |
| 3 years | 547 juta | ~493 GB |
Volume at €0,044/GB → ~Rp391.600/mo at 500 GB. That will exceed the compute bill. Controls:
- Narrow the hot table:
tenant_id, account_id, posted_at, direction, amount, balance, ext_ref, hash. PushrawJSON to R2/compressed columnar, not Postgres. - Partition by
hash(tenant_id)(16–32 partitions) — retention becomesDROP PARTITION, notDELETE. - BRIN index on
posted_at, btree on(account_id, posted_at DESC)only. No index on every column. - Archive >12 months to compressed Parquet on R2 (query rarely, keep legally).
- Hetzner volume instead of local SSD only when you exceed the plan disk — volume is cheaper per GB than upgrading the whole box.
Realistic 3-year storage with archiving: ~180–220 GB hot, rest in R2 at ~$0,015/GB (≈Rp2.100/mo for 500 GB compressed).
5. Failover design for a monolith (your clone plan)
CX32 primary (Jakarta-facing via SGP latency 20–40 ms)
├─ Postgres 16, streaming replica → CX32 standby (async)
├─ WAL archive → R2 every 60 s (point-in-time, 7 days)
└─ nightly pg_dump → R2 + weekly restore drill
DNS: Cloudflare A record, TTL 60
Health: Worker cron /healthz every 30 s → 3 fails → Cloudflare API flips A record to standby
| Property | Value |
|---|---|
| RPO | 5–30 s (async replica) / 0 for committed tx on primary |
| RTO | 2–5 min automated flip; 15 min manual promotion |
| Cost | +Rp121k/mo (second CX32) + ~Rp15k R2 |
| Ops | monthly failover drill (unannounced), promotion runbook 1 page |
Do not run synchronous replication across the public internet — commit latency dies. Async + WAL archive is the correct trade for this product.
6. Two cheats that cut the bill 20–50× later
Even on a VPS, 100 rps is wasteful because clients poll for data that changes 5,8 times/s across the whole platform — per account it changes 500/day = once every 173 s.
?since=<cursor>+ ETag — most polls return 304 or empty; a cached response costs microseconds of CPU.- Batch endpoint — 1 request for 50 accounts turns 100 rps into 2 rps.
- Snapshot files —
GET /accounts/{id}/snapshot.jsonserved from filesystem/Caddy file_serverwithCache-Control: max-age=60→ nginx/Caddy answers without touching Python.
With those three, the same 1.000 accounts need ~5 rps at the app, and a single CX22 would carry it. But build on CX32 anyway: the robots need the headroom.
7. Recommendation
| Phase | Hardware | Monthly | Trigger |
|---|---|---|---|
| Now | 1× CX32 + CF free proxy + R2 backups | ~Rp135k | launch |
| First SLA contract | + CX32 standby (streaming replica + DNS flip) | ~Rp290k | tenant demands 99,9% |
| 5.000 accounts | CX42 pair or add a robot node | ~Rp700k–1jt | robots saturate CPU |
| 20.000 accounts | split ingestion node from API/DB node | ~Rp1,5jt | connect timeout risk |
Ops time (≈6 h/mo at Rp200k/h = Rp1,2jt) still exceeds hosting by 4× at the CX32 tier. Automate the failover drill and backups or the staff cost becomes the real bill.
8. Measured before trusting
Before signing an SLA, run these on the actual box (one evening):
pgbenchcustom script: INSERT 500k rows/day equivalent, read query at 200 rps → confirm <10 ms p95.k6/vegeta: 200 rps for 10 min on/v1/mutations?since=with 50 concurrent clients → confirm p95 <50 ms, no memory growth.- Playwright soak: 12 concurrent sessions for 30 min → measure RSS; the browser farm is what will actually fall over.
- Failover drill: kill primary mid-write, time the DNS flip, verify no committed row lost.
Do not buy the CX42 pair until one of those numbers fails.