Best Practices

Cleeng API Best Practices: Timeouts and Retries

Configuring an API timeout (the duration between sending a request and receiving a response) and retry policy is crucial for maintaining fluent end-user experience and reducing unnecessary strain on the infrastructure.

Cleeng API Performance

Cleeng Platform is highly optimized for handling large volumes of traffic. Our infrastructure will autoscale according to demand.

The usual latency for Cleeng API (calculated for API 3.1, at our API Gateway, using 1 hour median metric) is below 50 ms. The miniscule portion of the total traffic (below 0.01%) can be served with higher latency - up to a few seconds.

Throttling

API throttling is introduced within the Cleeng sandbox and production environments to enhance the overall user experience and platform robustness.

This rate limiting is designed to prevent the system from being overwhelmed by malicious or accidental machine-driven traffic spikes, and to ensure that everyone can enjoy a stable and efficient environment. The actual limits are adjusted according to the traffic levels expected and experienced by each of our clients. If throttling limit is exceeded, 429 status code will be returned.

Also, we reserve the right to throttle the incoming requests or even block specific IP addresses, under certain circumstances:

  • When the traffic spike is too sudden, indicating machine-induced requests.
  • When the incoming traffic is identified as fraudulent, or a wide network/system scan.

Recommendations

  • Set up a default timeout of 8 seconds.
  • Only retry failed API calls once, to avoid an uncontrolled cascade of requests.
  • Use caching where possible, based on your use case.