Skip to main content
ALTCHA®

Performance & sizing

This page shows how fast one Sentinel replica answers its widget and feature endpoints, explains which work costs CPU and memory, and lists the settings that change it. For the minimum and production sizes of a replica, see Sizing.

Benchmark setup

One Sentinel 2.0.0-beta.1 container ran on an AWS c7a.medium (1 vCPU, 2 GiB, compute-optimized) with an external Redis ([redis] nodes). A separate client with 4 CPUs in the same network sent the requests over HTTP.

  • Concurrency 1 and 16. For each scenario and concurrency, the client sent 50 warm-up requests, then timed 1,000 requests with 1 or 16 in flight at a time. Every request succeeded.
  • Throughput is successful requests per second (req/s) over the measurement. Latency is the round trip measured by the client, in milliseconds, from sending a request until its response body was read.
  • Widget key. A public key whose security group keeps the default PBKDF2 pow.cost, so GET /v2/challenge derives every challenge at production cost, but sets a low pow.counter so the client could solve challenges quickly. Challenges were fetched and solved before each verify measurement, unmeasured.
  • Feature key. A restricted key in a security group without rules, for POST /v2/verify/signature and the feature endpoints.
  • Fixed inputs. The request bodies rotate through a short list of IPs, emails, texts, time zones, and user agents, so lookups hit Sentinel's caches and the classifier sees repeated texts. Results for unique traffic can be lower.
  • Production path. Every request went through request logging, rate limiting, and penalties, as in production; the rate limit was raised so the benchmark didn't hit it. No similarity model was configured.

Results

Widget endpoints

GET /v2/challenge derives a key for every challenge at the default PBKDF2 cost. POST /v2/verify checks a solution and records it for replay protection; the "with fields" rows also send form fields (email, message) and a time zone, which the classifier scores. POST /v2/verify/signature is the server-side check of a verified payload.

EndpointConc.req/sp50 (ms)p90 (ms)p99 (ms)
GET /v2/challenge112940.720.730.85
GET /v2/challenge16151110.3410.9011.24
POST /v2/verify125320.330.340.60
POST /v2/verify1644253.644.155.05
POST /v2/verify with fields18621.121.301.72
POST /v2/verify with fields16103814.9818.6626.32
POST /v2/verify/signature131950.250.260.29
POST /v2/verify/signature1669441.872.583.25

Classifier and feature endpoints

EndpointConc.req/sp50 (ms)p90 (ms)p99 (ms)
POST /v2/classifier17781.241.441.67
POST /v2/classifier1690917.8520.3925.70
POST /v2/ip121650.340.381.66
POST /v2/ip1637594.194.415.34
POST /v2/threat126250.330.340.36
POST /v2/threat1638314.144.195.41
POST /v2/language113000.760.901.06
POST /v2/language16152410.5611.2722.68
POST /v2/user-agent135460.220.240.26
POST /v2/user-agent1666672.282.433.59
POST /v2/time-zone149020.150.160.18
POST /v2/time-zone16123461.041.151.54
POST /v2/phishing148540.160.160.18
POST /v2/phishing16116281.091.223.38
POST /v2/eml (small message)19021.081.241.45
POST /v2/eml (small message)16105914.8118.1026.29

With remote [ip_resolver] providers, an uncached IP or threat lookup also waits for the provider.

Reading the results

  • Challenge derivation is CPU-bound. On 1 vCPU, GET /v2/challenge went from 1294 to 1511 req/s between 1 and 16 concurrent requests, while its p50 latency grew from 0.72 to 10.34 ms: the requests queued for the CPU. More vCPUs, with [pow] cpus raised to match, derive more challenges at once.
  • Verification is cheap. POST /v2/verify checks a solution and records it in Redis for replay protection, and POST /v2/verify/signature checks a signature; both served several times the challenge rate.
  • Classification is the expensive part of a verification. Sending form fields to classify cut POST /v2/verify from 4425 to 1038 req/s at 16 concurrent, close to POST /v2/classifier alone (909 req/s).
  • Cached lookups are fastest. user-agent, time-zone, and phishing answered in under 4 ms at p99 with 16 concurrent requests.

