API Reference / API Methods / Advanced
Jun. 03, 2019
List of methods

Retry logic

Algolia’s architecture is heavily redundant, to provide optimal reliability. Every application is hosted on at least three different servers (called clusters). As a developer, however, you don’t need to worry about those details. The API Client handles them for you:

  • It leverages our dynamic DSN to perform automatic load balancing between servers.
  • Its retry logic switches the targeted server whenever it detects that one of them is down or unreachable. Therefore, a given request will not fail unless all servers are down or unreachable at the same time.

Application-level errors (e.g. invalid query) are still reported without retry.

Error handling

Requests can fail for two main reasons:

  1. Network issues: the server could not be reached, or did not answer within the timeout.
  2. Application error: the server rejected the request.

In the latter case, the error reported by the API client contains:

  • message: an error message indicating the cause of the error
  • status: an HTTP status code indicating the type of error

Here’s an example:

1
2
3
4
{
  "message":"Invalid Application ID",
  "status":404
}

The error message is purely informational and intended for the developer. You should never rely on its content programmatically, as it may change without notice.

Did you find this page helpful?