Production / Limits and defaults

Limits and defaults

Every bound and default of TinyStore in one place, by engine. A call past a bound fails with a limit or invalid error that names the bound, and changes nothing. Each engine's guide repeats its own numbers in a table beside the calls they bound, and the chapters of the book link here instead of repeating them.

The store

WhatLimit or default
durability'full' for kv, jobs, sql and blobs; 'os' for records and metrics
memory budgetnone unless set; 1 GiB for tinystore serve --listen
a call waiting for memory10 seconds, then limit
free disk the store keeps1 GiB, keepFree
a time in the future10 minutes ahead of the store's clock
a sidecar with no clientsexits after 30 seconds
command line connections a store opened with cli serves4 at once; the next is told GOAWAY limit
a cli store's closewaits 2 seconds for the command line's calls, then cuts them off
a name of a bucket, queue, stream, database, index, config[a-z0-9][a-z0-9_-]{0,63}

SQL

WhatLimit or default
a transaction5 seconds
rows all or columns holds64 MiB of values, inside a transaction too
one each read5 seconds of one snapshot, then limit naming list
an each ordered by a unique keya new snapshot every 5 seconds, after its last row
rows each holdsa few parts of about 1 MiB
writes in one shared commit1,024, or 8 MiB
values of one statement32,766: an insert or upsert list's rows times columns
readersone per processor, 4 to 16, idle ones close after a minute
a mirror's list, and its scope100,000 rows each
statements compiled per connection128

KV

WhatLimit or default
a key, with its owners1 KiB
a value1 MiB
a page of list1,000 keys
a quotaone to eight windows
rate limits and counters in memory100,000 keys per name, written every second
an idle key's renewalonce a thirtieth of its span has passed
a once run's answer, kept1 day unless keep says

Jobs

WhatLimit or default
attempts10
backofffrom 1 s, doubling, up to 1 h, ±10 % at random
timeout1 minute per run
a lease30 seconds, renewed every 15 while a run lasts
keep of failed jobs7 days
waiting jobs10,000,000 per queue, maxWaiting
an id, a group1 to 1,024 bytes
a value, a step's answer1 MiB of JSON
progress4 KiB of JSON
a page1,000 jobs or 4 MiB
aheadexact to 10,000, then 10,000 and aheadAtLeast

Blobs

WhatLimit or default
a filenone, unless maxFileSize
a path with its folders1 KiB and 16 segments
a content type256 bytes
meta2 KiB in all
a page1,000 files
a file kept as a rowup to 16 KiB; larger ones are files of their own
a set's files togethernone, unless maxSize, which the set keeps
files one write evicts10,000
a use a read recordsonce an hour, or a thirtieth of idle
WhatLimit or default
a document1 MiB
setMany1,000 documents; 16 MiB of JSON
a search's text1 KiB, its first 32 words
a vector4,096 dimensions
limit + offset1,000; limit is 10; a total exact to 10,000
a field's weightabove 0, at most 1,000
a filter8 conditions, 1,000 values; a statement's rows, 100,000
vectorWeight0.5
a table's indexthe rows of one search's hits, 64 MiB together, as one all
store.search1 to 32 indexes; a group's limit + offset 1,000, limit 10; boost above 0, default 1

Channels and locks

WhatLimit or default
a message1 MiB
a branch's logits newest 1,024 messages or 4 MiB
every channel's messages64 MiB of the store's memory
a store's subscriptions10,000
a connection's pending output8 MiB
a lock's wait10 seconds
a lock's ttl, a lease10 seconds in an SDK, 30 in tinystore lock hold, 1 second to 1 hour
a semaphore's limit1 to 1,000
maxHoldnone

Records and metrics

WhatLimit or default
a stream's keep14 days
a logger's buffer1,024 lines, written every second
a page of events1,000, at most 10,000
a list in a records where1 to 1,000 values, each at most 4 KiB
a top or a largest10 answers, at most 1,000
a name's keep in metrics30 days
instruments' writes15 seconds, flush, a read, and close
sets of labels per instrument2,000 between two sends, then __overflow
series in a store100,000
buckets of an aggregate100,000, past it a page at a time
series of a metrics query1,000, past it a page at a time
earlier windows of a compare1,000

Nodes

WhatLimit or default
a link that has not shown its tokenclosed after 10 seconds, or past 64 KiB before it
links that have not shown their tokens yet64 at once

Over the wire

Bun, Node, Python and Go send each call to the core as one request, and get one answer back. The same holds with the core in your own process, in a private child, a sidecar or a remote server.

A request or an answer can be up to 64 MiB. When one is larger than 2 MiB, the frame size the SDK agrees with the core when it connects, the SDK and the core split it into frames and join them on the other side. You don't see this: the engine still gets one request, so a setMany, an append of a list, a batch or a transaction still commits once or not at all.

Past 64 MiB, the SDK refuses the request before it sends anything, so it changes nothing. The error names the call:

search.setMany: a request of 70074001 bytes, past the 67108864 a message holds

An answer past 64 MiB fails with the limit answer bytes for a read. For a write, it fails outcome_unknown, since the write already ran.

The 64 MiB counts the requests one connection sends in pieces at once, too. Each SDK waits for an earlier large request to finish before it sends one that would pass it, so you only meet the bound with one request.

The engines' own bounds still apply and usually come first: a setMany is at most 16 MiB of JSON, and an append at most 4 MiB of events.

Against a server of 0.13 or older, which can't join frames, every request and answer is one frame of at most 2 MiB, and the error says a body holds. A Rust program calls the engines directly, so it never meets these bounds.

Bounds by name

