Velo: About Backend Quotas
5 min read
This article deals with backend request quotas. There is a separate article for data quotas.
If backend requests on your site are not behaving as expected, your site may be exceeding one of the quotas. Use the monitoring dashboard to identify which requests are failing, and which quota is involved.
Requests Per Minute (RPM)
Wix allows you to make up to 7000 backend requests per minute (RPM) on premium sites, and 5000 requests on free sites. If your site exceeds the quota, any additional requests within a 1-minute window are blocked and you receive a 429 response code. For each throttled request, this error message appears in your site log:
/backend/<fileName>.js(w)/<functionName> was throttled because your site exceeded the maximum number of backend requests per minute.
What can I do?
The error message above indicates that you’re sending too many requests to your backend code. You can try to reduce your RPM and prevent the error using the following methods:
- Batch your requests
Batch multiple round trips (backend requests) into one. Make sure not to batch time-consuming requests together as there's also a time limit for backend requests.
See an example
Wix allows web modules called from the frontend, HTTP functions, and router hooks to run for up to 14 seconds. This quota applies to both free and premium sites. Any of these methods that take longer than 14 seconds receives a 504 response code. Note that after 14 seconds the code might still execute, but the connection to the client is closed so the results do not appear in the frontend. This error message appears in your site log:
/backend/<fileName>.js(w)/<functionName> timed out because it exceeded the maximum execution time.
What can I do?
The error message above indicates that the requests to your backend code are taking too long. You can try to reduce the running time of your code using the following methods:
- Identify parts of your code that are running for too long
Identify the parts of your code that are taking too long to run, and optimize them to improve performance. You can do this by including console logs before and after the code you want to test, and then checking to see how long it takes to run.
See an example
- Check your 3rd-party APIs
If you are using 3rd-party APIs on your site, make sure they are not too slow. For example, if you notice an API call to a 3rd-party is taking a few seconds to run, break it into smaller calls or see if you can upgrade your 3rd-party account to improve performance.
- Process data in chunks
If you are running a slow process or loading a large amount of data, either use pagination or process your data in chunks. Make sure not to create too many requests, as there is also a quota on requests per minute.
- Avoid repetition
Avoid repeating large database requests or complex calculations. If you can, cache the result or aggregate database queries.
- Optimize query times
If you’re querying a large data collection, you might want to consider adding an index to optimize query times. To do so, contact support.
If your site is exceeding one of the quotas, you can contact support to ask for more resources or to add indexes to your collections.
- Open the Contact Wix chatbot.
- Select Editor, Editor X, ADI & Live Sites.
- Select Velo.
- Select your coding level.
- Select There's an issue with my code.
- Select Contact an Expert.
- Select the site that needs more resources or an index.
- Paste the code that's causing the quota error into the text box, and click Send.
- In the text box, describe the issue you're having with your site and that you need more resources or an index.
- Click Send.
Did this help?