These numbers use the default PBKDF2 cost, a fixed set of inputs, and a single 1-vCPU replica. Use compute-optimized instances, as Sizing recommends, measure your own traffic mix before you size a cluster, and watch each replica's CPU and memory in Monitoring.

Where CPU and memory go

WorkCostControlled by
Challenge derivation (GET /v2/challenge, POST /v2/challenge)CPU for every challenge, in proportion to pow.cost.pow.cost and pow.algorithm in the security group; [pow] cpus caps parallel derivations.
Memory-hard algorithms (ARGON2ID, SCRYPT)CPU plus the memory cost per derivation: pow.memoryCost for ARGON2ID (default 65536 KiB), pow.cost for SCRYPT. Peak memory is about [pow] cpus × memory cost.[pow] max_memory_cost (default 262144 KiB) caps the memory cost of every rule.
Classification (POST /v2/classifier, POST /v2/verify with fields)CPU for language detection, text checks, and campaign tracking.The security group's classifier rules.
Local similarity model ([similarity] provider = "local")About 135 MB to download (a 118 MB int8 ONNX model and a 17 MB tokenizer). Each session holds its own copy of the model in memory, and every embedding uses CPU.[similarity.local] sessions and threads; [similarity] max_chunks.
AI decider ([classifier.ai])Outbound requests to the model provider, not local CPU.[classifier.ai] max_concurrency, queue_timeout, timeout.
Request logsA database write per batch of logged requests, for keys with request logging on.[request_logs], or ClickHouse.

When to add Redis

Add an external Redis or Valkey ([redis] nodes or [redis.sentinel]) when:

  • you run more than one replica, which requires it; see Clustering;
  • POST /v2/verify or POST /v2/verify/signature carries real traffic: each verification writes a replay-protection key and every request updates rate-limit counters, which the built-in KV store writes to the main database;
  • your main database is a network database and you want to keep per-request KV writes off it.

The benchmark above ran with an external Redis. A single small replica with light traffic works with the built-in KV store.

When to add ClickHouse

Request logs are buffered and written to the main database in batches, and raw logs are kept for [request_logs] retention (default 72h). Move them to ClickHouse when many API keys log requests at high volume, when you want to keep raw logs longer than a few days, or when log writes and queries compete with the main database. See ClickHouse.

Tuning settings

KeyEffect
[pow] cpusChallenge derivations at once (default: half the CPUs). Raise to the vCPU count when challenges dominate.
[pow] max_memory_costCaps the memory of one ARGON2ID or SCRYPT derivation.
[redis] nodesMoves replay protection, rate limits, and penalties from the database to Redis.
[redis] synchronousBuilt-in KV store on SQLite: normal skips the per-commit disk sync for faster writes, at the risk of losing the last writes on a power loss.
[database] sqlite_journal_modeEmbedded SQLite file: keep the default wal, where reads don't wait for writes. delete, where reads and writes block each other, is only for network storage; see SQLite on network storage.
[database] pool_min, pool_maxDatabase connections per replica (defaults 2 and 20). The database sees up to pool_max × replicas.
[database] acquire_timeoutHow long a request waits for a free connection before it fails.
[api_key_cache] enabled, max_keys, refresh_intervalKeeps API keys, security groups, and accounts in memory so widget requests skip the database. Raise max_keys above your key count.
[request_logs] flush_interval, batch_sizeHow often and in what batch size buffered logs are written. Larger batches mean fewer writes.
[rate_limit] memory_max_keysMemory bound of the in-memory rate-limit fallback while the KV store is down.
[similarity.local] sessions, threadsParallel embeddings; each session adds a copy of the model in memory.
[similarity] queue_timeoutWait for a free model session before EMBEDDING_UNAVAILABLE.
[classifier.ai] max_concurrency, queue_timeoutConcurrent AI requests and the wait for a free slot.

Start typing to search...

↑ ↓ Navigate ↵ Select