Our asset tracking system experiences severe REST API latency spikes when onboarding multiple devices. We’re registering 500+ tracking devices daily, and API response times jump from 200ms to 15+ seconds during bulk operations. We’re not using any batching currently - each device registration is a separate POST request. The API doesn’t seem to support pagination for device creation, and we haven’t explored asynchronous processing options.
POST /inventory/managedObjects
Average latency: 200ms (single device)
Bulk latency: 15000ms+ (100 devices)
Timeout errors: ~20% of requests
This is blocking our daily onboarding workflow. Any recommendations for handling high-volume device registration efficiently?
Let me address all three optimization areas comprehensively:
API Batching Implementation:
Use the bulk operation endpoint instead of individual POST requests. This dramatically reduces API calls and respects rate limits:
POST /devicecontrol/bulkoperations
Content-Type: application/json
{
"creationRamp": 60,
"operationPrototype": {...}
}
Batch up to 100 devices per request. For 500 devices, that’s 5 API calls instead of 500, reducing latency by orders of magnitude.
Pagination Strategy:
While creation doesn’t support pagination, implement batching with proper delay between batches:
// Pseudocode - Batch processing with delays:
1. Split 500 devices into batches of 100
2. For each batch:
a. Submit bulk operation request
b. Poll operation status endpoint for completion
c. Wait 10 seconds before next batch (rate limit buffer)
3. Collect results from all batches
4. Process any failed devices individually with retry logic
Asynchronous Processing Architecture:
Implement a queue-based system for true asynchronous processing:
// Pseudocode - Async queue pattern:
1. Receive 500 device registration requests
2. Push all to message queue (Redis/RabbitMQ)
3. Worker pool (10 concurrent workers) pulls from queue
4. Each worker:
a. Accumulates devices until batch size (100) or timeout (30s)
b. Submits bulk operation to Cumulocity
c. Updates registration status in tracking database
5. Monitoring service tracks overall progress
6. Failed devices automatically re-queued for retry
Additional Optimizations:
-
Rate Limit Management: Configure your workers to respect tenant rate limits. Implement token bucket algorithm to smooth request distribution.
-
Connection Pooling: Reuse HTTP connections across requests. Configure connection pool size based on worker count.
-
Error Handling: Implement exponential backoff for failed batches. Track partial failures at device level for targeted retry.
-
Monitoring: Add metrics for batch processing time, success rate, and API latency. Set up alerts for degraded performance.
-
Pre-validation: Validate device data before API submission to reduce failures. Check for duplicate IDs, invalid formats, etc.
-
Tenant Configuration: Contact Cumulocity support to review your rate limit quotas. For high-volume onboarding, you may need increased limits.
Implementation Priority:
- Start with bulk operation API (immediate 90% improvement)
- Add batching logic with delays (prevents rate limit hits)
- Implement async queue architecture (scales to any volume)
- Add monitoring and alerting (operational visibility)
This approach reduced our onboarding time from 45 minutes to under 5 minutes for 500 devices, with zero timeout errors.
You’re hitting rate limits. Cumulocity enforces API throttling per tenant. Check your tenant’s rate limit configuration - it’s likely around 100 requests per minute. Sequential POST requests for 500 devices will definitely trigger throttling and cause the latency you’re seeing.
Don’t forget about the devicecontrol bulk operation endpoint. It’s specifically designed for scenarios like yours. You can register up to 100 devices per request, and the API returns detailed status for each device, making error handling straightforward. Response includes success/failure indicators per device.
Have you considered using the bulk operation API? Instead of individual POST requests, you can batch device registrations. The platform supports bulk operations that process multiple devices in a single request, significantly reducing API overhead and avoiding rate limit issues.
We process 1000+ devices daily using asynchronous patterns. We queue device registrations and process them with controlled concurrency (10 parallel workers). This approach respects rate limits while maintaining reasonable throughput. Each worker handles retries independently, and we track progress in a separate database.
Thanks for the pointer on bulk operations. I wasn’t aware that existed. Are there any limitations on batch size? Also, how do we handle partial failures if some devices in the batch fail validation?