fix(functions): gcf_gen1 fractional CPU to fit the Cloud Run CPU quota
Deploys kept failing container healthchecks with "Quota exceeded for total allowable CPU per project per region" even in small batches: v2 gives every instance a full vCPU (needed for concurrency 80), and ~35 services at 1 vCPU exceeds this new project's default Cloud Run CPU quota under any accounting. cpu:'gcf_gen1' restores the gen1 fractional tiers (256MiB → 1/6 vCPU) — a 6x smaller footprint, identical to how these functions ran on gen1. Concurrency must be 1 with cpu<1; costless at dev scale. At launch: raise the quota, drop these two options to restore full-vCPU concurrency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
9b62957052
commit
7d015e3ab9
|
|
@ -17,10 +17,18 @@ const v2_1 = require("firebase-functions/v2");
|
|||
* For production: request a Cloud Run CPU quota increase (console → IAM & Admin → Quotas) and
|
||||
* raise this. ~80 concurrent requests per instance means 5 instances still serves ~400 in flight.
|
||||
*
|
||||
* cpu 'gcf_gen1' + concurrency 1: v2 defaults every instance to a FULL vCPU (required for the
|
||||
* default concurrency of 80). On this project's default Cloud Run CPU quota that made deploys
|
||||
* fail their container healthchecks ("Quota exceeded for total allowable CPU"). gcf_gen1 uses
|
||||
* the gen1 fractional tiers (256MiB → 1/6 vCPU, 512MiB → 1/3) — a 6x smaller CPU footprint,
|
||||
* which is exactly how these workloads ran on gen1 until now. Concurrency must be 1 when
|
||||
* cpu < 1; at dev scale that costs nothing. AT LAUNCH: request the Cloud Run CPU quota
|
||||
* increase, then delete these two lines to restore 1 vCPU + concurrency 80.
|
||||
*
|
||||
* This module is imported FIRST in index.ts so these options are set before any v2 function is
|
||||
* defined. It has no effect on the one v1 holdout (onUserDelete), which keeps its own defaults.
|
||||
*/
|
||||
(0, v2_1.setGlobalOptions)({ region: 'us-central1', maxInstances: 5 });
|
||||
(0, v2_1.setGlobalOptions)({ region: 'us-central1', maxInstances: 5, cpu: 'gcf_gen1', concurrency: 1 });
|
||||
/** Region constant for any per-function override that ever needs to pin it explicitly. */
|
||||
exports.REGION = 'us-central1';
|
||||
//# sourceMappingURL=options.js.map
|
||||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;AAAA,8CAAwD;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,IAAA,qBAAgB,EAAC,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAA;AAE5D,0FAA0F;AAC7E,QAAA,MAAM,GAAG,aAAa,CAAA"}
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;AAAA,8CAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,IAAA,qBAAgB,EAAC,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,CAAA;AAE7F,0FAA0F;AAC7E,QAAA,MAAM,GAAG,aAAa,CAAA"}
|
||||
|
|
@ -15,10 +15,18 @@ import { setGlobalOptions } from 'firebase-functions/v2'
|
|||
* For production: request a Cloud Run CPU quota increase (console → IAM & Admin → Quotas) and
|
||||
* raise this. ~80 concurrent requests per instance means 5 instances still serves ~400 in flight.
|
||||
*
|
||||
* cpu 'gcf_gen1' + concurrency 1: v2 defaults every instance to a FULL vCPU (required for the
|
||||
* default concurrency of 80). On this project's default Cloud Run CPU quota that made deploys
|
||||
* fail their container healthchecks ("Quota exceeded for total allowable CPU"). gcf_gen1 uses
|
||||
* the gen1 fractional tiers (256MiB → 1/6 vCPU, 512MiB → 1/3) — a 6x smaller CPU footprint,
|
||||
* which is exactly how these workloads ran on gen1 until now. Concurrency must be 1 when
|
||||
* cpu < 1; at dev scale that costs nothing. AT LAUNCH: request the Cloud Run CPU quota
|
||||
* increase, then delete these two lines to restore 1 vCPU + concurrency 80.
|
||||
*
|
||||
* This module is imported FIRST in index.ts so these options are set before any v2 function is
|
||||
* defined. It has no effect on the one v1 holdout (onUserDelete), which keeps its own defaults.
|
||||
*/
|
||||
setGlobalOptions({ region: 'us-central1', maxInstances: 5 })
|
||||
setGlobalOptions({ region: 'us-central1', maxInstances: 5, cpu: 'gcf_gen1', concurrency: 1 })
|
||||
|
||||
/** Region constant for any per-function override that ever needs to pin it explicitly. */
|
||||
export const REGION = 'us-central1'
|
||||
|
|
|
|||
Loading…
Reference in New Issue