Serverless Performance: Cloudflare Workers, Lambda and Lambda@Edge

Zack Bloom
5 min readintermediate
--
View Original

Overview

The article compares the performance of Cloudflare Workers, AWS Lambda, and Lambda@Edge, highlighting that Cloudflare Workers is significantly faster than its competitors. It presents empirical data from tests showing that Workers outperforms Lambda and Lambda@Edge by substantial margins in various scenarios.

What You'll Learn

1

How to evaluate the performance of serverless functions across different platforms

2

Why Cloudflare Workers can be a better choice for global applications

3

How to leverage V8 isolates for faster serverless function execution

Key Questions Answered

How much faster is Cloudflare Workers compared to AWS Lambda?
At the 95th percentile, Cloudflare Workers is 441% faster than AWS Lambda and 192% faster than Lambda@Edge. This performance advantage is significant for applications requiring low latency.
What factors contribute to the performance of Cloudflare Workers?
Cloudflare Workers utilizes V8 isolates, which have a startup time under 5ms and lower memory overhead compared to full Node.js processes. This architecture allows for quicker execution and responsiveness in serverless applications.
What are the performance metrics for serverless functions in different regions?
In North America, the 95th percentile response time for Workers is 40ms, while Lambda's is 882ms and Lambda@Edge's is 216ms. This indicates that Workers provides a more responsive experience for users globally.
What testing methodology was used to compare the serverless platforms?
The performance comparison was based on thousands of tests conducted by Catchpoint across various global locations, measuring the response times of simple functions that return the current time.

Key Statistics & Figures

Workers performance at 95th percentile
441% faster than Lambda
This statistic highlights the significant speed advantage of Workers in handling requests.
Workers response time at 50th percentile
13ms
This indicates that Workers can respond faster than the time it takes for a packet to reach half the distance to Virginia.
Lambda response time at 95th percentile
882ms
This shows that a significant portion of users may experience delays when using Lambda.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Serverless Platform
Cloudflare Workers
Used for executing serverless functions globally with low latency.
Serverless Platform
AWS Lambda
Compared against Cloudflare Workers in terms of performance.
Serverless Platform
Lambda@edge
Another competitor in the serverless function space, compared for performance metrics.

Key Actionable Insights

1
Consider using Cloudflare Workers for applications that require low latency and high responsiveness.
Given the significant performance advantages demonstrated in the tests, deploying serverless functions with Workers can enhance user experience, especially for global applications.
2
Leverage the global distribution of Cloudflare Workers to minimize latency for users in different geographical locations.
By utilizing Workers, you can ensure that users experience faster response times regardless of their location, which is crucial for maintaining engagement and satisfaction.
3
Evaluate the architecture of serverless platforms when choosing a provider.
Understanding how platforms like Cloudflare Workers utilize V8 isolates can inform decisions on which service to use based on performance needs.

Common Pitfalls

1
Relying solely on a single region for serverless functions can lead to performance issues.
As demonstrated, using AWS Lambda in a single region can result in higher latency for users located far from that region, impacting the overall user experience.