Responding to ever-increasing customer workload requirements for serverless cloud capabilities, we recently announced enhancements to our Oracle Cloud Infrastructure (OCI) Functions offering. OCI Functions is a serverless platform that lets you create, run, and scale applications without managing any infrastructure. Code or applications based on Functions typically run for short durations, from milliseconds to minutes, and you pay only for the resources used while the function is running.
Recent enhancements include pre-built functions, a catalog of ready-to-use functions built and maintained by Oracle to run certain tasks or actions in OCI without writing any code. Pre-built functions simplify the automation of operational tasks across OCI services and are designed with security best practices in mind. Pre-built functions incur no extra charges and require no writing, building, packaging, or maintaining of code.
While not identical, the most similar offering from Amazon Web Services (AWS) is Lambda, a serverless, event-driven compute service that lets you run code without provisioning or managing servers. Unlike AWS Lambda, which is proprietary and heightens vendor lock-in, OCI Functions is based on open source, which means that you can create portable applications that can easily be run in other clouds and on-premises environments. In other words, you’re not restricted to only one deployment environment.
With the features and benefits of both AWS Lambda and OCI Functions being similar, customers often jump straight to the bottom line: How do the services compare on cost? Which is the better choice for your serverless needs?
In this blog post, we explore a few common workload scenarios that illustrate the cost comparison between AWS Lambda and OCI Functions. Let’s begin with describing the prices and billing metrics listed for each service using x86-based processor architectures. All calculations use prices published as of March 15, 2023, and we have attempted to use “apples-to-apples” comparisons as much as possible.
AWS Lambda and OCI Functions have similar pricing models, so comparing them is easy. In both cases, customers are charged based on the number of requests (or “invocations”) for functions and the duration it takes for the code to run. Each company offers a free monthly tier, but the allocations within the tiers are different.
AWS Lambda pricing gives the following information:
“Lambda counts a request each time it starts executing in response to an event notification trigger…”
“Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 1 ms. The price depends on the amount of memory you allocate to your function.”
“The AWS Lambda free tier includes one million free requests per month and 400,000 GB-seconds of compute time per month…”
The pricing model for OCI Functions is nearly identical, but the OCI free tier is larger. The following table compares the Functions free tier:
Monthly allocation |
Unit |
AWS Lambda |
OCI Functions |
Bottom line |
Requests |
Number |
1 million |
2 million |
OCI offers 2x more than AWS |
Duration |
GB-sec |
400,000 |
400,000 |
Same |
OCI’s monthly free tier allocation for function requests is double that of AWS: 2 million versus 1 million.
The following table shows the lowest on-demand rates available for functions using x86-based processors from AWS Lambda and OCI Functions. Note that although AWS’ pricing varies widely by region, to show Lambda in its best light we’re using US East in northern Virginia region rates because they’re AWS’ lowest.
Attribute |
Unit |
AWS Lambda |
OCI Functions |
Bottom line |
Requests |
per 1M |
Same |
||
Duration |
per GB-sec |
AWS is 18% more expensive than OCI |
Prices for Lambda in other AWS regions can be much higher than in the US East region:
10% higher in Zurich
17% higher in Milan
24% higher in Bahrain and UAE
33% higher in Cape Town
38% higher in Hong Kong
In contrast, OCI offers consistent pricing and availability for all services, including OCI Functions, across all regions, globally. This consistency makes it easy for you to plan and budget for rapid geographic expansion, regardless of where you need to consume the cloud services.
Keeping these caveats in mind, the formula for the real cost for each serverless functions service is calculated as follows:
Total price = Requests fee + Duration fee
where
Requests fee = (requests – free tier allocation) * (price-per-1M-requests)
Duration fee = ((requests) * (function-duration-seconds) * (function-memory-GB) – (free tier allocation)) * (price-per-duration-GB-seconds)
Now that we know how to calculate the service prices, we’re ready to compare the true cost of real-world use cases using representative scenarios to illustrate common workloads.
In this image-processing use case, our function is triggered each time an image file is uploaded to object storage. Let’s say we upload 2M images per month and our 256 MB function takes an average of 90 seconds each time.
AWS Lambda:
Requests: (2M requests – 1M free) * ($0.20 per 1M) = $0.20
Duration: ((2M requests) * (90 seconds) * (256 MB) * (1 GB / 1024 MB) – (400,000 free)) * ($0.0000166667 per GB-sec) = $743.33
Total: $0.20 + $743.33 = $743.53 for AWS Lambda
OCI Functions:
Requests: (2M requests – 2M free) * ($0.20 per 1M) = free
Duration: ((2M requests) * (90 seconds) * (256 MB) * (1 GB / 1024 MB) – (400,000 free)) * ($0.00001417 per GB-sec) = $631.98
Total: free + $631.98 = $631.98 for OCI Functions
AWS Lambda is 18% more expensive than the equivalent using OCI Functions.
AWS Lambda |
OCI Functions |
Bottom line |
$743.53 |
$631.98 |
AWS is 18% more expensive than OCI |
In this scenario, a security system using a collection of temperature, vibration, and proximity sensors posts updates 50M times per month, each time invoking a 1 GB function which takes 0.5 seconds to run.
AWS Lambda:
Requests: (50M requests – 1M free) * ($0.20 per 1M) = $9.80
Duration: ((50M requests) * (0.5 seconds) * (1 GB) – (400,000 free)) * ($0.0000166667 per GB-sec) = $410.00
Total: $9.80 + $410.00 = $419.80 for AWS Lambda
OCI Functions:
Requests: (50M requests – 2M free) * ($0.20 per 1M) = $9.60
Duration: ((50M requests) * (0.5 seconds) * (1 GB) – (400,000 free)) * ($0.00001417 per GB-sec) = $348.58
Total: $9.60 + $348.58 = $358.18 for OCI Functions
AWS Lambda is 17% more expensive than the equivalent using OCI Functions.
AWS Lambda |
OCI Functions |
Bottom line |
$419.80 |
$358.18 |
AWS is 17% more expensive than OCI |
Both OCI Functions and AWS Lambda offer the ability for you to minimize cold start duration, which is the time required to deploy the compute and network resources necessary to successfully invoke a function. To reduce this latency and dial down variation in function response times, developers commonly employ provisioned concurrency to always have available the processing infrastructure for at least a certain minimum number of concurrent function invocations. Typically, you want to specify a concurrency level for hot starts equal to the number of concurrent function requests you expect.
While similar in concept, the way that AWS Lambda charges for provisioned concurrency differs from OCI Functions. With Lambda, you always pay for the concurrency and time you allocate -- and for requests and duration, but at region-specific rates, which are different than the on-demand prices. If demand for your Lambda function exceeds the concurrency you allocate, you’re billed for excess Lambda runs at the region-specific on-demand rates.
In contrast, pricing for provisioned concurrency for OCI Functions is regionally consistent: if you always use the specified provisioned concurrency level, you pay nothing extra. If not, you pay 25% of regular function process charges for any provisioned concurrency not used. (Note: The free tier does not apply to provisioned concurrency for either AWS or OCI.)
The following table shows the lowest provisioned concurrency rates available for functions using x86-based processors from AWS Lambda and OCI Functions. As before, because AWS’ pricing varies widely by region and to show Lambda in its best light for this comparison, we’re using US East (N. Virginia) rates because they are AWS’ lowest.
Attribute |
Unit |
AWS Lambda |
OCI Functions |
Requests |
per 1M |
||
Duration |
per GB-sec |
||
Allocated Provisioned Concurrency |
per GB-sec |
n/a |
|
Idle Provisioned Concurrency |
per GB-sec |
n/a |
Even wider regional variation exists in AWS Lambda pricing for provisioned concurrency than there was for on-demand pricing. Compared to the provisioned concurrency rates in US East, pricing in other AWS regions has the following extensions:
16% higher in London
20% higher in Frankfurt
27% higher in AWS GovCloud
32% higher in Zurich
59% higher in São Paulo
In contrast and as indicated above, OCI offers consistent pricing and availability for all services across all regions globally, including for provisioned concurrency for OCI Functions. This consistency makes it easy for you to plan and budget for rapid geographic expansion, regardless of where you need to consume the cloud services.
Because the pricing approaches for provisioned concurrency are different, we’ll take each one in turn and use the acronym “PC” for simplicity. The formula for AWS Lambda PC is calculated as:
AWS Lambda PC price = Requests fee + Duration fee + Allocated PC fee
where
Requests fee = (requests) * (price-per-1M-requests)
Duration fee = (requests) * (function-duration-seconds) * (function-memory-GB) * (price-per-duration-GB-seconds)
Allocated PC fee = (Allocated PC time) * (Allocated PC quantity) * (function-memory-GB) * (PC-price-per-GB-seconds)
The formula for OCI Functions PC is calculated as:
OCI Functions PC price = Requests fee + Duration fee + Idle PC fee
where
Requests fee = (requests) * (price-per-1M-requests)
Duration fee = (requests) * (function-duration-seconds) * (function-memory-GB) * (price-per-duration-GB-seconds)
Idle PC fee = ((Allocated PC time) * (Allocated PC quantity) * (function-memory-GB) – (requests) * (function-duration-seconds) * (function-memory-GB)) * (PC-price-per-GB-seconds)
In this example, we expect higher-than-normal demand in an eight-hour e-commerce promotional window. We set our provisioned concurrency quantity to 80 and expect each 512 MB function run to take 120 ms. During the eight-hour window, we get 2M requests.
AWS Lambda with provisioned concurrency:
Requests: (2M requests) * ($0.20 per 1M) = $0.40
Duration: (2M requests) * (0.12 seconds) * (512 MB) * (1 GB / 1024 MB) * ($0.0000097222 per GB-sec) = $1.17
Allocated Provisioned Concurrency = (8 hours) * (3600 seconds per hour) * (80 allocated) * (512 MB) * (1 GB / 1024 MB) * ($0.0000041667 per GB-sec) = $4.80
Total: $0.40 + $1.17 + $4.80 = $6.37 for AWS Lambda
OCI Functions with provisioned concurrency:
Requests: (2M requests) * ($0.20 per 1M) = $0.40
Duration: (2M requests) * (0.12 seconds) * (512 MB) * (1 GB / 1024 MB) * ($0.00001417 per GB-sec) = $1.70
Idle Provisioned Concurrency = ((8 hours) * (3600 seconds per hour) * (80 allocated) * (512 MB) * (1 GB / 1024 MB) – (2M requests) * (0.12 seconds) * (512 MB) * (1 GB / 1024 MB)) * ($0.0000035425 per GB-sec) = $3.66
Total: $0.40 + $1.70 + $3.66 = $5.76 for OCI Functions
AWS Lambda with provisioned concurrency is 11% more expensive than the equivalent using OCI Functions with provisioned concurrency.
AWS Lambda |
OCI Functions |
Bottom line |
$6.37 |
$5.76 |
AWS is 11% more expensive than OCI |
The evidence is clear: Even in AWS’ lowest-cost regions, OCI Functions provides an 11 to 18% cost advantage over AWS Lambda for x86 architecture general use cases. The difference is greater in many other AWS regions, especially when using provisioned concurrency -- up to 84% advantage for OCI in São Paulo, Brazil.
The addition of pre-built functions to OCI means that you can save both time and money for ready-to-use functions, which are built and maintained by Oracle. With no need to write, build, package, or maintain code and no extra charges for their use, choosing OCI Functions for your serverless compute needs is a smart choice.
Cost advantage and the efficiency of pre-built functions are just two reasons why customers choose OCI over AWS. You should also use other considerations when selecting any type of cloud service, but don’t overlook these benefits.
If you want to learn more about OCI Functions, see the product page and try the service for yourself. You can also contact us to speak with a cloud architect to discover how OCI Functions can help you accelerate and simplify adoption of cloud native services and scale functions’ usage across your organization in a cost-effective way.
Next Post