---
title: Limits
description: The quotas of the Pay as you go plan and the fixed limits of Luna, with the error each one raises.
related:
  - /platform/pricing
  - /organisation/manage-billing
  - /errors/quota-exceeded
---

Luna has one public plan, Pay as you go. Its quotas apply to your whole organisation, and the fixed limits apply to every app.

## Summary

| Limit | Pay as you go |
| --- | --- |
| [Requests a second](#requests-a-second) | 100,000 for the organisation |
| [Database storage](#database-and-file-storage) | 1 TiB |
| [File storage](#database-and-file-storage) | 1 TiB |
| [Egress a month](#egress-and-ingress-a-month) | 10 TiB |
| [Ingress a month](#egress-and-ingress-a-month) | 10 TiB |
| [Awake lunas](#awake-lunas) | 10,000 at once |
| [Running sandboxes](#running-sandboxes) | 100 at once |
| [Size of a luna](#size-of-a-luna) | 32,087 MiB and 8 cores |
| [History for restore and fork](#history-for-restore-and-fork) | 30 days |
| [Spending cap](#spending-cap) | None unless you set one |
| [App size](#app-size) | 256 MiB |
| [Names in code](#names-in-code) | 64 characters |
| [Environments and organisations](#environments-and-organisations) | 100 a project, 20 organisations an account |
| [Keys and tokens](#keys-and-tokens) | 100 a tenant, 50 account keys |
| [Secrets](#secrets) | 64 KiB each |
| [Call deadline](#call-deadline) | 60 s by default |
| [CPU without awaiting](#cpu-without-awaiting) | 30 s |
| [Calls and messages waiting](#calls-and-messages-waiting) | 1,000 calls, 10,000 messages a luna |
| [Message attempts](#message-attempts) | 10 by default |
| [Idle timeout](#idle-timeout) | 30 s by default |
| [Events, pushes and stream entries](#events-pushes-and-stream-entries) | 1 MiB each |
| [Durable step results](#durable-step-results) | 1 MiB each |
| [Connections](#connections) | 64 KiB of state, 16 tags, 128 live queries |
| [App sockets](#app-sockets) | 1 MiB a frame, 256 lunas a socket |
| [Outbound sockets](#outbound-sockets) | 64 a luna |
| [HTTP routes](#http-routes) | 10 MiB a body |
| [Files](#files) | 10 GiB an object, 1 TiB a luna |
| [Sandbox size](#sandbox-size) | 8 CPUs, 16 GiB of memory, 100 GiB of disk |
| [Isolates](#isolates) | 32 MiB a result |
| [Vectors](#vectors) | 8,192 dimensions |

## Quotas of the plan

Quotas count every project, environment and tenant of the organisation together. A tenant you add can have lower quotas of its own, as [Manage tenants from code](/platforms/manage-tenants-from-code) shows. [`luna billing`](/cli/billing) shows each quota beside what the month has used.

### Requests a second

The organisation takes up to 100,000 requests a second across all its tenants. A request past that fails with [`QuotaExceeded`](/errors/quota-exceeded), status 429, and the message `the tenant is over its request quota`.

### Database and file storage

Tables hold up to 1 TiB, and files hold another 1 TiB. When either is full, handlers that write fail with `QuotaExceeded`, status 507, and the message `the tenant is over its storage quota`. Queries still answer, so your app can still read.

### Egress and ingress a month

The organisation sends out up to 10 TiB and takes in up to 10 TiB each calendar month. Past either one, every call fails with `QuotaExceeded`, status 429, until the month ends. The message names `egress` or `ingress`.

### Awake lunas

Up to 10,000 lunas are awake at once. Past that, calls fail with `QuotaExceeded`, status 429, and a message saying the organisation has more than 10000 active lunas. Lunas fall asleep after their idle timeout, so the count drops on its own.

### Running sandboxes

Up to 100 sandboxes run at once. Starting one more fails, and the error's message starts with `QuotaExceeded:` and says the organisation may run 100 sandboxes at once.

### Size of a luna

A luna type may ask for up to 32,087 MiB of memory and 8 cores with `limits` in [`defineLuna`](/sdk/define-luna). A type that asks for nothing gets 512 MiB and 1 core. A deploy that asks for more is refused, and the message names the type and the most it may have. Reserving limits with `reserve: true` is not part of this plan, so a deploy that asks for it is refused too.

### History for restore and fork

Luna keeps 30 days of history. [Restore to an earlier moment](/develop/restore-to-an-earlier-moment) and [Fork a luna](/develop/fork-a-luna) reach back that far.

### Spending cap

The plan has no cap unless you set one. Once the month costs as much as your cap, every call fails with `QuotaExceeded`, status 429, and the message `this organisation's spending cap of $<CAP> for the month has been reached`. [Manage billing](/organisation/manage-billing) shows how to set it.

## Apps and accounts

### App size

An app and its dependencies are at most 256 MiB. [`luna deploy`](/cli/deploy) stops before it uploads and lists the largest packages: `the app and its dependencies are <N> MB, over the 256 MB limit`.

### Names in code

A luna type's name starts with a capital letter, and a handler's name with a small letter. A key field starts with a letter. Each uses letters, digits and `_`, at most 64 characters. A deploy with another name fails with status 400 and a message saying the manifest is invalid.

### Environments and organisations

A project has up to 100 environments. An environment's name is 1 to 39 lower-case letters, digits and single dashes, starts and ends with a letter or digit, and is not `production`. The 101st environment fails with status 403 and `<PROJECT> can have at most 100 environments`.

An account belongs to up to 20 organisations. Creating one more fails with status 403 and `an account can be in at most 20 organisations`. Names of organisations and projects are at most 100 characters.

### Keys and tokens

A tenant has up to 100 publishable keys and secret tokens together. One more fails with status 403 and `a tenant can have at most 100 keys`. An account has up to 50 account keys, and one more fails with status 409 and `an account has at most 50 keys: revoke one first`.

### Secrets

A secret's value is at most 64 KiB. Its name is 1 to 128 capital letters, digits and underscores, and starts with a capital letter or `_`. A larger value fails with status 400 and `a secret can be at most 65536 bytes`.

## Calls

### Call deadline

A call has 60 s by default. Set another deadline with the `luna-timeout-ms` header, or with `timeout` on [`ctx.call`](/sdk/ctx). A call past its deadline fails with [`Timeout`](/errors/timeout), status 504.

### CPU without awaiting

A handler may run for 30 s without awaiting. Past that, Luna stops the code, and the caller gets [`OutcomeUnknown`](/errors/outcome-unknown), status 502, because the call may or may not have taken effect.

### Calls and messages waiting

A luna takes up to 1,000 calls in flight, counting those waiting their turn. One more fails with [`Overloaded`](/errors/overloaded) and a message that the luna has too many calls in flight. A luna also holds up to 10,000 messages waiting to run, and one more fails with `Overloaded` and `mailbox full`.

### Message attempts

A message sent with `ctx.send` gets 10 attempts by default. The first retry comes 169 s after a failure, and each wait after that doubles. Set other values with `maxAttempts` and `firstRetry`, as [Call another luna](/lunas/call-another-luna) shows. After the last attempt, the message is set aside as a dead letter, and `luna logs` shows a `deadLetter` line.

### Idle timeout

A luna leaves memory after 30 s without calls. Set another time with `idleTimeout` in [`defineLuna`](/sdk/define-luna). Reaching it raises no error. The next call wakes the luna again.

## Messages and connections

### Events, pushes and stream entries

An event, a push, a message to a connection and a stream entry are each at most 1 MiB as JSON. A larger one fails with [`Invalid`](/errors/invalid), and the message names the event or stream, as in `stream <NAME>: an entry is at most 1 MiB`.

### Durable step results

A step of a durable run returns at most 1 MiB as JSON. A larger result fails with a message starting `a step result can be at most 1048576 bytes`. Store large outputs in a file and return its path.

### Connections

A connection's state is at most 64 KiB as JSON. It has up to 16 tags of 1 to 128 bytes each, and up to 128 live queries. Past the state or tag limits, the call fails with `Invalid`. A 129th live query fails with `Overloaded`.

### App sockets

An app's socket to Luna takes frames of at most 1 MiB, and carries up to 256 lunas. Opening a 257th fails with `Invalid` and a message that the socket already carries 256 lunas.

### Outbound sockets

A luna keeps up to 64 sockets to outside servers open at once. Opening one more fails with `Invalid` and `a luna has at most 64 outbound sockets open`.

### HTTP routes

A request body to a route is at most 10 MiB. A larger body fails with `Invalid`, status 413, and `the body is over <N> bytes`. A route's handler has 60 s, and a streamed response stays open for up to 1 h.

## Files, sandboxes and isolates

### Files

One object is at most 10 GiB. A put or get from code moves at most 256 MiB, or the bucket's `maxSize` if lower, and a larger put fails with `Invalid` and points to a signed upload URL. A signed URL lasts 1 h by default and 7 days at most. A luna holds at most 1 TiB of files, and a put past that fails with `Overloaded`. [Store files](/files-and-code/store-files) covers buckets.

### Sandbox size

A sandbox gets 1 CPU, 512 MiB of memory and 4 GiB of disk unless it asks for more, and it powers off after 5 min without requests. It may ask for up to 8 CPUs, 16 GiB of memory and 100 GiB of disk. A larger sandbox fails with `Invalid` and a message listing these maximums. It runs up to 256 processes at once.

### Isolates

An isolate run has 64 MiB of memory and 10 s by default, and must set a CPU limit. A run past a limit throws an `IsolateError` with `CpuLimitExceeded`, `MemoryLimitExceeded` or `TimeoutExceeded`. A result larger than 32 MiB fails with `ResultTooLarge`.

### Vectors

A vector column has 1 to 8,192 dimensions. `t.vector` throws while the app loads when the count is outside that range.
