| name | bamboohr-performance-tuning |
| description | Optimize BambooHR API performance with caching, batch reports, incremental sync,
and connection pooling. Use when experiencing slow API responses,
implementing caching, or optimizing sync throughput.
Trigger with phrases like "bamboohr performance", "optimize bamboohr",
"bamboohr latency", "bamboohr caching", "bamboohr slow", "bamboohr batch".
|
| allowed-tools | Read, Write, Edit |
| version | 1.4.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","hr","bamboohr","performance"] |
| compatibility | Designed for Claude Code |
BambooHR Performance Tuning
Overview
Optimize BambooHR API performance through request reduction, caching, incremental sync, and connection pooling. The biggest wins come from eliminating N+1 query patterns using custom reports and the changed-since endpoint.
Prerequisites
- BambooHR API client configured
- Redis or in-memory cache available (optional)
- Performance monitoring in place
Instructions
Step 1: Eliminate N+1 Queries with Custom Reports
The single biggest performance improvement: use POST /reports/custom instead of individual employee GETs.
const dir = await client.getDirectory();
for (const emp of dir.employees) {
await client.getEmployee(emp.id, ['salary', 'hireDate']);
}
const report = await client.customReport([
'firstName', 'lastName', 'department', 'jobTitle',
'hireDate', 'workEmail', 'status', 'location',
'supervisor', 'employeeNumber',
]);
Performance impact: 500x reduction in API calls. Custom reports return all active employees in one request.
Step 2: Incremental Sync with Changed-Since
import { readFileSync, writeFileSync } ;
= ;
(): <[]> {
: ;
{
lastSync = (, ).();
} {
lastSync = (.() - * * * ).();
}
changed = client.<{
: <, { : ; : }>;
}>(, );
changedIds = .(changed. || {});
.();
(changedIds. === ) [];
(changedIds. > ) {
report = client.([
, , , ,
]);
changedData = report..(
changedIds.(e.?.()),
);
} {
( id changedIds) {
emp = client.(id, [, , , ]);
}
}
(, ().());
changedIds;
}