Memory and CPU limits
A server has a fixed amount of memory and processor time. Without limits, one slow or broken
request can use all of it, and every other request waits. In Novis, every request runs under
limits. Novis has a default for each one, and you can change it in nvs.toml.
How a limit works
Section titled “How a limit works”[limits] sets what each request starts with, such as 64 MB of memory and 5 seconds of processor
time. When you do not set them, a request starts with 128 MB of memory and 30 seconds of processor
time. A command-line program has no limit on processor time unless you set one.
[limits.hard] sets the maximum. A request that needs more may raise its own limit up to the
maximum. When [limits.hard] does not set a limit, the maximum is the starting value. So the
request cannot raise it.
A request that uses more than a limit stops immediately. Only that request stops. The server writes the reason to its log, and the other requests keep running.
One limit for everything a request starts
Section titled “One limit for everything a request starts”A request can start tasks and other programs. They all share the limits of that request. A request that starts fifty programs still has one memory limit, and the fifty programs share it.
So the most memory one request can use is easy to know. It is the memory ceiling. The server counts the memory that its running requests use now. It starts a new request only when there is room for that request to reach its ceiling.
Your code can read its own memory
Section titled “Your code can read its own memory”Core\Budget returns three numbers: the memory the request uses now, its memory limit and the
highest amount it has used so far. A program that builds a large result can check this first.
Where to go next
Section titled “Where to go next”- Guides: limits lists every limit and shows how to raise one.
- Syntax: limits shows what happens to your code when a limit is reached.
