Skip to content

Toro Cloud Dev Center

API throttling

Martini allows you to conditionally throttle HTTP-based service invokes using throttling rules. Throttling lets you can control the rate at which services are invoked. It is typically used for:

  • Enhancing performance by avoiding resource exhaustion.

    Resource exhaustion

    For example, a service that makes repeated calls to the database may cause an instance-wide slowdown because database operations are expensive. By throttling, we can limit calls to services like this to ensure availability across Martini.

  • Restricting API usage, according to your organization's policies.

  • Mitigating Denial of Service (DoS) attacks.

Conditions for checking throttling rule matches

No checks will be done if there are no configured throttling rules. If multiple rules are applicable for the call, the rule with the highest priority will be chosen.

Every time an HTTP request is received, Martini will check for an applicable throttling rule. If it finds a match, then it will check if the configured rate has been exceeded. If not, the request is processed as usual; otherwise, Martini will throw an error response:

    "result": "ERROR",
    "apiErrorCode": -1,
    "message": "You have already exceeded the '1' requests allowable every '1 minute'."