Self-Hosted Deployment
Set rate limits
Know the request limits of a self-hosted Databrain backend and change them with environment variables.
The backend limits how many requests one client can send in a time window. Over the limit, it answers 429 with a message such as Too many requests, please try again later. Each limit has an environment variable on the backend container.
The general limit
| Variable | Default | Window | Counted per |
|---|---|---|---|
RATE_LIMIT | 500 | 2 minutes | Client IP |
Only a positive whole number turns this limit on. When RATE_LIMIT is not set, or is not a valid number, the backend only logs rate limit would block (log mode, RATE_LIMIT unset) and serves the request. Set it to enforce the limit:
RATE_LIMIT=500Limits that are always on
| Variable | Default | Window | Counted per | Applies to |
|---|---|---|---|---|
AUTH_ROUTE_RATE_LIMIT | 30 | 1 minute | Route and IP | Sign-in, sign-up, MFA and session routes |
REFRESH_ROUTE_RATE_LIMIT | 30 | 1 minute | Session and IP | Session refresh |
OTP_RATE_LIMIT | 50 | 1 minute | IP | One-time code checks |
EMAIL_RATE_LIMIT | 50 | 1 minute | IP | Emails sent from sign-up and CSV sharing |
SIGN_IN_IP_FAILURE_LIMIT | 100 | 15 minutes | IP | Failed sign-ins |
SIGN_IN_ACCOUNT_FAILURE_LIMIT | 50 | 15 minutes | Email address | Failed sign-ins |
SIGN_IN_IP_EMAIL_FAILURE_LIMIT | 10 | 15 minutes | IP and email. Resets on a good sign-in | Failed sign-ins |
SIGN_IN_CODE_MAIL_LIMIT | 10 | 15 minutes | Email address | Sign-in codes sent |
CRITICAL_DATASOURCE_RATE_LIMIT | 10 | 5 minutes | API token’s company, else origin, else IP | Create, update, sync and schema calls on /api/v2/datasource |
MCP_RATE_LIMIT | 30 | 1 minute | API token, else signed-in user, else IP | /api/mcp calls from the MCP server |
FILE_DOWNLOAD_RATE_LIMIT | 300 | 15 minutes | IP | File downloads |
REPORT_ACCESS_RATE_LIMIT | 300 | 15 minutes | IP | Report links |
UNSUBSCRIBE_RATE_LIMIT | 300 | 15 minutes | IP | Unsubscribe links |
SIGN_IN_RATE_LIMIT_WINDOW_MS sets the 15-minute sign-in window in milliseconds. CRITICAL_DATASOURCE_RATE_LIMIT_WINDOW_MS, FILE_DOWNLOAD_RATE_LIMIT_WINDOW_MS, REPORT_ACCESS_RATE_LIMIT_WINDOW_MS and UNSUBSCRIBE_RATE_LIMIT_WINDOW_MS set the other windows the same way.
Behind a load balancer
The backend trusts one proxy hop and counts the IP that hop reports. Put exactly one load balancer or reverse proxy in front of the backend, and make it set X-Forwarded-For. With more hops, every client looks like the same IP and shares one limit.
Each backend container counts on its own. With three containers behind a load balancer, one client can send up to three times the limit.
If you hit a limit
- People cannot sign in after a few tries. They hit a failed sign-in limit. Wait 15 minutes, or reset the password.
- An integration gets
429on datasource calls. It sends more than 10 create, update, sync or schema calls in 5 minutes. Space the calls out. - The MCP server answers “Too many MCP control-plane requests, please try later”. Wait a minute.
Wait for the window to end before you retry. Do not retry sign-in or email calls in a loop.