Deploy¶
Stateless fdyno processes serve the DynamoDB API. One FoundationDB cluster stores all data and decides which failures the deployment survives; more fdyno processes only remove fdyno as a single point of failure.
flowchart LR
accTitle: Load-balanced fdyno processes share one FoundationDB cluster
accDescr: Clients go through a load balancer. TLS may terminate there or in fdyno. Each fdyno process uses the same FoundationDB cluster.
C["AWS SDK clients"] --> LB["Load balancer<br/>(TLS here or in fdyno)"]
LB --> D1["fdyno"]
LB --> D2["fdyno"]
LB --> D3["fdyno"]
D1 --> F[("FoundationDB cluster")]
D2 --> F
D3 --> F
A process holds only connections, in-flight requests and metrics; replace it at any time.
Requirements¶
- FoundationDB 7.3, and its 7.3.x client library on each fdyno host. The OCI image includes client 7.3.77.
- Linux on
amd64orarm64for the release binaries and image. - One FoundationDB database per deployment. fdyno uses fixed directory names. Two deployments on one database share all tables and state.
- Clock synchronization. See clocks.
Install¶
To build from a checkout, run scripts/release/build-in-container.sh.
It builds reproducible Linux binaries, tarballs and an OCI image; see the
packaging guide.
For Kubernetes, the
Helm chart
sets the production profile, probes, drain timing and a writable cluster file,
and expects a proxy to terminate TLS.
Set up FoundationDB¶
fdyno adds no replication: pick FoundationDB's redundancy mode, coordinators
and failure domains for the failures you must survive. The
topology guide
has tested foundationdb.conf layouts for one and three hosts.
fdyno pins FoundationDB 7.3.77 and API version 730. To change the FoundationDB
version, follow change the FoundationDB version.
Change the FoundationDB version¶
This changes the FoundationDB server and client library, not fdyno's store format.
| Rule | Why |
|---|---|
| Keep API version 730. | fdyno selects 730 (fdb_, fdbget.h). 7.3 and 7.4 libraries both support it. Do not raise it until every cluster the process can reach runs the new version (multi-version client). |
| Change the client library before the Go binding. | The binding refuses a library older than its own header version. A 7.4 binding (header 740) needs a 7.4 libfdb_c; a 7.3 binding works with either. |
One libfdb_c per image. |
The OCI image and the release tarballs carry one library. A 7.3 → 7.4 change needs the second library added to the image or mounted. |
Restart every fdbserver process together, for a 7.3 patch change too. |
7.3 → 7.4 changes the wire protocol, so a 7.4 process cannot join a 7.3 cluster. 7.3.52 moved fields in the transaction-log commit and lock messages (#11697, #11705), so a 7.3.51 and a 7.3.77 process can misread each other. |
| Plan no downgrade from 7.4. | FoundationDB does not support downgrades between minor versions (administration). After the 7.4 restart, rollback means restoring a backup. |
The server packages stop and start FoundationDB when they install, so a
host-by-host package install creates a mixed-version window. Stage the new
fdbserver instead:
- Take a FoundationDB backup.
- Copy the new
fdbserverto a versioned path on every host, without the package scripts. - In the
[general]section offoundationdb.conf, setkill_on_configuration_change = falseon every host. Otherwisefdbmonitorrestarts each process as soon as its configuration changes. - Point
command =at the new binary on every host. - Restart every process at once with
fdbcli --exec 'kill; kill all; sleep 5'. Without thesleep,fdbclican exit before the kill requests leave, and nothing restarts. Expect a recovery. Then check the binary of eachfdbserverPID on each host (readlink /proc/<pid>/exe) andcluster.processes[].versioninstatus json, and send one client request. Do not repeat the kill within a minute: a 7.3.51fdbmonitorcan then hold every process down for its restart delay (default 60 s); a 7.3.77 or laterfdbmonitorrestarts a killed process at once. SendSIGTERMonly to anfdbserverstill on the old binary. - Leave
kill_on_configuration_change = falseuntil every process runs the new version. Setting it back totruerestarts every process on that host, so set it back one host at a time and wait for a healthystatusbetween hosts. Install the server packages only after every process runs the new binary. - Check
fdbcli status,/readyzon every fdyno process andfdyno_ambiguous_commit_outcomes_total(unknown write outcomes).
For a 7.3 patch change, roll fdyno to the new client library one process at a time, before or after step 5. 7.3 → 7.4 is one-way; get a verified backup and the cluster owner's approval first:
- Give every fdyno process both libraries: its primary
libfdb_cand the other version throughFDB_NETWORK_OPTION_EXTERNAL_CLIENT_LIBRARYorFDB_NETWORK_OPTION_EXTERNAL_CLIENT_DIRECTORY. Keep API version 730. - Roll the fdyno processes. List the client addresses that support 7.3 but
not 7.4, and continue only when the list holds only
fdbclior tool sessions. A stopped client can stay listed for up to 11 minutes.
fdbcli --exec 'status json' | jq -r '[.cluster.clients.supported_versions[] | select(.protocol_version | startswith("fdb00b073")) | .connected_clients[].address] - [.cluster.clients.supported_versions[] | select(.protocol_version | startswith("fdb00b074")) | .connected_clients[].address] | .[]'
- Stage 7.4 and restart every
fdbserverat once (steps 2 to 7 above). An attempt in flight can fail withcluster_version_changed(1039); after commit submission its outcome is unknown, like1021(retries inside a request). - When the cluster is stable on 7.4, roll fdyno again without the 7.3
library. A process that starts without a library for the cluster's
protocol exits 1 with
FoundationDB client library check failed.
Before 7.4, also check: TLS host-name validation is on by default in 7.4 (#12730); the 7.3.77 and 7.4 Go bindings panic on a fatal network-thread error; and for multi-Region, 7.4.8 and earlier lack the remote log-prefix barrier fix (see the Region-rebuild warning).
Enable storage consistency scanning¶
Once the cluster is healthy, enable FoundationDB's native scan from an
operator host. Set SCAN_MAX_BYTES_PER_SECOND to a positive read budget and
SCAN_INTERVAL_SECONDS to a positive target round duration. The rate cap can
make a round take longer than the target.
fdbcli -C /etc/foundationdb/fdb.cluster --exec \
"consistencyscan on restart 0 maxRate ${SCAN_MAX_BYTES_PER_SECOND:?set a positive rate} targetInterval ${SCAN_INTERVAL_SECONDS:?set a positive interval}"
fdbcli -C /etc/foundationdb/fdb.cluster --exec 'consistencyscan'
Confirm consistency_scan_enabled = 1. Check scan progress and foreground
latency under load. See Storage replica consistency.
Roles, disks and failure domains¶
Plan fdyno processes and FoundationDB processes separately. A FoundationDB
process has one main thread. Separating role groups lets them use different
cores. It does not add disk or network capacity. Check the recruited roles
in fdbcli --exec 'status json': a configured process class is not proof that
FoundationDB recruited that process for the role you intended.
| Role | What to size and verify |
|---|---|
| Commit and read-version proxies, resolvers and cluster services | Give stateless work CPU headroom. Check actual proxy and resolver recruitment. |
| Transaction logs | Check the current log set against the durability policy. Budget for commit load, queue growth and log spill during recovery, not only the quiet disk use. |
| Storage | Budget per-process caches and memory limits against host RAM, including the OS and any colocated fdyno processes. Verify the actual data directories are on the intended volumes. Watch storage queues and free space during load and recovery. |
| Coordinators | Place them so a majority survives the target failure. A surviving coordinator majority does not by itself supply a writable log set or full data replication. |
Multiple storage processes on one disk can use more cores, but share its IOPS and bandwidth. Processes on the same host share one host failure domain; adding processes there does not add replicas in other domains. If you change processes per host, compare at the same workload, item count and redundancy. Check CPU, disk and memory together before calling the new layout faster.
On large hosts, keep a storage process's cache-memory at or below about
55% of its memory. In one paired EC2 bulk-load comparison with Redwood
(run aws-20261118-c4w-wall, pre-v0.1 build d0c0c7ae, one run per setting),
storage processes with cache-memory of about 12 GiB of memory = 14.25GiB
kept reaching their limit and restarting. At 7.75GiB, none restarted, and
peak use was 79% of the limit. This is a starting point, not a general bound; check resident memory under your own
load (memory per process).
See the tested role layouts and memory budget.
Surviving an AZ loss¶
For a deployment across three availability zones, use three_data_hall.
Set locality-data_hall to the AZ and locality-zoneid to the host. Use nine
coordinators (three per AZ) and logs=4. With triple and one zone per AZ,
FoundationDB cannot place three log replicas in the two zones left, so it
stops accepting commits. One AWS run per mode used FoundationDB 7.3.51 and
ssd-redwood-1. Each run had six i4i.2xlarge storage hosts and i4i.xlarge
log hosts (six for three_data_hall, three for triple). It also had three
c7i.2xlarge hosts each for stateless roles, the API and clients:
| Failure, FoundationDB across 3 AZs | three_data_hall |
triple with zoneid = AZ |
|---|---|---|
| One AZ stopped | Stayed available. Largest write gap 5.5 s. | Unavailable until the lost hosts were replaced, about 8 minutes. |
| One storage disk wiped, host replaced | No write gap over 1.2 s. | No write gap over 1.2 s. |
| Coordinator quorum lost for 30 s | Write gap of about 40 s. Recovered by moving the coordinators. | The same. |
| Acknowledged writes lost / audited | 0 / 38,355 | 0 / 75,334 |
One fault per kind and mode is not an availability SLA, and these finite journals do not establish a zero-loss guarantee.
Storage engine. Use RocksDB (ssd-rocksdb-v1) for new clusters. See storage engine and disks.
Encryption at rest. fdyno does not encrypt stored values. Configure encryption in FoundationDB or on its disks.
Multi-region¶
Use one region-configured FoundationDB cluster, not independent clusters. fdyno has no global tables. The tested data DCs were us-east-2 and us-west-2. The third Region, us-east-1, hosted a coordinator in both shapes and satellite logs only in shape B.
| Region | Role |
|---|---|
| us-east-2 | Data DC; satellite logs in shape A |
| us-west-2 | Data DC |
| us-east-1 | Coordinator; satellite logs in shape B |
The runs used FoundationDB 7.3.51 and Redwood. Each data DC had six
i4i.2xlarge storage hosts, three i4i.xlarge log hosts, three c7i.2xlarge
stateless hosts and three c7i.4xlarge API hosts. Satellite logs used two
i4i.xlarge hosts. The
API PutItem baselines and whole-Region fault records
had one run per shape. Each run used concurrency 16, a 1,024-byte data field,
a 10 s warmup, a 60 s baseline measurement and one whole-Region fault. They
used pre-v0.1 build 8b4533f9 with default cluster version 3, in campaign
aws-20261117-c5-box-final.
| Shape | Satellite logs | API ops/s; p99 | Whole-region failover / failback |
|---|---|---|---|
| A | Primary region | 2,491; 14.42 ms | 21.65 s, forced recovery / 1,009.51 s |
| B | Third region | 395; 46.49 ms | 13.85 s, no forced recovery / failback guard not met in this run |
Failover includes primary confirmation and five successful Put/Get probes; failback includes replacement boot, rebuild and quiet movement. The API fault journals lost 0/5,635 acknowledged writes for A and 0/5,103 for B. B missed the 1,800 s quiet-movement guard while available and fully replicated; its final repair journal was not audited. Small-data, single-fault results do not guarantee async zero loss, an SLA or 5 TB recovery.
Shape B's zero-loss observation covers loss of the primary Region while its third-Region satellite logs survive. Only the original primary has a satellite policy in this layout. After promotion, the west DC has reduced Region-loss durability; its new writes lack that cross-Region synchronous log protection until a symmetric policy is configured. No zero-loss claim extends through a second Region loss or failback.
On FoundationDB 7.3, usable_regions=1 stops satellite recruitment for new
log generations, even if the region configuration still lists satellites.
Writes acknowledged in those generations are kept in one Region only.
A surviving current B+cb log set at usable_regions=2 continues to protect
new writes before the operator starts reconstruction. Permanently lost
storage can require the degraded 2 -> 1 -> 2 procedure. Follow the
Region-rebuild runbook:
it records the B-only exposure, restored satellite quorum and later full
remote replica separately. A reset to 1 is not continuous cross-Region protection.
Unsafe Region rebuild on FoundationDB 7.3.51 and 7.3.77
Do not use repopulate_anti_quorum to rebuild a lost Region on this pin.
It lacks the remote log-prefix barrier fix:
old transaction-log generations can be discarded before the rebuilt Region's
logs have copied them. This warning comes from code analysis, not an observed loss.
The cluster file¶
FoundationDB rewrites the cluster file when coordinators change; if fdyno
cannot, a restart after the old coordinators retire can fail. At startup fdyno
checks that it can create and rename a file in that directory: development
mode warns, the production profile stops unless
DYNODB_FDB_CLUSTER_FILE_READONLY_OK=1.
In a container, point FDB_CLUSTER_FILE at a copy in a directory the process
user can write. In Kubernetes, copy the ConfigMap into an emptyDir, as the
Helm chart does. With the FoundationDB operator, use its <cluster>-config
ConfigMap (key cluster-file). The operator updates it after a coordinator
change.
First start¶
Start v0.1 on an empty FoundationDB store. The first process writes the store record: record format 3, cluster version 12. Every table is then in the catalog registry from its creation, so the background workers never scan the catalog.
fdyno supports one store format: record format 3 at cluster version 12, packed item layout. The store format check refuses to start on any other store: an older version (8 to 11 included), another record format, or data without a store record. It exits 1 with "reset the store" and writes nothing. Nothing converts such a store. Keep the old binary on the old store. Move the data into a new store with export and import or dynodb migrate through the API. Check the item size limit before cutover. Do not point an older binary at the new store.
Production profile¶
DYNODB_PRODUCTION_MODE=1 checks the configuration before fdyno opens
FoundationDB or binds a port; a missing or unsafe setting stops startup.
Without it, fdyno uses development defaults, including the public
local/local credential. The profile also rejects requests for
features that fdyno does not implement, with UnsupportedOperationException.
These features are KMS encryption, positive OnDemandThroughput limits (-1 is
accepted), resource policies, Kinesis destinations and Contributor Insights
(compatibility).
This file passes the profile, as a systemd EnvironmentFile= or with
docker run --env-file. Neither format allows a comment after a value.
DYNODB_PRODUCTION_MODE=1
DYNODB_TRUSTED_SINGLE_TENANT=1
# A writable copy of the cluster file
FDB_CLUSTER_FILE=/var/lib/fdyno/fdb.cluster
# A private literal IP for the API; loopback for probes and metrics
DYNODB_LISTEN_ADDR=10.0.1.15:8000
DYNODB_OPS_ADDR=127.0.0.1:9100
DYNODB_CREDENTIALS_FILE=/etc/fdyno/credentials.json
# In-process TLS; or DYNODB_TLS_TERMINATED=1 behind a TLS proxy
DYNODB_TLS_CERT_FILE=/etc/fdyno/tls/server.crt
DYNODB_TLS_KEY_FILE=/etc/fdyno/tls/server.key
DYNODB_MAX_INFLIGHT=256
DYNODB_CDC_TRIM_INTERVAL=2m
DYNODB_TXN_TOKEN_GC_INTERVAL=10m
Create the credentials file before the first
start. To test the profile on one host, run
set -a; . /etc/fdyno/fdyno.env; set +a; dynodb.
The profile requires:
| Setting | Rule |
|---|---|
| Credentials | Custom keys from DYNODB_ or DYNODB_. Secrets of at least 32 bytes. No built-in keys. The file has mode 0600 or 0400 and the process user owns it. |
| Listeners | DYNODB_ and DYNODB_ are private or loopback literal IPs with ports. pprof, if set, is loopback. |
| Metrics | Only on the operations listener. Scrape that address, not the data port. |
| Transport | In-process TLS, or DYNODB_ to state that a proxy terminates TLS. With in-process TLS, a plaintext operations listener must bind loopback. |
| Cluster file | An absolute path that fdyno can replace. |
| Workers | TTL sweep, CDC trim and token GC not turned off. |
| Admission | DYNODB_ is a positive integer. |
| Network | DYNODB_. |
It also refuses invalid values of every configuration variable. It cannot check a TLS proxy, FoundationDB redundancy or your network.
Load balancing and probes¶
Use /readyz for load-balancer membership and /livez for restarts.
| Endpoint | Returns 200 when |
|---|---|
/livez, /healthz |
The process runs. |
/readyz, / |
A FoundationDB read version arrived within two seconds, and the process is not draining. |
Readiness checks access to a read version, not whether a write can commit or
whether the cluster still meets its redundancy goal. Use it to stop routing,
not to trigger a fleet restart. For the probe order and failure messages, see
the first-response runbook. Keep
DYNODB_IDLE_TIMEOUT above the load balancer's.
An admission refusal (DYNODB_MAX_INFLIGHT or the request-body budget) is
HTTP 400 ThrottlingException, as DynamoDB sends it. An L7 proxy that
retried 5xx answers on another backend no longer retries these refusals;
the client's SDK retries them with backoff.
Connection caps¶
The production profile caps open connections at 65,536 for the data listener
and 256 for the separate operations listener. One over the cap is reset
before its request; probes and scrapes use the operations cap. fdyno raises
soft RLIMIT_NOFILE to the hard limit. If that limit cannot fit both caps
plus 256 reserved descriptors, fdyno logs a warning and lowers the data cap.
Raise systemd LimitNOFILE= or container nofile to reach the full data cap.
Development has no connection cap.
Shutdown and restarts¶
On SIGTERM or SIGINT, fdyno drains in three steps:
| Moment | HTTP side | Workers | Why |
|---|---|---|---|
| Signal | /readyz returns 503 |
signal workers to stop; they try to release their worker leases | SIGTERM or SIGINT starts both branches; they run side by side. The delay gives a load balancer that checks readiness time to stop routing. |
| Drain delay | wait DYNODB_ (default 2s) |
||
| Close | stop accepting connections; wait for in-flight requests | The wait lasts up to the operation timeout or five seconds, whichever is longer. | |
| Exit | continue after workers stop or their wait expires | The worker wait ends the operation timeout or five seconds after the signal, whichever is shorter. Shutdown goes on even if workers miss it. |
fdyno does not check that the load balancer stopped routing during the drain delay.
A separate operations listener (DYNODB_OPS_ADDR), if set, stays up
through the delay and the data listener's shutdown, for final scrapes. It
closes after that, before the last wait for the workers.
Each stopping worker tries for up to 2 seconds to release its worker lease.
The release clears the lease only if this process still owns it. fdyno waits
for the workers until the operation timeout or five seconds after the signal,
whichever is shorter. It goes on if some have not stopped. A worker lease
that was not released, or that a process held at SIGKILL, must expire
before a peer takes it.
A request committing at exit can leave an unknown outcome (reliable writes).
Run fdyno under a supervisor that restarts it when it exits: the Helm
chart's Deployment, systemd Restart=on-failure, or
docker run --restart unless-stopped. Some startup checks exit 1 instead
of waiting. A store the store format check
refuses makes every restart exit 1 the same way; reset the store
(first start). A cluster that is down at start makes the process exit after
a 10 s startup check; the
supervisor restarts it until the cluster answers. So does a libfdb_c that
does not speak the cluster's protocol, with an error that names both
versions. If the cluster stops responding after startup, /readyz reports 503.
Background workers¶
Every process runs the background workers. They are TTL sweep, stream trim, automatic stream split, PITR trim, token cleanup, index backfill, table statistics, restore recovery, export, import and backup staging cleanup. A lease in FoundationDB picks one owner per worker. Each worker write checks the lease in its own transaction, so you need not pin workers. TTL deletes have a lease per range, so every process deletes and reclaim grows with the processes.
How a lease fences worker writes¶
Each worker has two keys in FoundationDB: the lease (owner and expiry) and
the epoch (owner and a random nonce). On each tick, a process takes or renews
the lease in one transaction. It takes the lease only when there is none or
the current one has expired by its own clock. The one exception is a lease
written by a clock far ahead; see A clock far ahead. A live renewal by the same
owner keeps the epoch. It creates one for a lease written by a binary
without epochs. Every other acquisition writes a new random epoch. This
includes the same process taking the lease again after a release or expiry
(lease.go).
Every write under a worker's lease fence first reads the epoch key in the same transaction, as a serializable read. It checks the lease owner with a snapshot read. Expiry is not compared with the clock at this point.
The figure below shows a takeover between the epoch read and the commit.
fdyno_lease_fence_rejections_total counts the writes the fence refuses
(lease_fence.go).
Clocks decide when a peer may take the lease; they do not decide which writes
commit.
| Moment | Process A | Process B | Why |
|---|---|---|---|
| A holds the lease | lease, epoch a | ||
| A writes | reads epoch a, then pauses before its commit | The write reads the epoch key in its own transaction. | |
| B takes over | (paused) | the lease expires by B's clock; B takes it, epoch b | In this example the lease expires by B's clock. The epoch change fences A's write. |
| A commits | commit fails | A takeover committed between the epoch read and the commit: the commit conflicts or, when the read is more than five seconds old, fails as too old. | |
| A retries | reads epoch b, not a: write refused | A fence rejection, counted by fdyno_. After a long pause, the pass's time budget can end before any retry. |
| Fact | Value |
|---|---|
| Lease lifetime | max(3 × tick interval,. With on-time renewals, the lease has at least 150 s left immediately before each renewal, so a peer whose clock is ahead by less than that does not take a live lease. A lease counts as live only while its expiry is later than the reader's clock; at equality a peer may take it. |
| Holder keeps the lease | While the gap between its renewals stays within the lease lifetime minus the clock difference: 90 s beyond the tick interval at the one-minute difference this page requires, when the 150 s term sets the lifetime. |
| Graceful shutdown | Releases the lease if it still names this process, with a 2-second timeout. A peer takes it at its next tick. If the release fails, the peer waits for expiry. |
Crash or SIGKILL |
A healthy peer holds the lease within the lease lifetime + clock difference + one tick interval + tick lateness, counted from the holder's last renewal. The lifetime alone is 155 s at a 5-second tick and 210 s at a 1-minute tick. |
| Long restore-recovery pass | The pass is bounded by the operation timeout. With DYNODB_ above about 50 s, a peer can take its lease mid-pass. The fence refuses the old pass's writes; the cost is a handover, not a double write. |
The worker-lease model checks these rules with pauses, crashes, clock differences and late ticks; see how we know. TTL range leases follow the same rules; see TTL. Restore, export and import jobs also hold a lease per job, with its own fence; this section does not cover those.
Clock synchronization¶
Keep the difference between any two fdyno instances within one minute. Use NTP with slewing, not clock steps. fdyno does not check clocks at startup.
Clock differences and steps affect fdyno as follows:
- TTL uses each process's clock minus
DYNODB_TTL_SKEW_MARGIN(one minute), so a clock up to the margin ahead never hides or deletes an item early. An item stays visible for the margin after expiry, and longer on a slow clock. A clock ahead by more than the margin can expire items early. - Stream trimming waits the retention plus
DYNODB_CDC_TRIM_SKEW_MARGIN. The margin must cover the clock difference. - Request signatures are checked against each process's own clock: a
request time more than 15 minutes from it fails with
InvalidSignatureException. See when a clock is off. - A process with a fast clock can take a worker lease early. The lease check still blocks writes from the old owner.
- A worker or job lease (restore, import, export) written by a clock far ahead does not block the other processes for the whole lead. See A clock far ahead.
- A forward step on every clock can make cleanup run early. A backward step can delay cleanup and make a hidden expired item visible again.
A forward clock step can also make garbage collection remove a transaction token too early. It can also make an instance ignore a token that is still stored. A replay or internal retry can then apply the write twice. fdyno does not limit the size of a step.
Cleanup and the instance that serves a replay or retry both apply the 10-minute token test with their own clock. A forward lead of either clock over the writer's clock shortens the replay window by roughly that lead. So a replay near the end of the window can apply twice.
Separately, a lead of more than 10 minutes minus DYNODB_OPERATION_TIMEOUT
can let an internal retry miss the token and apply twice. At the 5-minute
maximum timeout, that lead is 5 minutes. A writer clock behind is the same
case seen from the writer. If it is more than 10 minutes behind the instance
that serves a client retry with the same token, that retry applies again at
once. A write without a token keeps no record. fdyno retries it only when it
is idempotent, so no clock decides whether it applies twice.
The nemesis composite clock-step-back-11m+partition-oneway-fdyno shows
the token case: it steps one fdyno's clock 11 minutes back and drops
FoundationDB's replies to it. Tokened TransactWriteItems applied twice in 4
of 4 seeds
(record).
The 11-minute step exceeds the supported one-minute clock skew.
This can happen even when every host steps together, which keeps the skew between hosts within one minute. Such a step still ages existing tokens.
A host suspend, for example a VM pause, has the same effect on the suspended process. The clocks of the other processes move on by the pause. Its retry budget is measured on the monotonic clock and does not move on. So a retry after a long pause can find its token already removed. Once the suspended process's clock is corrected, the process can treat its token as expired.
A client retry near the end of its window can miss the token after a much shorter pause than an internal retry. Do not rely on the client retry window across a host suspend.
Each request scope reads the clock once for its TTL expiry threshold, so two items in one scope cannot disagree about the time. Time to live lists the scope of every operation.
A clock far ahead¶
A process whose clock runs far ahead writes lease expiries far in the future. If it then stops, the other processes usually take its worker and job leases (restore, import, export) well before that wall time:
- A process treats another owner's lease as implausible when its expiry is
more than the lease lifetime plus 5 minutes past its own clock. The
5 minutes (
leaseClockHorizon) are fixed; there is no setting. - It takes over an implausible lease only if two things hold at the read that takes it. The value is still implausible. It has seen the same value, unchanged, for one full lease lifetime on its own monotonic clock.
- Each renewal writes an expiry strictly larger than the stored one. This holds even when the holder's clock repeats a value (a frozen clock). So a holder that renews within one lifetime always changes the value. This rule never takes its lease, whichever clock is wrong.
- When a holder stops, a peer notes the lease value when it first sees it. One lifetime is 151 seconds for a worker lease at a 1-second interval, and 3 minutes for a job lease. If the value stays unchanged for one lifetime and is still implausible, the peer takes the lease at its next check.
- Otherwise the value has become plausible by then. The lead was less than about 5 minutes plus one lifetime, or the checks were too far apart. The peer can then take the lease by the plain rule, at its first check at or after the stored expiry. The takeover transaction itself can still fail and be retried at a later check.
- A restart of the observing process starts its wait again.
- An expiry never goes down while the same process renews it. So a holder
whose clock was corrected backward keeps its implausible expiry until its
clock catches up with it. Meanwhile
fdyno_worker_lease_implausible_expiry_totalkeeps rising on the other processes. Restart that process. The restart gives it a new owner ID, and its next lease is written from its corrected clock. - A clock stepped back also delays recovery when the holder stops without releasing its lease. This covers a crash. For a restore or PITR restore job, it also covers a normal stop or restart. An import or export run tries to release its lease when it stops normally. If that release fails, the same delay applies.
Take a job lease (PITR restore, restore, import or export) or a worker lease. Its holder steps its wall clock back by S and then stops that way. The lease keeps the expiry it wrote before the step, unless the same process takes the lease again. The stored expiry is then up to S later than after the same stop without a step. Another process may take the lease only at a check at or after it.
The stored expiry can be more than the lease lifetime plus 5 minutes past the peer's clock. Then the peer can take the lease sooner, by the rule above: at its first check at least one lifetime after it first saw the value. The value must be unchanged and still more than the lifetime plus 5 minutes ahead at that check. Late checks, a restart of the peer or a failed takeover transaction delay the actual takeover, as for any takeover. The delay changes only when another process may take the job. The job's recovery and fencing after the takeover are as after any takeover. - Every lease user is fenced. If the old holder was only slow, its next write is refused, and it can take the lease back by the normal rule. - Processes with different worker intervals have different lease lifetimes. A process can take the lease of a holder that renews on time under two conditions. The holder's lifetime is more than twice its own plus 5 minutes. The holder renews less often than the process's own lifetime. The takeover is fenced, and the new holder keeps the lease.
Each new implausible lease value increments
fdyno_worker_lease_implausible_expiry_total and logs a rate-limited warning
with the lead. A takeover by this rule logs a second rate-limited warning; a
takeover by the plain rule does not. The warning cannot tell whether the holder's clock is ahead or
the reader's clock is behind. See
the runbook.
These records also use the writer's clock. A clock far ahead still blocks them for the whole lead, and there is no automatic recovery:
- PITR history. A record stamped by a clock ahead by D stops the PITR trim of its table until D after the retention ends. So the history keeps growing. To recover, turn point-in-time recovery off and on again for the table. This deletes the existing restore window.
- Stream records. The same applies to the stream trim of a shard. To recover, disable the stream.
- Transaction tokens. A
ClientRequestTokenwritten by a clock ahead by D stays live for D plus 10 minutes. In that time it refuses a different request with the same token. There is no operator action; use a new token.
Sizing¶
Capacity planning turns a write and read load into FoundationDB host counts and an hourly price, from measured fleet runs.
- FoundationDB sets the capacity. More processes add HTTP and CPU, not storage or commit capacity.
- Memory. Size fdyno for the request sizes and concurrency you expect. See memory per process.
- Write amplification. Each LSI entry, GSI change record and the stream record add to the write's transaction, within FoundationDB's 10 MB limit.
What one write leaves behind¶
A write stores more than its item. Index entries live as long as the indexed item. The other rows become eligible for cleanup after a set time and stay until a background worker removes them. Take a steady write rate, with cleanup keeping up. A time-retained kind of row then holds about its write rate × its time to eligibility × its size. A cleanup backlog adds to that.
| Leftover | Written when | Eligible for cleanup after | Removed by |
|---|---|---|---|
| Stream record | Every change on a table with a stream | DYNODB_ (24 h) plus DYNODB_ (5 min) |
cdc-trimmer, every 5 min by default (DYNODB_). With off, stream records are never trimmed; the production profile refuses off. |
| Transaction token record | Transact, or a write-mode PartiQL Execute, with a Client |
10 minutes; it no longer replays after that, but stays stored until cleanup | txn-token-gc, every 10 min by default (DYNODB_). The production profile refuses off. |
| PITR undo record | Every change on a table with PITR | The table's recovery period plus DYNODB_ |
PITR trim, always on (every minute). See the cost of PITR. |
| Index entry | Each index whose key attributes the item has | As long as the item | The write that changes or deletes the item |
| TTL expiry-index entry | An item with a valid numeric TTL attribute, TTL on | Its bucket comes due | A write that moves the item to another bucket, removes its TTL attribute or deletes it, when that write knows the old image; otherwise ttl-sweeper (on by default), which clears expired and stale entries |
Sizes, from the encoders. D is a directory prefix; the directory layer assigns it.
| Leftover | Key | Value |
|---|---|---|
| Stream record | D + 21 to 23 bytes: ("vg",. Generation starts at 1. Each of the three numbers takes 1 byte when it is 0 and 2 bytes from 1 to 255, so the first generation with one shard is 21 bytes (stream_) |
An 18-byte header (22 with the compact flags), the keys or, compacted, their names, the images the stream view needs (each framed with a 4-byte length; compacted, the old image can be a delta) and optional identity fields; a large record spills into chunk keys |
| TTL expiry entry | At most a few bytes longer than the item key | — |
The byte counts assume no 00 byte inside a byte string: the tuple
encoding adds one byte for each (cdc_record_codec.go,
ttl_index.go).
Memory per process¶
The bounds below are of three kinds:
- per-process counters: in-flight requests, connections, waiters and the table view;
- per-request size checks: body, head and
BatchGetItem; - a reader count per snapshot backup.
They are not additive memory bounds. None of them caps resident memory. Multiply the per-process ones by the processes on a host. A bound marked "none" has no limit by default; set it for production.
| Bound | Default | What it limits |
|---|---|---|
In-flight requests, DYNODB_ |
None; the production profile requires a value | Signed API requests in progress. Each can hold a body of up to 16 MiB as received; a gzip or deflate body also holds its decompressed copy of up to 16 MiB, plus the decoded request. A Batch can read up to 100 requested items of up to 48,000 bytes each. A request over the limit gets 400 Throttling. |
| Request body budget | DYNODB_ × (16 MiB + 1 byte); none without DYNODB_ |
The body buffers of requests in progress, as received on the wire, also while bodies are read before the signature check. It does not count decompressed copies, decoded requests or responses, so it is not a memory ceiling for the process. A request that finds it spent gets 400 Throttling. |
| Request head | 16 KiB for the request line and 16 KiB for the parsed headers | Above either, the handler answers 400. A head above 68 KiB, which includes 4 KiB of read slack, gets 431 from the parser and the connection closes. |
| Data connections | None; production up to 65,536 | Open data connections. A connection over the cap is reset. |
| Operations connections | None; production 256 | Open operations-listener connections, counted apart from data connections. |
| Same-item waiters | 4,096 per item; 65,536 per process | Writes queued behind a busy item. A write over a bound gets Provisioned. |
| Backup readers | One per backup | Pages are read in key order while staging writes proceed. |
| Per-table view | 1,000 tables | Tables tracked in the per-table view. |
| Go heap floor | 24 MiB | An untouched heap reserve so the collector runs less often. It counts toward GOMEMLIMIT, but it is not a resident-memory minimum. |
See the admission code and the configuration reference.
Processes per host¶
By default, a process uses one FoundationDB client network thread. The
strong GetItem sweep
used three i4i.xlarge storage hosts, three i4i.xlarge log hosts, ssd-2 and
one API host. It ran in campaign aws-20261117-fdbthreads on November 17,
2026. The cluster version and the build commit were not recorded; the build was from before
version 9.
Each row shows the best measured point for its setup.
| Host | Processes | Reads/s | Observation |
|---|---|---|---|
| c7i.xlarge, 4 vCPU | 1 | 53,000 | 79% CPU |
| c7i.xlarge, 4 vCPU | 2 | 61,000 | CPU |
| c7i.2xlarge, 8 vCPU | 1 | 62,000 | Not host CPU (50%); cause not measured in this run |
| c7i.2xlarge, 8 vCPU | 1, two client threads | 63,700 (+3%) | 80% CPU and about twice the p99; that setting is retired |
| c7i.2xlarge, 8 vCPU | 2 | 100,000 | — |
Start with one process per 2 to 4 vCPU and scale with processes. Each process opens one FoundationDB database handle; each read uses its own transaction. See performance to load-test your deployment.
Before you go live¶
- FoundationDB redundancy and coordinators match the failures you must survive.
- The production profile starts on every process.
- A request signed with a custom key works; the
localkey fails. - TLS works end to end.
- Prometheus scrapes the operations listener; the alert rules are loaded.
- Clocks are synchronized.
- A backup was restored and checked.
- Clients retry writes safely.