Throughput(Rate Limits)

Understand how throughput works on Unifra and how to handle 429 errors. ​ 🤔

The throughput

Throughput is a measure of the number of requests your application can send per second. It is also known as application "rate limiting". In situations where a large number of requests are sent at the same time, your throughput may be affected. And Unifra will help you solve this problem.

Unifra has an elastic throughput system where users can guarantee their given throughput limit (measured in compute units per second), but typically experience higher throughput in practice. In most cases, hitting the throughput limit will not affect the user's experience with the application.

As long as retry is implemented, the request will go through in the next second. As a general rule of thumb, if you are experiencing rate limit requests below 30%, using retries is the best solution.

Error Response

When you exceed your capacity, you will receive an error response. This response will be different depending on whether you are connecting to Unifra using HTTP or WebSockets.

If you would like to test receiving a 429 response, send a POST request to https://httpstat.us/429.

HTTP

You will receive an HTTP 429 (Too Many Requests) response status code.

WebSockets

You will receive a JSON-RPC error response with error code 429. For example, the response might be:

{
	"jsonrpc": "2.0",
	"error": {
		"code": 429,
		"message": "Your app has exceeded its compute units per second capacity. If you have retries enabled, you can safely ignore this message. If not, check out https://docs.unifra.io/guides/rate-limits"
	}
}

:bulb: Final Tips

Use a different key for each part of your project (e.g., frontend, backend, or development) to isolate throughput usage to each use case. This also splits monitoring across different parts of your project, making it easier to debug issues and monitor usage.