Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion apps/sim/background/knowledge-connector-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ export async function executeConnectorSyncJob(payload: unknown) {
export const knowledgeConnectorSync = task({
id: 'knowledge-connector-sync',
maxDuration: CONNECTOR_SYNC_MAX_DURATION_SECONDS,
machine: 'large-2x',
/**
* Sized from production telemetry: peak sampled RSS 2.6 GB and peak 1.4 vCPU,
* so `large-1x` holds ~3x memory and ~2.8x CPU headroom. No `outOfMemory`
* escalation: an OOM is a SIGKILL, so the run never reaches the terminal
* write that clears `syncLockToken`, and the escalated attempt would find the
* row still `syncing` and skip. The stale-lock reaper owns that recovery.
*/
machine: 'large-1x',
retry: {
maxAttempts: 3,
factor: 2,
Expand Down
8 changes: 7 additions & 1 deletion apps/sim/background/knowledge-processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ export async function runDocumentProcessing(
export const processDocument = task({
id: 'knowledge-process-document',
maxDuration: envNumber(env.KB_CONFIG_MAX_DURATION, 600),
machine: 'large-1x', // 4 vCPU, 8GB RAM - needed for large PDF processing
/**
* Sized from production telemetry: peak sampled RSS 902 MB and peak 1.2 vCPU
* across a corpus where no document exceeded 2 GB, so `medium-2x` holds ~4x
* memory and ~1.7x CPU headroom over the observed worst case. The prior
* `large-1x` reserved 8 GB against a worst case using an eighth of it.
*/
machine: 'medium-2x',
retry: {
maxAttempts: envNumber(env.KB_CONFIG_MAX_ATTEMPTS, 3),
factor: envNumber(env.KB_CONFIG_RETRY_FACTOR, 2),
Expand Down
Loading