Each bound that one call meets has a name. When a call passes it, the limit error (LimitError in Bun and Python, ErrLimit in Go, ErrorKind::Limit in Rust) carries three facts:

  • limit, the bound's name, for example set_many documents
  • wanted, what the call would have taken of it, for example 1001
  • bound, the most it takes, for example 1000

They are fields of the error in Bun, Python and Go, and error.fact("limit") and its like in Rust.

Each SDK exports the same bounds, so a program can size its batches before it calls, and can tell which bound an error met without reading its message:

import { limits } from '@tinyshed/tinystore'

const courses = store.index<Course>('courses', { fields: { name: 1 } })
const most = limits.setManyDocuments.bound
for (let at = 0; at < catalogue.length; at += most) {
	await courses.setMany(catalogue.slice(at, at + most))
}
from tinystore import bounds

courses = store.index("courses", Course, fields={"name": 1})
most = bounds.SET_MANY_DOCUMENTS.bound
for at in range(0, len(catalogue), most):
    await courses.set_many(catalogue[at : at + most])
courses, err := search.OpenIndex[Course](store, "courses", search.Fields{"name": 1})
for batch := range slices.Chunk(catalogue, int(limits.SetManyDocuments.Bound)) {
	if err := courses.SetMany(ctx, batch); err != nil {
		return err
	}
}
use tinystore::limits::SET_MANY_DOCUMENTS;

let courses = store.index::<Course>("courses").field("name", 1.0).open()?;
for batch in catalogue.chunks(SET_MANY_DOCUMENTS.bound as usize) {
    courses.set_many(batch.iter().map(|(id, course)| (id, course)))?;
}

The bounds live in limits in Bun and Node, in tinystore.bounds in Python, in the limits package in Go and in tinystore::limits in Rust. Python's tinystore.limits is a different module: rate limits and quotas. Each constant has the name below in its language's case: limits.setManyDocuments, bounds.SET_MANY_DOCUMENTS, limits.SetManyDocuments and limits::SET_MANY_DOCUMENTS.

ConstantThe error's limitBoundWhat it bounds
VALUE_BYTESvalue bytes1 MiBa bucket's value
SETTING_BYTESsetting bytes16 KiBa live setting's change, as JSON
CONFIG_BYTESconfig bytes256 KiBevery change a config keeps
LOCK_WAITERSlock waiters10,000callers waiting for one lock or semaphore
SUBSCRIPTIONSsubscriptions10,000subscriptions to the store's channels
JOB_BYTESjob bytes1 MiBa job's payload, result or step's answer, as JSON
PROGRESS_BYTESprogress bytes4 KiBa run's progress, as JSON
ROWS_BYTESbytes of a call's rows64 MiBthe values one call reads from a database
MIRROR_ROWSmirror rows100,000the rows of a mirror's list, and the rows in its scope
EVENT_BYTESevent bytes256 KiBone event
APPEND_BYTESappend bytes4 MiBthe events of one append
AGGREGATE_ROWSaggregate rows10,000the rows of one aggregate of events
COUNT_BYTEScount bytes64 MiBthe different values one top or distinct holds
SESSIONSsessions10,000the sessions one sessions call keeps, open ones included
SESSION_BYTESsession bytes64 MiBthe events and by values one sessions call keeps
WHERE_VALUE_BYTESwhere value bytes4 KiBa value that a statement of a records where gives, as JSON
SUM_RANGEsum range128the bits a sum of integers in an aggregate's stats is held in
INGEST_SAMPLESingest samples100,000the samples of one ingest, in one write
INGEST_BYTESingest bytes32 MiBthe samples of one ingest with their labels
REPLACE_SAMPLESreplace samples10,000the samples of one gauge's replace
REPLACE_BYTESreplace bytes4 MiBthe samples of one replace with the series' labels
TEXT_SAMPLEStext samples100,000the samples of one exporter's text
TEXT_BYTEStext bytes32 MiBone exporter's text
QUERY_SERIESseries1,000the series one metrics query finds
QUERY_BYTESbytes read16 MiBwhat one metrics query reads from the file
QUERY_SAMPLESsamples decoded1,048,576the samples one metrics query decodes
QUERY_ANSWERanswer100,000the samples or buckets one metrics query answers
SET_MANY_DOCUMENTSset_many documents1,000the documents of one setMany
SET_MANY_BYTESset_many bytes16 MiBthe documents of one setMany as JSON
DOCUMENT_BYTESdocument bytes1 MiBone document as JSON, or a table's row as its index reads it
SEARCH_HITSsearch hits1,000offset and limit of one search together
SEARCH_TEXTsearch text1 KiBa search's text
FILTER_CONDITIONSfilter conditions8the conditions of one search's filter
FILTER_VALUESfilter values1,000the values in the lists of one search's conditions
FILTER_ROWSfilter rows100,000the rows a statement of a table's index's where gives
FILTER_TEXTfilter text256 bytesa text that a filter keeps or asks for
VECTOR_DIMENSIONSvector dimensions4,096a vector
REQUEST_BYTESrequest bytes64 MiBone request from an SDK; 2 MiB to a server of 0.13
ANSWER_BYTESanswer bytes64 MiBone answer to an SDK; 2 MiB from a server of 0.13
A bound that the store's options set is named the same way, but it has no
constant: store memory and store memory, now for the memory budget,
series in a store for maxSeries, waiting jobs for a queue's
maxWaiting, file bytes for a set of files' maxFileSize, and set bytes
for its maxSize. The error's bound gives the number that this store uses.

testdata/wire/limits.json holds the table, and each SDK's tests check their constants against it.

See also

Edit this page on GitHub Updated 27 November 2026

esc
↑↓ navigate ↵ open ⇥ filter 0 results