TL
The short answer

OCI Functions cost is calculated from two things: the number of invocations and the resource usage of each run, measured as the memory allocated to the function multiplied by its execution time and expressed in gigabyte seconds. That means memory allocation and execution duration drive the bill just as much as how often the function fires. The levers follow directly: set memory to the value that minimises memory multiplied by duration for the workload, trim execution time by removing slow dependencies and cold start overhead, and reserve serverless for spiky, event driven, low duty cycle work where paying only while code runs genuinely beats a running instance. For steady, high volume, or long running workloads, a right sized instance or container often costs less. Match the model to the traffic shape and serverless stays lean rather than quietly accumulating.

Functions rarely top an OCI bill on their own, but a fleet of poorly tuned functions and misplaced steady workloads adds up. Here is how the cost model works and where it leaks.

How is OCI Functions cost calculated?

Two components make up the charge. The first is invocations, a per call charge that scales with how often the function executes. The second is resource usage, calculated as the memory you allocate to the function multiplied by the time it runs, billed in gigabyte seconds. A function allocated one gigabyte of memory that runs for two seconds consumes two gigabyte seconds per invocation; double the memory or double the runtime and the resource charge doubles with it. There is typically a free monthly allowance on both components, after which usage bills at the listed rates. Because the resource charge is a product of memory and time, it is the lever most teams overlook, focusing only on invocation count.

What is the right memory allocation?

Memory is not a simple higher costs more setting, because OCI Functions ties available CPU to the memory you allocate, so a memory constrained function may run slowly and rack up gigabyte seconds through long duration. Allocate more memory and the per second rate rises, but execution can finish faster, lowering the time component. The cheapest setting is the memory allocation that minimises memory multiplied by duration for that specific workload, and it is found by testing across a few memory levels and measuring the resulting gigabyte seconds, not assumed. The pattern to avoid at both extremes is obvious once stated: a starved function that runs long, and a lavishly provisioned function that finishes no faster.

  • Test memory levels. Run the function at a few memory settings and compare gigabyte seconds per invocation, not just runtime.
  • Trim execution time. Remove slow startup work, lazy load heavy dependencies, and cut unnecessary network calls inside the function, since every second runs against the resource charge.
  • Reduce invocations where you can. Batch events, debounce noisy triggers, and avoid functions that poll when an event driven trigger would do.

When is serverless actually cheaper?

Serverless wins on the right traffic shape and loses on the wrong one. For spiky, event driven, and low duty cycle work, Functions usually beat a continuously running instance because you pay only while code executes and nothing during the idle gaps. For steady, high volume, or long running workloads, the per invocation and gigabyte second charges accumulate until a right sized flexible compute instance or a container on OKE costs less for the same work. The decision is the serverless version of the broader build choice: pay per use for bursty demand, pay for provisioned capacity for steady demand. The flexible compute shapes that often beat serverless at steady scale are the same precise sizing lever covered across the OCI estate.

Worked example

A European SaaS company ran a set of OCI Functions allocated generous memory by default, including one steady high volume function firing continuously that had been built serverless for convenience. Testing memory levels and trimming a slow dependency cut the gigabyte seconds per invocation across the fleet, and moving the one always busy function onto a right sized flexible compute instance removed a large recurring serverless charge. The genuinely bursty functions stayed serverless. Figures are verified against billing data and anonymised.

Where serverless fits the OCI compute picture

Functions is one corner of OCI compute economics, and the placement decision connects to the rest. Steady database workloads belong on Autonomous Database with the ECPU and auto scaling discipline covered in Autonomous: ECPU sizing and auto scaling, while the question of which Oracle workloads belong on OCI in the first place is covered in when Oracle workloads belong on OCI. The full compute, storage, and database context lives in the OCI cost optimization guide, and the cross cloud serverless comparison sits in the cross cloud cost optimization guide.

Frequently asked questions

How is OCI Functions cost calculated?
On invocations and on resource usage measured as memory allocated multiplied by execution time, in gigabyte seconds. How often a function runs and how much memory and time each run consumes both drive the bill.
Does allocating more memory cost more?
Higher memory raises the per second rate but can shorten execution if the function was constrained, lowering the time component. The cheapest setting minimises memory multiplied by duration for that workload, found by testing rather than assumed.
Is serverless always cheaper than a running instance on OCI?
For spiky, event driven, low duty cycle work, Functions usually beat a running instance. For steady, high volume, or long running workloads, a right sized instance or container often costs less. Match the model to the traffic shape.

Keep your OCI serverless spend lean

We help enterprises tune OCI Functions memory and duration and place steady workloads where they cost less, so serverless stays cheap for the work it suits. Our guarantee: we reduce your cloud spend or we reimburse our service fee. Pricing is either a Fixed Fee scoped up front or Gainshare, a share of verified savings with no retainer and no risk. We take zero provider commissions and answer only to you.

Independent · buyer-side

Put a defensible number on your cloud spend.

No provider in the room, no published price list. Tell us your footprint and we will scope the savings against your billing data — we reduce your cloud spend or we reimburse our service fee.

Buyer-side intelligence, monthly.

The Cloud Spend Navigator: what changed in cloud pricing, commitments, and FinOps — no vendor spin.