File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,13 +98,17 @@ export const knowledgeConnectorSync = task({
9898 id : 'knowledge-connector-sync' ,
9999 maxDuration : CONNECTOR_SYNC_MAX_DURATION_SECONDS ,
100100 /**
101- * Sized from production telemetry: peak sampled RSS 2.6 GB and peak 1.4 vCPU,
102- * so `large-1x` holds ~3x memory and ~2.8x CPU headroom. No `outOfMemory`
103- * escalation: an OOM is a SIGKILL, so the run never reaches the terminal
104- * write that clears `syncLockToken`, and the escalated attempt would find the
105- * row still `syncing` and skip. The stale-lock reaper owns that recovery.
101+ * Sized from production telemetry: p99.9 sampled RSS ~650 MB, peak 2.6 GB, and
102+ * peak 1.4 vCPU, so `medium-2x` (4 GB, 2 vCPU) still clears the worst case.
103+ * The run is I/O-bound — it mostly waits on source APIs and their rate-limit
104+ * backoff — and Trigger.dev bills wall-clock per preset, so `large-1x` paid
105+ * double for headroom no run used. Not `medium-1x`: 2 GB sits below the peak,
106+ * and there is no `outOfMemory` escalation to absorb it. An OOM is a SIGKILL,
107+ * so the run never reaches the terminal write that clears `syncLockToken`,
108+ * and the escalated attempt would find the row still `syncing` and skip. The
109+ * stale-lock reaper owns that recovery.
106110 */
107- machine : 'large-1x ' ,
111+ machine : 'medium-2x ' ,
108112 retry : {
109113 maxAttempts : 3 ,
110114 factor : 2 ,
Original file line number Diff line number Diff line change @@ -319,12 +319,13 @@ export const processDocument = task({
319319 id : 'knowledge-process-document' ,
320320 maxDuration : envNumber ( env . KB_CONFIG_MAX_DURATION , 600 ) ,
321321 /**
322- * Sized from production telemetry: peak sampled RSS 902 MB and peak 1.2 vCPU
323- * across a corpus where no document exceeded 2 GB, so `medium-2x` holds ~4x
324- * memory and ~1.7x CPU headroom over the observed worst case. The prior
325- * `large-1x` reserved 8 GB against a worst case using an eighth of it.
322+ * Sized from production telemetry: p99.9 sampled RSS ~740 MB and peak just
323+ * under 2 GB, so `medium-1x` (2 GB) holds the overwhelming majority and the
324+ * rare document past it escalates through `outOfMemory` below. Processing waits on embedding and storage calls far
325+ * more than it computes, so the single vCPU stretches a CPU-bound parse
326+ * slightly but halves the wall-clock rate every run is billed at.
326327 */
327- machine : 'medium-2x ' ,
328+ machine : 'medium-1x ' ,
328329 retry : {
329330 /**
330331 * The ceiling for thrown errors: database retries use all of it, and
You can’t perform that action at this time.
0 commit comments