Config
A store runs on the numbers in KeepBlox.defaults. The store option config overrides any of them
for that store’s profiles:
const store = KeepBlox.store("Profiles", { template = TEMPLATE, config = { renew = 120, death = 300 },})The defaults are measured against the library’s simulation scenarios and the ProfileStore baseline. Change them only for a reason you can name.
Fields
Section titled “Fields”Renewal and crash loss
Section titled “Renewal and crash loss”| Field | Default | Meaning |
|---|---|---|
renew |
300 | Seconds between an owner’s writes of a profile. Every write renews the lease and saves the data if it changed. What a crash can lose meanwhile is covered by the MemoryStore snapshot in each beat, so this sets the data store cost (at 300 s, about 13 reads and 13 writes per player-hour), not the loss. |
renewFallback |
30 | Seconds between writes of a profile no MemoryStore snapshot covers (too large, holding buffers, or MemoryStore down). For such a profile, this is the most play a crash can lose. |
heartbeat |
4 | Seconds between a server’s MemoryStore beats. Each beat carries the snapshots of its changed profiles and picks up hand-over requests. |
snapshotBytes |
1000 | Bytes a profile’s snapshot in MemoryStore may take at every beat: its whole data up to this size, or for a larger profile its edits since it was stored. The experience’s MemoryStore holds about 1.2 KB per player in all. |
snapshotTtl |
900 | Seconds a server’s MemoryStore entry, with its snapshots, outlives its last beat: how late after a crash a player can come back and still get them. |
Taking over a key
Section titled “Taking over a key”| Field | Default | Meaning |
|---|---|---|
death |
605 | Seconds a newcomer waits on a lease that does not move before it takes the key from a KeepBlox owner it believes dead. Used only when the owner’s MemoryStore beat cannot be read. Only the newcomer’s own clock measures it. |
profileStoreSteal |
40 | Seconds after its first hand-over request that a newcomer takes a key from a ProfileStore owner, as ProfileStore itself does (its SESSION_STEAL). |
profileStoreDead |
630 | A ProfileStore owner whose LastUpdate is this many seconds old is dead (ProfileStore’s ASSUME_DEAD). |
Calls and loads
Section titled “Calls and loads”| Field | Default | Meaning |
|---|---|---|
loadTimeout |
120 | Seconds a load may take in all before it fails with "timeout", every step counted: waiting for this server’s own release, the import, the claim and waiting on the owner, settling a trade. While the server’s budget is spent, a load waits for it within this time, and its later tries leave 10 requests of each kind to saves. Shared stores also retry a call for at most this long. |
callTimeout |
20 | Seconds a single data store or MemoryStore call may take before it counts as failed. |
backoffMin |
1 | The first retry delay, in seconds, for a hand-over poll or a failed call. |
backoffMax |
5 | The longest retry delay; each delay doubles from backoffMin up to this. |
Size and shutdown
Section titled “Size and shutdown”| Field | Default | Meaning |
|---|---|---|
writeBytesPerMinute |
3145728 (3 MB) | Bytes of data one key may write a minute. A larger profile saves its data less often on renewals. Roblox allows 4 MB. See Large profiles. |
shutdownDeadline |
25 | Seconds a shutdown (or store:close()) waits for releases before it gives up. Roblox allows 30 for BindToClose. |
Resolve rules
Section titled “Resolve rules”A store resolves its config when it is opened, and raises an error on a bad one:
- Every name must be one of the fields above; an unknown name is an error.
- Every value must be a positive number.
deathmust be at least twicerenew, so a slow owner is never mistaken for a dead one.backoffMinmust not exceedbackoffMax.renewFallbackis capped atrenew: a fallback slower than the renewal itself would be no fallback. This one is adjusted, not refused.
KeepBlox.store("Profiles", { template = TEMPLATE, config = { renew = 400 } })-- error: KeepBlox: death must be at least twice renewRaising renew therefore means raising death with it.
Shared stores
Section titled “Shared stores”KeepBlox.shared takes the same config option and the same rules. It uses loadTimeout,
callTimeout, backoffMin and backoffMax.