Skip to content

Rate Limits

Rate limits protect the platform and ensure fair usage across all customers.


OperationLimit
Batch Write25 items per request
Batch Get100 keys per request
Transactional Get100 items per request
Transactional Write25 items per request
Query/Scan1 MB per response
Item Size400 KB maximum
Total Request Size4 MB maximum

Rate limits depend on your plan tier:

PlanLimit
Free100 requests/second
Pro1,000 requests/second
EnterpriseCustom (contact sales)

When rate limited, the API returns HTTP 429:

HTTP/1.1 429 Too Many Requests
Retry-After: 5
Content-Type: application/json
{
"type": "https://tools.ietf.org/html/rfc6585#section-4",
"title": "Too Many Requests",
"status": 429,
"detail": "Rate limit exceeded. Retry after 5 seconds.",
"retryAfter": 5
}
HeaderDescription
Retry-AfterSeconds to wait before retrying
X-RateLimit-LimitMaximum requests per window
X-RateLimit-RemainingRequests remaining in window
X-RateLimit-ResetUnix timestamp when limit resets

ResourceLimit
Databases3
Storage100 MB
Requests/month10,000
Team Members1
ResourceLimit
Databases10
Storage10 GB
Requests/month1,000,000
Team Members10
ResourceLimit
DatabasesUnlimited
StorageUnlimited
Requests/monthUnlimited
Team MembersUnlimited

async Task<Result<T>> ExecuteWithRetry<T>(Func<Task<Result<T>>> operation)
{
var maxRetries = 5;
var baseDelay = TimeSpan.FromMilliseconds(100);
for (int i = 0; i < maxRetries; i++)
{
var result = await operation();
if (result.IsSuccess)
return result;
if (!IsRateLimited(result))
return result;
var delay = baseDelay * Math.Pow(2, i);
var jitter = TimeSpan.FromMilliseconds(Random.Shared.Next(0, 100));
await Task.Delay(delay + jitter);
}
return Result.Fail("Max retries exceeded");
}

The TerraScale SDK handles rate limits automatically:

var client = new TerraScaleDatabase(new TerraScaleDatabaseOptions
{
ApiKey = "ts_live_your_api_key",
Endpoint = "https://api.terrascale.io",
Retry = new RetryPolicyOptions
{
MaxRetries = 5,
BaseDelay = TimeSpan.FromMilliseconds(100),
MaxDelay = TimeSpan.FromSeconds(10),
UseJitter = true
}
});

Instead of many small requests, use batch operations:

// Bad: Many individual requests
foreach (var key in keys)
{
await client.GetItemAsync(key.Pk, key.Sk);
}
// Good: Single batch request
await client.BatchGetAsync(keys);

For high-volume applications, implement a request queue:

var semaphore = new SemaphoreSlim(100); // Max concurrent requests
async Task<T> ExecuteWithThrottle<T>(Func<Task<T>> operation)
{
await semaphore.WaitAsync();
try
{
return await operation();
}
finally
{
semaphore.Release();
}
}

Track your usage to stay within limits:

var usage = await client.Payment.GetUsageAsync();
Console.WriteLine($"Requests this month: {usage.Value.TotalRequests}");
Console.WriteLine($"Storage used: {usage.Value.TotalStorageGb} GB");

Higher plans have higher limits. See Plans for details.

Contact sales@terrascale.io for:

  • Custom rate limits
  • Dedicated capacity
  • SLA guarantees
  • Volume discounts